TinyMaterialDesign
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
WifiControl Class Referenceabstract

The WiFi of a device as WifiLoginPage uses it: scan, connect and the stored credentials. All calls must return quickly - the scan and the connection run in the background and are polled. More...

#include <WifiControl.h>

Inheritance diagram for WifiControl:
Inheritance graph
[legend]

Public Types

enum class  State { kDisconnected , kConnecting , kConnected , kFailed }
 

Public Member Functions

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.
 

Detailed Description

The WiFi of a device as WifiLoginPage uses it: scan, connect and the stored credentials. All calls must return quickly - the scan and the connection run in the background and are polled.

Implementations: Esp32Wifi (TinyMaterialDesign/Wifi/WifiEsp32.h, not included by TinyMaterialDesign.h) and SimulatedWifi (desktop, tests); for another board derive from this class.

Member Enumeration Documentation

◆ State

enum class State
strong
Enumerator
kDisconnected 
kConnecting 
kConnected 
kFailed 

Constructor & Destructor Documentation

◆ ~WifiControl()

virtual ~WifiControl ( )
virtualdefault

Member Function Documentation

◆ connect()

virtual void connect ( const char *  ssid,
const char *  password 
)
pure virtual

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

Implemented in Esp32Wifi, and SimulatedWifi.

◆ disconnect()

virtual void disconnect ( )
pure virtual

Implemented in SimulatedWifi, and Esp32Wifi.

◆ forget()

virtual void forget ( )
inlinevirtual

Removes the stored credentials.

Reimplemented in SimulatedWifi, and Esp32Wifi.

◆ hasCredentials()

virtual bool hasCredentials ( )
pure virtual

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

Implemented in SimulatedWifi, and Esp32Wifi.

◆ ip()

virtual std::string ip ( )
inlinevirtual

The IP address while connected.

Reimplemented in SimulatedWifi, and Esp32Wifi.

◆ scanDone()

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

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

Implemented in SimulatedWifi, and Esp32Wifi.

◆ ssid()

virtual std::string ssid ( )
pure virtual

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

Implemented in SimulatedWifi, and Esp32Wifi.

◆ startScan()

virtual bool startScan ( )
pure virtual

Starts a scan in the background.

Implemented in SimulatedWifi, and Esp32Wifi.

◆ state()

virtual State state ( )
pure virtual

Implemented in SimulatedWifi, and Esp32Wifi.


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