|
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Definition for ESP-NOW hardware abstraction layer. More...
#include <espnow_hal.h>
Public Member Functions | |
| void | begin (uint8_t *gateway, uint8_t channel=0, peerType_t peerType=COMM_NODE) |
| Setup communication environment and establish the connection from node to gateway. More... | |
| void | stop () |
| Terminates communication and closes all connectrions. More... | |
| int32_t | send (uint8_t *da, uint8_t *data, int len) |
| Sends data to the other peer. More... | |
| void | onDataRcvd (comms_hal_rcvd_data dataRcvd) |
| Attach a callback function to be run on every received message. More... | |
| void | onDataSent (comms_hal_sent_data dataRcvd) |
| Attach a callback function to be run after sending a message to receive its status. More... | |
| uint8_t | getAddressLength () |
| Get address length used on ESP-NOW subsystem. More... | |
| size_t | getMaxMessageLength () |
| Get maximum message length on ESP-NOW subsystem. More... | |
Static Public Attributes | |
| static const size_t | COMMS_HAL_MAX_MESSAGE_LENGTH = 250 |
| Maximum message length for ESP-NOW. More... | |
| static const uint8_t | COMMS_HAL_ADDR_LEN = 6 |
| Address length for ESP-NOW. Correspond to mac address. More... | |
Static Public Attributes inherited from Comms_halClass | |
| static const size_t | COMMS_HAL_MAX_MESSAGE_LENGTH = 0 |
| Maximum message length. More... | |
| static const uint8_t | COMMS_HAL_ADDR_LEN = 1 |
| Address length. More... | |
Protected Member Functions | |
| void | initComms (peerType_t peerType) |
| Communication subsistem initialization. More... | |
Static Protected Member Functions | |
| static void ICACHE_FLASH_ATTR | rx_cb (uint8_t *mac_addr, uint8_t *data, uint8_t len) |
| Function that processes incoming messages and passes them to upper layer. More... | |
| static void ICACHE_FLASH_ATTR | tx_cb (uint8_t *mac_addr, uint8_t status) |
| Function that gets sending status. More... | |
Protected Attributes | |
| uint8_t | gateway [COMMS_HAL_ADDR_LEN] |
| Gateway address. More... | |
| uint8_t | channel |
| WiFi channel to be used. More... | |
| comms_hal_rcvd_data | dataRcvd |
| Pointer to a function to be called on every received message. More... | |
| comms_hal_sent_data | sentResult |
| Pointer to a function to be called to notify last sending status. More... | |
Protected Attributes inherited from Comms_halClass | |
| uint8_t | gateway [COMMS_HAL_ADDR_LEN] |
| Gateway address. More... | |
| uint8_t | channel |
| WiFi channel to be used. More... | |
| comms_hal_rcvd_data | dataRcvd = 0 |
| Pointer to a function to be called on every received message. More... | |
| comms_hal_sent_data | sentResult = 0 |
| Pointer to a function to be called to notify last sending status. More... | |
| peerType_t | _ownPeerType |
| Stores peer type, node or gateway. More... | |
Definition for ESP-NOW hardware abstraction layer.
Definition at line 31 of file espnow_hal.h.
|
virtual |
Setup communication environment and establish the connection from node to gateway.
| gateway | Address of gateway. It may be NULL in case this is used in the own gateway |
| channel | Establishes a channel for the communication. Its use depends on actual communications subsystem |
| peerType | Role that peer plays into the system, sensor node or gateway. |
Implements Comms_halClass.
Definition at line 67 of file espnow_hal.cpp.
|
inlinevirtual |
Get address length used on ESP-NOW subsystem.
Implements Comms_halClass.
Definition at line 103 of file espnow_hal.h.
|
inline |
Get maximum message length on ESP-NOW subsystem.
Definition at line 111 of file espnow_hal.h.
|
protectedvirtual |
Communication subsistem initialization.
| peerType | Role that peer plays into the system, sensor node or gateway. |
Implements Comms_halClass.
Definition at line 24 of file espnow_hal.cpp.
|
virtual |
Attach a callback function to be run on every received message.
| dataRcvd | Pointer to the callback function |
Implements Comms_halClass.
Definition at line 122 of file espnow_hal.cpp.
|
virtual |
Attach a callback function to be run after sending a message to receive its status.
| dataRcvd | Pointer to the callback function |
Implements Comms_halClass.
Definition at line 126 of file espnow_hal.cpp.
|
staticprotected |
Function that processes incoming messages and passes them to upper layer.
| mac_addr | Destination address to send the message to |
| data | Data buffer that contain the message to be sent |
| len | Data length in number of bytes |
Definition at line 55 of file espnow_hal.cpp.
|
virtual |
Sends data to the other peer.
| da | Destination address to send the message to |
| data | Data buffer that contain the message to be sent |
| len | Data length in number of bytes |
Implements Comms_halClass.
Definition at line 86 of file espnow_hal.cpp.
|
virtual |
Terminates communication and closes all connectrions.
Implements Comms_halClass.
Definition at line 79 of file espnow_hal.cpp.
|
staticprotected |
Function that gets sending status.
| mac_addr | Destination address to send the message to |
| status | Sending status |
Definition at line 61 of file espnow_hal.cpp.
|
protected |
WiFi channel to be used.
Definition at line 39 of file espnow_hal.h.
|
static |
Address length for ESP-NOW. Correspond to mac address.
Definition at line 34 of file espnow_hal.h.
|
static |
Maximum message length for ESP-NOW.
Definition at line 33 of file espnow_hal.h.
|
protected |
Pointer to a function to be called on every received message.
Definition at line 41 of file espnow_hal.h.
|
protected |
Gateway address.
Definition at line 38 of file espnow_hal.h.
|
protected |
Pointer to a function to be called to notify last sending status.
Definition at line 42 of file espnow_hal.h.
1.8.18