ESP8266
Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
ESP8266WiFiSTAClass Class Reference
Inheritance diagram for ESP8266WiFiSTAClass:
ESP8266WiFiClass

Public Member Functions

wl_status_t begin (const char *ssid, const char *passphrase=NULL, int32_t channel=0, const uint8_t *bssid=NULL, bool connect=true)
 
wl_status_t begin (char *ssid, char *passphrase=NULL, int32_t channel=0, const uint8_t *bssid=NULL, bool connect=true)
 
wl_status_t begin ()
 
bool config (IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1=(uint32_t) 0x00000000, IPAddress dns2=(uint32_t) 0x00000000)
 
bool reconnect ()
 
bool disconnect (bool wifioff=false)
 
bool setAutoConnect (bool autoConnect)
 
bool getAutoConnect ()
 
bool setAutoReconnect (bool autoReconnect)
 
uint8_t waitForConnectResult ()
 
IPAddress localIP ()
 
uint8_t * macAddress (uint8_t *mac)
 
String macAddress ()
 
IPAddress subnetMask ()
 
IPAddress gatewayIP ()
 
IPAddress dnsIP (uint8_t dns_no=0)
 
String hostname ()
 
bool hostname (char *aHostname)
 
bool hostname (const char *aHostname)
 
bool hostname (String aHostname)
 
wl_status_t status ()
 
String SSID () const
 
String psk () const
 
uint8_t * BSSID ()
 
String BSSIDstr ()
 
int32_t RSSI ()
 
bool beginWPSConfig (void)
 
bool beginSmartConfig ()
 
bool stopSmartConfig ()
 
bool smartConfigDone ()
 

Static Protected Member Functions

static void _smartConfigCallback (uint32_t status, void *result)
 

Static Protected Attributes

static bool _useStaticIp = false
 
static bool _smartConfigStarted = false
 
static bool _smartConfigDone = false
 

Member Function Documentation

void ESP8266WiFiSTAClass::_smartConfigCallback ( uint32_t  st,
void *  result 
)
staticprotected

_smartConfigCallback

Parameters
st
result
wl_status_t ESP8266WiFiSTAClass::begin ( const char *  ssid,
const char *  passphrase = NULL,
int32_t  channel = 0,
const uint8_t *  bssid = NULL,
bool  connect = true 
)

Start Wifi connection if passphrase is set the most secure supported mode will be automatically selected

Parameters
ssidconst char* Pointer to the SSID string.
passphraseconst char * Optional. Passphrase. Valid characters in a passphrase must be between ASCII 32-126 (decimal).
bssiduint8_t[6] Optional. BSSID / MAC of AP
channelOptional. Channel of AP
connectOptional. call connect
Returns
wl_status_t ESP8266WiFiSTAClass::begin ( char *  ssid,
char *  passphrase = NULL,
int32_t  channel = 0,
const uint8_t *  bssid = NULL,
bool  connect = true 
)
wl_status_t ESP8266WiFiSTAClass::begin ( )

Use to connect to SDK config.

Returns
wl_status_t
bool ESP8266WiFiSTAClass::beginSmartConfig ( )

Start SmartConfig

bool ESP8266WiFiSTAClass::beginWPSConfig ( void  )

WPS config so far only WPS_TYPE_PBC is supported (SDK 1.2.0)

Returns
ok
uint8_t * ESP8266WiFiSTAClass::BSSID ( void  )

Return the current bssid / mac associated with the network if configured

Returns
bssid uint8_t *
String ESP8266WiFiSTAClass::BSSIDstr ( void  )

Return the current bssid / mac associated with the network if configured

Returns
String bssid mac
bool ESP8266WiFiSTAClass::config ( IPAddress  local_ip,
IPAddress  gateway,
IPAddress  subnet,
IPAddress  dns1 = (uint32_t)0x00000000,
IPAddress  dns2 = (uint32_t)0x00000000 
)

Change IP configuration settings disabling the dhcp client

Parameters
local_ipStatic ip configuration
gatewayStatic gateway configuration
subnetStatic Subnet mask
dns1Static DNS server 1
dns2Static DNS server 2
bool ESP8266WiFiSTAClass::disconnect ( bool  wifioff = false)

Disconnect from the network

Parameters
wifioff
Returns
one value of wl_status_t enum
IPAddress ESP8266WiFiSTAClass::dnsIP ( uint8_t  dns_no = 0)

Get the DNS ip address.

Parameters
dns_no
Returns
IPAddress DNS Server IP
IPAddress ESP8266WiFiSTAClass::gatewayIP ( )

Get the gateway ip address.

Returns
IPAddress gatewayIP
bool ESP8266WiFiSTAClass::getAutoConnect ( )

Checks if ESP8266 station mode will connect to AP automatically or not when it is powered on.

Returns
auto connect
String ESP8266WiFiSTAClass::hostname ( void  )

Get ESP8266 station DHCP hostname

Returns
hostname
bool ESP8266WiFiSTAClass::hostname ( char *  aHostname)

Set ESP8266 station DHCP hostname

Parameters
aHostnamemax length:32
Returns
ok
bool ESP8266WiFiSTAClass::hostname ( const char *  aHostname)

Set ESP8266 station DHCP hostname

Parameters
aHostnamemax length:32
Returns
ok
bool ESP8266WiFiSTAClass::hostname ( String  aHostname)

Set ESP8266 station DHCP hostname

Parameters
aHostnamemax length:32
Returns
ok
IPAddress ESP8266WiFiSTAClass::localIP ( )

Get the station interface IP address.

Returns
IPAddress station IP
uint8_t * ESP8266WiFiSTAClass::macAddress ( uint8_t *  mac)

Get the station interface MAC address.

Parameters
macpointer to uint8_t array with length WL_MAC_ADDR_LENGTH
Returns
pointer to uint8_t *
String ESP8266WiFiSTAClass::macAddress ( void  )

Get the station interface MAC address.

Returns
String mac
String ESP8266WiFiSTAClass::psk ( ) const

Return the current pre shared key associated with the network

Returns
psk string
bool ESP8266WiFiSTAClass::reconnect ( )

will force a disconnect an then start reconnecting to AP

Returns
ok
int32_t ESP8266WiFiSTAClass::RSSI ( void  )

Return the current network RSSI.

Returns
RSSI value
bool ESP8266WiFiSTAClass::setAutoConnect ( bool  autoConnect)

Setting the ESP8266 station to connect to the AP (which is recorded) automatically or not when powered on. Enable auto-connect by default.

Parameters
autoConnectbool
Returns
if saved
bool ESP8266WiFiSTAClass::setAutoReconnect ( bool  autoReconnect)

Set whether reconnect or not when the ESP8266 station is disconnected from AP.

Parameters
autoReconnect
Returns
bool ESP8266WiFiSTAClass::smartConfigDone ( )

Query SmartConfig status, to decide when stop config

Returns
smartConfig Done
String ESP8266WiFiSTAClass::SSID ( ) const

Return the current SSID associated with the network

Returns
SSID
wl_status_t ESP8266WiFiSTAClass::status ( )

Return Connection status.

Returns
one of the value defined in wl_status_t
bool ESP8266WiFiSTAClass::stopSmartConfig ( )

Stop SmartConfig

IPAddress ESP8266WiFiSTAClass::subnetMask ( )

Get the interface subnet mask address.

Returns
IPAddress subnetMask
uint8_t ESP8266WiFiSTAClass::waitForConnectResult ( )

Wait for WiFi connection to reach a result returns the status reached or disconnect if STA is off

Returns
wl_status_t

Member Data Documentation

bool ESP8266WiFiSTAClass::_smartConfigDone = false
staticprotected
bool ESP8266WiFiSTAClass::_smartConfigStarted = false
staticprotected
bool ESP8266WiFiSTAClass::_useStaticIp = false
staticprotected