State
#enum StateWhether a Wi-Fi interface is connected: Unknown, NoWifi, Disconnected or Connected.
| Name | Type | Description |
|---|---|---|
Unknown | | The backend could not tell, for example an interface NetworkManager does not manage and iw is missing, a failed read, or a network that changed while it was being read. |
NoWifi | | The machine has no wireless interface, or the platform has no Wi-Fi backend. |
Disconnected | | There is a Wi-Fi interface but it is not associated with a network as a client, Wi-Fi is turned off, or (on macOS) the interface is acting as a hotspot. |
Connected | | The interface is associated with a network. |
import net.wifi
func main:
each st in [
wifi.State.Unknown, wifi.State.NoWifi, wifi.State.Disconnected, wifi.State.Connected
]:
s := wifi.Status { state = st }
println wifi.StateName(st), s.IsConnected()
end
println wifi.TrustName(wifi.Trust.NotWifi),
wifi.TrustName(wifi.Trust.Trusted),
wifi.TrustName(wifi.Trust.Untrusted)
endunknown false no-wifi false disconnected false connected true not-wifi trusted untrusted