![](/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/inc/CommProtocolPeerBrute.h
- Revision:
- 55:79ab0bbc5008
- Parent:
- 54:c04d7b6fa075
- Child:
- 61:8d9efd33cac9
--- a/xDotBridge/inc/CommProtocolPeerBrute.h Wed Feb 22 15:39:40 2017 -0700 +++ b/xDotBridge/inc/CommProtocolPeerBrute.h Mon Feb 27 08:06:36 2017 -0700 @@ -18,6 +18,33 @@ static uint8_t pair_network_session_key[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 }; static uint8_t pair_data_session_key[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 }; +const uint16_t PROTOCOL_NVM_START_ADDR = 0x1000; +const uint16_t PROTOCOL_NVM_SIZE = 12; // Bytes +const uint16_t PROTOCOL_FLAG = 0x5A00; +const uint16_t PROTOCOL_REV = 0x0000; +class NvmProtocolObj { +public: + NvmProtocolObj(); + void setDefaults(); + CmdResult fromBytes(uint8_t *data, uint8_t size); + CmdResult toBytes(uint8_t *data, uint8_t &size); + + uint16_t getProtocolFlag(); + bool validProtocolFlag(); + uint16_t getProtocolRev(); + bool validProtocolRev(); + + uint16_t getLogicalAddr(); + void setLogicalAddr(uint16_t in); + uint32_t getLastMsgSeq(); + void setLastMsgSeq(uint32_t in); +private: + uint16_t mProtocolFlag; + uint16_t mProtocolRev; + uint16_t mLogicalAddr; + uint32_t mSeqNum; +}; + /** * @class PeerBruteCommProtocol * @brief This class implements a peer-to-peer (P2P) brute force protocol. @@ -63,6 +90,7 @@ * @return Returns the result of all the commands */ CmdResult init(); + CmdResult dotDefaults(); /** * @brief Sets weather this object is configured as a TX or RX @@ -163,9 +191,10 @@ uint32_t getULC(); private: - uint8_t mNetworkAddr[4]; - uint8_t mNetwork_session_key[16]; - uint8_t mData_session_key[16]; +// uint8_t mNetworkAddr[4]; +// uint8_t mNetwork_session_key[16]; +// uint8_t mData_session_key[16]; + NvmProtocolObj mMemObj; bool mIsTx; uint32_t mPrevDownLinkCnt; @@ -214,4 +243,5 @@ CmdResult genEncypKeys(); }; + #endif