|
EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Go to the documentation of this file.
12 #if defined(ARDUINO) && ARDUINO >= 100
19 #include <ESP8266WiFi.h>
56 bool addPeer (
const uint8_t* da);
64 static void ICACHE_FLASH_ATTR
rx_cb (uint8_t* mac_addr, uint8_t*
data, uint8_t len);
71 static void ICACHE_FLASH_ATTR
tx_cb (uint8_t* mac_addr, uint8_t
status);
96 void stop ()
override;
105 int32_t
send (uint8_t* da, uint8_t*
data,
int len)
override;
140 DEBUG_DBG (
"Send esp-now task %s", enable ?
"enabled" :
"disabled");
EnigmaIOTRingBuffer< comms_queue_item_t > out_queue
peerType_t
Peer role on communication.
Library to build a gateway for EnigmaIoT system.
static const size_t COMMS_HAL_MAX_MESSAGE_LENGTH
Maximum message length for ESP-NOW.
bool addPeer(const uint8_t *da)
Adds a peer to esp-now peer list.
Definition for ESP-NOW hardware abstraction layer.
void handle() override
Sends next message in the queue.
void begin(uint8_t *gateway, uint8_t channel=0, peerType_t peerType=COMM_NODE) override
Setup communication environment and establish the connection from node to gateway.
void enableTransmit(bool enable) override
Enables or disables transmission of queued messages. Used to disable communication during wifi scan.
static void ICACHE_FLASH_ATTR tx_cb(uint8_t *mac_addr, uint8_t status)
Function that gets sending status.
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.
comms_queue_item_t * getCommsQueue()
int32_t send(uint8_t *da, uint8_t *data, int len) override
Sends data to the other peer.
static const uint8_t COMMS_QUEUE_SIZE
void initComms(peerType_t peerType) override
Communication subsistem initialization.
void onDataSent(comms_hal_sent_data dataRcvd) override
Attach a callback function to be run after sending a message to receive its status.
void(* comms_hal_rcvd_data)(uint8_t *address, uint8_t *data, uint8_t len)
Espnow_halClass Espnow_hal
Singleton instance of ESP-NOW class.
void onDataRcvd(comms_hal_rcvd_data dataRcvd) override
Attach a callback function to be run on every received message.
comms_hal_rcvd_data dataRcvd
Pointer to a function to be called on every received message.
Espnow_halClass()
Class constructor.
int32_t sendEspNowMessage(comms_queue_item_t *message)
Auxiliary function definition.
uint8_t getAddressLength() override
Get address length used on ESP-NOW subsystem.
static void runHandle(void *param)
Static function that calls handle inside task.
size_t getMaxMessageLength()
Get maximum message length on ESP-NOW subsystem.
Generic communication system abstraction layer.
void(* comms_hal_sent_data)(uint8_t *address, uint8_t status)
void stop() override
Terminates communication and closes all connectrions.
uint8_t gateway[COMMS_HAL_ADDR_LEN]
Gateway address.
uint8_t channel
Comms channel to be used.
Interface for communication subsystem abstraction layer definition.
static const uint8_t COMMS_HAL_ADDR_LEN
Address length for ESP-NOW. Correspond to mac address.