EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Public Member Functions | Protected Attributes | List of all members
NodeList Class Reference

#include <NodeList.h>

Public Member Functions

 NodeList ()
 Node list constructor. More...
 
NodegetNodeFromID (uint16_t nodeId)
 Gets node that correspond with given nodeId. More...
 
NodegetNodeFromMAC (const uint8_t *mac)
 Gets node that correspond with given address. More...
 
NodegetNodeFromName (const char *name)
 Gets node that correspond with given node name. More...
 
int8_t checkNodeName (const char *name, const uint8_t *address)
 Check Node name for duplicate. More...
 
NodefindEmptyNode ()
 Searches for a free place for a new Node instance. More...
 
uint16_t countActiveNodes ()
 Gets the number of active nodes (registered or registering) More...
 
bool unregisterNode (uint16_t nodeId)
 Frees up a node and marks it as available. More...
 
bool unregisterNode (const uint8_t *mac)
 Frees up a node and marks it as available. More...
 
bool unregisterNode (Node *node)
 Frees up a node using a pointer to it. More...
 
NodegetNextActiveNode (uint16_t nodeId)
 Gets next active node by nodeId. More...
 
NodegetNextActiveNode (Node *node)
 Gets next active node by instance where to get nodeId. More...
 
NodegetNewNode (const uint8_t *mac)
 Finds a node that correspond with given address of creates a new one if it does not exist. More...
 
void printToSerial (Stream *port)
 Dumps node list data to a Stream object. More...
 
NodegetBroadcastNode ()
 Gets broadcas node instance. More...
 
void initBroadcastNode ()
 Init broadcast node data. More...
 
uint16_t getLastBroadcastMsgCounter ()
 Ask for last broadcast message counter state. More...
 
void incLastBroadcastMsgCounter ()
 Increments last broadcast message counter stata by one. More...
 

Protected Attributes

Node nodes [NUM_NODES]
 Static Node array that holds maximum number of supported nodes. More...
 
Node broadcastNode
 Node instance that holds data used for broadcast messages. This does not represent any individual node. More...
 
uint16_t lastBroadcastMsgCounter
 Last broadcast message counter state for all nodes, both for data and control messages. More...
 

Detailed Description

Definition at line 506 of file NodeList.h.

Constructor & Destructor Documentation

◆ NodeList()

NodeList::NodeList ( )

Node list constructor.

Definition at line 129 of file NodeList.cpp.

Member Function Documentation

◆ checkNodeName()

int8_t NodeList::checkNodeName ( const char *  name,
const uint8_t *  address 
)

Check Node name for duplicate.

Parameters
nameCustom node name
addressAddress of node which is being tried to set name
Returns
Error code to show name correctness. 0 = OK, -1 = Name already used, -2 = Name is too long, -3 = Name is empty

Definition at line 201 of file NodeList.cpp.

◆ countActiveNodes()

uint16_t NodeList::countActiveNodes ( )

Gets the number of active nodes (registered or registering)

Returns
Number of active nodes

Definition at line 247 of file NodeList.cpp.

◆ findEmptyNode()

Node * NodeList::findEmptyNode ( )

Searches for a free place for a new Node instance.

Returns
Node instance to hold new instance

Definition at line 234 of file NodeList.cpp.

◆ getBroadcastNode()

Node* NodeList::getBroadcastNode ( )
inline

Gets broadcas node instance.

Returns
Broadcas node instance

Definition at line 607 of file NodeList.h.

◆ getLastBroadcastMsgCounter()

uint16_t NodeList::getLastBroadcastMsgCounter ( )
inline

Ask for last broadcast message counter state.

Returns
last broadcast message counter

Definition at line 620 of file NodeList.h.

◆ getNewNode()

Node * NodeList::getNewNode ( const uint8_t *  mac)

Finds a node that correspond with given address of creates a new one if it does not exist.

Parameters
macaddress to search for
Returns
Node instance. NULL if it Node store is full

Definition at line 324 of file NodeList.cpp.

◆ getNextActiveNode() [1/2]

Node * NodeList::getNextActiveNode ( Node node)

Gets next active node by instance where to get nodeId.

Parameters
nodeNode which have the nodeId to find
Returns
Pointer to node or NULL if it was not found

Definition at line 309 of file NodeList.cpp.

◆ getNextActiveNode() [2/2]

Node * NodeList::getNextActiveNode ( uint16_t  nodeId)

Gets next active node by nodeId.

Parameters
nodeIdNodeId of the node to find
Returns
Pointer to node or NULL if it was not found

Definition at line 295 of file NodeList.cpp.

◆ getNodeFromID()

Node * NodeList::getNodeFromID ( uint16_t  nodeId)

Gets node that correspond with given nodeId.

Parameters
nodeIdNodeId to search for
Returns
Node instance that has given nodeId. NULL if it was not found

Definition at line 135 of file NodeList.cpp.

◆ getNodeFromMAC()

Node * NodeList::getNodeFromMAC ( const uint8_t *  mac)

Gets node that correspond with given address.

Parameters
macaddress to search for
Returns
Node instance that has given address. NULL if it was not found

Definition at line 142 of file NodeList.cpp.

◆ getNodeFromName()

Node * NodeList::getNodeFromName ( const char *  name)

Gets node that correspond with given node name.

Parameters
nameNode name to search for
Returns
Node instance that has given name. NULL if it was not found

Definition at line 174 of file NodeList.cpp.

◆ incLastBroadcastMsgCounter()

void NodeList::incLastBroadcastMsgCounter ( )
inline

Increments last broadcast message counter stata by one.

Definition at line 627 of file NodeList.h.

◆ initBroadcastNode()

void NodeList::initBroadcastNode ( )

Init broadcast node data.

Definition at line 161 of file NodeList.cpp.

◆ printToSerial()

void NodeList::printToSerial ( Stream *  port)

Dumps node list data to a Stream object.

Parameters
portStram port

Definition at line 340 of file NodeList.cpp.

◆ unregisterNode() [1/3]

bool NodeList::unregisterNode ( const uint8_t *  mac)

Frees up a node and marks it as available.

Parameters
macAddress to free up
Returns
'True' if it was deleted. 'False' if address was not found

Definition at line 270 of file NodeList.cpp.

◆ unregisterNode() [2/3]

bool NodeList::unregisterNode ( Node node)

Frees up a node using a pointer to it.

Parameters
nodePointer to node instance
Returns
'True' if it was deleted. 'False' if it was already deleted

Definition at line 281 of file NodeList.cpp.

◆ unregisterNode() [3/3]

bool NodeList::unregisterNode ( uint16_t  nodeId)

Frees up a node and marks it as available.

Parameters
nodeIdNodeId to free up
Returns
'True' if it was deleted. 'False' if nodeId was not found

Definition at line 258 of file NodeList.cpp.

Member Data Documentation

◆ broadcastNode

Node NodeList::broadcastNode
protected

Node instance that holds data used for broadcast messages. This does not represent any individual node.

Definition at line 633 of file NodeList.h.

◆ lastBroadcastMsgCounter

uint16_t NodeList::lastBroadcastMsgCounter
protected

Last broadcast message counter state for all nodes, both for data and control messages.

Definition at line 634 of file NodeList.h.

◆ nodes

Node NodeList::nodes[NUM_NODES]
protected

Static Node array that holds maximum number of supported nodes.

Definition at line 632 of file NodeList.h.


The documentation for this class was generated from the following files: