TinyMaterialDesign
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Esp32Wifi Class Reference

WifiControl for the ESP32: asynchronous scan and connection, the credentials are stored in the flash (Preferences, namespace "wifi") when a connection works, and used by begin(). More...

#include <WifiEsp32.h>

Inheritance diagram for Esp32Wifi:
Inheritance graph
[legend]
Collaboration diagram for Esp32Wifi:
Collaboration graph
[legend]

Public Member Functions

void begin ()
 Station mode; connects with the stored credentials (if any).
 
bool startScan () override
 Starts a scan in the background.
 
bool scanDone (std::vector< WifiNetwork > &out) override
 
void connect (const char *ssid, const char *password) override
 Connects in the background; the credentials are stored when it works.
 
void disconnect () override
 
State state () override
 
std::string ssid () override
 The network that is connected or that is being connected to.
 
std::string ip () override
 The IP address while connected.
 
bool hasCredentials () override
 Credentials are stored (they are used at the start).
 
void forget () override
 Removes the stored credentials.
 
- Public Member Functions inherited from WifiControl
virtual ~WifiControl ()=default
 
virtual bool startScan ()=0
 Starts a scan in the background.
 
virtual bool scanDone (std::vector< WifiNetwork > &out)=0
 
virtual void connect (const char *ssid, const char *password)=0
 Connects in the background; the credentials are stored when it works.
 
virtual void disconnect ()=0
 
virtual State state ()=0
 
virtual std::string ssid ()=0
 The network that is connected or that is being connected to.
 
virtual std::string ip ()
 The IP address while connected.
 
virtual bool hasCredentials ()=0
 Credentials are stored (they are used at the start).
 
virtual void forget ()
 Removes the stored credentials.
 

Public Attributes

uint32_t connectTimeoutMs = 20000
 Time after which a connection attempt counts as failed.
 

Additional Inherited Members

- Public Types inherited from WifiControl
enum class  State { kDisconnected , kConnecting , kConnected , kFailed }
 

Detailed Description

WifiControl for the ESP32: asynchronous scan and connection, the credentials are stored in the flash (Preferences, namespace "wifi") when a connection works, and used by begin().

Esp32Wifi wifi; void setup() { wifi.begin(); // connects with the stored credentials loginPage.setWifi(&wifi); }

Member Function Documentation

◆ begin()

void begin ( )
inline

Station mode; connects with the stored credentials (if any).

◆ connect()

void connect ( const char *  ssid,
const char *  password 
)
inlineoverridevirtual

Connects in the background; the credentials are stored when it works.

Implements WifiControl.

◆ disconnect()

void disconnect ( )
inlineoverridevirtual

Implements WifiControl.

◆ forget()

void forget ( )
inlineoverridevirtual

Removes the stored credentials.

Reimplemented from WifiControl.

◆ hasCredentials()

bool hasCredentials ( )
inlineoverridevirtual

Credentials are stored (they are used at the start).

Implements WifiControl.

◆ ip()

std::string ip ( )
inlineoverridevirtual

The IP address while connected.

Reimplemented from WifiControl.

◆ scanDone()

bool scanDone ( std::vector< WifiNetwork > &  out)
inlineoverridevirtual

True when the scan has finished; out then holds the networks (strongest first, each SSID once - see normalizeNetworks()).

Implements WifiControl.

◆ ssid()

std::string ssid ( )
inlineoverridevirtual

The network that is connected or that is being connected to.

Implements WifiControl.

◆ startScan()

bool startScan ( )
inlineoverridevirtual

Starts a scan in the background.

Implements WifiControl.

◆ state()

State state ( )
inlineoverridevirtual

Implements WifiControl.

Member Data Documentation

◆ connectTimeoutMs

uint32_t connectTimeoutMs = 20000

Time after which a connection attempt counts as failed.


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