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

Last change on this file since 17066 was 16857, checked in by tbretz, 11 years ago
Added the 'use strict'
File size: 844 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 "Open":
26 console.out("Lidctrl in '"+state.name+"'... sending CLOSE... waiting for 'Closed'.");
27 dim.send("LID_CONTROL/CLOSE");
28 return "Closed";
29
30 case "Closed":
31 return "";
32 }
33
34 throw new Error("LID_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
35}
Note: See TracBrowser for help on using the repository browser.