trikRuntime
|
Class for WiFi management. More...
#include <trikWiFi.h>
Signals | |
void | scanFinished () |
Emitted when scanning for available networks initiated by scan() is finished and results are available and ready to be obtained by scanResults() method. More... | |
void | connected () |
Emitted when wpa_supplicant connects to WiFi network. SSID of this network can be retrieved by status() method. More... | |
void | disconnected (trikWiFi::DisconnectReason reason) |
Emitted when wpa_supplicant disconnects from current network. More... | |
void | statusReady () |
Emitted when connection status requested by statusRequest() is ready and results can be obtained by statusResult() method. More... | |
void | error (const QString &message) |
Emitted when something goes wrong. More... | |
Public Member Functions | |
TrikWiFi (const QString &interfaceFilePrefix, const QString &daemonFile, QObject *parent=nullptr) | |
Constructor. More... | |
~TrikWiFi () override | |
Destructor. More... | |
void | connect (const QString &ssid) |
Connect to a network with given ssid. More... | |
void | disconnect () |
Disconnect from network if we are currently connected to one. More... | |
void | statusRequest () |
Asynchronously gets conection status and connection information such as SSID and IP. More... | |
Status | statusResult () const |
Returns last known connection status. To refresh, use statusRequest() method. More... | |
void | scanRequest () |
Asynchronously scans for available WiFi networks. More... | |
QList< ScanResult > | scanResult () const |
Returns a list of currently known available WiFi networks. Use scanRequest() method to refresh. More... | |
void | reinit () |
Disposes an old connection to wpa_supplicant and creates a new one. More... | |
void | dispose () |
Closes the connection to wpa_supplicant. More... | |
SignalStrength | signalStrength () |
Return signal strength of current Wi-Fi connection. More... | |
Class for WiFi management.
Allows to connect and disconnect to/from WPA-PSK network (using wpa-supplicant utility), to scan for available networks and to alter configuration of wpa-supplicant.
TrikWiFi::TrikWiFi | ( | const QString & | interfaceFilePrefix, |
const QString & | daemonFile, | ||
QObject * | parent = nullptr |
||
) |
Constructor.
interfaceFilePrefix | - path and prefix of file names that are used by this library to communicate with wpa_supplicant. |
daemonFile | - file that wpa_supplicant uses to communicate with clients, something like /run/wpa_supplicant/wlan0. |
parent | - parent QObject. |
|
override |
Destructor.
void TrikWiFi::connect | ( | const QString & | ssid | ) |
Connect to a network with given ssid.
|
signal |
Emitted when wpa_supplicant connects to WiFi network. SSID of this network can be retrieved by status() method.
void TrikWiFi::disconnect | ( | ) |
Disconnect from network if we are currently connected to one.
|
signal |
Emitted when wpa_supplicant disconnects from current network.
void TrikWiFi::dispose | ( | ) |
Closes the connection to wpa_supplicant.
|
signal |
Emitted when something goes wrong.
void TrikWiFi::reinit | ( | ) |
Disposes an old connection to wpa_supplicant and creates a new one.
|
signal |
Emitted when scanning for available networks initiated by scan() is finished and results are available and ready to be obtained by scanResults() method.
void TrikWiFi::scanRequest | ( | ) |
Asynchronously scans for available WiFi networks.
When done, sends scanFinished() signal, then scan results can be obtained via scanResult() method.
QList< ScanResult > TrikWiFi::scanResult | ( | ) | const |
Returns a list of currently known available WiFi networks. Use scanRequest() method to refresh.
SignalStrength TrikWiFi::signalStrength | ( | ) |
Return signal strength of current Wi-Fi connection.
|
signal |
Emitted when connection status requested by statusRequest() is ready and results can be obtained by statusResult() method.
void TrikWiFi::statusRequest | ( | ) |
Asynchronously gets conection status and connection information such as SSID and IP.
Emits statusReady when done, then status can be obtained by statusResult() call.
Status TrikWiFi::statusResult | ( | ) | const |
Returns last known connection status. To refresh, use statusRequest() method.