|
SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
|
ESP-NOW adapter for ESP platform. More...
#include <espnow_adapter.hpp>


Classes | |
| struct | EventFD |
| Wrapper of event file descriptor. More... | |
| struct | RawSocket |
| Wrapper of raw socket. More... | |
Public Member Functions | |
| Adapter () | |
| Constructs a new ESP-NOW adapter. More... | |
| ~Adapter () | |
| Destroys the adapter. More... | |
| void | setRecvCb (AdapterRecvCb cb) noexcept |
| Sets receive callback. More... | |
| AdapterRecvCb | getRecvCb () const noexcept |
| Gets receive callback. More... | |
| void | setSendCb (AdapterSendCb cb) noexcept |
| Sets send callback. More... | |
| AdapterSendCb | getSendCb () const noexcept |
| Gets send callback. More... | |
| void | send (const LocalAddrT &dst, const std::string &data) |
| Sends local message. More... | |
| void | addPeer (const LocalAddrT &peer) |
| Adds peer to peer list. More... | |
| void | removePeer (const LocalAddrT &peer) |
| Removes peer from peer list. More... | |
| Adapter (const std::string &ifname) | |
| Constructs a new ESP-NOW adapter. More... | |
| ~Adapter () | |
| Destroys the adapter. More... | |
| void | setRecvCb (AdapterRecvCb cb) noexcept |
| Sets receive callback. More... | |
| AdapterRecvCb | getRecvCb () const noexcept |
| Gets receive callback. More... | |
| void | setSendCb (AdapterSendCb cb) noexcept |
| Sets send callback. More... | |
| AdapterSendCb | getSendCb () const noexcept |
| Gets send callback. More... | |
| void | send (const LocalAddrT &dst, const std::string &data) |
| Sends local message. More... | |
| void | addPeer (const LocalAddrT &peer) |
| Adds peer to peer list. More... | |
| void | removePeer (const LocalAddrT &peer) |
| Removes peer from peer list. More... | |
| void | setRecvCb (AdapterRecvCb cb) noexcept |
| Sets receive callback. More... | |
| AdapterRecvCb | getRecvCb () const noexcept |
| Gets receive callback. More... | |
| void | setSendCb (AdapterSendCb cb) noexcept |
| Sets send callback. More... | |
| AdapterSendCb | getSendCb () const noexcept |
| Gets send callback. More... | |
| virtual void | send (const LocalAddrT &dst, const std::string &data) const |
| Sends local message. More... | |
| void | addPeer (const LocalAddrT &peer) |
| Adds peer to peer list. More... | |
| void | removePeer (const LocalAddrT &peer) |
| Removes peer from peer list. More... | |
Protected Member Functions | |
| void | handlerThread () |
| Function of thread handling incoming packets. More... | |
| void | attachSocketFilter () |
| Attaches BPF filter to the socket. More... | |
| void | processIEEE80211RawPacket (const uint8_t *data, size_t len) |
| Processes incoming raw IEEE 802.11 packet. More... | |
| bool | parseRadiotap (const uint8_t *data, size_t len, IEEE80211::RadiotapParsedFields &rpf) |
| Parses radiotap header of IEEE 802.11 frame. More... | |
| void | processIEEE80211RawAction (const uint8_t *data, size_t len, int rssi) |
| Processes incoming raw IEEE 802.11 action frame. More... | |
| void | processIEEE80211RawAck (const uint8_t *data, size_t len, int rssi) |
| Processes incoming raw IEEE 802.11 acknowledgement. More... | |
Protected Attributes | |
| RawSocket | m_sock |
| Socket. | |
| EventFD | m_eventFd |
| Epoll event file descriptor. | |
| int | m_epollFd |
| Epoll file descriptor. | |
| LocalAddrT | m_localAddr |
| Cached local MAC address. | |
| std::thread | m_thread |
| Handler thread. | |
ESP-NOW adapter for ESP platform.
ESP-NOW adapter for testing.
ESP-NOW adapter for Linux platform.
Low level API for ESP-NOW communication.
Implements IAdapter interface.
Only one ESPNOW instance can use this at a time and there may be only one Adapter instance at a time.
Low level API for ESP-NOW communication.
Implements IAdapter interface.
Definition at line 30 of file espidf/spsp/espnow_adapter.hpp.
| SPSP::LocalLayers::ESPNOW::Adapter::Adapter | ( | ) |
Constructs a new ESP-NOW adapter.
| AdapterError | when any call to underlaying library fails |
| SPSP::LocalLayers::ESPNOW::Adapter::~Adapter | ( | ) |
Destroys the adapter.
| SPSP::LocalLayers::ESPNOW::Adapter::Adapter | ( | const std::string & | ifname | ) |
Constructs a new ESP-NOW adapter.
Starts packet capture on 802.11 interface identified by ifname.
| ifname | Interface name (must be in monitor mode) |
| AdapterError | when any call to underlaying library fails |
| SPSP::LocalLayers::ESPNOW::Adapter::~Adapter | ( | ) |
Destroys the adapter.
|
inlinevirtual |
Adds peer to peer list.
| peer | Peer address |
| AdapterError | when peer can't be added |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 93 of file testing/spsp/espnow_adapter.hpp.
|
virtual |
Adds peer to peer list.
| peer | Peer address |
| AdapterError | when peer can't be added |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
|
inlinevirtual |
Adds peer to peer list.
Doesn't do anything on Linux plaform.
| peer | Peer address |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 131 of file linux/spsp/espnow_adapter.hpp.
|
protected |
Attaches BPF filter to the socket.
| AdapterError | when any call to underlaying library fails |
|
inlinenoexcept |
Gets receive callback.
| cb | Callback |
Definition at line 48 of file testing/spsp/espnow_adapter.hpp.
|
noexcept |
Gets receive callback.
| cb | Callback |
|
inlinenoexcept |
Gets receive callback.
| cb | Callback |
Definition at line 96 of file linux/spsp/espnow_adapter.hpp.
|
inlinenoexcept |
Gets send callback.
| cb | Callback |
Definition at line 68 of file testing/spsp/espnow_adapter.hpp.
|
noexcept |
Gets send callback.
| cb | Callback |
|
inlinenoexcept |
Gets send callback.
| cb | Callback |
Definition at line 110 of file linux/spsp/espnow_adapter.hpp.
|
protected |
Function of thread handling incoming packets.
|
protected |
Parses radiotap header of IEEE 802.11 frame.
| data | Raw data |
| len | Data length |
| rpf | Parsed radiotap fields. Those not present are left unmodified! |
|
protected |
Processes incoming raw IEEE 802.11 acknowledgement.
| data | Raw data |
| len | Data length |
| rssi | Received signal strength indicator (in dBm) |
|
protected |
Processes incoming raw IEEE 802.11 action frame.
| data | Raw data |
| len | Data length |
| rssi | Received signal strength indicator (in dBm) |
|
protected |
Processes incoming raw IEEE 802.11 packet.
| data | Raw data |
| len | Data length |
|
virtual |
Removes peer from peer list.
| peer | Peer address |
| AdapterError | when peer can't be removed |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
|
inlinevirtual |
Removes peer from peer list.
| peer | Peer address |
| AdapterError | when peer can't be removed |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 104 of file testing/spsp/espnow_adapter.hpp.
|
inlinevirtual |
Removes peer from peer list.
Doesn't do anything on Linux plaform.
| peer | Peer address |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 140 of file linux/spsp/espnow_adapter.hpp.
|
virtual |
Sends local message.
| dst | Destination address |
| data | Raw data to be sent |
| AdapterError | when call to send function fails (not when packet undelivered) |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
|
virtual |
Sends local message.
Injects IEEE 802.11 packet onto the packet capture interface.
| dst | Destination address |
| data | Raw data to be sent |
| AdapterError | when call to send function fails (not when packet undelivered) |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
|
inlinevirtual |
Sends local message.
| dst | Destination address |
| data | Raw data to be sent |
| AdapterError | when call to send function fails (not when packet undelivered) |
Definition at line 81 of file testing/spsp/espnow_adapter.hpp.
|
inlinevirtualnoexcept |
Sets receive callback.
Callback should be called in new thread.
| cb | Callback |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 38 of file testing/spsp/espnow_adapter.hpp.
|
virtualnoexcept |
Sets receive callback.
Callback should be called in new thread.
| cb | Callback |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
|
inlinevirtualnoexcept |
Sets receive callback.
Callback should be called in new thread.
| cb | Callback |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 89 of file linux/spsp/espnow_adapter.hpp.
|
inlinevirtualnoexcept |
Sets send callback.
| cb | Callback |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 58 of file testing/spsp/espnow_adapter.hpp.
|
virtualnoexcept |
|
inlinevirtualnoexcept |
Sets send callback.
| cb | Callback |
Implements SPSP::LocalLayers::ESPNOW::IAdapter.
Definition at line 103 of file linux/spsp/espnow_adapter.hpp.
1.8.17