source: trunk/FACT++/scripts/handleFadConnected.js@ 15458

Last change on this file since 15458 was 15135, checked in by tbretz, 12 years ago
Connect of disconnected.
File size: 1.2 KB
Line 
1// Get fad control connected
2function handleFadConnected(wait_state)
3{
4 var state = dim.state("FAD_CONTROL");
5 if (state===undefined)
6 return undefined;
7
8 if (wait_state && wait_state.length>0 && state.name!=wait_state)
9 return wait_state;
10
11 //dim.log("BIAS_CONTROL: "+state.name+"["+state.index+"]");
12
13 switch (state.name)
14 {
15 case "Offline":
16 return undefined;
17
18 case "Disconnected":
19 console.out("Fadctrl in Diconnected... connect.");
20 dim.send("FAD_CONTROL/START");
21 return "Connected";
22
23 // Do-nothing conditions
24 case "Connecting":
25 return wait_state;
26
27 // Do-something conditions
28 case "Configuring1":
29 case "Configuring2":
30 case "Configured":
31 console.out("Fadctrl in Configure state... reset.");
32 dim.send("FAD_CONTROL/RESET_CONFIGURE");
33 return "Connected";
34
35 case "Disengaged":
36 console.out("Fadctrl in Disengaged... connecting.");
37 dim.send("FAD_CONTROL/START");
38 return "Connected";
39
40 // Final state reached condition
41 case "Connected":
42 case "WritingData":
43 return "";
44 }
45
46 throw new Error("FAD_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
47}
Note: See TracBrowser for help on using the repository browser.