An Object which enables a single peer-to-peer connection.
More...
#include <espnow.h>
|
static void | OnDataRecv (const uint8_t *mac, const uint8_t *incomingData, int len) |
| Callback function when data is received over ESP-NOW. More...
|
|
static void | OnDataSent (const uint8_t *mac_addr, esp_now_send_status_t status) |
| Callback function when data is sent over ESP-NOW. More...
|
|
|
static uint8_t | dst_address [6] = {0} |
| Destination MAC address for ESP-NOW communication. More...
|
|
static char | received_token [4] = {0} |
| Received token data from ESP-NOW communication. More...
|
|
static uint8_t | received = 0 |
| Flag indicating whether data has been received. More...
|
|
An Object which enables a single peer-to-peer connection.
◆ generate_own_address()
int64_t generate_own_address |
( |
| ) |
|
Generate a unique ID based on the MAC address.
- Returns
- The generated unique ID.
◆ get_dst_address()
uint8_t * get_dst_address |
( |
| ) |
|
Get the destination MAC address.
- Returns
- The destination MAC address as an array of bytes.
◆ get_own_mac_address()
uint uint8_t * get_own_mac_address |
( |
| ) |
|
Get the MAC address of the local device.
- Returns
- The MAC address as an array of bytes.
◆ init()
void init |
( |
uint8_t * |
destination_address | ) |
|
Initialize ESP-NOW communication.
This function initializes ESP-NOW communication and registers callbacks for sending and receiving data.
- Parameters
-
destination_address | The MAC address of the destination device. |
◆ OnDataRecv()
void OnDataRecv |
( |
const uint8_t * |
mac, |
|
|
const uint8_t * |
incomingData, |
|
|
int |
len |
|
) |
| |
|
static |
Callback function when data is received over ESP-NOW.
- Parameters
-
mac | The MAC address of the sender. |
incomingData | The received data. |
len | The length of the received data. |
◆ OnDataSent()
void OnDataSent |
( |
const uint8_t * |
mac_addr, |
|
|
esp_now_send_status_t |
status |
|
) |
| |
|
static |
Callback function when data is sent over ESP-NOW.
- Parameters
-
mac_addr | The MAC address of the recipient. |
status | The send status. |
◆ send_string()
uint8_t send_string |
( |
char * |
send_msg, |
|
|
uint8_t |
num_of_char |
|
) |
| |
Send a string message over ESP-NOW.
- Parameters
-
send_msg | The message to send. |
num_of_char | The number of characters in the message. |
- Returns
- 1 if the message was sent successfully, 0 otherwise.
◆ set_dst_address()
void set_dst_address |
( |
uint8_t * |
destination_address | ) |
|
Set the destination MAC address.
- Parameters
-
destination_address | The new destination MAC address. |
◆ dst_address
uint8_t dst_address = {0} |
|
static |
Destination MAC address for ESP-NOW communication.
◆ peerInfo
esp_now_peer_info_t peerInfo |
◆ received
Flag indicating whether data has been received.
◆ received_token
char received_token = {0} |
|
static |
Received token data from ESP-NOW communication.
The documentation for this class was generated from the following files: