trikRuntime
trikWiFi::TrikWiFi Class Reference

Class for WiFi management. More...

#include <trikWiFi.h>

Inheritance diagram for trikWiFi::TrikWiFi:
Collaboration diagram for trikWiFi::TrikWiFi:

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< ScanResultscanResult () 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

TrikWiFi::TrikWiFi ( const QString &  interfaceFilePrefix,
const QString &  daemonFile,
QObject *  parent = nullptr 
)

Constructor.

Parameters
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.
TrikWiFi::~TrikWiFi ( )
override

Destructor.

Member Function Documentation

void TrikWiFi::connect ( const QString &  ssid)

Connect to a network with given ssid.

void trikWiFi::TrikWiFi::connected ( )
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.

void trikWiFi::TrikWiFi::disconnected ( trikWiFi::DisconnectReason  reason)
signal

Emitted when wpa_supplicant disconnects from current network.

void TrikWiFi::dispose ( )

Closes the connection to wpa_supplicant.

void trikWiFi::TrikWiFi::error ( const QString &  message)
signal

Emitted when something goes wrong.

void TrikWiFi::reinit ( )

Disposes an old connection to wpa_supplicant and creates a new one.

void trikWiFi::TrikWiFi::scanFinished ( )
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.

void trikWiFi::TrikWiFi::statusReady ( )
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.


The documentation for this class was generated from the following files: