Anniversary Sale · up to 80% off all librariesEnds Nov 9Shop now
SOFTTDocs

Network Info

Read the connection status, IP configuration, BSSID and channel of the network NetWizard is connected to.

These methods return information about the current station connection. Except for getConnectionStatus(), they return meaningful values only while the connection status is CONNECTED; check it with getConnectionStatus() first.

Methods

getConnectionStatus()

NetWizardConnectionStatus getConnectionStatus();

Returns the current connection status. See Connection statuses.

NetWizardConnectionStatus status = NW.getConnectionStatus();

localIP()

IPAddress localIP();

Returns the IP address of the device on the connected network.

IPAddress ip = NW.localIP();
String ipStr = NW.localIP().toString();

gatewayIP()

IPAddress gatewayIP();

Returns the gateway IP address of the connected network.

IPAddress gateway = NW.gatewayIP();
String gatewayStr = NW.gatewayIP().toString();

subnetMask()

IPAddress subnetMask();

Returns the subnet mask of the connected network.

IPAddress subnet = NW.subnetMask();
String subnetStr = NW.subnetMask().toString();

getBSSID()

void getBSSID(uint8_t* bssid);

Writes the 6-byte BSSID (MAC address of the access point) of the connected network into bssid.

uint8_t bssid[6];
NW.getBSSID(bssid);

getChannel()

uint8_t getChannel();

Returns the WiFi channel of the connected network.

uint8_t channel = NW.getChannel();

Connection statuses

NetWizardConnectionStatus is a scoped enum that reflects the state of the station connection:

ValueMeaning
NetWizardConnectionStatus::DISCONNECTEDNot connected to a network.
NetWizardConnectionStatus::CONNECTINGA connection attempt has started.
NetWizardConnectionStatus::CONNECTEDConnected to the network.
NetWizardConnectionStatus::CONNECTION_FAILEDThe connection attempt failed, for example because of an invalid password.
NetWizardConnectionStatus::CONNECTION_LOSTAn established connection was lost.
NetWizardConnectionStatus::NOT_FOUNDThe configured network was not found.

To react to status changes, register onConnectionStatus().

  • Credentials: getSSID() and getPassword() return the configured network's credentials.

On this page