C

WifiManager QML Type

Main interface to the Wifi functionality. More...

Import Statement: import B2Qt.Wifi 1.0

Properties

Signals

Methods

Detailed Description

WifiManager is a singleton type that is a central point for handling Wifi functionality related tasks. You can use WifiManager's API to control the Wifi backend, scan surroundings for Wifi access points and connect a device to a wireless network.

When scanning for networks, WifiManager packs the results in a list-based data model which can be used with Qt's Model/View classes. Information about the Wifi networks is supplied via the model's interface, accessed with the following roles:

  • ssid - informal (human) name of a Wifi network (string)
  • bssid - basic service set identification of a network, used to uniquely identify BSS (string)
  • signalStrength - strength of a Wifi signal represented as percentage (0-100) (int)
  • supportsWPA - holds whether network access point supports WPA security protocol (bool)
  • supportsWPA2 - holds whether network access point supports WPA2 security protocol (bool)
  • supportsWEP - holds whether network access point supports WEP security protocol (bool)
  • supportsWPS - holds whether network access point supports WPS security protocol (bool)

Property Documentation

[read-only] BackendState : enumeration

This property holds the current state of the Wifi backend.

  • WifiManager.Initializing - Wireless supplicant is starting up
  • WifiManager.Running - Supplicant is initialized and ready to process commands
  • WifiManager.Terminating - Shutting down wireless supplicant
  • WifiManager.NotRunning - Wireless supplicant process is not running

[read-only] NetworkState : enumeration

This property holds the current state of the network connection.

  • WifiManager.Disconnected - Not connected to any network
  • WifiManager.Authenticating - Verifying password with the network provider
  • WifiManager.HandshakeFailed - Incorrect password provided
  • WifiManager.ObtainingIPAddress - Requesting IP address from DHCP server
  • WifiManager.DhcpRequestFailed - Could not retrieve IP address
  • WifiManager.Connected - Ready to process network requests

[read-only] currentSSID : string

This property holds a network name of last selected network, the network for which the NetworkState change events are sent. Property can contain an empty string when no active network connection exists.


[read-only] lastError : string

This property holds an error message if some internal process has failed.

See also connect.


[read-only] networks : model

This property holds a list-based data model of networks that can be sensed by a device. Model can be used with Qt's Model/View classes like ListView. Data in the model is updated every 5 seconds if scanning is enabled.

See also scanning.


scanning : bool

This property holds whether or not the backend is scanning for Wifi networks. To preserve battery energy, set this property to false when scanning is not required. When enabled, new readings are taken every 5 seconds.

For scanning to work, first you need to initialize the Wifi backend.

See also start.


Signal Documentation

backendStateChanged(BackendState backendState)

This signal is emitted whenever changes in a backend state occur.

See also start and stop.


currentSSIDChanged(string currentSSID)

This signal is emitted when switching between different Wifi networks.

See also start and stop.


lastErrorChanged(string error)

This signal is emitted if some internal process has failed, error contains a message on what has failed.

See also connect.


networkStateChanged(NetworkState networkState)

This signal is emitted whenever changes in a network state occur. The network name for which the NetworkState change events are send can be obtained from currentSSID.

See also NetworkState and currentSSID.


scanningChanged(bool scanning)

This signal is emitted when device starts or stops to scan for available Wifi networks.

See also scanning.


Method Documentation

bool connect(WifiConfiguration config)

Connect a device to a network using the config network configuration. This method returns true if the network with provoded configuration could be successfully added by the backend or false on failure, to obtain an error message read lastError property.

See also disconnect, NetworkState, and lastError.


disconnect()

Disconnect from currently connected network connection.

See also connect and NetworkState.


start()

Start the Wifi backend. This function returns immediately, the BackendState change events are delivered asynchronously.

See also stop and BackendState.


stop()

Stop the Wifi backend and if connected to any network shut down the network connection. This function returns immediately, the BackendState change events are delivered asynchronously.

See also start and BackendState.


Available under certain Qt licenses.
Find out more.