|
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Class definition for a single sensor Node. More...
#include <NodeList.h>
Public Member Functions | |
| Node () | |
| Plain constructor. More... | |
| Node (node_t nodeData) | |
| Constructor that initializes data from another Node data. More... | |
| uint8_t * | getMacAddress () |
| Gets address from Node. More... | |
| uint16_t | getNodeId () |
| Gets Node identifier. More... | |
| void | setNodeId (uint16_t nodeId) |
| Sets a new Node identifier. More... | |
| char * | getNodeName () |
| Gets Node name. More... | |
| void | setNodeName (const char *name) |
| Sets Node name. More... | |
| uint8_t * | getEncriptionKey () |
| Gets Node encryption key. More... | |
| void | setEncryptionKey (const uint8_t *key) |
| Sets encryption key. More... | |
| time_t | getKeyValidFrom () |
| Gets last time that key was agreed with gateway. More... | |
| void | setKeyValidFrom (time_t keyValidFrom) |
| Sets time when key was agreed with gateway. More... | |
| time_t | getLastMessageTime () |
| Gets last time that node sent a message. More... | |
| void | setLastMessageTime () |
| Sets current moment as last node message time. More... | |
| uint16_t | getLastMessageCounter () |
| Gets counter for last received message from node. More... | |
| void | setLastMessageCounter (uint16_t counter) |
| Sets counter for last received message from node. More... | |
| void | setMacAddress (uint8_t *macAddress) |
| Sets node address. More... | |
| bool | isKeyValid () |
| Gets shared key validity for this node. More... | |
| void | setKeyValid (bool status) |
| Sets shared key validity for this node. More... | |
| bool | isRegistered () |
| Gets registration state of this node. More... | |
| status_t | getStatus () |
| Gets status for finite state machine that represents node. More... | |
| void | setStatus (status_t status) |
| Sets status for finite state machine that represents node. More... | |
| node_t | getNodeData () |
| Gets a struct that represents node object. May be used for node serialization. More... | |
| void | printToSerial (Stream *port=&Serial) |
| Dumps node data to the given stream, Serial by default. This method may be used for debugging. More... | |
| void | reset () |
| Resets all node fields to a default initial and not registered state. More... | |
| void | setSleepy (bool sleepy) |
| Sets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sleep after sending a message. In this case it will wait for a short while for a downlink message from gateway. More... | |
| 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 time changes. More... | |
| bool | getInitAsSleepy () |
| Gets initial sleepy mode. More... | |
| bool | getSleepy () |
| Gets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sleep after sending a message. In this case it will wait for a short while for a downlink message from gateway. More... | |
| void | updatePacketsRate (float value) |
| Adds a new message rate value for filter calculation. More... | |
Public Attributes | |
| uint8_t | queuedMessage [MAX_MESSAGE_LENGTH] |
| Message queued for sending to node in case of sleepy mode. More... | |
| size_t | qMessageLength |
| Queued message length. More... | |
| bool | qMessagePending = false |
True if message should be sent just after next data message More... | |
| uint32_t | packetNumber = 0 |
| Number of packets received from node to gateway. More... | |
| uint32_t | packetErrors = 0 |
| Number of errored packets. More... | |
| double | per = 0 |
| Current packet error rate of a specific node. More... | |
| double | packetsHour = 0 |
| Packet rate ffor a specific nope. More... | |
| int64_t | t1 |
| int64_t | t2 |
| int64_t | t3 |
| int64_t | t4 |
| Timestaps to calculate clock offset. More... | |
Protected Member Functions | |
| void | initRateFilter () |
| Starts smoothing filter. More... | |
Protected Attributes | |
| bool | keyValid |
| Node shared key valid. More... | |
| status_t | status |
Current node status. See enum node_status More... | |
| uint16_t | lastMessageCounter |
| Last message counter state for specific Node. More... | |
| uint16_t | nodeId |
| Node identifier asigned by gateway. More... | |
| timer_t | keyValidFrom |
| Last time that Node and Gateway agreed a key. More... | |
| bool | sleepyNode = true |
| Node sleepy definition. More... | |
| bool | initAsSleepy |
| Stores initial sleepy node. If this is false, this node does not accept sleep time changes. More... | |
| uint8_t | mac [ENIGMAIOT_ADDR_LEN] |
| Node address. More... | |
| uint8_t | key [KEY_LENGTH] |
| Shared key. More... | |
| timer_t | lastMessageTime |
| Node state. More... | |
| FilterClass * | rateFilter |
| Filter for message rate smoothing. More... | |
| char | nodeName [NODE_NAME_LENGTH] |
| Node name. Use as a human friendly name to avoid use of numeric address*/. More... | |
Friends | |
| class | NodeList |
Class definition for a single sensor Node.
Definition at line 93 of file NodeList.h.
| Node::Node | ( | ) |
Plain constructor.
Definition at line 77 of file NodeList.cpp.
| Node::Node | ( | node_t | nodeData | ) |
Constructor that initializes data from another Node data.
| nodeData | node_instance struct that contains initalization values for new Node |
node_instance struct Definition at line 83 of file NodeList.cpp.
|
inline |
Gets Node encryption key.
Definition at line 157 of file NodeList.h.
|
inline |
Gets initial sleepy mode.
true if node started as sleepy. false otherwise Definition at line 306 of file NodeList.h.
|
inline |
Gets last time that key was agreed with gateway.
Definition at line 171 of file NodeList.h.
|
inline |
Gets counter for last received message from node.
Definition at line 202 of file NodeList.h.
|
inline |
Gets last time that node sent a message.
Definition at line 187 of file NodeList.h.
|
inline |
Gets address from Node.
Definition at line 112 of file NodeList.h.
| node_t Node::getNodeData | ( | ) |
Gets a struct that represents node object. May be used for node serialization.
Definition at line 17 of file NodeList.cpp.
|
inline |
|
inline |
|
inline |
Gets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sleep after sending a message. In this case it will wait for a short while for a downlink message from gateway.
true if node sleeps after sending a message and wait for downlink. false if downlink may happen in any moment Definition at line 315 of file NodeList.h.
|
inline |
Gets status for finite state machine that represents node.
Definition at line 252 of file NodeList.h.
|
protected |
Starts smoothing filter.
Definition at line 66 of file NodeList.cpp.
|
inline |
Gets shared key validity for this node.
true if node shared key is valid. false otherwise Definition at line 228 of file NodeList.h.
|
inline |
Gets registration state of this node.
true if node is registered on gateway. false otherwise Definition at line 244 of file NodeList.h.
| void Node::printToSerial | ( | Stream * | port = &Serial | ) |
Dumps node data to the given stream, Serial by default. This method may be used for debugging.
| port | Stream to print data to |
Definition at line 31 of file NodeList.cpp.
| void Node::reset | ( | ) |
Resets all node fields to a default initial and not registered state.
Definition at line 104 of file NodeList.cpp.
| void Node::setEncryptionKey | ( | const uint8_t * | key | ) |
|
inline |
Records if node started as a sleepy node or not. If it did not started so it will never accept sleep time changes.
| sleepy | true if node started as sleepy. false otherwise |
Definition at line 298 of file NodeList.h.
|
inline |
Sets shared key validity for this node.
| status | node key validity |
Definition at line 236 of file NodeList.h.
|
inline |
Sets time when key was agreed with gateway.
| keyValidFrom | Time on key agreement |
Definition at line 179 of file NodeList.h.
|
inline |
Sets counter for last received message from node.
| counter | Message counter |
Definition at line 210 of file NodeList.h.
|
inline |
Sets current moment as last node message time.
Definition at line 194 of file NodeList.h.
|
inline |
|
inline |
Sets a new Node identifier.
| nodeId | New nodeId value |
Definition at line 128 of file NodeList.h.
|
inline |
Sets Node name.
| name | Custom node name. This should be unique in the network |
Definition at line 148 of file NodeList.h.
|
inline |
Sets node working mode regarding battery saving strategy. If node is sleepy it will turn into deep sleep after sending a message. In this case it will wait for a short while for a downlink message from gateway.
| sleepy | true if node sleeps after sending a message and wait for downlink. false if downlink may happen in any moment |
Definition at line 286 of file NodeList.h.
|
inline |
Sets status for finite state machine that represents node.
| status | Node status |
Definition at line 260 of file NodeList.h.
| void Node::updatePacketsRate | ( | float | value | ) |
Adds a new message rate value for filter calculation.
| value | Next value for calculation |
Definition at line 99 of file NodeList.cpp.
|
friend |
Definition at line 355 of file NodeList.h.
|
protected |
Stores initial sleepy node. If this is false, this node does not accept sleep time changes.
Definition at line 343 of file NodeList.h.
|
protected |
Shared key.
Definition at line 345 of file NodeList.h.
|
protected |
Node shared key valid.
Definition at line 337 of file NodeList.h.
|
protected |
Last time that Node and Gateway agreed a key.
Definition at line 341 of file NodeList.h.
|
protected |
Last message counter state for specific Node.
Definition at line 339 of file NodeList.h.
|
protected |
Node state.
Definition at line 346 of file NodeList.h.
|
protected |
Node address.
Definition at line 344 of file NodeList.h.
|
protected |
Node identifier asigned by gateway.
Definition at line 340 of file NodeList.h.
|
protected |
Node name. Use as a human friendly name to avoid use of numeric address*/.
Definition at line 348 of file NodeList.h.
| uint32_t Node::packetErrors = 0 |
Number of errored packets.
Definition at line 330 of file NodeList.h.
| uint32_t Node::packetNumber = 0 |
Number of packets received from node to gateway.
Definition at line 329 of file NodeList.h.
| double Node::packetsHour = 0 |
Packet rate ffor a specific nope.
Definition at line 332 of file NodeList.h.
| double Node::per = 0 |
Current packet error rate of a specific node.
Definition at line 331 of file NodeList.h.
| size_t Node::qMessageLength |
Queued message length.
Definition at line 326 of file NodeList.h.
| bool Node::qMessagePending = false |
True if message should be sent just after next data message
Definition at line 327 of file NodeList.h.
| uint8_t Node::queuedMessage[MAX_MESSAGE_LENGTH] |
Message queued for sending to node in case of sleepy mode.
Definition at line 325 of file NodeList.h.
|
protected |
Filter for message rate smoothing.
Definition at line 347 of file NodeList.h.
|
protected |
Node sleepy definition.
Definition at line 342 of file NodeList.h.
|
protected |
Current node status. See enum node_status
Definition at line 338 of file NodeList.h.
| int64_t Node::t1 |
Definition at line 333 of file NodeList.h.
| int64_t Node::t2 |
Definition at line 333 of file NodeList.h.
| int64_t Node::t3 |
Definition at line 333 of file NodeList.h.
| int64_t Node::t4 |
Timestaps to calculate clock offset.
Definition at line 333 of file NodeList.h.
1.8.18