source: trunk/FACT++/scripts/handleLidClosed.js@ 17689

Last change on this file since 17689 was 17536, checked in by tbretz, 11 years ago
Added PowerProblem to the list of handled states.
File size: 869 bytes
Line 
1'use strict';
2
3// Get Lids closed
4function handleLidClosed(wait_state)
5{
6 var state = dim.state("LID_CONTROL");
7 if (state===undefined)
8 return undefined;
9
10 if (wait_state && wait_state.length>0 && state.name!=wait_state)
11 return wait_state;
12
13 //dim.log("LID_CONTROL: "+state.name+"["+state.index+"]");
14
15 switch (state.name)
16 {
17 // Do-nothing conditions
18 case "NoConnection":
19 case "Connected":
20 case "Moving":
21 return wait_state;
22
23 case "Unknown":
24 case "Inconsistent":
25 case "PowerProblem":
26 case "Open":
27 console.out("Lidctrl in '"+state.name+"'... sending CLOSE... waiting for 'Closed'.");
28 dim.send("LID_CONTROL/CLOSE");
29 return "Closed";
30
31 case "Closed":
32 return "";
33 }
34
35 throw new Error("LID_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
36}
Note: See TracBrowser for help on using the repository browser.