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

Keeps the name and password of one WiFi network in flash. More...

#include <CredentialStore.h>

Public Member Functions

bool load ()
 Reads the flash. Returns true if a network is saved.
bool valid () const
 True if a network is saved (after load() or save()).
bool save (const char *ssid, const char *password)
 Saves the network; an empty or null password means an open network. False if the flash could not be written.
bool forget ()
 Removes the saved network. False if the flash could not be written.
const char * ssid () const
 Name of the saved network.
const char * password () const
 Password of the saved network, nullptr if it is an open network.

Detailed Description

Keeps the name and password of one WiFi network in flash.

Uses the EEPROM emulation that both the ESP32 and the Raspberry Pi Pico cores provide, so no filesystem partition is needed. The data is marked, so flash that was never written by this class reads as "nothing saved".

Definition at line 14 of file CredentialStore.h.

Member Function Documentation

◆ forget()

bool twd::CredentialStore::forget ( )
inline

Removes the saved network. False if the flash could not be written.

Definition at line 36 of file CredentialStore.h.

◆ load()

bool twd::CredentialStore::load ( )
inline

Reads the flash. Returns true if a network is saved.

Definition at line 17 of file CredentialStore.h.

◆ password()

const char * twd::CredentialStore::password ( ) const
inline

Password of the saved network, nullptr if it is an open network.

Definition at line 45 of file CredentialStore.h.

◆ save()

bool twd::CredentialStore::save ( const char * ssid,
const char * password )
inline

Saves the network; an empty or null password means an open network. False if the flash could not be written.

Definition at line 27 of file CredentialStore.h.

◆ ssid()

const char * twd::CredentialStore::ssid ( ) const
inline

Name of the saved network.

Definition at line 42 of file CredentialStore.h.

◆ valid()

bool twd::CredentialStore::valid ( ) const
inline

True if a network is saved (after load() or save()).

Definition at line 24 of file CredentialStore.h.


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