Accept Time Broadcasts
NodeJsController sending Time broadcasts every few minutes. Sensor accepting not just Time messages addressed to the specific sensor.
This commit is contained in:
@@ -706,5 +706,8 @@ dbc.connect('mongodb://' + dbAddress + ':' + dbPort + '/' + dbName, function(err
|
||||
} else {
|
||||
throw new Error('unknown Gateway type');
|
||||
}
|
||||
setInterval(function() {
|
||||
sendTime(BROADCAST_ADDRESS, NODE_SENSOR_ID, gw);
|
||||
}, 5*60*1000);
|
||||
});
|
||||
|
||||
|
||||
@@ -322,6 +322,11 @@ boolean MySensor::process() {
|
||||
delay(millis() & 0x3ff);
|
||||
sendWrite(sender, build(msg, nc.nodeId, sender, NODE_SENSOR_ID, C_INTERNAL, I_FIND_PARENT_RESPONSE, false).set(nc.distance));
|
||||
return false;
|
||||
} else if (command == C_INTERNAL && type == I_TIME) {
|
||||
if (timeCallback != NULL) {
|
||||
// Deliver time to callback
|
||||
timeCallback(msg.getULong());
|
||||
}
|
||||
} else if (destination == nc.nodeId) {
|
||||
// Check if sender requests an ack back.
|
||||
if (mGetRequestAck(msg)) {
|
||||
@@ -397,11 +402,6 @@ boolean MySensor::process() {
|
||||
}
|
||||
sendRoute(build(msg, nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN,false).set(""));
|
||||
}
|
||||
} else if (type == I_TIME) {
|
||||
if (timeCallback != NULL) {
|
||||
// Deliver time to callback
|
||||
timeCallback(msg.getULong());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user