Merge pull request #295 from tekka007/harmonization

I_HEARTBEAT_RESPONSE and typo
This commit is contained in:
tekka007
2015-12-15 14:50:32 +01:00
3 changed files with 10 additions and 15 deletions
+2 -2
View File
@@ -163,10 +163,10 @@ typedef enum {
I_INCLUSION_MODE, I_CONFIG, I_FIND_PARENT, I_FIND_PARENT_RESPONSE,
I_LOG_MESSAGE, I_CHILDREN, I_SKETCH_NAME, I_SKETCH_VERSION,
I_REBOOT, I_GATEWAY_READY,
I_REQUEST_SIGNING, /*!< Indicates senter require signed messages (bool param) */
I_REQUEST_SIGNING, /*!< Indicates sender require signed messages (bool param) */
I_GET_NONCE, /*!< Request for a nonce */
I_GET_NONCE_RESPONSE, /*!< Payload is nonce data */
I_HEARTBEAT, I_PRESENTATION, I_DISCOVER, I_DISCOVER_RESPONSE
I_HEARTBEAT, I_PRESENTATION, I_DISCOVER, I_DISCOVER_RESPONSE, I_HEARTBEAT_RESPONSE
} mysensor_internal;
+3 -10
View File
@@ -215,7 +215,7 @@ void sendBatteryLevel(uint8_t value, bool enableAck) {
}
void sendHeartbeat(void) {
_sendRoute(build(_msg, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_HEARTBEAT, false).set(_heartbeat++));
_sendRoute(build(_msg, _nc.nodeId, GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_HEARTBEAT_RESPONSE, false).set(_heartbeat++));
}
@@ -271,15 +271,8 @@ void _processInternalMessages() {
presentation();
}
} else if (type == I_HEARTBEAT) {
if (!mGetAck(_msg)) {
// Send heartbeat ack message back to sender (with the same payload)
_msgTmp = _msg;
mSetRequestAck(_msgTmp,false); // Reply without ack flag (otherwise we would end up in an eternal loop)
mSetAck(_msgTmp,true);
_msgTmp.sender = _nc.nodeId;
_msgTmp.destination = _msg.sender;
_sendRoute(_msgTmp);
}
// Send heartbeat ack message back to sender (with the same payload)
_sendRoute(build(_msg, _nc.nodeId, _msg.sender, _msg.sensor, C_INTERNAL, I_HEARTBEAT_RESPONSE, false).set(_heartbeat++));
} else if (type == I_TIME && receiveTime) {
// Deliver time to callback
if (receiveTime)
+5 -3
View File
@@ -94,8 +94,9 @@ inline void transportProcess() {
!mGetAck(_msg) &&
(mGetCommand(_msg) != C_INTERNAL ||
(type != I_GET_NONCE_RESPONSE && type != I_GET_NONCE && type != I_REQUEST_SIGNING &&
type != I_ID_REQUEST && type != I_ID_RESPONSE &&
type != I_FIND_PARENT && type != I_FIND_PARENT_RESPONSE))) {
type != I_ID_REQUEST && type != I_ID_RESPONSE &&
type != I_FIND_PARENT && type != I_FIND_PARENT_RESPONSE &&
type != I_HEARTBEAT && type != I_HEARTBEAT_RESPONSE))) {
if (!mGetSigned(_msg)) {
// Got unsigned message that should have been signed
debug(PSTR("no sign\n"));
@@ -414,7 +415,8 @@ boolean transportSendRoute(MyMessage &message) {
(mGetCommand(message) != C_INTERNAL ||
(type != I_GET_NONCE && type != I_GET_NONCE_RESPONSE && type != I_REQUEST_SIGNING &&
type != I_ID_REQUEST && type != I_ID_RESPONSE &&
type != I_FIND_PARENT && type != I_FIND_PARENT_RESPONSE))) {
type != I_FIND_PARENT && type != I_FIND_PARENT_RESPONSE &&
type != I_HEARTBEAT && type != I_HEARTBEAT_RESPONSE))) {
// Send nonce-request
_signingNonceStatus=SIGN_WAITING_FOR_NONCE;
if (!_sendRoute(build(_msgTmp, _nc.nodeId, message.destination, message.sensor, C_INTERNAL, I_GET_NONCE, false).set(""))) {