Rev 1244 | Rev 1246 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1244 | Rev 1245 | ||
|---|---|---|---|
| Line 445... | Line 445... | ||
| 445 | } |
445 | } |
| 446 | else |
446 | else |
| 447 | { |
447 | { |
| 448 | this.exchangeData = data; |
448 | this.exchangeData = data; |
| 449 | this.createCalendarMenu(); |
449 | this.createCalendarMenu(); |
| - | 450 | ||
| - | 451 | this.setLEDtoCalendar(); |
|
| 450 | } |
452 | } |
| 451 | } |
453 | } |
| 452 | } |
454 | } |
| 453 | 455 | ||
| 454 | /* this function parses calendar data from exchange-script and creates a menu */ |
456 | /* this function parses calendar data from exchange-script and creates a menu */ |
| Line 458... | Line 460... | ||
| 458 | var self = this; |
460 | var self = this; |
| 459 | 461 | ||
| 460 | this.exchangeCalendarLastMenuItem = null; |
462 | this.exchangeCalendarLastMenuItem = null; |
| 461 | this.exchangeCalendarFirstMenuItem = null; |
463 | this.exchangeCalendarFirstMenuItem = null; |
| 462 | 464 | ||
| 463 | //log("createCalendar \n"); |
- | |
| 464 | if (this.exchangeData) |
465 | if (this.exchangeData) |
| 465 | { |
466 | { |
| 466 | //log("have data \n"); |
- | |
| 467 | var lastMenuItem; |
467 | var lastMenuItem; |
| 468 | for (var i = 0; i < this.exchangeData.meetings.length; i++) |
468 | for (var i = 0; i < this.exchangeData.meetings.length; i++) |
| 469 | { |
469 | { |
| 470 | //log("looping \n"); |
- | |
| 471 | /* create the menuitem for a calendar meeting */ |
470 | /* create the menuitem for a calendar meeting */ |
| 472 | var menu = new MenuItem(this); |
471 | var menu = new MenuItem(this); |
| 473 | menu.displayData[0] = this.lcdCenterText(this.replaceAumlauts(this.exchangeData.meetings[i].subject)); |
472 | menu.displayData[0] = this.lcdCenterText(this.replaceAumlauts(this.exchangeData.meetings[i].subject)); |
| 474 | menu.displayData[1] = this.lcdCenterText(this.exchangeData.meetings[i].start.replace(":",".") + " - " |
473 | menu.displayData[1] = this.lcdCenterText(this.exchangeData.meetings[i].start.replace(":",".") + " - " |
| 475 | + this.exchangeData.meetings[i].end.replace(":",".")); |
474 | + this.exchangeData.meetings[i].end.replace(":",".")); |
| Line 540... | Line 539... | ||
| 540 | { |
539 | { |
| 541 | this.screenSaverCnt = 0; |
540 | this.screenSaverCnt = 0; |
| 542 | this.mainScreenCnt = 0; |
541 | this.mainScreenCnt = 0; |
| 543 | for (var i = 0; i < this.myRotaryService.getSteps(SwitchId); i++) |
542 | for (var i = 0; i < this.myRotaryService.getSteps(SwitchId); i++) |
| 544 | { |
543 | { |
| 545 | if (this.myRotaryService.getDirection(SwitchId) == "Clockwise") |
544 | if (this.myRotaryService.getDirection(SwitchId) == "Clockwise") |
| 546 | { |
545 | { |
| 547 | if (this.currentMenuItem.doRight) |
546 | if (this.currentMenuItem.doRight) |
| 548 | { |
547 | { |
| 549 | this.currentMenuItem.doRight(); |
548 | this.currentMenuItem.doRight(); |
| 550 | } |
549 | } |
| 551 | } |
550 | } |
| 552 | else |
551 | else |
| 553 | { |
552 | { |
| 554 | if (this.currentMenuItem.doLeft) |
553 | if (this.currentMenuItem.doLeft) |
| 555 | { |
554 | { |
| 556 | this.currentMenuItem.doLeft(); |
555 | this.currentMenuItem.doLeft(); |
| 557 | } |
556 | } |
| 558 | } |
557 | } |
| 559 | } |
558 | } |
| 560 | 559 | ||
| 561 | this.updateDisplay(); |
560 | this.updateDisplay(); |
| 562 | } |
561 | } |
| Line 564... | Line 563... | ||
| 564 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
563 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
| 565 | { |
564 | { |
| 566 | this.screenSaverCnt = 0; |
565 | this.screenSaverCnt = 0; |
| 567 | this.mainScreenCnt = 0; |
566 | this.mainScreenCnt = 0; |
| 568 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
567 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
| 569 | { |
568 | { |
| 570 | if (this.currentMenuItem.doPress) |
569 | if (this.currentMenuItem.doPress) |
| 571 | { |
570 | { |
| 572 | this.currentMenuItem.doPress(); |
571 | this.currentMenuItem.doPress(); |
| 573 | } |
572 | } |
| 574 | this.updateDisplay(); |
573 | this.updateDisplay(); |
| Line 609... | Line 608... | ||
| 609 | /* If we have no interval timer running do nothing */ |
608 | /* If we have no interval timer running do nothing */ |
| 610 | if (this.myInterval != null) |
609 | if (this.myInterval != null) |
| 611 | { |
610 | { |
| 612 | /* Stop the interval */ |
611 | /* Stop the interval */ |
| 613 | this.myInterval.stop(); |
612 | this.myInterval.stop(); |
| 614 | } |
613 | } |
| 615 | } |
614 | } |
| 616 | 615 | ||
| 617 | Display.prototype.lcdOnline = function() |
616 | Display.prototype.lcdOnline = function() |
| 618 | { |
617 | { |
| 619 | /* If service is not online do nothing */ |
618 | /* If service is not online do nothing */ |
| 620 | if (this.myLCDService.isOnline()) |
619 | if (this.myLCDService.isOnline()) |
| 621 | { |
620 | { |
| 622 | /* Clear the LCD screen */ |
621 | /* Clear the LCD screen */ |
| 623 | this.myLCDService.clearScreen(); |
622 | this.myLCDService.clearScreen(); |
| 624 | /* Set backlight to max */ |
623 | /* Set backlight to max */ |
| 625 | this.myLCDService.setBacklight(255); |
624 | this.myLCDService.setBacklight(255); |
| 626 | 625 | ||
| Line 632... | Line 631... | ||
| 632 | /* Start interval timer for our printout. Arguments are the callback function and time in milliseconds */ |
631 | /* Start interval timer for our printout. Arguments are the callback function and time in milliseconds */ |
| 633 | this.myInterval = new Interval(function() { self.timerUpdate() }, 5000); |
632 | this.myInterval = new Interval(function() { self.timerUpdate() }, 5000); |
| 634 | } |
633 | } |
| 635 | 634 | ||
| 636 | this.myInterval.start(); |
635 | this.myInterval.start(); |
| 637 | 636 | ||
| 638 | this.timerUpdate(); |
637 | this.timerUpdate(); |
| - | 638 | } |
|
| - | 639 | } |
|
| - | 640 | ||
| - | 641 | Display.prototype.setLEDtoCalendar = function() |
|
| - | 642 | { |
|
| - | 643 | if (this.exchangeData) |
|
| - | 644 | { |
|
| - | 645 | var now = new Date(); |
|
| - | 646 | //for (var i = 0; i < this.exchangeData.meetings.length; i++) |
|
| - | 647 | if (this.exchangeData.meetings.length > 0) |
|
| - | 648 | { |
|
| - | 649 | /* check if current time is before start of first meeting |
|
| - | 650 | first meeting is always the next meeting or current meeting */ |
|
| - | 651 | var startDate = new Date(this.exchangeData.meetings[0].start); |
|
| - | 652 | if (now < startDate) |
|
| - | 653 | { |
|
| - | 654 | this.setLEDgreen(); |
|
| - | 655 | } |
|
| - | 656 | else |
|
| - | 657 | { |
|
| - | 658 | this.setLEDred(); |
|
| - | 659 | } |
|
| - | 660 | ||
| - | 661 | //var endDate = new Date(this.exchangeData.meetings[i].end); |
|
| - | 662 | //now.getHours() |
|
| - | 663 | //this.exchangeData.meetings[i].start |
|
| - | 664 | //this.exchangeData.meetings[i].end |
|
| - | 665 | //var startTimeSplit = this.exchangeData.meetings[i].start.split(":"); |
|
| - | 666 | //var endTimeSplit = this.exchangeData.meetings[i].end.split(":"); |
|
| 639 | } |
667 | } |
| 640 | } |
668 | } |
| 641 | 669 | ||
| 642 | Display.prototype.setLEDred = function() |
670 | Display.prototype.setLEDred = function() |
| 643 | { |
671 | { |