source: trunk/FACT++/scripts/handleFeedbackConnected.js@ 20115

Last change on this file since 20115 was 17919, checked in by tbretz, 10 years ago
Added OnStandby, Warning and Critical.
File size: 1.0 KB
Line 
1'use strict';
2
3function handleFeedbackConnected(wait_state)
4{
5 var state = dim.state("FEEDBACK");
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("FEEDBACK: "+state.name+"["+state.index+"]");
13
14 switch (state.name)
15 {
16 case "Disconnected":
17 case "Connecting":
18 return undefined;
19
20 case "Connected":
21 case "Calibrated":
22 return "";
23
24 case "WaitingForData":
25 case "OnStandby":
26 case "InProgress":
27 case "Warning":
28 case "Critical":
29 console.out("Feedback in '"+state.name+"'... sending STOP... waiting for 'Calibrated'.");
30 dim.send("FEEDBACK/STOP");
31 return "Calibrated";
32
33 case "Calibrating":
34 console.out("Feedback in '"+state.name+"'... sending STOP... waiting for 'Connected'.");
35 dim.send("FEEDBACK/STOP");
36 return "Connected";
37 }
38
39 throw new Error("FEEDBACK:"+state.name+"["+state.index+"] unknown or not handled.");
40}
41
Note: See TracBrowser for help on using the repository browser.