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

Last change on this file since 14782 was 14763, checked in by neise, 12 years ago
initial include
File size: 1.1 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.print("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("Fad 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("Bias in Configure state... reset.");
32 dim.send("FAD_CONTROL/RESET_CONFIGURE");
33 return "Connected";
34
35 // Final state reached condition
36 case "Connected":
37 case "WritingData":
38 return "";
39 }
40
41 throw new Error("FAD_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
42}
Note: See TracBrowser for help on using the repository browser.