Rev 1346 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1346 | Rev 1349 | ||
|---|---|---|---|
| Line 12... | Line 12... | ||
| 12 | FOST02.prototype.myReportInterval = null; |
12 | FOST02.prototype.myReportInterval = null; |
| 13 | FOST02.prototype.myLastValue = null; |
13 | FOST02.prototype.myLastValue = null; |
| 14 | 14 | ||
| 15 | FOST02.prototype.canMessageHandler = function(canMessage) |
15 | FOST02.prototype.canMessageHandler = function(canMessage) |
| 16 | { |
16 | { |
| - | 17 | var self = this; |
|
| 17 | if (canMessage.getDirectionFlag() == "From_Owner") |
18 | if (canMessage.getDirectionFlag() == "From_Owner") |
| 18 | { |
19 | { |
| 19 | switch (canMessage.getCommandName()) |
20 | switch (canMessage.getCommandName()) |
| 20 | { |
21 | { |
| 21 | case "Temperature_Celsius": |
22 | case "Temperature_Celsius": |
| 22 |
|
23 | // log(this.myName + ":" + this.myId + "> New temperature value: " + canMessage.getData("Value") + "\n"); |
| 23 | this.myLastValueTemp[canMessage.getData("SensorId")] = canMessage.getData("Value"); |
24 | this.myLastValueTemp[canMessage.getData("SensorId")] = canMessage.getData("Value"); |
| 24 | this.callEvent(" |
25 | this.callEvent("newTempValue", canMessage.getData("SensorId")); |
| 25 | var dataArray = new Array(); |
26 | var dataArray = new Array(); |
| 26 | dataArray["service"] = self; |
27 | dataArray["service"] = self; |
| 27 | dataArray["sensor"] = canMessage.getData("SensorId"); |
28 | dataArray["sensor"] = canMessage.getData("SensorId"); |
| 28 | dataArray["value"] = canMessage.getData("Value"); |
29 | dataArray["value"] = canMessage.getData("Value"); |
| 29 | dataArray["moduleName"] = canMessage.getModuleName(); |
30 | dataArray["moduleName"] = canMessage.getModuleName(); |
| 30 | dataArray["moduleId"] = canMessage.getModuleId(); |
31 | dataArray["moduleId"] = canMessage.getModuleId(); |
| 31 | this.callEvent("newValue", dataArray); |
32 | this.callEvent("newValue", dataArray); |
| 32 | break; |
33 | break; |
| 33 | 34 | ||
| 34 | case "Humidity_Percent": |
35 | case "Humidity_Percent": |
| 35 |
|
36 | // log(this.myName + ":" + this.myId + "> New humidity value: " + canMessage.getData("Value") + "\n"); |
| 36 | this.myLastValueHumi[canMessage.getData("SensorId")] = canMessage.getData("Value"); |
37 | this.myLastValueHumi[canMessage.getData("SensorId")] = canMessage.getData("Value"); |
| - | 38 | ||
| 37 | this.callEvent("newHumidityValue", canMessage.getData("SensorId")); |
39 | this.callEvent("newHumidityValue", canMessage.getData("SensorId")); |
| - | 40 | ||
| 38 | break; |
41 | break; |
| 39 | 42 | ||
| 40 | case "Sensor_Report_Interval": |
43 | case "Sensor_Report_Interval": |
| 41 | log(this.myName + ":" + this.myId + "> New report interval: " + canMessage.getData("Time") + "\n"); |
44 | log(this.myName + ":" + this.myId + "> New report interval: " + canMessage.getData("Time") + "\n"); |
| 42 | this.myReportInterval = canMessage.getData("Time"); |
45 | this.myReportInterval = canMessage.getData("Time"); |