source: branches/FACT++_scripts_refactoring/handleRatectrlConnected.js@ 18558

Last change on this file since 18558 was 16857, checked in by tbretz, 11 years ago
Added the 'use strict'
File size: 825 bytes
Line 
1'use strict';
2
3function handleRatectrlConnected(wait_state)
4{
5 var state = dim.state("RATE_CONTROL");
6 if (state===undefined)
7 return undefined;
8
9 if (wait_state && wait_state.length>0 && state.name!=wait_state)
10 return wait_state;
11
12 //dim.log("RATE_CONTROL: "+state.name+"["+state.index+"]");
13
14 switch (state.name)
15 {
16 case "DimNetworkNotAvailable":
17 case "Disconnected":
18 return undefined;
19
20 case "Calibrating":
21 case "GlobalThresholdSet":
22 case "InProgress":
23 console.out("Ratectrl in '"+state.name+"'... sending STOP... waiting for 'Connected'.");
24 dim.send("RATE_CONTROL/STOP");
25 return "Connected";
26
27 case "Connected":
28 return "";
29 }
30
31 throw new Error("RATE_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
32}
33
Note: See TracBrowser for help on using the repository browser.