|
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Main node class. Manages communication with gateway and allows sending and receiving user data. More...
#include <EnigmaIOTNode.h>
Public Member Functions | |
| void | begin (Comms_halClass *comm, uint8_t *gateway=NULL, uint8_t *networkKey=NULL, bool useCounter=true, bool sleepy=true) |
| Initalizes communication basic data and starts node registration. More... | |
| void | stop () |
| Stops EnigmaIoT protocol. More... | |
| void | setSleepTime (uint32_t sleepTime) |
| Allows to configure a new sleep time period from user code. More... | |
| bool | setNodeAddress (uint8_t address[ENIGMAIOT_ADDR_LEN]) |
| Set node address to be used in EnigmaIOT communication. More... | |
| uint32_t | getSleepTime () |
| Returns sleep period in seconds. More... | |
| void | handle () |
This method should be called periodically for instance inside loop() function. It is used for internal node maintenance tasks. More... | |
| void | enableClockSync (bool clockSync=true) |
| Controls clock synchronization function. More... | |
| void | setLed (uint8_t led, time_t onTime=FLASH_LED_TIME) |
| Sets a LED to be flashed every time a message is transmitted. More... | |
| void | setResetPin (int pin) |
| Sets a pin to be used to reset configuration it it is connected to ground during startup. More... | |
| bool | sendData (const uint8_t *data, size_t len, nodePayloadEncoding_t payloadEncoding=CAYENNELPP) |
| Starts a data message transmission. More... | |
| bool | sendUnencryptedData (const uint8_t *data, size_t len, nodePayloadEncoding_t payloadEncoding=CAYENNELPP) |
| Starts a data message transmission. More... | |
| void | onDataRx (onNodeDataRx_t handler) |
| Defines a function callback that will be called on every downlink data message that is received from gateway. More... | |
| void | onConnected (onConnected_t handler) |
| Defines a function callback that will be called everytime node is registered on gateway. More... | |
| void | onDisconnected (onDisconnected_t handler) |
| Defines a function callback that will be called everytime node is disconnected from gateway. More... | |
| void | onWiFiManagerExit (onWiFiManagerExit_t handle) |
| Register callback to be called on wifi manager exit. More... | |
| void | onWiFiManagerStarted (onWiFiManagerStarted_t handle) |
| Register callback to be called on wifi manager start. More... | |
| void | addWiFiManagerParameter (AsyncWiFiManagerParameter *p) |
| Adds a parameter to configuration portal. More... | |
| void | sleep () |
| Requests transition to sleep mode (low energy state) More... | |
| int64_t | clock () |
| Gets current clock counter. millis() + offset. More... | |
| time_t | unixtime () |
| Gets current time in seconds from 1970, if time is synchronized. More... | |
| bool | hasClockSync () |
| Checks if internal clock is synchronized to gateway. More... | |
| bool | isRegistered () |
| Checks if node is registered. More... | |
| int8_t | getRSSI () |
| Gets latest RSSI measurement. It is updated during start up or in case of transmission errors. More... | |
| void | resetConfig () |
| Deletes configuration file stored on SPIFFS. It makes neccessary to configure it again using WiFi Portal. More... | |
Protected Member Functions | |
| bool | checkCRC (const uint8_t *buf, size_t count, uint32_t *crc) |
| Check that a given CRC matches to calulated value from a buffer. More... | |
| void | startIdentifying (time_t period) |
| Starts node identification by flashing led. More... | |
| void | stopIdentifying () |
| Stops node identification. More... | |
| bool | loadRTCData () |
| Loads configuration from RTC data. Uses a CRC to check data integrity. More... | |
| bool | loadFlashData () |
| Loads configuration from flash memory. More... | |
| bool | saveFlashData (bool fsOpen=false) |
| Saves configuration to flash memory. More... | |
| bool | configWiFiManager (rtcmem_data_t *data) |
| Starts configuration AP and web server and gets settings from it. More... | |
| void | restart (bool reboot=true) |
| Sets connection as unregistered to force a resyncrhonisation after boot. More... | |
| bool | clientHello () |
| Build a ClientHello messange and send it to gateway. More... | |
| bool | clockRequest () |
| Build a ClockRequest messange and send it to gateway. More... | |
| bool | processClockResponse (const uint8_t *mac, const uint8_t *buf, size_t count) |
| Gets a buffer containing a ClockResponse message and process it. It uses that message to calculate clock difference against gateway and synchronize to it. More... | |
| bool | processServerHello (const uint8_t *mac, const uint8_t *buf, size_t count) |
| Gets a buffer containing a ServerHello message and process it. It uses that message to calculate a shared key using Diffie Hellman algorithm. More... | |
| nodeInvalidateReason_t | processInvalidateKey (const uint8_t *mac, const uint8_t *buf, size_t count) |
| Gets a buffer containing an InvalidateKey message and process it. This trigger a new key agreement to start. More... | |
| bool | dataMessage (const uint8_t *data, size_t len, bool controlMessage=false, bool encrypt=true, nodePayloadEncoding_t payloadEncoding=CAYENNELPP) |
| Builds, encrypts and sends a Data message. More... | |
| bool | unencryptedDataMessage (const uint8_t *data, size_t len, bool controlMessage=false, nodePayloadEncoding_t payloadEncoding=CAYENNELPP) |
| Builds and sends a Data message without encryption. Not recommended, use it only if you absolutely need more performance. More... | |
| bool | processOTACommand (const uint8_t *mac, const uint8_t *data, uint8_t len) |
| Processes a single OTA update command or data. More... | |
| bool | processControlCommand (const uint8_t *mac, const uint8_t *data, size_t len) |
| Processes a control command. Does not propagate to user code. More... | |
| bool | processDownstreamData (const uint8_t *mac, const uint8_t *buf, size_t count, bool control=false) |
| Processes downstream data from gateway. More... | |
| void | manageMessage (const uint8_t *mac, const uint8_t *buf, uint8_t count) |
| Process every received message. More... | |
| void | getStatus (uint8_t *mac_addr, uint8_t status) |
| Functrion to debug send status. More... | |
| bool | processGetSleepTimeCommand (const uint8_t *mac, const uint8_t *buf, uint8_t len) |
| Processes a request of sleep time configuration. More... | |
| bool | processSetSleepTimeCommand (const uint8_t *mac, const uint8_t *buf, uint8_t len) |
| Processes a request to set new sleep time configuration. More... | |
| bool | processSetIdentifyCommand (const uint8_t *mac, const uint8_t *buf, uint8_t len) |
| Processes a request to start indicate to identify a node visually. More... | |
| bool | processSetResetConfigCommand (const uint8_t *mac, const uint8_t *buf, uint8_t len) |
| Processes a request to reset node configuration. More... | |
| bool | processVersionCommand (const uint8_t *mac, const uint8_t *buf, uint8_t len) |
| Processes a request firmware version. More... | |
| bool | sendData (const uint8_t *data, size_t len, bool controlMessage, bool encrypt=true, nodePayloadEncoding_t payloadEncoding=CAYENNELPP) |
| Initiades data transmission distinguissing if it is payload or control data. More... | |
| bool | searchForGateway (rtcmem_data_t *data, bool shouldStoreData=false) |
| Starts searching for a gateway that it using configured Network Name as WiFi AP. Stores this info for subsequent use. More... | |
| void | clearRTC () |
| Clears configuration stored in RTC memory to recover factory state. More... | |
| void | clearFlash () |
| Clears configuration stored in flash to recover factory state. More... | |
| bool | saveRTCData () |
| Save configuration to RTC to store current status and recover it after deep sleep. More... | |
| void | checkResetButton () |
| Checks reset button status during startup. More... | |
| bool | reportRSSI () |
| Sends RSSI value and channel to Gateway. More... | |
| bool | processGetRSSICommand (const uint8_t *mac, const uint8_t *data, uint8_t len) |
| Processes a request to measure RSSI. More... | |
| bool | processGetNameCommand (const uint8_t *mac, const uint8_t *data, uint8_t len) |
| Processes a request to get Node name and address. More... | |
| bool | processSetNameResponse (const uint8_t *mac, const uint8_t *data, uint8_t len) |
| Processes a response to set Node name. More... | |
| bool | processSetNameCommand (const uint8_t *mac, const uint8_t *data, uint8_t len) |
| Processes a request to set Node name. More... | |
| bool | sendNodeNameSet (const char *name) |
| Informs Gateway about custom node name. More... | |
Static Protected Member Functions | |
| static void | rx_cb (uint8_t *mac_addr, uint8_t *data, uint8_t len) |
| Function that will be called anytime this node receives a message. More... | |
| static void | tx_cb (uint8_t *mac_addr, uint8_t status) |
| Function that will be called anytime this node sends a message to indicate status result of sending process. More... | |
Protected Attributes | |
| Node | node |
| Node abstraction to store context. More... | |
| bool | flashBlue = false |
| If true Tx LED will be flashed. More... | |
| int8_t | led = -1 |
IO Pin that corresponds to Tx LED. Default value disables LED. It is initialized with setLed method. More... | |
| unsigned int | ledOnTime |
Time that LED is On during flash. Initalized on setLed More... | |
| Comms_halClass * | comm |
| Comms abstraction layer. More... | |
| onNodeDataRx_t | notifyData |
| Callback that will be called on every message reception. More... | |
| onConnected_t | notifyConnection |
| Callback that will be called anytime a new node is registered. More... | |
| onDisconnected_t | notifyDisconnection |
| Callback that will be called anytime a node is disconnected. More... | |
| bool | useCounter = true |
true means that data message counter will be used to mark message order More... | |
| rtcmem_data_t | rtcmem_data |
| Context data to be stored on persistent storage. More... | |
| bool | sleepRequested = false |
true means that this node will sleep as soon a message is sent and downlink wait time has passed More... | |
| uint64_t | sleepTime |
| Time in microseconds that this node will be slept between measurements. More... | |
| uint8_t | dataMessageSent [MAX_MESSAGE_LENGTH] |
| Buffer where sent message is stored in case of retransmission is needed. More... | |
| uint8_t | dataMessageSentLength = 0 |
| Message length stored for use in case of message retransmission is needed. More... | |
| bool | dataMessageSendPending = false |
| True in case of message retransmission is needed. More... | |
| nodePayloadEncoding_t | dataMessageSendEncoding = RAW |
| Encoding of the message pending to be sent. More... | |
| bool | dataMessageEncrypt = true |
| Message encryption enabled. Stored for use in case of message retransmission is needed. More... | |
| nodeInvalidateReason_t | invalidateReason = UNKNOWN_ERROR |
| Last key invalidation reason. More... | |
| bool | otaRunning = false |
| True if OTA update has started. More... | |
| bool | otaError = false |
| True if OTA update has failed. This normally produces a restart. More... | |
| time_t | lastOTAmsg |
| Time when last OTA update message has received. This is used to control timeout. More... | |
| boolean | indentifying = false |
| True if node has its led flashing to be identified. More... | |
| time_t | identifyStart |
| Time when identification started flashing. Used to control identification timeout. More... | |
| clock_t | timeSyncPeriod = QUICK_SYNC_TIME |
| Clock synchronization period. More... | |
| bool | clockSyncEnabled = false |
| If true clock is synchronized with Gateway. More... | |
| bool | shouldRestart = false |
| Triggers a restart if true. More... | |
| bool | gatewaySearchStarted = false |
| Avoids start a new gateway scan if it already started. More... | |
| bool | requestSearchGateway = false |
| Flag to control updating gateway address, RSSI and channel. More... | |
| bool | requestReportRSSI = false |
| Flag to control RSSI reporting. More... | |
| bool | configCleared = false |
| This flag disables asy configuration save after triggering a factory reset. More... | |
| int | resetPin = -1 |
| Pin used to reset configuration if it is connected to ground during startup. More... | |
| AsyncWiFiManager * | wifiManager |
| Wifi configuration portal. More... | |
| onWiFiManagerExit_t | notifyWiFiManagerExit |
| Function called when configuration portal exits. More... | |
| onWiFiManagerStarted_t | notifyWiFiManagerStarted |
| Function called when configuration portal is started. More... | |
Main node class. Manages communication with gateway and allows sending and receiving user data.
Definition at line 116 of file EnigmaIOTNode.h.
|
inline |
Adds a parameter to configuration portal.
| p | Configuration parameter |
Definition at line 651 of file EnigmaIOTNode.h.
| void EnigmaIOTNodeClass::begin | ( | Comms_halClass * | comm, |
| uint8_t * | gateway = NULL, |
||
| uint8_t * | networkKey = NULL, |
||
| bool | useCounter = true, |
||
| bool | sleepy = true |
||
| ) |
Initalizes communication basic data and starts node registration.
| comm | Physical layer to be used on this node network |
| gateway | Gateway address |
| networkKey | Network key to protect shared key agreement |
| useCounter | Indicates if a counter has to be added to every message data to check message sequence. true by default |
| sleepy | Indicates if this node changes to low energy mode (sleep mode) after sending a data message. true by default |
This condition is signalled to Gateway during registration so that downlink messages are managed diferently. On non sleepy nodes a downlink data message can be sent on any moment as node will be always awake. But for nodes that sleep, normally those that are powered with batteries, downlink message will be queued on gateway and sent just after an uplink data message from node has been sent
Definition at line 510 of file EnigmaIOTNode.cpp.
|
protected |
Check that a given CRC matches to calulated value from a buffer.
| buf | Pointer to the buffer that contains the stream to calculate CRC |
| count | Buffer length in number of bytes |
| crc | Received CRC to check against calculation |
true if CRC check was successful. false otherwise Definition at line 958 of file EnigmaIOTNode.cpp.
|
protected |
Checks reset button status during startup.
Definition at line 488 of file EnigmaIOTNode.cpp.
|
protected |
Clears configuration stored in flash to recover factory state.
Definition at line 309 of file EnigmaIOTNode.cpp.
|
protected |
Clears configuration stored in RTC memory to recover factory state.
Definition at line 1740 of file EnigmaIOTNode.cpp.
|
protected |
Build a ClientHello messange and send it to gateway.
true if ClientHello message was successfully sent. false otherwise Definition at line 968 of file EnigmaIOTNode.cpp.
| int64_t EnigmaIOTNodeClass::clock | ( | ) |
Gets current clock counter. millis() + offset.
int64_t format Definition at line 1172 of file EnigmaIOTNode.cpp.
|
protected |
Build a ClockRequest messange and send it to gateway.
true if ClockRequest message was successfully sent. false otherwise Definition at line 1057 of file EnigmaIOTNode.cpp.
|
protected |
Starts configuration AP and web server and gets settings from it.
| data | Pointer to configuration data to be stored on RTC memory to keep status along sleep cycles |
true if data was been correctly configured. false otherwise Definition at line 321 of file EnigmaIOTNode.cpp.
|
protected |
Builds, encrypts and sends a Data message.
| data | Buffer to store payload to be sent |
| len | Length of payload data |
| controlMessage | Signals if this message is an EnigmaIoT control message that should not be passed to higher layers |
| payloadEncoding | Identifies data encoding of payload. It can be RAW, CAYENNELPP, MSGPACK |
true if message could be correcly sent Definition at line 1361 of file EnigmaIOTNode.cpp.
|
inline |
Controls clock synchronization function.
| clockSync | If true clock will be synchronized with gateway |
Definition at line 511 of file EnigmaIOTNode.h.
| int8_t EnigmaIOTNodeClass::getRSSI | ( | ) |
Gets latest RSSI measurement. It is updated during start up or in case of transmission errors.
Definition at line 63 of file EnigmaIOTNode.cpp.
| uint32_t EnigmaIOTNodeClass::getSleepTime | ( | ) |
Returns sleep period in seconds.
Definition at line 55 of file EnigmaIOTNode.cpp.
|
protected |
Functrion to debug send status.
| mac_addr | Address of message sender |
| status | Result status code |
Definition at line 2214 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::handle | ( | ) |
This method should be called periodically for instance inside loop() function. It is used for internal node maintenance tasks.
digitalRead (led) &&
Definition at line 801 of file EnigmaIOTNode.cpp.
| bool EnigmaIOTNodeClass::hasClockSync | ( | ) |
Checks if internal clock is synchronized to gateway.
Definition at line 1189 of file EnigmaIOTNode.cpp.
|
inline |
Checks if node is registered.
Definition at line 686 of file EnigmaIOTNode.h.
|
protected |
Loads configuration from flash memory.
true if data was read successfuly. false otherwise Definition at line 159 of file EnigmaIOTNode.cpp.
|
protected |
Loads configuration from RTC data. Uses a CRC to check data integrity.
true if data is valid. false otherwise Definition at line 113 of file EnigmaIOTNode.cpp.
|
protected |
Process every received message.
It starts clasiffying message usint the first byte. After that it passes it to the corresponding method for decoding
| mac | Address of message sender |
| buf | Buffer that stores message bytes |
| count | Length of message in number of bytes |
Definition at line 2090 of file EnigmaIOTNode.cpp.
|
inline |
Defines a function callback that will be called everytime node is registered on gateway.
Use example:
| handler | Pointer to the function |
Definition at line 598 of file EnigmaIOTNode.h.
|
inline |
Defines a function callback that will be called on every downlink data message that is received from gateway.
Use example:
| handler | Pointer to the function |
Definition at line 571 of file EnigmaIOTNode.h.
|
inline |
Defines a function callback that will be called everytime node is disconnected from gateway.
Deregistration is always started by gateway due syntax or encryption error or in case of key validity is over.
Use example:
| handler | Pointer to the function |
Definition at line 627 of file EnigmaIOTNode.h.
|
inline |
Register callback to be called on wifi manager exit.
| handle | Callback function pointer |
Definition at line 635 of file EnigmaIOTNode.h.
|
inline |
Register callback to be called on wifi manager start.
| handle | Callback function pointer |
Definition at line 643 of file EnigmaIOTNode.h.
|
protected |
Gets a buffer containing a ClockResponse message and process it. It uses that message to calculate clock difference against gateway and synchronize to it.
| mac | Address where this message was received from |
| buf | Pointer to the buffer that contains the message |
| count | Message length in number of bytes of ClockResponse message |
true if message could be correcly processed Definition at line 1109 of file EnigmaIOTNode.cpp.
|
protected |
Processes a control command. Does not propagate to user code.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1987 of file EnigmaIOTNode.cpp.
|
protected |
Processes downstream data from gateway.
| mac | Gateway address |
| buf | Buffer to store received payload |
| count | Length of payload data |
| control | Idicates if downstream message is user or control data. If true it is a control message |
true if message could be correcly decoded Definition at line 2018 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to get Node name and address.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1495 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to measure RSSI.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1704 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request of sleep time configuration.
| mac | Gateway address |
| buf | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1472 of file EnigmaIOTNode.cpp.
|
protected |
Gets a buffer containing an InvalidateKey message and process it. This trigger a new key agreement to start.
| mac | Address where this message was received from |
| buf | Pointer to the buffer that contains the message |
| count | Message length in number of bytes of InvalidateKey message |
Definition at line 2074 of file EnigmaIOTNode.cpp.
|
protected |
Processes a single OTA update command or data.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1817 of file EnigmaIOTNode.cpp.
|
protected |
Gets a buffer containing a ServerHello message and process it. It uses that message to calculate a shared key using Diffie Hellman algorithm.
| mac | Address where this message was received from |
| buf | Pointer to the buffer that contains the message |
| count | Message length in number of bytes of ServerHello message |
true if message could be correcly processed Definition at line 1196 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to start indicate to identify a node visually.
| mac | Gateway address |
| buf | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1691 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to set Node name.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1577 of file EnigmaIOTNode.cpp.
|
protected |
Processes a response to set Node name.
| mac | Gateway address |
| data | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1529 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to reset node configuration.
| mac | Gateway address |
| buf | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1711 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request to set new sleep time configuration.
| mac | Gateway address |
| buf | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1754 of file EnigmaIOTNode.cpp.
|
protected |
Processes a request firmware version.
| mac | Gateway address |
| buf | Buffer to store received message |
| len | Length of payload data |
true if message could be correcly decoded and processed Definition at line 1799 of file EnigmaIOTNode.cpp.
|
protected |
Sends RSSI value and channel to Gateway.
Definition at line 780 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::resetConfig | ( | ) |
Deletes configuration file stored on SPIFFS. It makes neccessary to configure it again using WiFi Portal.
Definition at line 45 of file EnigmaIOTNode.cpp.
|
protected |
Sets connection as unregistered to force a resyncrhonisation after boot.
| reboot | True if a reboot should be triggered after unregistration |
Definition at line 1976 of file EnigmaIOTNode.cpp.
|
staticprotected |
Function that will be called anytime this node receives a message.
| mac_addr | Address of message sender |
| data | Buffer that stores message bytes |
| len | Length of message in number of bytes |
Definition at line 950 of file EnigmaIOTNode.cpp.
|
protected |
Saves configuration to flash memory.
| fsOpen | True if FileSystem has is managed in outter code |
true if data could be written successfuly. false otherwise Definition at line 233 of file EnigmaIOTNode.cpp.
|
protected |
Save configuration to RTC to store current status and recover it after deep sleep.
true if result is successful. false otherwise Definition at line 286 of file EnigmaIOTNode.cpp.
|
protected |
Starts searching for a gateway that it using configured Network Name as WiFi AP. Stores this info for subsequent use.
| data | Node context structure |
| shouldStoreData | True if this method should save context in flash |
true if gateway could be found. false otherwise Definition at line 664 of file EnigmaIOTNode.cpp.
|
protected |
Initiades data transmission distinguissing if it is payload or control data.
| data | Buffer to store payload to be sent |
| len | Length of payload data |
| controlMessage | Signals if this message is an EnigmaIoT control message that should not be passed to higher layers |
| encrypt | true if data should be encrypted. Default is true |
| payloadEncoding | Identifies data encoding of payload. It can be RAW, CAYENNELPP, MSGPACK |
true if message could be correcly sent Definition at line 1260 of file EnigmaIOTNode.cpp.
|
inline |
Starts a data message transmission.
| data | Payload buffer |
| len | Payload length |
| payloadEncoding | Identifies data encoding of payload. It can be RAW, CAYENNELPP, MSGPACK |
Definition at line 534 of file EnigmaIOTNode.h.
|
protected |
Informs Gateway about custom node name.
| name | Custom node name |
Definition at line 1614 of file EnigmaIOTNode.cpp.
|
inline |
Starts a data message transmission.
| data | Payload buffer |
| len | Payload length |
| payloadEncoding | Identifies data encoding of payload. It can be RAW, CAYENNELPP, MSGPACK |
Definition at line 544 of file EnigmaIOTNode.h.
| void EnigmaIOTNodeClass::setLed | ( | uint8_t | led, |
| time_t | onTime = FLASH_LED_TIME |
||
| ) |
Sets a LED to be flashed every time a message is transmitted.
| led | LED I/O pin |
| onTime | Flash duration. 100ms by default. |
Definition at line 67 of file EnigmaIOTNode.cpp.
| bool EnigmaIOTNodeClass::setNodeAddress | ( | uint8_t | address[ENIGMAIOT_ADDR_LEN] | ) |
Set node address to be used in EnigmaIOT communication.
| address | Node address |
true if addres was set correctly Definition at line 741 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::setResetPin | ( | int | pin | ) |
Sets a pin to be used to reset configuration it it is connected to ground during startup.
| pin | Reset pin |
Definition at line 72 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::setSleepTime | ( | uint32_t | sleepTime | ) |
Allows to configure a new sleep time period from user code.
| sleepTime | Time in seconds. Final period is not espected to be exact. Its value depends on communication process |
Definition at line 746 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::sleep | ( | ) |
Requests transition to sleep mode (low energy state)
Sleep can be requested in any moment and will be triggered inmediatelly except if node is doing registration or is waiting for downlink
Definition at line 1287 of file EnigmaIOTNode.cpp.
|
protected |
Starts node identification by flashing led.
| period | Flash led period in ms |
Definition at line 477 of file EnigmaIOTNode.cpp.
| void EnigmaIOTNodeClass::stop | ( | ) |
Stops EnigmaIoT protocol.
Definition at line 736 of file EnigmaIOTNode.cpp.
|
protected |
Stops node identification.
Definition at line 483 of file EnigmaIOTNode.cpp.
|
staticprotected |
Function that will be called anytime this node sends a message to indicate status result of sending process.
| mac_addr | Address of message destination |
| status | Result of sending process |
Definition at line 954 of file EnigmaIOTNode.cpp.
|
protected |
Builds and sends a Data message without encryption. Not recommended, use it only if you absolutely need more performance.
| data | Buffer to store payload to be sent |
| len | Length of payload data |
| controlMessage | Signals if this message is an EnigmaIoT control message that should not be passed to higher layers |
true if message could be correcly sent Definition at line 1297 of file EnigmaIOTNode.cpp.
| time_t EnigmaIOTNodeClass::unixtime | ( | ) |
Gets current time in seconds from 1970, if time is synchronized.
time_t format Definition at line 1181 of file EnigmaIOTNode.cpp.
|
protected |
If true clock is synchronized with Gateway.
Definition at line 142 of file EnigmaIOTNode.h.
|
protected |
Comms abstraction layer.
Definition at line 122 of file EnigmaIOTNode.h.
|
protected |
This flag disables asy configuration save after triggering a factory reset.
Definition at line 147 of file EnigmaIOTNode.h.
|
protected |
Message encryption enabled. Stored for use in case of message retransmission is needed.
Definition at line 134 of file EnigmaIOTNode.h.
|
protected |
Encoding of the message pending to be sent.
Definition at line 133 of file EnigmaIOTNode.h.
|
protected |
True in case of message retransmission is needed.
Definition at line 132 of file EnigmaIOTNode.h.
|
protected |
Buffer where sent message is stored in case of retransmission is needed.
Definition at line 130 of file EnigmaIOTNode.h.
|
protected |
Message length stored for use in case of message retransmission is needed.
Definition at line 131 of file EnigmaIOTNode.h.
|
protected |
If true Tx LED will be flashed.
Definition at line 119 of file EnigmaIOTNode.h.
|
protected |
Avoids start a new gateway scan if it already started.
Definition at line 144 of file EnigmaIOTNode.h.
|
protected |
Time when identification started flashing. Used to control identification timeout.
Definition at line 140 of file EnigmaIOTNode.h.
|
protected |
True if node has its led flashing to be identified.
Definition at line 139 of file EnigmaIOTNode.h.
|
protected |
Last key invalidation reason.
Definition at line 135 of file EnigmaIOTNode.h.
|
protected |
Time when last OTA update message has received. This is used to control timeout.
Definition at line 138 of file EnigmaIOTNode.h.
|
protected |
IO Pin that corresponds to Tx LED. Default value disables LED. It is initialized with setLed method.
Definition at line 120 of file EnigmaIOTNode.h.
|
protected |
Time that LED is On during flash. Initalized on setLed
Definition at line 121 of file EnigmaIOTNode.h.
|
protected |
Node abstraction to store context.
Definition at line 118 of file EnigmaIOTNode.h.
|
protected |
Callback that will be called anytime a new node is registered.
Definition at line 124 of file EnigmaIOTNode.h.
|
protected |
Callback that will be called on every message reception.
Definition at line 123 of file EnigmaIOTNode.h.
|
protected |
Callback that will be called anytime a node is disconnected.
Definition at line 125 of file EnigmaIOTNode.h.
|
protected |
Function called when configuration portal exits.
Definition at line 150 of file EnigmaIOTNode.h.
|
protected |
Function called when configuration portal is started.
Definition at line 151 of file EnigmaIOTNode.h.
|
protected |
True if OTA update has failed. This normally produces a restart.
Definition at line 137 of file EnigmaIOTNode.h.
|
protected |
True if OTA update has started.
Definition at line 136 of file EnigmaIOTNode.h.
|
protected |
Flag to control RSSI reporting.
Definition at line 146 of file EnigmaIOTNode.h.
|
protected |
Flag to control updating gateway address, RSSI and channel.
Definition at line 145 of file EnigmaIOTNode.h.
|
protected |
Pin used to reset configuration if it is connected to ground during startup.
Definition at line 148 of file EnigmaIOTNode.h.
|
protected |
Context data to be stored on persistent storage.
Definition at line 127 of file EnigmaIOTNode.h.
|
protected |
Triggers a restart if true.
Definition at line 143 of file EnigmaIOTNode.h.
|
protected |
true means that this node will sleep as soon a message is sent and downlink wait time has passed
Definition at line 128 of file EnigmaIOTNode.h.
|
protected |
Time in microseconds that this node will be slept between measurements.
Definition at line 129 of file EnigmaIOTNode.h.
|
protected |
Clock synchronization period.
Definition at line 141 of file EnigmaIOTNode.h.
|
protected |
true means that data message counter will be used to mark message order
Definition at line 126 of file EnigmaIOTNode.h.
|
protected |
Wifi configuration portal.
Definition at line 149 of file EnigmaIOTNode.h.
1.8.18