Minor optimizations & code harmonization (#708)

This commit is contained in:
Olivier
2016-12-28 22:47:41 +01:00
committed by Henrik Ekblad
parent 7445b065ec
commit dd9dff77ed
15 changed files with 65 additions and 53 deletions
+7 -8
View File
@@ -6,7 +6,7 @@
* network topology allowing messages to be routed to nodes.
*
* Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
* Copyright (C) 2013-2015 Sensnology AB
* Copyright (C) 2013-2016 Sensnology AB
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*
* Documentation: http://www.mysensors.org
@@ -38,26 +38,25 @@ bool gatewayTransportSend(MyMessage &message)
return true;
}
bool gatewayTransportInit()
bool gatewayTransportInit(void)
{
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set("Gateway startup complete."));
(void)gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
// Send presentation of locally attached sensors (and node if applicable)
presentNode();
return true;
}
bool gatewayTransportAvailable()
bool gatewayTransportAvailable(void)
{
while (MY_SERIALDEVICE.available()) {
// get the new byte:
char inChar = (char) MY_SERIALDEVICE.read();
const char inChar = (char)MY_SERIALDEVICE.read();
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1) {
if (inChar == '\n') {
_serialInputString[_serialInputPos] = 0;
bool ok = protocolParse(_serialMsg, _serialInputString);
const bool ok = protocolParse(_serialMsg, _serialInputString);
if (ok) {
setIndication(INDICATION_GW_RX);
}
@@ -76,7 +75,7 @@ bool gatewayTransportAvailable()
return false;
}
MyMessage & gatewayTransportReceive()
MyMessage & gatewayTransportReceive(void)
{
// Return the last parsed message
return _serialMsg;