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 |
Return the singleton instance |
| Method | __init__ |
WiFi Initialiser |
| Async Method | check_ |
Check if the WiFi is connected |
| Method | isconnected |
Check if the WiFi is connected. |
| Property | ssid |
SSID. |
| Class Variable | _wi |
Undocumented |
| Instance Variable | _connected |
Undocumented |
| Instance Variable | _credentials |
Undocumented |
| Instance Variable | _wlan |
Undocumented |
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.
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.
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