EnigmaIOT  0.9.3
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...
 

Protected Attributes

Node nodes [NUM_NODES]
 Static Node array that holds maximum number of supported nodes. More...
 

Detailed Description

Definition at line 359 of file NodeList.h.

Constructor & Destructor Documentation

◆ NodeList()

NodeList::NodeList ( )

Node list constructor.

Definition at line 120 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 163 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 209 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 196 of file NodeList.cpp.

◆ 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 275 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 266 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 257 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 126 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 133 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 148 of file NodeList.cpp.

◆ printToSerial()

void NodeList::printToSerial ( Stream *  port)

Dumps node list data to a Stream object.

Parameters
portStram port

Definition at line 290 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 232 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 243 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 220 of file NodeList.cpp.

Member Data Documentation

◆ nodes

Node NodeList::nodes[NUM_NODES]
protected

Static Node array that holds maximum number of supported nodes.

Definition at line 457 of file NodeList.h.


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