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

Last change on this file since 16715 was 16533, checked in by tbretz, 11 years ago
Renamed WritingData of fadctrl to RunInProgress
File size: 1.3 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 case "RunInProgress":
41 console.out("RunInProgress detected... closing.");
42 dim.send("FAD_CONTROL/CLOSE_OPEN_FILES");
43 return "Connected";
44
45 // Final state reached condition
46 case "Connected":
47 return "";
48 }
49
50 throw new Error("FAD_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
51}
Note: See TracBrowser for help on using the repository browser.