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

Last change on this file since 17449 was 17028, checked in by tbretz, 11 years ago
Updated to the recent changes in the feedback (still untested)
File size: 980 bytes
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 "InProgress":
26 console.out("Feedback in '"+state.name+"'... sending STOP... waiting for 'Calibrated'.");
27 dim.send("FEEDBACK/STOP");
28 return "Calibrated";
29
30 case "Calibrating":
31 console.out("Feedback in '"+state.name+"'... sending STOP... waiting for 'Connected'.");
32 dim.send("FEEDBACK/STOP");
33 return "Connected";
34 }
35
36 throw new Error("FEEDBACK:"+state.name+"["+state.index+"] unknown or not handled.");
37}
38
Note: See TracBrowser for help on using the repository browser.