Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
WiFi Station Interface

Control and monitoring of WiFi station interface. More...

Functions

void StationClass::enable (bool enabled, bool save=false)
 Enable / disable WiFi station. More...
 
bool StationClass::isEnabled ()
 Get WiFi station enable status. More...
 
bool StationClass::config (String ssid, String password, bool autoConnectOnStartup=true, bool save=true)
 Configure WiFi station. More...
 
bool StationClass::connect ()
 Connect WiFi station to network. More...
 
bool StationClass::disconnect ()
 Disconnect WiFi station from network. More...
 
bool StationClass::isConnected ()
 Get WiFi station connectoin status. More...
 
bool StationClass::isConnectionFailed ()
 Get WiFi station connection failure status. More...
 
EStationConnectionStatus StationClass::getConnectionStatus ()
 Get WiFi station connection status. More...
 
const char * StationClass::getConnectionStatusName ()
 Get WiFi station connection status name. More...
 
bool StationClass::isEnabledDHCP ()
 Get WiFi station DHCP enabled status. More...
 
void StationClass::enableDHCP (bool enable)
 Enable or disable WiFi station DHCP. More...
 
void StationClass::setHostname (String hostname)
 Set WiFi station DHCP hostname. More...
 
String StationClass::getHostname ()
 Set WiFi station DHCP hostname. More...
 
IPAddress StationClass::getIP ()
 Get WiFi station IP address. More...
 
String StationClass::getMAC ()
 Get WiFi station MAC address. More...
 
IPAddress StationClass::getNetworkMask ()
 Get WiFi station network mask. More...
 
IPAddress StationClass::getNetworkGateway ()
 Get WiFi station default gateway. More...
 
IPAddress StationClass::getNetworkBroadcast ()
 GetWiFi station broadcast address. More...
 
bool StationClass::setIP (IPAddress address)
 Set WiFi station IP address. More...
 
bool StationClass::setIP (IPAddress address, IPAddress netmask, IPAddress gateway)
 Set WiFi station IP parameters. More...
 
String StationClass::getSSID ()
 Get WiFi station SSID. More...
 
String StationClass::getPassword ()
 Get WiFi station password. More...
 
sint8 StationClass::getRssi ()
 
uint8 StationClass::getChannel ()
 
bool StationClass::startScan (ScanCompletedDelegate scanCompleted)
 Start WiFi station network scan. More...
 
void StationClass::waitConnection (ConnectionDelegate successfulConnected)
 Assign handler for WiFi station connection. More...
 
void StationClass::waitConnection (ConnectionDelegate successfulConnected, int secondsTimeOut, ConnectionDelegate connectionNotEstablished)
 Assign handler for WiFi station connection with timeout. More...
 
void StationClass::smartConfigStart (SmartConfigType sctype, SmartConfigDelegate callback=NULL)
 Start WiFi station smart configuration. More...
 
void StationClass::smartConfigStop ()
 Stop WiFi station smart configuration. More...
 
virtual void StationClass::onSystemReady ()
 Handle system ready events. More...
 
static void StationClass::staticScanCompleted (void *arg, STATUS status)
 
void StationClass::internalCheckConnection ()
 
static void StationClass::staticCheckConnection ()
 
void StationClass::internalSmartConfig (sc_status status, void *pdata)
 
static void StationClass::staticSmartConfigCallback (sc_status status, void *pdata)
 
 BssInfo::BssInfo (bss_info *info)
 
bool BssInfo::isOpen ()
 Get BSS open status. More...
 
const char * BssInfo::getAuthorizationMethodName ()
 Get BSS authorisation method name. More...
 
uint32_t BssInfo::getHashId ()
 Get BSS hash ID. More...
 

Variables

String BssInfo::ssid
 SSID. More...
 
uint8 BssInfo::bssid [6]
 BSS ID. More...
 
AUTH_MODE BssInfo::authorization
 Authorisation mode. More...
 
uint8 BssInfo::channel
 Channel number. More...
 
sint16 BssInfo::rssi
 RSSI level. More...
 
bool BssInfo::hidden
 True if AP is hidden. More...
 

Detailed Description

Control and monitoring of WiFi station interface.

WiFi station class.

Note
The WiFi station interface provides client access to a WiFi network. Control of WiFi connection including WiFi SSID and password and IP address, DHCP, etc.
See also
WiFi Access Point

Function Documentation

bool StationClass::config ( String  ssid,
String  password,
bool  autoConnectOnStartup = true,
bool  save = true 
)

Configure WiFi station.

Parameters
ssidWiFi SSID
passwordWiFi password
autoConnectOnStartupTrue to auto connect. False for manual. (Default: True)
saveTrue to save the SSID and password in Flash. False otherwise. (Default: True)
bool StationClass::connect ( )

Connect WiFi station to network.

bool StationClass::disconnect ( )

Disconnect WiFi station from network.

void StationClass::enable ( bool  enabled,
bool  save = false 
)

Enable / disable WiFi station.

Note
Disabling WiFi station will also disable and clear the handler set with waitConnection.
Parameters
enabledTrue to enable station. False to disable.
saveTrue to save operational mode to flash, False to set current operational mode only
void StationClass::enableDHCP ( bool  enable)

Enable or disable WiFi station DHCP.

Parameters
enableTrue to enable WiFi station DHCP
const char* BssInfo::getAuthorizationMethodName ( )

Get BSS authorisation method name.

Return values
char*Pointer to c string BSS authoristation method name
EStationConnectionStatus StationClass::getConnectionStatus ( )

Get WiFi station connection status.

Return values
EStationConnectionStatusConnection status structure
const char* StationClass::getConnectionStatusName ( )

Get WiFi station connection status name.

Return values
char*Pointer to c string name of connection status
uint32_t BssInfo::getHashId ( )

Get BSS hash ID.

Return values
uint32_tBSS hash ID
String StationClass::getHostname ( )

Set WiFi station DHCP hostname.

Return values
WiFistation DHCP hostname
IPAddress StationClass::getIP ( )

Get WiFi station IP address.

Return values
IPAddressIP address of WiFi station
String StationClass::getMAC ( )

Get WiFi station MAC address.

Return values
StringWiFi station MAC address
IPAddress StationClass::getNetworkBroadcast ( )

GetWiFi station broadcast address.

Return values
IPAddressWiFi statoin broadcast address
IPAddress StationClass::getNetworkGateway ( )

Get WiFi station default gateway.

Return values
IPAddressWiFi station default gateway
IPAddress StationClass::getNetworkMask ( )

Get WiFi station network mask.

Return values
IPAddressWiFi station network mask
String StationClass::getPassword ( )

Get WiFi station password.

Return values
StringWiFi station password
String StationClass::getSSID ( )

Get WiFi station SSID.

Return values
StringWiFi station SSID
bool StationClass::isConnected ( )

Get WiFi station connectoin status.

Return values
boolTrue if connected.
bool StationClass::isConnectionFailed ( )

Get WiFi station connection failure status.

Return values
boolTrue if connection failed
bool StationClass::isEnabled ( )

Get WiFi station enable status.

Return values
boolTrue if WiFi station enabled
bool StationClass::isEnabledDHCP ( )

Get WiFi station DHCP enabled status.

Return values
boolTrue if DHCP enabled
bool BssInfo::isOpen ( )

Get BSS open status.

Return values
boolTrue if BSS open
virtual void StationClass::onSystemReady ( )
protectedvirtual

Handle system ready events.

Implements ISystemReadyHandler.

void StationClass::setHostname ( String  hostname)

Set WiFi station DHCP hostname.

Parameters
hostname- WiFi station DHCP hostname
bool StationClass::setIP ( IPAddress  address)

Set WiFi station IP address.

Parameters
addressIP address
Return values
boolTrue on success
bool StationClass::setIP ( IPAddress  address,
IPAddress  netmask,
IPAddress  gateway 
)

Set WiFi station IP parameters.

Parameters
addressIP address
netmaskNetwork mask
gatewayDefault gatway
Return values
boolTrue on success
void StationClass::smartConfigStart ( SmartConfigType  sctype,
SmartConfigDelegate  callback = NULL 
)

Start WiFi station smart configuration.

Parameters
sctypeSmart configuration type
callbackFunction to call on WiFi staton smart configuration complete (Default: none)
void StationClass::smartConfigStop ( )

Stop WiFi station smart configuration.

bool StationClass::startScan ( ScanCompletedDelegate  scanCompleted)

Start WiFi station network scan.

Parameters
scanCompletedFunction to call when scan completes
Return values
boolTrue on success
void StationClass::waitConnection ( ConnectionDelegate  successfulConnected)

Assign handler for WiFi station connection.

Note
The handler will be cleared if the WiFi Station is disabled. If you subsequently reenable WiFi Station, another call to waitConnection must be made if you want the handler to be reinstalled.
Parameters
successfulConnectedFunction to call when WiFi station connects to network
void StationClass::waitConnection ( ConnectionDelegate  successfulConnected,
int  secondsTimeOut,
ConnectionDelegate  connectionNotEstablished 
)

Assign handler for WiFi station connection with timeout.

Note
The handler will be cleared if the WiFi Station is disabled. If you subsequently reenable WiFi Station, another call to waitConnection must be made if you want the handler to be reinstalled.
Parameters
successfulConnectedFunction to call when WiFi station connects to network
secondsTimeOutQuantity of seconds to wait for connection
connectionNotEstablishedFunction to call if WiFi station fails to connect to network

Variable Documentation

AUTH_MODE BssInfo::authorization

Authorisation mode.

uint8 BssInfo::bssid[6]

BSS ID.

uint8 BssInfo::channel

Channel number.

bool BssInfo::hidden

True if AP is hidden.

sint16 BssInfo::rssi

RSSI level.

String BssInfo::ssid

SSID.