Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Embed: (wiki syntax)

« Back to documentation index

NvmProtocolObj Class Reference

NvmProtocolObj Class Reference

This convenience class implements helps storing protocol settings to non-volatile memory. More...

#include <CommProtocolPeerBrute.h>

Public Member Functions

 NvmProtocolObj ()
 NvmProtocolObj constructor.
void setDefaults ()
 Set all internal variables to defaults.
CmdResult toBytes (uint8_t *data, uint8_t &size)
 Saves internal state from a byte array.
CmdResult fromBytes (uint8_t *data, uint8_t size)
 Loads internal state from a byte array.
uint16_t getProtocolFlag ()
 Accessor for protocol flag.
bool validProtocolFlag ()
 Checks if protocol flag is valid.
uint16_t getProtocolRev ()
 Accessor for protocol rev.
bool validProtocolRev ()
 Checks if the revision of the protocol matches.
void getNetworkAddr (std::vector< uint8_t > &addr)
 Accessor for network address.
void setNetworkAddr (const std::vector< uint8_t > &addr)
 A setter for network address.
void getNetworkSessionKey (std::vector< uint8_t > &key)
 Accessor for network session key.
void setNetworkSessionKey (const std::vector< uint8_t > &key)
 A setter for network session key.
void getDataSessionKey (std::vector< uint8_t > &key)
 Accessor for data session key.
void setDataSessionKey (const std::vector< uint8_t > &key)
 A setter for data session key.
uint16_t getLogicalAddr ()
 A accessor for logical address.
void setLogicalAddr (uint16_t in)
 A setter for logical address.
uint32_t getLastMsgSeq ()
 A accessor for LastMsgSeq.
void setLastMsgSeq (uint32_t in)
 A setter for LastMsgSeq.
void incLastMsgSeq ()
 A convenience method which increments LastMsgSeq.

Detailed Description

This convenience class implements helps storing protocol settings to non-volatile memory.

This class can translate to and from a byte array which can be stored then be easily stored using any number of APIs.

Definition at line 33 of file CommProtocolPeerBrute.h.


Constructor & Destructor Documentation

NvmProtocolObj constructor.

Initializes internal values with defaults

Definition at line 590 of file CommProtocolPeerBrute.cpp.


Member Function Documentation

CmdResult fromBytes ( uint8_t *  data,
uint8_t  size 
)

Loads internal state from a byte array.

This byte array should typically have previously generated by the toBytes function.

Definition at line 605 of file CommProtocolPeerBrute.cpp.

void getDataSessionKey ( std::vector< uint8_t > &  key )

Accessor for data session key.

Value return via parameter

Parameters:
keyA STL Vector which will be set with 16 byte key

Definition at line 684 of file CommProtocolPeerBrute.cpp.

uint32_t getLastMsgSeq (  )

A accessor for LastMsgSeq.

Definition at line 707 of file CommProtocolPeerBrute.cpp.

uint16_t getLogicalAddr (  )

A accessor for logical address.

Definition at line 699 of file CommProtocolPeerBrute.cpp.

void getNetworkAddr ( std::vector< uint8_t > &  addr )

Accessor for network address.

Note value is returned via parameter.

Parameters:
addrA STL vector which will be set to 4 byte address

Definition at line 654 of file CommProtocolPeerBrute.cpp.

void getNetworkSessionKey ( std::vector< uint8_t > &  key )

Accessor for network session key.

Value return via parameter

Parameters:
keyA STL Vector which will be set with 16 byte key

Definition at line 669 of file CommProtocolPeerBrute.cpp.

uint16_t getProtocolFlag (  )

Accessor for protocol flag.

Definition at line 638 of file CommProtocolPeerBrute.cpp.

uint16_t getProtocolRev (  )

Accessor for protocol rev.

Definition at line 646 of file CommProtocolPeerBrute.cpp.

void incLastMsgSeq (  )

A convenience method which increments LastMsgSeq.

Definition at line 711 of file CommProtocolPeerBrute.cpp.

void setDataSessionKey ( const std::vector< uint8_t > &  key )

A setter for data session key.

Parameters:
keyThe network session key to be stored. This value should be 16 bytes.

Definition at line 689 of file CommProtocolPeerBrute.cpp.

void setDefaults (  )

Set all internal variables to defaults.

This is automatically called from constructor.

Definition at line 594 of file CommProtocolPeerBrute.cpp.

void setLastMsgSeq ( uint32_t  in )

A setter for LastMsgSeq.

Parameters:
inValue for ter for LastMsgSeq
void setLogicalAddr ( uint16_t  in )

A setter for logical address.

Parameters:
inValue for logical address

Definition at line 703 of file CommProtocolPeerBrute.cpp.

void setNetworkAddr ( const std::vector< uint8_t > &  addr )

A setter for network address.

Parameters:
addrThe network address to be stored. This value should be 4 bytes.

Definition at line 659 of file CommProtocolPeerBrute.cpp.

void setNetworkSessionKey ( const std::vector< uint8_t > &  key )

A setter for network session key.

Parameters:
keyThe network session key to be stored. This value should be 16 bytes.

Definition at line 674 of file CommProtocolPeerBrute.cpp.

CmdResult toBytes ( uint8_t *  data,
uint8_t &  size 
)

Saves internal state from a byte array.

Definition at line 622 of file CommProtocolPeerBrute.cpp.

bool validProtocolFlag (  )

Checks if protocol flag is valid.

Definition at line 642 of file CommProtocolPeerBrute.cpp.

bool validProtocolRev (  )

Checks if the revision of the protocol matches.

Definition at line 650 of file CommProtocolPeerBrute.cpp.