class documentation

class WiFi(Device):

Constructor: WiFi()

View In Hierarchy

WiFi Connection

This singleton class manages the WiFi Connection. It connects using the credentials as held in the wifi configuration file. The connection is checked periodically and if the connection is lost, it will attempt to reconnect. The LED is set to red when not connected and cleared when connected.

Class Method get_instance Return the singleton instance
Method __init__ WiFi Initialiser
Async Method check_OK Check if the WiFi is connected
Method isconnected Check if the WiFi is connected.
Property ssid SSID.
Class Variable _wi_fi Undocumented
Instance Variable _connected Undocumented
Instance Variable _credentials Undocumented
Instance Variable _wlan Undocumented
@classmethod
def get_instance(cls):

Return the singleton instance

The singleton is created on the first call.

The connection is initiated and a timer is set up to check the success of the connection. If the connect fails or the connection is subsequently lost, reconnection is attempted.

def __init__(self):

WiFi Initialiser

This initialises the WiFi connection using the credentials from the configuration file. If the singleton already exists then an assert exception is raised. The LED is set to red if the connection is not established.

async def check_OK(self):

Check if the WiFi is connected

This checks if the WiFi is connected. If it is newly connected, the LED is cleared. If it is not connected, the LED is set to red and the connection is attempted. If the connection is not established, the active state of the WiFi is toggled to force a reconnect.

This runs forever as a task under asyncio

def isconnected(self):

Check if the WiFi is connected.

A wrapper for the standard MicroPython network class method.

@property
ssid =

SSID.

Held as part of credentials tuple.

Returns
ssid
_wi_fi =

Undocumented

_connected: bool =

Undocumented

_credentials =

Undocumented

_wlan =

Undocumented