WifiManager QML Type
Main interface to the Wifi functionality. More...
|Import Statement:||import B2Qt.Wifi 1.0|
- BackendState : enumeration
- NetworkState : enumeration
- currentSSID : string
- lastError : string
- networks : model
- scanning : bool
- backendStateChanged(BackendState backendState)
- currentSSIDChanged(string currentSSID)
- lastErrorChanged(string error)
- networkStateChanged(NetworkState networkState)
- scanningChanged(bool scanning)
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)
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
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
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.
This property holds an error message if some internal process has failed.
See also connect.
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.
This signal is emitted if some internal process has failed, error contains a message on what has failed.
See also connect.
This signal is emitted when device starts or stops to scan for available Wifi networks.
See also scanning.
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.
Available under certain Qt licenses.
Find out more.