JBImprov
Improv Wi-Fi provisioning over serial and Bluetooth LE
Loading...
Searching...
No Matches
JBImprovWiFi Class Referenceabstract

Wi-Fi operations needed by JBImprov. More...

#include <JBImprovWiFi.h>

Inheritance diagram for JBImprovWiFi:
JBImprovDefaultWiFi

Public Types

enum class  ConnectStatus : uint8_t { Connecting , Connected , Failed }
 Result of connectStatus(). More...

Public Member Functions

virtual void begin ()
 Called from JBImprov::begin().
virtual bool isConnected ()=0
 true when connected to a network and an IP address is assigned.
virtual bool connect (const char *ssid, const char *password, const char *hostname)=0
 Start connecting to a network. Must return without waiting.
virtual ConnectStatus connectStatus ()=0
 Progress of the attempt started by connect().
virtual void cancelConnect ()
 Called when JBImprov gives up on an attempt (timeout or failure).
virtual bool localIP (char *buffer, size_t size)=0
 Write the local IPv4 address as text.
virtual bool startScan ()=0
 Start an asynchronous scan.
virtual int scanStatus ()=0
 Scan progress: the number of networks found when done, or JBIMPROV_SCAN_RUNNING / JBIMPROV_SCAN_FAILED.
virtual bool scanResult (int index, JBImprovNetwork &network)=0
 Get network index (0 based) of the last scan.
virtual void scanDelete ()
 Free the scan results.
virtual bool setHostname (const char *hostname)
 Use a new hostname. It may take effect on the next connection.
virtual bool defaultHostname (char *buffer, size_t size)
 Write the hostname to use when none is set.
virtual const char * hardware ()
 Hardware chip or variant for device info, e.g. "ESP32-S3".
virtual const char * osName ()
 Name of the OS or framework for device info, or nullptr to leave it out.
virtual const char * osVersion ()
 Version of the OS or framework for device info, or nullptr to leave it out.

Detailed Description

Wi-Fi operations needed by JBImprov.

All methods are called from JBImprov::loop() and must not block for long.

Member Enumeration Documentation

◆ ConnectStatus

enum class JBImprovWiFi::ConnectStatus : uint8_t
strong

Result of connectStatus().

Enumerator
Connecting 

Still trying.

Connected 

Connected and has an IP address.

Failed 

Gave up, e.g. wrong password. A timeout is handled by JBImprov.

Member Function Documentation

◆ begin()

virtual void JBImprovWiFi::begin ( )
inlinevirtual

Called from JBImprov::begin().

Reimplemented in JBImprovDefaultWiFi.

◆ cancelConnect()

virtual void JBImprovWiFi::cancelConnect ( )
inlinevirtual

Called when JBImprov gives up on an attempt (timeout or failure).

Reimplemented in JBImprovDefaultWiFi.

◆ connect()

virtual bool JBImprovWiFi::connect ( const char * ssid,
const char * password,
const char * hostname )
pure virtual

Start connecting to a network. Must return without waiting.

Parameters
ssidNetwork name.
passwordEmpty string for an open network.
hostnameHostname to use, may be empty.
Returns
false if the attempt couldn't be started.

Implemented in JBImprovDefaultWiFi.

◆ connectStatus()

virtual ConnectStatus JBImprovWiFi::connectStatus ( )
pure virtual

Progress of the attempt started by connect().

Implemented in JBImprovDefaultWiFi.

◆ defaultHostname()

virtual bool JBImprovWiFi::defaultHostname ( char * buffer,
size_t size )
inlinevirtual

Write the hostname to use when none is set.

Returns
false if there is none.

Reimplemented in JBImprovDefaultWiFi.

◆ hardware()

virtual const char * JBImprovWiFi::hardware ( )
inlinevirtual

Hardware chip or variant for device info, e.g. "ESP32-S3".

Reimplemented in JBImprovDefaultWiFi.

◆ isConnected()

virtual bool JBImprovWiFi::isConnected ( )
pure virtual

true when connected to a network and an IP address is assigned.

Implemented in JBImprovDefaultWiFi.

◆ localIP()

virtual bool JBImprovWiFi::localIP ( char * buffer,
size_t size )
pure virtual

Write the local IPv4 address as text.

Returns
false if there is none.

Implemented in JBImprovDefaultWiFi.

◆ osName()

virtual const char * JBImprovWiFi::osName ( )
inlinevirtual

Name of the OS or framework for device info, or nullptr to leave it out.

Reimplemented in JBImprovDefaultWiFi.

◆ osVersion()

virtual const char * JBImprovWiFi::osVersion ( )
inlinevirtual

Version of the OS or framework for device info, or nullptr to leave it out.

Reimplemented in JBImprovDefaultWiFi.

◆ scanDelete()

virtual void JBImprovWiFi::scanDelete ( )
inlinevirtual

Free the scan results.

Reimplemented in JBImprovDefaultWiFi.

◆ scanResult()

virtual bool JBImprovWiFi::scanResult ( int index,
JBImprovNetwork & network )
pure virtual

Get network index (0 based) of the last scan.

Returns
false if out of range.

Implemented in JBImprovDefaultWiFi.

◆ scanStatus()

virtual int JBImprovWiFi::scanStatus ( )
pure virtual

Scan progress: the number of networks found when done, or JBIMPROV_SCAN_RUNNING / JBIMPROV_SCAN_FAILED.

Implemented in JBImprovDefaultWiFi.

◆ setHostname()

virtual bool JBImprovWiFi::setHostname ( const char * hostname)
inlinevirtual

Use a new hostname. It may take effect on the next connection.

Returns
false if the hostname isn't accepted (e.g. too long).

Reimplemented in JBImprovDefaultWiFi.

◆ startScan()

virtual bool JBImprovWiFi::startScan ( )
pure virtual

Start an asynchronous scan.

Returns
false if it couldn't be started.

Implemented in JBImprovDefaultWiFi.


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