Rev 999 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 999 | Rev 1001 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | 1 | ||
| 2 | function SensorPrint(name, id) |
2 | function SensorPrint(type, name, id) |
| 3 | { |
3 | { |
| 4 | /* We must always call the parent constructor, initialization |
4 | /* We must always call the parent constructor, initialization |
| 5 | of variables could be done here, but initialize is a better place */ |
5 | of variables could be done here, but initialize is a better place */ |
| 6 | this.Service(name, id); |
6 | this.Service(type, name, id); |
| 7 | } |
7 | } |
| 8 | 8 | ||
| 9 | /* We inherit from Service with this call, it must always be next |
9 | /* We inherit from Service with this call, it must always be next |
| 10 | after the constructor */ |
10 | after the constructor */ |
| 11 | extend(SensorPrint, Service); |
11 | extend(SensorPrint, Service); |
| Line 25... | Line 25... | ||
| 25 | /* We must always call the parent initialize */ |
25 | /* We must always call the parent initialize */ |
| 26 | this.Service.prototype.initialize.call(this, initialArguments); |
26 | this.Service.prototype.initialize.call(this, initialArguments); |
| 27 | 27 | ||
| 28 | /* This is used for function decalrations like the callbacks below */ |
28 | /* This is used for function decalrations like the callbacks below */ |
| 29 | var self = this; |
29 | var self = this; |
| - | 30 | ||
| - | 31 | if (!this.myInitialArguments["HD44789"]) |
|
| - | 32 | { |
|
| - | 33 | log(this.myName + ":" + this.myId + "> Failed to initialize, HD44789-config missing from config.\n"); |
|
| - | 34 | return; |
|
| - | 35 | } |
|
| - | 36 | ||
| - | 37 | if (!this.myInitialArguments["DS18x20"]) |
|
| - | 38 | { |
|
| - | 39 | log(this.myName + ":" + this.myId + "> Failed to initialize, DS18x20-config missing from config.\n"); |
|
| - | 40 | return; |
|
| - | 41 | } |
|
| - | 42 | ||
| - | 43 | if (!this.myInitialArguments["BusVoltage"]) |
|
| - | 44 | { |
|
| - | 45 | log(this.myName + ":" + this.myId + "> Failed to initialize, BusVoltage-config missing from config.\n"); |
|
| - | 46 | return; |
|
| - | 47 | } |
|
| - | 48 | ||
| - | 49 | if (!this.myInitialArguments["SimpleDTMF"]) |
|
| - | 50 | { |
|
| - | 51 | log(this.myName + ":" + this.myId + "> Failed to initialize, SimpleDTMF-config missing from config.\n"); |
|
| - | 52 | return; |
|
| - | 53 | } |
|
| 30 | 54 | ||
| 31 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
55 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
| 32 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
56 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
| 33 | /* Add a callback for when the service goes online */ |
57 | /* Add a callback for when the service goes online */ |
| 34 | this.myLCDService.registerEventCallback("online", function(args) { self.lcdOnline(); }); |
58 | this.myLCDService.registerEventCallback("online", function(args) { self.lcdOnline(); }); |
| Line 108... | Line 132... | ||
| 108 | if (this.myInterval == null) |
132 | if (this.myInterval == null) |
| 109 | { |
133 | { |
| 110 | var self = this; |
134 | var self = this; |
| 111 | 135 | ||
| 112 | /* Start interval timer for our printout. Arguments are the callback function and time in seconds */ |
136 | /* Start interval timer for our printout. Arguments are the callback function and time in seconds */ |
| 113 |
|
137 | //this.myInterval = new Interval(function() { self.timerUpdate() }, 1000); |
| 114 | } |
138 | } |
| 115 | 139 | ||
| 116 |
|
140 | //this.myInterval.start(); |
| 117 | } |
141 | } |
| 118 | } |
142 | } |
| 119 | 143 | ||
| 120 | SensorPrint.prototype.lcdOffline = function() |
144 | SensorPrint.prototype.lcdOffline = function() |
| 121 | { |
145 | { |