TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
Loading...
Searching...
No Matches
twd::Esp32WifiFrameLink Class Reference

Raw Ethernet access to the WiFi network through the ESP32's station. More...

#include <Esp32WifiFrameLink.h>

Inheritance diagram for twd::Esp32WifiFrameLink:
Collaboration diagram for twd::Esp32WifiFrameLink:

Public Member Functions

bool begin (const char *ssid, const char *password) override
 Start joining the network; returns at once, see connected().
bool connected () override
 True while associated with the access point (the MCU has no IP address).
bool sendFrame (const uint8_t *frame, uint16_t len) override
 Sends a frame to the uplink network; false if it was dropped.
void setFrameReceiver (FrameReceiver *receiver) override
 Frames coming from the uplink network are passed to receiver.
const uint8_t * macAddress () override

Detailed Description

Raw Ethernet access to the WiFi network through the ESP32's station.

Joins the network and then takes over frame reception from the IP stack (esp_wifi_internal_reg_rxcb), so everything the station receives is passed to the FrameReceiver, and sends frames with esp_wifi_internal_tx(). The station's own DHCP client is stopped: the MCU has no IP address, the host behind the bridge uses the station's MAC address and asks the network itself.

Also an Uplink, so the composition can report the association state.

See also
L2Bridge

Definition at line 26 of file Esp32WifiFrameLink.h.

Member Function Documentation

◆ begin()

bool twd::Esp32WifiFrameLink::begin ( const char * ssid,
const char * password )
inlineoverridevirtual

Start joining the network; returns at once, see connected().

Implements twd::Uplink.

Definition at line 28 of file Esp32WifiFrameLink.h.

◆ connected()

bool twd::Esp32WifiFrameLink::connected ( )
inlineoverridevirtual

True while associated with the access point (the MCU has no IP address).

Implements twd::Uplink.

Definition at line 51 of file Esp32WifiFrameLink.h.

◆ macAddress()

const uint8_t * twd::Esp32WifiFrameLink::macAddress ( )
inlineoverridevirtual

The station MAC as the WiFi stack reports it. On chips with their own radio this equals the MAC from the chip's fuses; on the ESP32-P4 the radio sits in a companion chip (ESP-Hosted), whose MAC is the one the access point sees. Starts the WiFi stack on the first call, so it must not be called from a time-critical path before begin(); the result is cached.

Implements twd::FrameLink.

Definition at line 65 of file Esp32WifiFrameLink.h.

◆ sendFrame()

bool twd::Esp32WifiFrameLink::sendFrame ( const uint8_t * frame,
uint16_t len )
inlineoverridevirtual

Sends a frame to the uplink network; false if it was dropped.

Implements twd::FrameLink.

Definition at line 53 of file Esp32WifiFrameLink.h.

◆ setFrameReceiver()

void twd::Esp32WifiFrameLink::setFrameReceiver ( FrameReceiver * receiver)
inlineoverridevirtual

Frames coming from the uplink network are passed to receiver.

Implements twd::FrameLink.

Definition at line 58 of file Esp32WifiFrameLink.h.


The documentation for this class was generated from the following file: