|
ndn-embeds 0.1.0
Lightweight NDN protocol stack for embedded systems
|
NDN Face abstract base class. More...
#include <ndn/face.hpp>
Inheritance diagram for ndn::Face:Public Member Functions | |
| virtual | ~Face ()=default |
| Destructor. | |
| virtual FaceId | id () const =0 |
| Get the Face ID. | |
| virtual size_t | maxPayloadSize () const =0 |
| Get the maximum payload size. | |
| void | setPacketCallback (PacketCallback callback) |
| Set the packet receive callback. | |
Lifecycle management | |
| virtual Error | start ()=0 |
| Start the Face. | |
| virtual void | stop ()=0 |
| Stop the Face. | |
Packet transmission | |
| virtual Error | send (const uint8_t *data, size_t len)=0 |
| Send a packet. | |
| virtual Error | sendTo (FaceId destFace, const uint8_t *data, size_t len)=0 |
| Send a packet to a specific Face. | |
| virtual Error | broadcast (const uint8_t *data, size_t len)=0 |
| Broadcast a packet to all nodes. | |
Protected Member Functions | |
| void | onPacketReceived (FaceId faceId, const uint8_t *data, size_t len) |
| Internal handler for packet reception. | |
Protected Attributes | |
| PacketCallback | packetCallback_ |
| Packet receive callback. | |
NDN Face abstract base class.
A Face abstracts a network interface. Each transport (ESP-NOW, BLE, etc.) inherits from this class.
|
pure virtual |
Broadcast a packet to all nodes.
| data | Packet data to send |
| len | Packet size in bytes |
Implemented in ndn::EspNowFace.
|
pure virtual |
Get the Face ID.
Implemented in ndn::EspNowFace.
Referenced by ndn::Forwarder::addFace().
|
pure virtual |
Get the maximum payload size.
Returns the maximum number of bytes this Face can send at once. ESP-NOW v1: 250 bytes, v2: up to 1470 bytes.
Implemented in ndn::EspNowFace.
|
inlineprotected |
Internal handler for packet reception.
Derived classes call this method when a packet is received.
| faceId | ID of the Face that received the packet |
| data | Received packet data |
| len | Packet size in bytes |
Definition at line 144 of file face.hpp.
References packetCallback_.
|
pure virtual |
Send a packet.
Sends a packet to the default destination.
| data | Packet data to send |
| len | Packet size in bytes |
Implemented in ndn::EspNowFace.
Send a packet to a specific Face.
| destFace | Destination Face ID |
| data | Packet data to send |
| len | Packet size in bytes |
Implemented in ndn::EspNowFace.
|
inline |
Set the packet receive callback.
| callback | Callback function invoked on packet reception |
Definition at line 132 of file face.hpp.
References packetCallback_.
Referenced by ndn::Forwarder::addFace().
|
pure virtual |
Start the Face.
Initializes the transport and begins sending/receiving packets.
Implemented in ndn::EspNowFace.
|
pure virtual |
Stop the Face.
Stops sending/receiving packets and releases resources.
Implemented in ndn::EspNowFace.
|
protected |
Packet receive callback.
Definition at line 150 of file face.hpp.
Referenced by onPacketReceived(), and setPacketCallback().