Subversion Repositories HomeAutomation

Rev

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

Rev 1249 Rev 1250
Line 105... Line 105...
105
        return;
105
        return;
106
    }
106
    }
107
    this.shortName = this.myInitialArguments["ShortName"];
107
    this.shortName = this.myInitialArguments["ShortName"];
108
 
108
 
109
    /* Start interval timer for sending timestamp to network. Arguments are the callback function and time in milliseconds
109
    /* Start interval timer for sending timestamp to network. Arguments are the callback function and time in milliseconds
110
    used to make sure an eth-node gets its init packet */
110
    used to make sure an eth-node gets its init packet (600s) */
111
    this.myIntervalAlways = new Interval(function() { self.sendTimeStamp() }, 10000);
111
    this.myIntervalAlways = new Interval(function() { self.sendTimeStamp() }, 600000);
112
    this.myIntervalAlways.start();
112
    this.myIntervalAlways.start();
113
   
113
   
114
    this.screenSaverCnt = 0;
114
    this.screenSaverCnt = 0;
115
    this.mainScreenCnt = 0;
115
    this.mainScreenCnt = 0;
116
    this.exchangeUpdateCnt = exchangeUpdateTimeout-10;
116
    this.exchangeUpdateCnt = exchangeUpdateTimeout-10;
Line 267... Line 267...
267
        if (data.result)
267
        if (data.result)
268
        {
268
        {
269
            if (data.error)
269
            if (data.error)
270
            {
270
            {
271
                this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking failed");
271
                this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking failed");
272
                log("Display: got this error from exchange server: " + data.error + "\n");
272
                log("Display:"+this.myId+"> Got this error from exchange server: " + data.error + "\n");
273
            }
273
            }
274
            else
274
            else
275
            {
275
            {
276
                this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking succeeded");
276
                this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking succeeded");
277
                log("Display: Successfully booked room\n");
277
                log("Display:"+this.myId+"> Successfully booked room\n");
278
               
278
               
279
                /* do an exchange lookup */
279
                /* do an exchange lookup */
280
                this.exchangeCalendar.lookup(this.shortName);
280
                this.exchangeCalendar.lookup(this.shortName);
281
            }
281
            }
282
           
282
           
283
        }
283
        }
284
        else if (data.error)
284
        else if (data.error)
285
        {
285
        {
286
            this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking failed");
286
            this.bookResultMenuItem.displayData[0] = this.lcdCenterText("Booking failed");
287
            log("Display: got this error from exchange.php: " + data.error + "\n");
287
            log("Display:"+this.myId+"> Got this error from exchange.php: " + data.error + "\n");
288
        }
288
        }
289
        this.updateDisplay();
289
        this.updateDisplay();
290
    }
290
    }
291
}
291
}
292
 
292
 
Line 443... Line 443...
443
    if (shortname == this.shortName)
443
    if (shortname == this.shortName)
444
    {
444
    {
445
        //FIXME check if data contains error tag and error message, print to log and keep previous data?
445
        //FIXME check if data contains error tag and error message, print to log and keep previous data?
446
        if (data.error)
446
        if (data.error)
447
        {
447
        {
448
            log("Display: got this error from exchange.php: " + data.error + "\n");
448
            log("Display:"+this.myId+"> got this error from exchange.php: " + data.error + "\n");
449
        }
449
        }
450
        else
450
        else
451
        {
451
        {
452
            this.exchangeData = data;
452
            this.exchangeData = data;
453
            this.createCalendarMenu();
453
            this.createCalendarMenu();
Line 689... Line 689...
689
    this.setLED(0, 255, 0);
689
    this.setLED(0, 255, 0);
690
}
690
}
691
 
691
 
692
Display.prototype.setLED = function(red, green, blue)
692
Display.prototype.setLED = function(red, green, blue)
693
{
693
{
694
log("trying to set leds to red " +red+" green "+green+" blue "+blue+"\n");
694
log("Display:"+this.myId+"> Trying to set leds to red " +red+" green "+green+" blue "+blue+"\n");
695
    if (this.mySoftPwmService.isOnline())
695
    if (this.mySoftPwmService.isOnline())
696
    {
696
    {
697
        this.mySoftPwmService.setPWMValue(255-(red&0xff), 1);
697
        this.mySoftPwmService.setPWMValue(255-(red&0xff), 1);
698
        this.mySoftPwmService.setPWMValue(255-(green&0xff), 2);
698
        this.mySoftPwmService.setPWMValue(255-(green&0xff), 2);
699
        this.mySoftPwmService.setPWMValue(255-(blue&0xff), 0);
699
        this.mySoftPwmService.setPWMValue(255-(blue&0xff), 0);