TOSAs OTA bootloader, test nodejs gateway and other misc changes.
Merge commit '5968ddf21964dff4043e70df8bd65286c90b5127' into development * commit '5968ddf21964dff4043e70df8bd65286c90b5127': Send reboot msg after message retrieval to deal with sensors going to sleep Node JS controller OTA Bootloader Binary message payload handling Remote reboot capability Misc fixes Conflicts: EthernetGateway/EthernetGateway.ino libraries/MySensors/MyGateway.cpp libraries/MySensors/MyMessage.h
This commit is contained in:
@@ -33,6 +33,30 @@ const char* MyMessage::getString() const {
|
||||
}
|
||||
}
|
||||
|
||||
// handles single character hex (0 - 15)
|
||||
char MyMessage::i2h(uint8_t i) const {
|
||||
uint8_t k = i & 0x0F;
|
||||
if (k <= 9)
|
||||
return '0' + k;
|
||||
else
|
||||
return 'A' + k - 10;
|
||||
}
|
||||
|
||||
char* MyMessage::getStream(char *buffer) const {
|
||||
uint8_t cmd = miGetCommand();
|
||||
if ((cmd == C_STREAM) && (buffer != NULL)) {
|
||||
for (uint8_t i = 0; i < miGetLength(); i++)
|
||||
{
|
||||
buffer[i * 2] = i2h(data[i] >> 4);
|
||||
buffer[(i * 2) + 1] = i2h(data[i]);
|
||||
}
|
||||
buffer[miGetLength() * 2] = '\0';
|
||||
return buffer;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char* MyMessage::getString(char *buffer) const {
|
||||
uint8_t payloadType = miGetPayloadType();
|
||||
if (payloadType == P_STRING) {
|
||||
@@ -57,10 +81,7 @@ char* MyMessage::getString(char *buffer) const {
|
||||
ultoa(ulValue, buffer, 10);
|
||||
break;
|
||||
case P_CUSTOM:
|
||||
// TODO: Ok, what do we do here? We should probably convert this to hex
|
||||
// Mostly gateway interested in this so we do the special handling of this
|
||||
// over there.
|
||||
|
||||
return getStream(buffer);
|
||||
break;
|
||||
}
|
||||
return buffer;
|
||||
|
||||
Reference in New Issue
Block a user