Subversion Repositories HomeAutomation

Rev

Rev 1204 | Rev 1216 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1204 Rev 1212
Line 53... Line 53...
53
Display.prototype.mainScreenCnt = null;
53
Display.prototype.mainScreenCnt = null;
54
 
54
 
55
const exchangeUpdateTimeout = 50;
55
const exchangeUpdateTimeout = 50;
56
const mainScreenTimeout = 40;
56
const mainScreenTimeout = 40;
57
const screenSaverTimeout = 120;
57
const screenSaverTimeout = 120;
-
 
58
 
-
 
59
const bookingIncrease = 15;
58
 
60
 
59
/* This function must always be declared, this is where all the startup code
61
/* This function must always be declared, this is where all the startup code
60
   should be placed. Gets called with arguments like what ids to use etc. */
62
   should be placed. Gets called with arguments like what ids to use etc. */
61
Display.prototype.initialize = function(initialArguments)
63
Display.prototype.initialize = function(initialArguments)
62
{
64
{
Line 192... Line 194...
192
    menuChooseOk.setNextItem(menuChooseCancel);
194
    menuChooseOk.setNextItem(menuChooseCancel);
193
    menuChooseOk.setPrevItem(menuChooseTo);
195
    menuChooseOk.setPrevItem(menuChooseTo);
194
    /* set the function that shall be executed when knob is turned */
196
    /* set the function that shall be executed when knob is turned */
195
    menuChooseOk.doRight = this.changeToNext;
197
    menuChooseOk.doRight = this.changeToNext;
196
    menuChooseOk.doLeft = this.changeToPrev;
198
    menuChooseOk.doLeft = this.changeToPrev;
197
 
199
 
198
    /* connect the items as a linked list */
200
    /* connect the items as a linked list */
199
    menuChooseCancel.setNextItem(menuChooseFrom);
201
    menuChooseCancel.setNextItem(menuChooseFrom);
200
    menuChooseCancel.setPrevItem(menuChooseOk);
202
    menuChooseCancel.setPrevItem(menuChooseOk);
201
    menuChooseCancel.setDescItem(this.bookMenuItem);
203
    menuChooseCancel.setDescItem(this.bookMenuItem);
202
    /* set the function that shall be executed when knob is turned */
204
    /* set the function that shall be executed when knob is turned */
203
    menuChooseCancel.doRight = this.changeToNext;
205
    menuChooseCancel.doRight = this.changeToNext;
Line 239... Line 241...
239
    this.parentDisplay.bookFromTime = new Date();
241
    this.parentDisplay.bookFromTime = new Date();
240
    this.parentDisplay.bookToTime = new Date();
242
    this.parentDisplay.bookToTime = new Date();
241
    //this.bookFromTime.setHours(8);
243
    //this.bookFromTime.setHours(8);
242
    //this.bookToTime.setHours(8);
244
    //this.bookToTime.setHours(8);
243
    if (this.parentDisplay.bookFromTime.getMinutes() < 30)
245
    if (this.parentDisplay.bookFromTime.getMinutes() < 30)
244
    {
246
    {
245
        this.parentDisplay.bookFromTime.setMinutes(0);
247
        this.parentDisplay.bookFromTime.setMinutes(0);
246
        this.parentDisplay.bookToTime.setMinutes(30);
248
        this.parentDisplay.bookToTime.setMinutes(30);
247
    }
249
    }
248
    else
250
    else
249
    {
251
    {
Line 282... Line 284...
282
Display.prototype.incBookTimeTo = function()
284
Display.prototype.incBookTimeTo = function()
283
{
285
{
284
    //FIXME: constraints?
286
    //FIXME: constraints?
285
    if (this.parentDisplay.bookToTime.getHours() < 23)
287
    if (this.parentDisplay.bookToTime.getHours() < 23)
286
    {
288
    {
287
        this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() + 30);
289
        this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() + bookingIncrease);
288
    }
290
    }
289
}
291
}
290
 
292
 
291
Display.prototype.decBookTimeTo = function()
293
Display.prototype.decBookTimeTo = function()
292
{
294
{
293
    //FIXME: constraints?
295
    //FIXME: constraints?
294
    var now = new Date();
296
    var now = new Date();
295
    if (this.parentDisplay.bookToTime.getHours() >= now.getHours())
297
    if (this.parentDisplay.bookToTime.getHours() >= now.getHours())
296
    {
298
    {
297
        this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() - 30);
299
        this.parentDisplay.bookToTime.setMinutes(this.parentDisplay.bookToTime.getMinutes() - bookingIncrease);
298
    }
300
    }
299
}
301
}
300
 
302
 
301
Display.prototype.incBookTimeFrom = function()
303
Display.prototype.incBookTimeFrom = function()
302
{
304
{
303
    //FIXME: constraints?
305
    //FIXME: constraints?
304
    if (this.parentDisplay.bookFromTime.getHours() < 23)
306
    if (this.parentDisplay.bookFromTime.getHours() < 23)
305
    {
307
    {
306
        this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() + 30);
308
        this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() + bookingIncrease);
307
    }
309
    }
308
}
310
}
309
 
311
 
310
Display.prototype.decBookTimeFrom = function()
312
Display.prototype.decBookTimeFrom = function()
311
{
313
{
312
    //FIXME: constraints?
314
    //FIXME: constraints?
313
    var now = new Date();
315
    var now = new Date();
314
    if (this.parentDisplay.bookFromTime.getHours() >= now.getHours())
316
    if (this.parentDisplay.bookFromTime.getHours() >= now.getHours())
315
    {
317
    {
316
        this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() - 30);
318
        this.parentDisplay.bookFromTime.setMinutes(this.parentDisplay.bookFromTime.getMinutes() - bookingIncrease);
317
    }
319
    }
318
}
320
}
319
 
321
 
320
Display.prototype.setBookTimeFrom = function()
322
Display.prototype.setBookTimeFrom = function()
321
{
323
{
Line 334... Line 336...
334
}
336
}
335
 
337
 
336
Display.prototype.chooseBookTimeFrom = function()
338
Display.prototype.chooseBookTimeFrom = function()
337
{
339
{
338
    this.displayData[0] = " <"+this.parentDisplay.bookFromTime.getTimeShortFormated()+"> -  "
340
    this.displayData[0] = " <"+this.parentDisplay.bookFromTime.getTimeShortFormated()+"> -  "
339
                                +this.parentDisplay.bookToTime.getTimeShortFormated()+"   ";
341
                                +this.parentDisplay.bookToTime.getTimeShortFormated()+"   ";
340
}
342
}
341
 
343
 
342
Display.prototype.setBookTime = function()
344
Display.prototype.setBookTime = function()
343
{
345
{
344
    this.displayData[0] = "  "+this.parentDisplay.bookFromTime.getTimeShortFormated()+"  -  "
346
    this.displayData[0] = "  "+this.parentDisplay.bookFromTime.getTimeShortFormated()+"  -  "
345
                                +this.parentDisplay.bookToTime.getTimeShortFormated()+"   ";
347
                                +this.parentDisplay.bookToTime.getTimeShortFormated()+"   ";
346
}
348
}
Line 423... Line 425...
423
            this.exchangeCalendarLastMenuItem = lastMenuItem;
425
            this.exchangeCalendarLastMenuItem = lastMenuItem;
424
            this.exchangeCalendarLastMenuItem.setNextItem(this.bookMenuItem);
426
            this.exchangeCalendarLastMenuItem.setNextItem(this.bookMenuItem);
425
            this.exchangeCalendarFirstMenuItem.setPrevItem(this.statusMenuItem);
427
            this.exchangeCalendarFirstMenuItem.setPrevItem(this.statusMenuItem);
426
       
428
       
427
        }
429
        }
-
 
430
        /* to link in the newly created menuitems with exchangeinformation the display must be showing
-
 
431
           either the statusmenu or the bookingmenu */
428
        if (this.currentMenuItem == this.statusMenuItem || this.currentMenuItem == this.bookMenuItem)
432
        if (this.currentMenuItem == this.statusMenuItem || this.currentMenuItem == this.bookMenuItem)
429
        {
433
        {
-
 
434
            /* if there is one or more exchangemenuitems */
430
            if (this.exchangeCalendarFirstMenuItem && this.exchangeCalendarLastMenuItem)
435
            if (this.exchangeCalendarFirstMenuItem && this.exchangeCalendarLastMenuItem)
431
            {
436
            {
432
                this.statusMenuItem.setNextItem(this.exchangeCalendarFirstMenuItem);
437
                this.statusMenuItem.setNextItem(this.exchangeCalendarFirstMenuItem);
433
                this.bookMenuItem.setPrevItem(this.exchangeCalendarLastMenuItem);
438
                this.bookMenuItem.setPrevItem(this.exchangeCalendarLastMenuItem);
-
 
439
            }
-
 
440
            /* if not then link statusmenu to bookingmenu */
-
 
441
            else
-
 
442
            {
-
 
443
                this.statusMenuItem.setNextItem(this.bookMenuItem);
-
 
444
                this.bookMenuItem.setPrevItem(this.statusMenuItem);
434
            }
445
            }
435
        }
446
        }
436
    }
447
    }
437
}
448
}
438
 
449