source: trunk/FACT++/scripts/handleFtmIdle.js@ 16336

Last change on this file since 16336 was 14968, checked in by tbretz, 12 years ago
Replaced dim.print by dim.log
File size: 1.3 KB
Line 
1// Get ftm connected, idle and with working FTUs
2function handleFtmIdle(wait_state)
3{
4 var state = dim.state("FTM_CONTROL");
5 if (state===undefined)
6 return undefined;
7
8 // Only try to open the service if the server is already in the list
9 if (wait_state && wait_state.length>0 && state.name!=wait_state)
10 return wait_state;
11
12 //dim.log("FTM_CONTROL: "+state.name+"["+state.index+"]");
13
14 switch (state.name)
15 {
16 case "Disconnected":
17 console.out("Ftm in "+state.name+"... connect.");
18 dim.send("FTM_CONTROL/RECONNECT");
19 return "Idle";
20
21 case "Idle":
22 //ftu_counter = data.counter;
23 return "";
24
25 case "TriggerOn":
26 console.out("Ftm in "+state.name+"... stop trigger.");
27 dim.send("FTM_CONTROL/STOP_TRIGGER");
28 return "Idle";
29
30 case "Configuring1":
31 case "Configuring2":
32 case "Configured":
33 console.out("Ftm in "+state.name+"... reset configuration.");
34 dim.send("FTM_CONTROL/RESET_CONFIGURE");
35 return "Idle";
36
37 case "ConfigError1":
38 case "ConfigError2":
39 case "ConfigError3":
40 throw new Error("FTM_CONTROL:"+state.name+"["+state.index+"] in error state.");
41 }
42
43 throw new Error("FTM_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
44}
Note: See TracBrowser for help on using the repository browser.