#include <WifiEspNowBroadcast.h>
◆ begin()
| bool WifiEspNowBroadcastClass::begin |
( |
const char * |
ssid, |
|
|
int |
channel = 1, |
|
|
int |
scanFreq = 15000 |
|
) |
| |
Initialize ESP-NOW with pseudo broadcast.
- Parameters
-
| ssid | AP SSID to announce and find peers. |
| channel | AP channel, used if there is no STA connection. |
| scanFreq | how often to scan for peers (milliseconds). |
- Returns
- whether success.
◆ end()
| void WifiEspNowBroadcastClass::end |
( |
| ) |
|
◆ loop()
| void WifiEspNowBroadcastClass::loop |
( |
| ) |
|
Refresh peers if scanning is due.
This should be invoked in Arduino sketch loop() function.
◆ onReceive()
Set receive callback.
- Parameters
-
| cb | the callback. |
| arg | an arbitrary argument passed to the callback. |
- Note
- Only one callback is allowed; this replaces any previous callback.
◆ send()
| bool WifiEspNowBroadcastClass::send |
( |
const uint8_t * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Broadcast a message.
- Parameters
-
| buf | payload. |
| count | payload size, must not exceed WIFIESPNOW_MAXMSGLEN . |
- Returns
- whether success (message queued for transmission).
◆ setKey()
| bool WifiEspNowBroadcastClass::setKey |
( |
const uint8_t |
primary[WIFIESPNOW_KEYLEN], |
|
|
const uint8_t |
peer[WIFIESPNOW_KEYLEN] = nullptr |
|
) |
| |
Set encryption keys.
- Parameters
-
| primary | primary key, also known as KOK or PMK. |
| peer | peer key, also known as LMK; nullptr to disable encryption. The same peer key is applied to every discovered peer. |
- Returns
- whether success.
The documentation for this class was generated from the following files: