Skip to main content

interface.getstate()

Retrieve the current state of the network interface

Availability

Device (from impOS™ 42)

Returns

Integer — a state constant

Description

This is draft documentation which covers impOS™ functionality that, though currently in internal development, has been made available to a number of customers for testing purposes only. Both the functionality described here and the documentation itself are subject to change, including breaking changes, and may differ significantly from their final release versions.


This method returns the current state of the target network interface object.

The value returned may be one of the following constants:

impOS Constant Value Network Interface State
imp.net.UNKNOWN -1 Idle/unknown
imp.net.STARTING 0 Starting
imp.net.CONNECTED 1 Connected
imp.net.WIFI_SCANNING 100 WiFi scanning
imp.net.WIFI_JOINING 101 WiFi joining
imp.net.WIFI_WPSING 102 WiFi WPS in progress
imp.net.WIFI_LINK_UP 103 WiFi link up
imp.net.WIFI_DHCPING 104 WiFi getting IP address via DHCP
imp.net.WIFI_STOPPED 105 WiFi stopped
imp.net.WIFI_STOPPED_UNHAPPY 106 WiFi sub-system unhappy
imp.net.ETHERNET_LINK_UP 200 Ethernet link up
imp.net.ETHERNET_DHCPING 201 Ethernet getting IP address via DHCP
imp.net.ETHERNET_STOPPED 202 Ethernet stopped
imp.net.ETHERNET_STOPPED_UNHAPPY 203 Ethernet sub-system unhappy
imp.net.ETHERNET_STOPPED_NO_LINK 204 Ethernet stopped: No link
imp.net.CELLULAR_PINGING 300 Cellular contacting modem
imp.net.CELLULAR_WAITING_FOR_SIM 301 Cellular waiting for SIM
imp.net.CELLULAR_PPP_CONNECTING 302 Cellular connecting via PPP
imp.net.CELLULAR_REGISTERING 303 Cellular registering with network
imp.net.CELLULAR_REGISTRATION_DENIED 304 Cellular network registration request denied
imp.net.CELLULAR_STOPPED 305 Cellular stopped
imp.net.CELLULAR_STOPPED_UNHAPPY 306 Cellular modem unhappy

Electric Imp reserves the right to alter the value of these constants in future impOS releases.

Note This value will be the same as that passed into the state parameter of any callback function registered with imp.net.open().