jacdac.wifi.client
Module Contents
Classes
Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer. |
- class jacdac.wifi.client.WifiClient(bus: jacdac.bus.Bus, role: str, *, missing_rssi_value: Optional[int] = None)
Bases:
jacdac.bus.SensorClient
Discovery and connection to WiFi networks. Separate TCP service can be used for data transfer. Implements a client for the WIFI service.
- property enabled Optional[bool]
Determines whether the WiFi radio is enabled. It starts enabled upon reset.,
- property ip_address Optional[bytes]
0, 4 or 16 byte buffer with the IPv4 or IPv6 address assigned to device if any.,
- property eui_48 Optional[bytes]
The 6-byte MAC address of the device. If a device does MAC address randomization it will have to “restart”.,
- property ssid Optional[str]
SSID of the access-point to which device is currently connected. Empty string if not connected.,
- on_got_ip(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted upon successful join and IP address assignment.
- on_lost_ip(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted when disconnected from network.
- on_scan_complete(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
A WiFi network scan has completed. Results can be read with the last_scan_results command. The event indicates how many networks where found, and how many are considered as candidates for connection.
- on_networks_changed(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted whenever the list of known networks is updated.
- on_connection_failed(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted when when a network was detected in scan, the device tried to connect to it and failed. This may be because of wrong password or other random failure.
- add_network(ssid: str, password: str) None
Automatically connect to named network if available. Also set password if network is not open.
- reconnect() None
Enable the WiFi (if disabled), initiate a scan, wait for results, disconnect from current WiFi network if any, and then reconnect (using regular algorithm, see set_network_priority).
- forget_network(ssid: str) None
Prevent from automatically connecting to named network in future. Forgetting a network resets its priority to 0.