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

WiFi without hardware, for the desktop and tests: a fixed list of networks; connecting succeeds after connectMs if the network is open or the password is password ("demo"). More...

#include <WifiControl.h>

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

Public Member Functions

 SimulatedWifi ()
 
void setConnected (const char *ssid)
 Starts connected (with stored credentials).
 
bool startScan () override
 Starts a scan in the background.
 
bool scanDone (std::vector< WifiNetwork > &out) override
 
void connect (const char *ssid, const char *pw) 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

std::vector< WifiNetwork > networks
 
std::string password = "demo"
 The password that works for the secure networks.
 
uint32_t scanMs = 800
 
uint32_t connectMs = 1500
 

Additional Inherited Members

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

Detailed Description

WiFi without hardware, for the desktop and tests: a fixed list of networks; connecting succeeds after connectMs if the network is open or the password is password ("demo").

Constructor & Destructor Documentation

◆ SimulatedWifi()

SimulatedWifi ( )
inline

Member Function Documentation

◆ 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.

◆ setConnected()

void setConnected ( const char *  ssid)
inline

Starts connected (with stored credentials).

◆ 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

◆ connectMs

uint32_t connectMs = 1500

◆ networks

std::vector<WifiNetwork> networks

◆ password

std::string password = "demo"

The password that works for the secure networks.

◆ scanMs

uint32_t scanMs = 800

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