 |
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Go to the documentation of this file.
12 #if defined(ARDUINO) && ARDUINO >= 100
220 memcpy (
mac, macAddress, 6);
394 int8_t
checkNodeName (
const char* name,
const uint8_t* address);
uint16_t lastMessageCounter
Last message counter state for specific Node.
uint16_t lastMessageCounter
Last message counter state for specific Node.
void setLastMessageTime()
Sets current moment as last node message time.
Node * findEmptyNode()
Searches for a free place for a new Node instance.
uint32_t packetNumber
Number of packets received from node to gateway.
Node * getNodeFromName(const char *name)
Gets node that correspond with given node name.
timer_t lastMessageTime
Node state.
void setNodeName(const char *name)
Sets Node name.
void printToSerial(Stream *port)
Dumps node list data to a Stream object.
bool sleepyNode
Node sleepy definition.
void setStatus(status_t status)
Sets status for finite state machine that represents node.
Node nodes[NUM_NODES]
Static Node array that holds maximum number of supported nodes.
uint32_t packetErrors
Number of errored packets.
bool qMessagePending
True if message should be sent just after next data message
bool isKeyValid()
Gets shared key validity for this node.
void setInitAsSleepy(bool sleepy)
Records if node started as a sleepy node or not. If it did not started so it will never accept sleep ...
Node * getNewNode(const uint8_t *mac)
Finds a node that correspond with given address of creates a new one if it does not exist.
void setNodeId(uint16_t nodeId)
Sets a new Node identifier.
bool keyValid
Node shared key valid.
Node * getNodeFromMAC(const uint8_t *mac)
Gets node that correspond with given address.
NodeList()
Node list constructor.
static const size_t ENIGMAIOT_ADDR_LEN
Address size. Mac address = 6 bytes.
uint8_t key[32]
Shared key.
static const uint8_t NODE_NAME_LENGTH
Maximum number of characters of node name.
bool initAsSleepy
Stores initial sleepy node. If this is false, this node does not accept sleep time changes.
int64_t t4
Timestaps to calculate clock offset.
bool getSleepy()
Gets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sl...
void setKeyValid(bool status)
Sets shared key validity for this node.
node_t getNodeData()
Gets a struct that represents node object. May be used for node serialization.
time_t lastMessageTime
Last time a message was received by Node.
bool keyValid
Node shared key valid.
enum node_status status_t
Node state.
status_t getStatus()
Gets status for finite state machine that represents node.
uint16_t nodeId
Node identifier asigned by gateway.
uint16_t getNodeId()
Gets Node identifier.
bool unregisterNode(uint16_t nodeId)
Frees up a node and marks it as available.
time_t getLastMessageTime()
Gets last time that node sent a message.
uint16_t nodeId
Node identifier asigned by gateway.
void setKeyValidFrom(time_t keyValidFrom)
Sets time when key was agreed with gateway.
bool sleepyNode
Node sleepy definition.
void setMacAddress(uint8_t *macAddress)
Sets node address.
timer_t keyValidFrom
Last time that Node and Gateway agreed a key.
void setSleepy(bool sleepy)
Sets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sl...
void initRateFilter()
Starts smoothing filter.
void reset()
Resets all node fields to a default initial and not registered state.
bool getInitAsSleepy()
Gets initial sleepy mode.
void setEncryptionKey(const uint8_t *key)
Sets encryption key.
status_t status
Current node status. See enum node_status
double packetsHour
Packet rate ffor a specific nope.
Node * getNextActiveNode(uint16_t nodeId)
Gets next active node by nodeId.
uint8_t * getEncriptionKey()
Gets Node encryption key.
static const int NUM_NODES
Maximum number of nodes that this gateway can handle.
enum ota_status ota_status_t
Struct that define node fields. Used for long term storage needs.
uint8_t key[KEY_LENGTH]
Shared key.
uint16_t getLastMessageCounter()
Gets counter for last received message from node.
status_t status
Node state.
uint8_t mac[ENIGMAIOT_ADDR_LEN]
Node address.
char * getNodeName()
Gets Node name.
static const uint8_t MAX_MESSAGE_LENGTH
Maximum payload size on ESP-NOW.
FilterClass * rateFilter
Filter for message rate smoothing.
time_t keyValidFrom
Last time that Node and Gateway agreed a key.
void updatePacketsRate(float value)
Adds a new message rate value for filter calculation.
Class definition for a single sensor Node.
uint8_t queuedMessage[MAX_MESSAGE_LENGTH]
Message queued for sending to node in case of sleepy mode.
int8_t checkNodeName(const char *name, const uint8_t *address)
Check Node name for duplicate.
bool isRegistered()
Gets registration state of this node.
uint8_t * getMacAddress()
Gets address from Node.
time_t getKeyValidFrom()
Gets last time that key was agreed with gateway.
void printToSerial(Stream *port=&Serial)
Dumps node data to the given stream, Serial by default. This method may be used for debugging.
uint8_t mac[ENIGMAIOT_ADDR_LEN]
Node address.
double per
Current packet error rate of a specific node.
Node * getNodeFromID(uint16_t nodeId)
Gets node that correspond with given nodeId.
char nodeName[NODE_NAME_LENGTH]
Node name. Use as a human friendly name to avoid use of numeric address*/.
uint16_t countActiveNodes()
Gets the number of active nodes (registered or registering)
enum control_message_type control_message_type_t
size_t qMessageLength
Queued message length.
const uint8_t KEY_LENGTH
Key length used by selected crypto algorythm. The only tested value is 32. Change it only if you know...
node_status
State definition for nodes.
void setLastMessageCounter(uint16_t counter)
Sets counter for last received message from node.
Filter to process message rate or other values.