-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (37 loc) · 1.25 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module.exports = function(server) {
var Roller_0_Query = server.where({ type: "roller", name: "roller_0" });
var Roller_1_Query = server.where({ type: "roller", name: "roller_1" });
var Roller_2_Query = server.where({ type: "roller", name: "roller_2" });
var Roller_3_Query = server.where({ type: "roller", name: "roller_3" });
var StateMachineQuery = server.where({ type: "state_machine" });
server.observe(
[
Roller_0_Query,
Roller_1_Query,
Roller_2_Query,
Roller_3_Query,
StateMachineQuery
],
function(roller_0, roller_1, roller_2, roller_3, state_machine) {
console.log(
"State Machine came online: " +
state_machine.name + ", " +
roller_0.name + ", " +
roller_1.name + ", " +
roller_2.name + ", " +
roller_3.name
);
state_machine.on("start", function() {
roller_0.call("start-counting");
roller_1.call("start-counting");
roller_2.call("start-counting");
roller_3.call("start-counting");
});
state_machine.on("stop", function() {
roller_0.call("stop-counting");
roller_1.call("stop-counting");
roller_2.call("stop-counting");
roller_3.call("stop-counting");
});
});
};