QWlanManager
Loading...
Searching...
No Matches
qwm::Manager Class Reference

Use to manage all wlan related operations. More...

Inheritance diagram for qwm::Manager:
Collaboration diagram for qwm::Manager:

Signals

void sInterfaceAdded (qwm::Interface interface)
 Emitted when a new interface has been added.
 
void sInterfaceRemoved (qwm::Interface interface)
 Emitted when an interface has been removed.
 
void sScanStarted (const QUuid &idInterface)
 Emitted when a network scan has been started on an interface.
 
void sScanSucceed (const QUuid &idInterface, qwm::ListNetworks listNets)
 Emitted when a network scan succeeded.
 
void sScanFailed (const QUuid &idInterface, qwm::WlanError idErr)
 Emitted when a network scan failed.
 
void sConnectionStarted (const QUuid &idInterface, const QString &ssid)
 Emitted when trying to connect to a network.
 
void sConnectionSucceed (const QUuid &idInterface, const QString &ssid)
 Emitted when network connection succeed.
 
void sConnectionFailed (const QUuid &idInterface, const QString &ssid, qwm::WlanError idErr)
 Emitted when network connection failed.
 
void sDisconnectionStarted (const QUuid &idInterface)
 Emitted when interface is trying to disconnect from network.
 
void sDisconnectionSucceed (const QUuid &idInterface)
 Emitted when interface disconnection succeeded.
 
void sDisconnectionFailed (const QUuid &idInterface, qwm::WlanError idErr)
 Emitted when interface disconnection failed.
 
void sForgetStarted (const QUuid &idInterface, const QString &ssid)
 Emitted when trying to forget a network.
 
void sForgetSucceed (const QUuid &idInterface, const QString &ssid)
 Emitted when network has been forgotten.
 
void sForgetFailed (const QUuid &idInterface, const QString &ssid, qwm::WlanError idErr)
 Emitted when network forget request failed.
 
void sSignalQualityChanged (const QUuid &idInterface, uint percent)
 Emitted when signal quality of current network changes.
 

Public Member Functions

 Manager (QObject *parent=nullptr)
 Construct a wlan manager.
 
void setOptions (WlanOptions opts)
 Allow to set options of the manager.
 
WlanOptions getOptions () const
 Retrieve current manager options.
 
ListInterfaces getInterfaces () const
 Allow to retrieve list of interfaces.
 
Interface getInterface (const QUuid &idInterface) const
 Allow to retrieve an interface via its ID.
 
void doScan (const QUuid &idInterface)
 Allow to perform a scan.
 
void doConnect (const QUuid &idInterface, const QString &ssid, const QString &password="")
 Allow to connect to a network.
 
void doDisconnect (const QUuid &idInterface)
 Allow to disconnect from a network.
 
void doForget (const QUuid &idInterface, const QString &ssid)
 Allow to remove network internal credentials.
 

Detailed Description

Use to manage all wlan related operations.

This class control all interfaces operations: interface added/removed, scan, connection, etc...

Note
Also note that some OSes require permissions to be granted to perform wlan operations, see qwm::Permissions for more details.
See also
qwm::Permissions

Constructor & Destructor Documentation

◆ Manager()

qwm::Manager::Manager ( QObject * parent = nullptr)
explicit

Construct a wlan manager.

Allow to perform needed backend initialization and retrieve list of available interfaces.

Parameters
[out]parentThe parent argument is passed to QObject's constructor

Member Function Documentation

◆ setOptions()

void qwm::Manager::setOptions ( WlanOptions opts)

Allow to set options of the manager.

Parameters
[in]optsOptions to use.
See also
getOptions()

◆ getOptions()

WlanOptions qwm::Manager::getOptions ( ) const

Retrieve current manager options.

Returns
Returns options of manager
See also
setOptions()

◆ getInterfaces()

ListInterfaces qwm::Manager::getInterfaces ( ) const

Allow to retrieve list of interfaces.

Returns
Returns list of available interfaces.
See also
getInterface()
sInterfaceAdded(), sInterfaceRemoved()

◆ getInterface()

Interface qwm::Manager::getInterface ( const QUuid & idInterface) const

Allow to retrieve an interface via its ID.

Parameters
[in]idInterfaceInterface ID to use.
If ID is unknown, returned interface will be invalid.
Returns
Returns interface related to the ID.
See also
getInterfaces()
Interface::isValid()

◆ doScan()

void qwm::Manager::doScan ( const QUuid & idInterface)

Allow to perform a scan.

This request is asynchronous, use associated signals to manage status.

Parameters
[in]idInterfaceInterface ID to use.
See also
sScanStarted()
sScanSucceed(), sScanFailed()

◆ doConnect()

void qwm::Manager::doConnect ( const QUuid & idInterface,
const QString & ssid,
const QString & password = "" )

Allow to connect to a network.

This request is asynchronous, use associated signals to manage status.

Parameters
[in]idInterfaceInterface ID to use.
[in]ssidNetwork SSID to connect.
Nothing is performed if already connected.
[in]passwordPassword to use for connection.
This value can be empty, in this case, internal credentials will be used.
If the password isn't registered internally or is wrong, signal sConnectionFailed() will be emitted with error code WlanError::WERR_NET_PASSKEY: in this case password has to be provided.
Note
Recommended scenario is to call this method once with empty password and ask the user for the password only if WlanError::WERR_NET_PASSKEY error is received.
Remarks
On CoreWlan backend, when an empty password is provided in order to use internal credentials, a temporary admin access will be asked in order to retrieve the network passkey from the keychain subsystem (and only for that).
Otherwise, option WlanOption::WOPT_ALLOW_ADMIN_REQUESTS can be disabled, if so, caller will always have to provide network password.
See also
sConnectionStarted()
sConnectionSucceed(), sConnectionFailed()
doDisconnect(), doForget()

◆ doDisconnect()

void qwm::Manager::doDisconnect ( const QUuid & idInterface)

Allow to disconnect from a network.

This request is asynchronous, use associated signals to manage status.

Parameters
[in]idInterfaceInterface ID to use.
Nothing is performed if already disconnected.
See also
sDisconnectionStarted()
sDisconnectionSucceed(), sDisconnectionFailed()
doForget(), doConnect()

◆ doForget()

void qwm::Manager::doForget ( const QUuid & idInterface,
const QString & ssid )

Allow to remove network internal credentials.

This request is asynchronous, use associated signals to manage status.

Parameters
[in]idInterfaceInterface ID to use.
[in]ssidNetwork SSID to forget
Note
Using this method will trigger a disconnection.
See also
sForgetStarted()
sForgetSucceed(), sForgetFailed()

◆ sInterfaceAdded

void qwm::Manager::sInterfaceAdded ( qwm::Interface interface)
signal

Emitted when a new interface has been added.

Parameters
[in]interfaceInterface that has been added
See also
sInterfaceRemoved()

◆ sInterfaceRemoved

void qwm::Manager::sInterfaceRemoved ( qwm::Interface interface)
signal

Emitted when an interface has been removed.

Parameters
[in]interfaceInterface that has been removed
See also
sInterfaceAdded()

◆ sScanStarted

void qwm::Manager::sScanStarted ( const QUuid & idInterface)
signal

Emitted when a network scan has been started on an interface.

Parameters
[in]idInterfaceInterface ID for which the scan has been started.
See also
sScanSucceed(), sScanFailed()
doScan()

◆ sScanSucceed

void qwm::Manager::sScanSucceed ( const QUuid & idInterface,
qwm::ListNetworks listNets )
signal

Emitted when a network scan succeeded.

Parameters
[in]idInterfaceInterface ID for which the scan succeeded.
[in]listNetsList of networks found.
See also
sScanFailed()
sScanStarted()
doScan()

◆ sScanFailed

void qwm::Manager::sScanFailed ( const QUuid & idInterface,
qwm::WlanError idErr )
signal

Emitted when a network scan failed.

Parameters
[in]idInterfaceInterface ID for which the scan failed.
[in]idErrError ID explaining why scan has failed.
See also
sScanSucceed()
sScanStarted()
doScan()

◆ sConnectionStarted

void qwm::Manager::sConnectionStarted ( const QUuid & idInterface,
const QString & ssid )
signal

Emitted when trying to connect to a network.

Parameters
[in]idInterfaceInterface ID used.
[in]ssidNetwork SSID the interface is trying to connect
See also
sConnectionSucceed(), sConnectionFailed()
doConnect()

◆ sConnectionSucceed

void qwm::Manager::sConnectionSucceed ( const QUuid & idInterface,
const QString & ssid )
signal

Emitted when network connection succeed.

Parameters
[in]idInterfaceInterface ID for which the connection succeeded.
[in]ssidNetwork SSID connected
See also
sConnectionFailed()
sConnectionStarted()
doConnect()

◆ sConnectionFailed

void qwm::Manager::sConnectionFailed ( const QUuid & idInterface,
const QString & ssid,
qwm::WlanError idErr )
signal

Emitted when network connection failed.

Parameters
[in]idInterfaceInterface ID for which the connection failed.
[in]ssidNetwork SSID interface was trying to connect
[in]idErrError ID explaining why connection has failed.
See also
sConnectionSucceed()
sConnectionStarted()
doConnect()

◆ sDisconnectionStarted

void qwm::Manager::sDisconnectionStarted ( const QUuid & idInterface)
signal

Emitted when interface is trying to disconnect from network.

Parameters
[in]idInterfaceInterface ID used.
See also
sDisconnectionSucceed(), sDisconnectionFailed()
doDisconnect()

◆ sDisconnectionSucceed

void qwm::Manager::sDisconnectionSucceed ( const QUuid & idInterface)
signal

Emitted when interface disconnection succeeded.

Parameters
[in]idInterfaceInterface ID used.
See also
sDisconnectionFailed()
sDisconnectionStarted()
doDisconnect()

◆ sDisconnectionFailed

void qwm::Manager::sDisconnectionFailed ( const QUuid & idInterface,
qwm::WlanError idErr )
signal

Emitted when interface disconnection failed.

Parameters
[in]idInterfaceInterface ID used.
[in]idErrError ID explaining why disconnection has failed.
See also
sDisconnectionSucceed()
sDisconnectionStarted()
doDisconnect()

◆ sForgetStarted

void qwm::Manager::sForgetStarted ( const QUuid & idInterface,
const QString & ssid )
signal

Emitted when trying to forget a network.

Parameters
[in]idInterfaceInterface ID used.
[in]ssidNetwork SSID to forget
See also
sForgetSucceed(), sForgetFailed()
doForget()

◆ sForgetSucceed

void qwm::Manager::sForgetSucceed ( const QUuid & idInterface,
const QString & ssid )
signal

Emitted when network has been forgotten.

Parameters
[in]idInterfaceInterface ID used.
[in]ssidNetwork SSID forgotten
See also
sForgetFailed()
sForgetStarted()
doForget()

◆ sForgetFailed

void qwm::Manager::sForgetFailed ( const QUuid & idInterface,
const QString & ssid,
qwm::WlanError idErr )
signal

Emitted when network forget request failed.

Parameters
[in]idInterfaceInterface ID used.
[in]ssidNetwork SSID to forgot
[in]idErrError ID explaining failure reasons.
See also
sForgetSucceed()
sForgetStarted()
doForget()

◆ sSignalQualityChanged

void qwm::Manager::sSignalQualityChanged ( const QUuid & idInterface,
uint percent )
signal

Emitted when signal quality of current network changes.

Parameters
[in]idInterfaceInterface ID for which the quality signal has changed.
[in]percentSignal quality in percentage.
Note
This signal is only emitted for current network of the interface.
Other networks quality signals can be retrieved via doScan()
See also
doScan(), doConnect()

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