![](/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:
- 64:46c8819c07cc
- Parent:
- 63:e1efbe3402d9
- Child:
- 65:d546060aa03d
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp Tue Mar 14 09:54:04 2017 -0600 +++ b/xDotBridge/src/CommProtocolPeerBrute.cpp Tue Mar 14 11:53:53 2017 -0600 @@ -33,10 +33,11 @@ if (result != cmdSuccess) { myLogWarning("Reverting to protocol defaults NVM Read failed"); mMemObj.setDefaults(); + writeInfoToNVM(); } configForSavedNetwork(); - writeInfoToNVM(); + resetCounters(); mPrevDownLinkCnt = dot->getDownLinkCounter(); return cmdSuccess; @@ -122,6 +123,8 @@ dot->setClass("C"); // Set class C dot->setTxPower(TX_PWR); dot->setPreserveSession(false); +// dot->setDownLinkCounter(0); +// dot->setUpLinkCounter(1); // TODO break out in a utility function // update configuration if necessary myLogDebug("Setting up peer to peer configuration"); @@ -183,27 +186,12 @@ std::vector<uint8_t> key; key.reserve(16); - // REPLACE WITH NETWORK ADDRESS -// result = genEncypKey(key, 8); -// if (result != cmdSuccess) { -// myLogError("Error generating network ID."); -// return cmdError; -// } -// if (dot->setNetworkId(key) != mDot::MDOT_OK) { -// myLogError("Error setting network ID."); -// return cmdError; -// } - result = genEncypKey(key, 4, false); if (result != cmdSuccess) { myLogError("Error generating network address."); return cmdError; } mMemObj.setNetworkAddr(key); -// if (dot->setNetworkAddress(key) != mDot::MDOT_OK) { -// myLogError("Error setting network address."); -// return cmdError; -// } result = genEncypKey(key, 16); if (result != cmdSuccess) { @@ -211,10 +199,6 @@ return cmdError; } mMemObj.setNetworkSessionKey(key); -// if (dot->setNetworkSessionKey(key) != mDot::MDOT_OK) { -// myLogError("Error setting network session key."); -// return cmdError; -// } result = genEncypKey(key, 16); if (result != cmdSuccess) { @@ -222,14 +206,9 @@ return cmdError; } mMemObj.setDataSessionKey(key); -// if (dot->setDataSessionKey(key) != mDot::MDOT_OK) { -// myLogError("Error setting data session key."); -// return cmdError; -// } configForSavedNetwork(); writeInfoToNVM(); - display_config(); return cmdSuccess; } @@ -281,6 +260,7 @@ wait(TX_TIME/1000.0); // Wait TX_TIME + mPrevDownLinkCnt = 0; // FIXME just test code if (mPrevDownLinkCnt < dot->getDownLinkCounter()) { msgPending = true; } @@ -462,7 +442,7 @@ CmdResult CommProtocolPeerBrute::resetCounters() { dot->setDownLinkCounter(0); - dot->setUpLinkCounter(0); + dot->setUpLinkCounter(1); return cmdSuccess; }