ESPNow as Arduino Stream. When use_send_ack is true we prevent any buffer overflows by blocking writes until the previous packet has been confirmed. When no acknowledgments are used, you might need to throttle the send speed to prevent any buffer overflow on the receiver side.
More...
#include <ESPNowStream.h>
|
| bool | addBroadcastPeer () |
| |
|
bool | addPeer (const char *address) |
| | Adds a peer to which we can send info or from which we can receive info.
|
| |
|
bool | addPeer (esp_now_peer_info_t &peer) |
| | Adds a peer to which we can send info or from which we can receive info.
|
| |
|
template<size_t size> |
| bool | addPeers (const char *(&array)[size]) |
| | Adds an array of.
|
| |
| int | available () override |
| |
| int | availableForWrite () override |
| |
| bool | begin () |
| | Initialization of ESPNow.
|
| |
|
bool | begin (ESPNowStreamConfig cfg) |
| | Initialization of ESPNow incl WIFI.
|
| |
|
ESPNowStreamConfig | defaultConfig () |
| |
| void | end () |
| | DeInitialization.
|
| |
| virtual void | flush () override |
| |
|
BufferRTOS< uint8_t > & | getBuffer () |
| | provides access to the receive buffer
|
| |
|
float | getBufferPercent () |
| | provides how much the receive buffer is filled (in percent)
|
| |
|
uint32_t | getLastIoSuccessTime () const |
| | time when we were able to send or receive the last packet successfully
|
| |
|
const char * | macAddress () |
| | Returns the mac address of the current ESP32.
|
| |
|
| operator bool () |
| |
| size_t | readBytes (uint8_t *data, size_t len) override |
| | Reeds the data from the peers.
|
| |
| void | setReceiveCallback (esp_now_recv_cb_t cb) |
| |
|
void | setSendCallback (esp_now_send_cb_t cb) |
| | Defines an alternative send callback.
|
| |
|
void | setWriteBufferSize (int size) |
| |
|
size_t | write (const char *peer, const uint8_t *data, size_t len) |
| | Writes the data - sends it to all the indicated peer mac address string.
|
| |
| size_t | write (const uint8_t *data, size_t len) override |
| | Writes the data - sends it to all registered peers.
|
| |
|
size_t | write (const uint8_t *peer, const uint8_t *data, size_t len) |
| | Writes the data - sends it to all the peers.
|
| |
| virtual size_t | write (uint8_t ch) override |
| |
|
|
wifi_interface_t | getInterface () |
| |
|
bool | handleQueueError (esp_err_t rc, int &retry_count) |
| | Handles errors when queuing packets.
|
| |
|
bool | handleTransmissionResult (int &retry_count) |
| | Handles the result of packet transmission (after queuing)
|
| |
|
bool | isEncrypted () |
| |
|
const char * | mac2str (const uint8_t *array) |
| |
|
void | refillReadBuffer () |
| |
|
void | resetAvailableToWrite () |
| |
|
bool | sendPacket (const uint8_t *data, size_t len, int &retry_count, const uint8_t *destination=nullptr) |
| | Sends a single packet with retry logic.
|
| |
|
bool | setup () |
| | Initialization.
|
| |
|
void | setupReceiveBuffer () |
| |
|
void | setupSemaphore () |
| |
|
bool | str2mac (const char *mac, uint8_t *values) |
| |
|
|
static int | bufferAvailableForWrite () |
| |
|
static void | default_recv_cb (const esp_now_recv_info *info, const uint8_t *data, int data_len) |
| |
|
static void | default_send_cb (const wifi_tx_info_t *tx_info, esp_now_send_status_t status) |
| |
|
|
int | _timeout = 10 |
| |
|
volatile size_t | available_to_write = 0 |
| |
|
BufferRTOS< uint8_t > | buffer {0} |
| |
|
ESPNowStreamConfig | cfg |
| |
|
bool | has_peers = false |
| |
|
bool | is_broadcast = false |
| |
|
bool | is_init = false |
| |
|
uint32_t | last_io_success_time = 0 |
| |
|
volatile bool | last_send_success = true |
| |
|
bool | read_ready = false |
| |
|
esp_now_recv_cb_t | receive = default_recv_cb |
| |
|
esp_now_send_cb_t | send = default_send_cb |
| |
|
RingBuffer< uint8_t > | tmp_in {0} |
| |
|
RingBuffer< uint8_t > | tmp_out {0} |
| |
|
int | write_buffer_size = MAX_SINGLE_CHARS |
| |
|
SemaphoreHandle_t | xSemaphore = nullptr |
| |
ESPNow as Arduino Stream. When use_send_ack is true we prevent any buffer overflows by blocking writes until the previous packet has been confirmed. When no acknowledgments are used, you might need to throttle the send speed to prevent any buffer overflow on the receiver side.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ addBroadcastPeer()
| bool addBroadcastPeer |
( |
| ) |
|
|
inline |
Adds the broadcast peer (FF:FF:FF:FF:FF:FF) to send to all devices in range. Note: Broadcast does not support acknowledgments
◆ available()
◆ availableForWrite()
| int availableForWrite |
( |
| ) |
|
|
inlineoverridevirtual |
◆ begin()
Initialization of ESPNow.
Reimplemented from BaseStream.
◆ end()
◆ flush()
|
|
inlineoverridevirtualinherited |
◆ readBytes()
| size_t readBytes |
( |
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
Reeds the data from the peers.
Implements BaseStream.
◆ setReceiveCallback()
| void setReceiveCallback |
( |
esp_now_recv_cb_t |
cb | ) |
|
|
inline |
Defines the Receive Callback - Deactivates the readBytes and available() methods!
◆ write() [1/2]
| size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
Writes the data - sends it to all registered peers.
Implements BaseStream.
◆ write() [2/2]
| virtual size_t write |
( |
uint8_t |
ch | ) |
|
|
inlineoverridevirtualinherited |
The documentation for this class was generated from the following file: