![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
Diff: xDotBridge/src/CommProtocolPeerBrute.cpp
- Revision:
- 70:6b3ca63792c2
- Parent:
- 66:bcaa6dbf538a
- Child:
- 72:bcc66cdfd101
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp Fri Mar 24 08:15:37 2017 -0600 +++ b/xDotBridge/src/CommProtocolPeerBrute.cpp Mon Mar 27 09:16:33 2017 -0600 @@ -37,7 +37,11 @@ mMemObj.setDefaults(); writeInfoToNVM(); } - configForSavedNetwork(); + result = configForSavedNetwork(); + if (result != cmdSuccess) { + myLogError("Init error during radio config"); + return result; + } resetCounters(); @@ -299,11 +303,6 @@ return cmdSuccess; // Maybe add timeout as a possible return value } -CmdResult CommProtocolPeerBrute::sampleDLC () { - mPrevDownLinkCnt = dot->getDownLinkCounter(); - return cmdSuccess; -} - CmdResult CommProtocolPeerBrute::recv (std::vector<uint8_t> &msg) { dot->recv(msg); @@ -314,14 +313,14 @@ { std::vector<uint8_t> alertMsg; dot->recv(alertMsg); + if (alertMsg.size() < 16) { + myLogError("Alert message too short"); + return cmdError; + } if (alertMsg[0] != 0xEF || alertMsg[1] != 0x10) { myLogError("Invalid alert message flag."); return cmdError; } - if (alertMsg.size() < 16) { - myLogError("Alert message too short"); - return cmdError; - } eui.clear(); eui.assign(alertMsg.begin()+2, alertMsg.begin()+2+8); @@ -631,7 +630,7 @@ void NvmProtocolObj::setNetworkAddr(const std::vector<uint8_t> &addr) { if (addr.size() > sizeof(mNetworkAddr)) { - // TODO log error + myLogError("Network address too long. Value not stored."); return; } for (uint8_t i=0; i < sizeof(mNetworkAddr); i++) { @@ -646,7 +645,7 @@ void NvmProtocolObj::setNetworkSessionKey(const std::vector<uint8_t> &key) { if (key.size() > sizeof(mNetworkSessionKey)) { - // TODO log error + myLogError("Network session key too long. Value not stored."); return; } for (uint8_t i=0; i < sizeof(mNetworkSessionKey); i++) { @@ -661,7 +660,7 @@ void NvmProtocolObj::setDataSessionKey(const std::vector<uint8_t> &key) { if (key.size() > sizeof(mDataSessionKey)) { - // TODO log error + myLogError("Data session key too long. Value not stored."); return; } for (uint8_t i=0; i < sizeof(mDataSessionKey); i++) {