Rev 1185 | Rev 1190 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1185 | Rev 1189 | ||
|---|---|---|---|
| Line 13... | Line 13... | ||
| 13 | extend(Display, Service); |
13 | extend(Display, Service); |
| 14 | 14 | ||
| 15 | /* Declaration of instance variables, for static variables remove prototype */ |
15 | /* Declaration of instance variables, for static variables remove prototype */ |
| 16 | /* The currently displayed menuitem */ |
16 | /* The currently displayed menuitem */ |
| 17 | Display.prototype.currentMenuItem = null; |
17 | Display.prototype.currentMenuItem = null; |
| - | 18 | ||
| - | 19 | Display.prototype.statusMenuItem = null; |
|
| - | 20 | Display.prototype.bookMenuItem = null; |
|
| 18 | 21 | ||
| 19 | /* format: minutes since 00:00 (480/60 = 8:00) */ |
22 | /* format: minutes since 00:00 (480/60 = 8:00) */ |
| 20 | Display.prototype.bookFromTime = |
23 | Display.prototype.bookFromTime = null; |
| 21 | Display.prototype.bookToTime = |
24 | Display.prototype.bookToTime = null; |
| 22 | 25 | ||
| 23 | /* the shortname for this exchangeobject */ |
26 | /* the shortname for this exchangeobject */ |
| 24 | Display.prototype.shortName = |
27 | Display.prototype.shortName = null; |
| 25 | 28 | ||
| 26 | /* the name for this display (shown on first screen) */ |
29 | /* the name for this display (shown on first screen) */ |
| 27 | Display.prototype.niceName = |
30 | Display.prototype.niceName = null; |
| 28 | 31 | ||
| 29 | /* The display should regulary update and store the calendar */ |
32 | /* The display should regulary update and store the calendar */ |
| 30 | Display.prototype.exchangeData = null; |
33 | Display.prototype.exchangeData = null; |
| 31 | 34 | ||
| 32 | Display.prototype.myLCDService = null; |
35 | Display.prototype.myLCDService = null; |
| 33 | Display.prototype.myRotaryService = null; |
36 | Display.prototype.myRotaryService = null; |
| 34 | Display.prototype.mySoftPwmService = null; |
37 | Display.prototype.mySoftPwmService = null; |
| 35 | Display.prototype.myInterval = null; |
38 | Display.prototype.myInterval = null; |
| - | 39 | ||
| 36 | Display.prototype.exchangeCalendar = null; |
40 | Display.prototype.exchangeCalendar = null; |
| - | 41 | Display.prototype.exchangeCalendarFirstMenuItem = null; |
|
| - | 42 | Display.prototype.exchangeCalendarLastMenuItem = null; |
|
| 37 | 43 | ||
| 38 | 44 | ||
| 39 | /* This function must always be declared, this is where all the startup code |
45 | /* This function must always be declared, this is where all the startup code |
| 40 | should be placed. Gets called with arguments like what ids to use etc. */ |
46 | should be placed. Gets called with arguments like what ids to use etc. */ |
| 41 | Display.prototype.initialize = function(initialArguments) |
47 | Display.prototype.initialize = function(initialArguments) |
| Line 45... | Line 51... | ||
| 45 | 51 | ||
| 46 | /* This is used for function declarations like the callbacks below */ |
52 | /* This is used for function declarations like the callbacks below */ |
| 47 | var self = this; |
53 | var self = this; |
| 48 | 54 | ||
| 49 | if (!this.myInitialArguments["HD44789"]) |
55 | if (!this.myInitialArguments["HD44789"]) |
| 50 | { |
56 | { |
| 51 | log(this.myName + ":" + this.myId + "> Failed to initialize, HD44789-config missing from config.\n"); |
57 | log(this.myName + ":" + this.myId + "> Failed to initialize, HD44789-config missing from config.\n"); |
| 52 | return; |
58 | return; |
| 53 | } |
59 | } |
| 54 | 60 | ||
| 55 | if (!this.myInitialArguments["Rotary"]) |
61 | if (!this.myInitialArguments["Rotary"]) |
| 56 | { |
62 | { |
| 57 | log(this.myName + ":" + this.myId + "> Failed to initialize, Rotary-config missing from config.\n"); |
63 | log(this.myName + ":" + this.myId + "> Failed to initialize, Rotary-config missing from config.\n"); |
| 58 | return; |
64 | return; |
| 59 | } |
65 | } |
| 60 | 66 | ||
| 61 | if (!this.myInitialArguments["softPWM"]) |
67 | if (!this.myInitialArguments["softPWM"]) |
| 62 | { |
68 | { |
| 63 | log(this.myName + ":" + this.myId + "> Failed to initialize, softPWM-config missing from config.\n"); |
69 | log(this.myName + ":" + this.myId + "> Failed to initialize, softPWM-config missing from config.\n"); |
| 64 | return; |
70 | return; |
| 65 | } |
71 | } |
| 66 | 72 | ||
| 67 | if (!this.myInitialArguments["Name"]) |
73 | if (!this.myInitialArguments["Name"]) |
| 68 | { |
74 | { |
| 69 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
75 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
| 70 | return; |
76 | return; |
| 71 | } |
77 | } |
| 72 | this.niceName = this.myInitialArguments["Name"]; |
78 | this.niceName = this.myInitialArguments["Name"]; |
| 73 | 79 | ||
| 74 | if (!this.myInitialArguments["ShortName"]) |
80 | if (!this.myInitialArguments["ShortName"]) |
| 75 | { |
81 | { |
| 76 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
82 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
| 77 | return; |
83 | return; |
| 78 | } |
84 | } |
| 79 | this.shortName = this.myInitialArguments["ShortName"]; |
85 | this.shortName = this.myInitialArguments["ShortName"]; |
| 80 | 86 | ||
| 81 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
87 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
| 82 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
88 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
| 83 | /* Add a callback for when the service goes online */ |
89 | /* Add a callback for when the service goes online */ |
| Line 104... | Line 110... | ||
| 104 | this.mySoftPwmService.registerEventCallback("online", function(args) { self.softPwmOnline(); }); |
110 | this.mySoftPwmService.registerEventCallback("online", function(args) { self.softPwmOnline(); }); |
| 105 | /* If the service is already online we should call the handler here */ |
111 | /* If the service is already online we should call the handler here */ |
| 106 | this.softPwmOnline(); |
112 | this.softPwmOnline(); |
| 107 | 113 | ||
| 108 | this.exchangeCalendar = new ExchangeCalendar(function(shortname, data) { self.exchangeCalendarLookupCallback(shortname, data); }); |
114 | this.exchangeCalendar = new ExchangeCalendar(function(shortname, data) { self.exchangeCalendarLookupCallback(shortname, data); }); |
| - | 115 | ||
| - | 116 | this.bookFromTime = new Date(); |
|
| - | 117 | this.bookFromTime.setHours(8); |
|
| - | 118 | this.bookFromTime.setMinutes(0); |
|
| - | 119 | this.bookToTime = new Date(); |
|
| - | 120 | this.bookToTime.setHours(8); |
|
| - | 121 | this.bookToTime.setMinutes(30); |
|
| 109 | 122 | ||
| 110 | 123 | ||
| 111 | /* create the first menu item */ |
124 | /* create the first menu item */ |
| 112 | this. |
125 | this.statusMenuItem = new MenuItem(this); |
| 113 | this. |
126 | this.statusMenuItem.displayData[0] = " " + this.niceName + " "; |
| - | 127 | this.statusMenuItem.doUpdate = this.updateStatusMenuItem; |
|
| 114 | this.currentMenuItem |
128 | this.currentMenuItem = this.statusMenuItem; |
| - | 129 | ||
| - | 130 | /* create the menuitem where you can choose to enter the booking sub-menu */ |
|
| - | 131 | this.bookMenuItem = new MenuItem(this); |
|
| - | 132 | this.bookMenuItem.displayData[0] = " Book room "; |
|
| - | 133 | this.bookMenuItem.displayData[1] = " "; |
|
| - | 134 | this.bookMenuItem.doUpdate = this.updateBookMenuItem; |
|
| - | 135 | ||
| - | 136 | /* connect the items as a linked list */ |
|
| - | 137 | this.statusMenuItem.setNextItem(this.bookMenuItem); |
|
| - | 138 | this.statusMenuItem.setPrevItem(this.bookMenuItem); |
|
| - | 139 | /* set the function that shall be executed when knob is turned */ |
|
| - | 140 | this.statusMenuItem.doRight = this.changeToNext; |
|
| - | 141 | this.statusMenuItem.doLeft = this.changeToPrev; |
|
| 115 | 142 | ||
| 116 | /* |
143 | /* connect the items as a linked list */ |
| - | 144 | this.bookMenuItem.setNextItem(this.statusMenuItem); |
|
| - | 145 | this.bookMenuItem.setPrevItem(this.statusMenuItem); |
|
| - | 146 | /* set the function that shall be executed when knob is turned */ |
|
| - | 147 | this.bookMenuItem.doRight = this.changeToNext; |
|
| - | 148 | this.bookMenuItem.doLeft = this.changeToPrev; |
|
| - | 149 | ||
| - | 150 | /* create the menuitem where you can choose the to-time */ |
|
| 117 | var |
151 | var menuChooseTo = new MenuItem(this); |
| 118 |
|
152 | menuChooseTo.displayData[1] = " Ok Cancel "; |
| 119 |
|
153 | menuChooseTo.doUpdate = this.chooseBookTimeTo; |
| - | 154 | ||
| - | 155 | this.bookMenuItem.doPress = this.changeToDesc; |
|
| - | 156 | this.bookMenuItem.setDescItem(menuChooseTo); |
|
| 120 | 157 | ||
| - | 158 | /* create the menuitem where you can choose to book the room with OK */ |
|
| - | 159 | var menuChooseOk = new MenuItem(this); |
|
| - | 160 | menuChooseOk.displayData[1] = " <Ok> Cancel "; |
|
| - | 161 | menuChooseOk.doUpdate = this.setBookTime; |
|
| - | 162 | ||
| - | 163 | /* create the menuitem where you can choose to cancel the booking */ |
|
| - | 164 | var menuChooseCancel = new MenuItem(this); |
|
| - | 165 | menuChooseCancel.displayData[1] = " Ok <Cancel> "; |
|
| - | 166 | menuChooseCancel.doUpdate = this.setBookTime; |
|
| - | 167 | ||
| - | 168 | /* create the menuitem where you can choose the from-time */ |
|
| - | 169 | var menuChooseFrom = new MenuItem(this); |
|
| - | 170 | menuChooseFrom.displayData[1] = " Ok Cancel "; |
|
| - | 171 | menuChooseFrom.doUpdate = this.chooseBookTimeFrom; |
|
| - | 172 | ||
| - | 173 | /* connect the items as a linked list */ |
|
| - | 174 | menuChooseTo.setNextItem(menuChooseOk); |
|
| - | 175 | menuChooseTo.setPrevItem(menuChooseFrom); |
|
| - | 176 | /* set the function that shall be executed when knob is turned */ |
|
| - | 177 | menuChooseTo.doRight = this.changeToNext; |
|
| - | 178 | menuChooseTo.doLeft = this.changeToPrev; |
|
| - | 179 | menuChooseTo.doPress = this.changeToDesc; |
|
| - | 180 | ||
| - | 181 | /* connect the items as a linked list */ |
|
| - | 182 | menuChooseOk.setNextItem(menuChooseCancel); |
|
| - | 183 | menuChooseOk.setPrevItem(menuChooseTo); |
|
| - | 184 | /* set the function that shall be executed when knob is turned */ |
|
| - | 185 | menuChooseOk.doRight = this.changeToNext; |
|
| - | 186 | menuChooseOk.doLeft = this.changeToPrev; |
|
| - | 187 | ||
| - | 188 | /* connect the items as a linked list */ |
|
| - | 189 | menuChooseCancel.setNextItem(menuChooseFrom); |
|
| - | 190 | menuChooseCancel.setPrevItem(menuChooseOk); |
|
| - | 191 | menuChooseCancel.setDescItem(this.bookMenuItem); |
|
| - | 192 | /* set the function that shall be executed when knob is turned */ |
|
| - | 193 | menuChooseCancel.doRight = this.changeToNext; |
|
| - | 194 | menuChooseCancel.doLeft = this.changeToPrev; |
|
| - | 195 | menuChooseCancel.doPress = this.changeToDesc; |
|
| - | 196 | ||
| 121 | /* connect the items as a linked list */ |
197 | /* connect the items as a linked list */ |
| 122 |
|
198 | menuChooseFrom.setNextItem(menuChooseTo); |
| 123 |
|
199 | menuChooseFrom.setPrevItem(menuChooseCancel); |
| 124 | /* set the function that shall be executed when knob is turned */ |
200 | /* set the function that shall be executed when knob is turned */ |
| 125 |
|
201 | menuChooseFrom.doRight = this.changeToNext; |
| 126 |
|
202 | menuChooseFrom.doLeft = this.changeToPrev; |
| - | 203 | menuChooseFrom.doPress = this.changeToDesc; |
|
| 127 | 204 | ||
| 128 | /* |
205 | /* create the menuitem where you can modify the to-time */ |
| - | 206 | var menuSetTo = new MenuItem(this); |
|
| - | 207 | menuSetTo.doUpdate = this.setBookTimeTo; |
|
| - | 208 | menuSetTo.displayData[0] = " Set end time "; |
|
| - | 209 | menuSetTo.doRight = this.incBookTimeTo; |
|
| - | 210 | menuSetTo.doLeft = this.decBookTimeTo; |
|
| 129 |
|
211 | menuSetTo.doPress = this.changeToDesc; |
| - | 212 | menuSetTo.setDescItem(menuChooseTo); |
|
| 130 |
|
213 | menuChooseTo.setDescItem(menuSetTo); |
| - | 214 | ||
| 131 | /* |
215 | /* create the menuitem where you can modify the from-time */ |
| - | 216 | var menuSetFrom = new MenuItem(this); |
|
| - | 217 | menuSetFrom.doUpdate = this.setBookTimeFrom; |
|
| - | 218 | menuSetFrom.displayData[0] = " Set start time "; |
|
| 132 |
|
219 | menuSetFrom.doRight = this.incBookTimeFrom; |
| - | 220 | menuSetFrom.doLeft = this.decBookTimeFrom; |
|
| 133 |
|
221 | menuSetFrom.doPress = this.changeToDesc; |
| - | 222 | menuSetFrom.setDescItem(menuChooseFrom); |
|
| - | 223 | menuChooseFrom.setDescItem(menuSetFrom); |
|
| - | 224 | ||
| - | 225 | } |
|
| - | 226 | ||
| - | 227 | Display.prototype.changeToDesc = function() |
|
| - | 228 | { |
|
| - | 229 | if (this.descItem) |
|
| 134 | 230 | { |
|
| - | 231 | this.parentDisplay.currentMenuItem = this.descItem; |
|
| 135 | 232 | } |
|
| 136 | } |
233 | } |
| 137 | 234 | ||
| 138 | Display.prototype.changeToNext = function() |
235 | Display.prototype.changeToNext = function() |
| 139 | { |
236 | { |
| 140 | if (this.nextItem) |
237 | if (this.nextItem) |
| 141 | { |
238 | { |
| 142 | this.parentDisplay.currentMenuItem = this.nextItem; |
239 | this.parentDisplay.currentMenuItem = this.nextItem; |
| 143 | } |
240 | } |
| 144 | - | ||
| 145 | } |
241 | } |
| 146 | 242 | ||
| 147 | Display.prototype.changeToPrev = function() |
243 | Display.prototype.changeToPrev = function() |
| 148 | { |
244 | { |
| 149 | if (this.prevItem) |
245 | if (this.prevItem) |
| 150 | { |
246 | { |
| 151 | this.parentDisplay.currentMenuItem = this.prevItem; |
247 | this.parentDisplay.currentMenuItem = this.prevItem; |
| 152 | } |
248 | } |
| 153 | } |
249 | } |
| 154 | 250 | ||
| 155 | Display.prototype. |
251 | Display.prototype.incBookTimeTo = function() |
| 156 | { |
252 | { |
| 157 |
|
253 | //FIXME: constraints? |
| 158 | /* Get the current date time on the format YYYY-mm-dd HH.ii.ss */ |
- | |
| 159 |
|
254 | this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() + 30); |
| 160 | this.displayData[1] = " " + dateAndTime; |
- | |
| 161 | //this.currentMenuItem.displayData[1] = " " + dateAndTime; |
- | |
| 162 | } |
255 | } |
| - | 256 | ||
| - | 257 | Display.prototype.decBookTimeTo = function() |
|
| - | 258 | { |
|
| - | 259 | //FIXME: constraints? |
|
| - | 260 | this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() - 30); |
|
| - | 261 | } |
|
| - | 262 | ||
| - | 263 | Display.prototype.incBookTimeFrom = function() |
|
| - | 264 | { |
|
| - | 265 | //FIXME: constraints? |
|
| - | 266 | this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() + 30); |
|
| - | 267 | } |
|
| - | 268 | ||
| - | 269 | Display.prototype.decBookTimeFrom = function() |
|
| - | 270 | { |
|
| - | 271 | //FIXME: constraints? |
|
| - | 272 | this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() - 30); |
|
| - | 273 | } |
|
| - | 274 | ||
| - | 275 | Display.prototype.setBookTimeFrom = function() |
|
| - | 276 | { |
|
| - | 277 | this.displayData[1] = " <"+this.parentDisplay.bookFromTime.getTimeShortFormated()+"> "; |
|
| - | 278 | } |
|
| - | 279 | ||
| - | 280 | Display.prototype.setBookTimeTo = function() |
|
| - | 281 | { |
|
| - | 282 | this.displayData[1] = " <"+this.parentDisplay.bookToTime.getTimeShortFormated()+"> "; |
|
| - | 283 | } |
|
| - | 284 | ||
| - | 285 | Display.prototype.chooseBookTimeTo = function() |
|
| - | 286 | { |
|
| - | 287 | this.displayData[0] = " "+this.parentDisplay.bookFromTime.getTimeShortFormated()+" - <" |
|
| - | 288 | +this.parentDisplay.bookToTime.getTimeShortFormated()+"> "; |
|
| - | 289 | } |
|
| - | 290 | ||
| - | 291 | Display.prototype.chooseBookTimeFrom = function() |
|
| - | 292 | { |
|
| - | 293 | this.displayData[0] = " <"+this.parentDisplay.bookFromTime.getTimeShortFormated()+"> - " |
|
| - | 294 | +this.parentDisplay.bookToTime.getTimeShortFormated()+" "; |
|
| - | 295 | } |
|
| - | 296 | ||
| - | 297 | Display.prototype.setBookTime = function() |
|
| - | 298 | { |
|
| - | 299 | this.displayData[0] = " "+this.parentDisplay.bookFromTime.getTimeShortFormated()+" - " |
|
| - | 300 | +this.parentDisplay.bookToTime.getTimeShortFormated()+" "; |
|
| - | 301 | } |
|
| - | 302 | ||
| - | 303 | Display.prototype.updateStatusMenuItem = function() |
|
| - | 304 | { |
|
| - | 305 | var date = new Date(); |
|
| - | 306 | var dateAndTime = "" + date.getTimeShortFormated(); |
|
| - | 307 | this.displayData[1] = " " + dateAndTime + " "; |
|
| - | 308 | ||
| - | 309 | if (this.parentDisplay.exchangeCalendarFirstMenuItem && this.parentDisplay.exchangeCalendarLastMenuItem) |
|
| - | 310 | { |
|
| - | 311 | this.parentDisplay.statusMenuItem.setNextItem(this.parentDisplay.exchangeCalendarFirstMenuItem); |
|
| - | 312 | this.parentDisplay.bookMenuItem.setPrevItem(this.parentDisplay.exchangeCalendarLastMenuItem); |
|
| - | 313 | } |
|
| - | 314 | } |
|
| 163 | 315 | ||
| - | 316 | Display.prototype.updateBookMenuItem = function() |
|
| - | 317 | { |
|
| - | 318 | if (this.parentDisplay.exchangeCalendarFirstMenuItem && this.parentDisplay.exchangeCalendarLastMenuItem) |
|
| - | 319 | { |
|
| - | 320 | this.parentDisplay.statusMenuItem.setNextItem(this.parentDisplay.exchangeCalendarFirstMenuItem); |
|
| - | 321 | this.parentDisplay.bookMenuItem.setPrevItem(this.parentDisplay.exchangeCalendarLastMenuItem); |
|
| - | 322 | } |
|
| - | 323 | } |
|
| 164 | 324 | ||
| 165 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
325 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
| 166 | { |
326 | { |
| - | 327 | log("callback: "+shortname+" \n"); |
|
| 167 | if (shortname == this.shortName) |
328 | if (shortname == this.shortName) |
| 168 | { |
329 | { |
| 169 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
330 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
| 170 | this.exchangeData = data; |
331 | this.exchangeData = data; |
| - | 332 | ||
| - | 333 | this.createCalendarMenu(); |
|
| - | 334 | } |
|
| - | 335 | } |
|
| - | 336 | ||
| - | 337 | Display.prototype.createCalendarMenu = function() |
|
| - | 338 | { |
|
| - | 339 | log("createCalendar \n"); |
|
| - | 340 | if (this.exchangeData) |
|
| - | 341 | { |
|
| - | 342 | log("have data \n"); |
|
| - | 343 | var lastMenuItem; |
|
| - | 344 | for (var i = 0; i < this.exchangeData.meetings.length; i++) |
|
| - | 345 | { |
|
| - | 346 | log("looping \n"); |
|
| - | 347 | /* create the menuitem for a calendar meeting */ |
|
| - | 348 | var menu = new MenuItem(this); |
|
| - | 349 | menu.displayData[0] = this.exchangeData.meetings[i].organizer; |
|
| - | 350 | menu.displayData[1] = " "+this.exchangeData.meetings[i].start.replace(":",".") + " - " |
|
| - | 351 | + this.exchangeData.meetings[i].end.replace(":",".")+" "; |
|
| - | 352 | menu.doRight = this.changeToNext; |
|
| - | 353 | menu.doLeft = this.changeToPrev; |
|
| - | 354 | ||
| - | 355 | if (i == 0) |
|
| - | 356 | { |
|
| - | 357 | this.exchangeCalendarFirstMenuItem = menu; |
|
| - | 358 | } |
|
| - | 359 | else |
|
| - | 360 | { |
|
| - | 361 | menu.setPrevItem(lastMenuItem); |
|
| - | 362 | lastMenuItem.setNextItem(menu); |
|
| - | 363 | } |
|
| - | 364 | ||
| - | 365 | lastMenuItem = menu; |
|
| - | 366 | } |
|
| - | 367 | this.exchangeCalendarLastMenuItem = lastMenuItem; |
|
| - | 368 | this.exchangeCalendarLastMenuItem.setNextItem(this.bookMenuItem); |
|
| - | 369 | this.exchangeCalendarFirstMenuItem.setPrevItem(this.statusMenuItem); |
|
| 171 | } |
370 | } |
| 172 | } |
371 | } |
| 173 | 372 | ||
| 174 | Display.prototype.softPwmOnline = function() |
373 | Display.prototype.softPwmOnline = function() |
| 175 | { |
374 | { |
| Line 205... | Line 404... | ||
| 205 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
404 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
| 206 | { |
405 | { |
| 207 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
406 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
| 208 | { |
407 | { |
| 209 | if (this.currentMenuItem.doPress) |
408 | if (this.currentMenuItem.doPress) |
| 210 | { |
409 | { |
| 211 | this.currentMenuItem.doPress(); |
410 | this.currentMenuItem.doPress(); |
| 212 | } |
411 | } |
| 213 | } |
412 | } |
| 214 | this.updateDisplay(); |
413 | this.updateDisplay(); |
| 215 | } |
414 | } |
| 216 | 415 | ||
| 217 | Display.prototype.updateDisplay = function() |
416 | Display.prototype.updateDisplay = function() |
| 218 | { |
417 | { |
| 219 | /* see if the current menuitem wants to update itself */ |
418 | /* see if the current menuitem wants to update itself */ |
| 220 | if (this.currentMenuItem.doUpdate) |
419 | if (this.currentMenuItem.doUpdate) |
| 221 | { |
420 | { |
| 222 | this.currentMenuItem.doUpdate(); |
421 | this.currentMenuItem.doUpdate(); |
| 223 | } |
422 | } |
| 224 | 423 | ||
| 225 | /* Clear the LCD screen */ |
424 | /* Clear the LCD screen */ |
| 226 |
|
425 | //this.myLCDService.clearScreen(); |
| 227 | 426 | ||
| 228 | /* send the data for the current menuitem to display */ |
427 | /* send the data for the current menuitem to display */ |
| 229 | for (var i = 0; i < this.currentMenuItem.displayData.length; i++) |
428 | for (var i = 0; i < this.currentMenuItem.displayData.length; i++) |
| 230 | { |
429 | { |
| 231 | this.myLCDService.printText(0, i, this.currentMenuItem.displayData[i]); |
430 | this.myLCDService.printText(0, i, this.currentMenuItem.displayData[i]); |
| Line 257... | Line 456... | ||
| 257 | if (this.myInterval == null) |
456 | if (this.myInterval == null) |
| 258 | { |
457 | { |
| 259 | var self = this; |
458 | var self = this; |
| 260 | 459 | ||
| 261 | /* Start interval timer for our printout. Arguments are the callback function and time in milliseconds */ |
460 | /* Start interval timer for our printout. Arguments are the callback function and time in milliseconds */ |
| 262 | this.myInterval = new Interval(function() { self.timerUpdate() }, |
461 | this.myInterval = new Interval(function() { self.timerUpdate() }, 10000); |
| 263 | } |
462 | } |
| 264 | 463 | ||
| 265 | this.myInterval.start(); |
464 | this.myInterval.start(); |
| 266 | 465 | ||
| 267 | this. |
466 | this.timerUpdate(); |
| 268 | } |
467 | } |
| 269 | } |
468 | } |
| 270 | 469 | ||
| 271 | Display.prototype.timerUpdate = function() |
470 | Display.prototype.timerUpdate = function() |
| 272 | { |
471 | { |
| 273 | /* If LCD service is not online do nothing */ |
472 | /* If LCD service is not online do nothing */ |
| 274 | if (this.myLCDService.isOnline()) |
473 | if (this.myLCDService.isOnline()) |
| 275 | { |
474 | { |
| 276 |
|
475 | this.exchangeCalendar.lookup(this.shortName); |
| 277 | 476 | ||
| 278 | /* update the info on display */ |
477 | /* update the info on display */ |
| 279 | this.updateDisplay(); |
478 | this.updateDisplay(); |
| 280 | 479 | ||
| 281 | //var date = new Date(); |
480 | //var date = new Date(); |