WiFiDirect
Since: BlackBerry 10.2.0
#include <bb/device/WiFiDirect>
To link against this class, add the following line to your .pro file: LIBS += -lbbdevice
The WiFiDirect class provides the entry point to accessing information about WiFiDirect devices, or establishing connections with those devices.
Overview
Properties Index
bb::device::WiFiDirectConnectionState::Type | connectionState [read-only] |
bool | enabled [read-only] |
QDateTime | lastUpdate [read-only] |
QString | networkInterfaceName [read-only] |
QString | networkOwnerHardwareAddress [read-only] |
QString | networkOwnerIpAddress [read-only] |
QString | networkPassword [read-only] |
bb::device::WiFiDirectRole::Type | networkRole [read-only] |
QString | networkSsid [read-only] |
bool | scanning [read-only] |
bool | supported [read-only] |
Public Functions Index
Static Public Functions Index
bool | isSupported () |
Signals Index
void | connectionStateChanged (bb::device::WiFiDirectConnectionState::Type connectionState) |
void | deviceConnected (const QString &name, const QString &hardwareAddress, bb::device::WiFiDirectDeviceType::Type type, const QString &ipAddress, bb::device::WiFiDirectIntent::Type intent) |
void | deviceDisconnected (const QString &hardwareAddress) |
void | deviceDiscovered (const QString &name, const QString &hardwareAddress, bb::device::WiFiDirectDeviceType::Type type, bb::device::WiFiDirectSecondaryDeviceType::Types secondaryTypes, bb::device::WiFiDirectRole::Type role) |
void | deviceFound (const QString &name, const QString &hardwareAddress, bb::device::WiFiDirectDeviceType::Type type) |
void | deviceLost (const QString &hardwareAddress) |
void | enabledChanged (bool enabled) |
void | lastUpdateChanged (QDateTime lastUpdate) |
void | networkInterfaceNameChanged (QString networkInterfaceName) |
void | networkOwnerHardwareAddressChanged (QString networkHardwareAddress) |
void | networkOwnerIpAddressChanged (QString networkIpAddress) |
void | networkPasswordChanged (QString networkPassword) |
void | networkRoleChanged (bb::device::WiFiDirectRole::Type networkRole) |
void | networkSsidChanged (QString networkSsid) |
void | scanCompleted () |
void | scanningChanged (bool scanning) |
void | sessionStarted (const QString &session) |
void | sessionStopped () |
Properties
bb::device::WiFiDirectConnectionState::Type
The current state of the connection to the network group.
BlackBerry 10.2.0
bool
Indicates if the WiFi Direct service is enabled or not.
BlackBerry 10.2.0
QDateTime
The timestamp of the last time the current list of discovered devices has been updated.
If no scan has been performed or if the list of discovered devices is unavailable (or being updated), lastUpdate will be invalid (lastUpdate.isValid() is false).
BlackBerry 10.2.0
QString
The name of the network interface used to connect to the network group.
BlackBerry 10.2.0
bb::device::WiFiDirectRole::Type
Your role within the network group.
See bb::device::WiFiDirectRole for more details.
BlackBerry 10.2.0
bool
Indicates if WiFi Direct is currently scanning for available devices or not.
BlackBerry 10.2.0
bool
Indicates if the WiFi Direct service is supported on this device or not.
BlackBerry 10.2.0
Public Functions
Construct a WiFiDirect instance.
Parameters | |
---|---|
parent |
If not 0, the supplied parent is responsible for deleting this instance. |
BlackBerry 10.2.0
virtual
Destructor.
Q_INVOKABLE bb::device::WiFiDirectResult::Type
Attempts to abort a connection attempt that is in progress.
One of bb::device::WiFiDirectResult, indicating the result of the attempt.
BlackBerry 10.2.0
Q_INVOKABLE QStringList
Returns the hardwareAddress for each connected device.
A QStringList containing the hardware address for each device currently connected to the network group.
BlackBerry 10.2.0
bb::device::WiFiDirectConnectionState::Type
The current state of the connection to a network group.
See bb::device::WiFiDirectConnectionState for more details.
BlackBerry 10.2.0
Q_INVOKABLE bb::device::WiFiDirectDeviceType::Type
Obtains the type of the device specified by the supplied hardware address.
Parameters | |
---|---|
hardwareAddress |
The unique identifier for the device. |
A bb::device::WiFiDirectDeviceType containing the type of the device specified by hardwareAddress, if it could be obtained, otherwise bb::device::WiFiDirectDeviceType::Unknown is returned.
BlackBerry 10.2.0
Q_INVOKABLE QString
Obtains the IP address for the device specified by the supplied hardware address.
Parameters | |
---|---|
hardwareAddress |
The unique identifier for the device. |
A QString containing the IP address of the device specified by hardwareAddress, if it could be obtained, otherwise an empty string is returned.
BlackBerry 10.2.0
bool
Indicates if the WiFi Direct service is enabled or not.
True if the service is enabled, False otherwise.
BlackBerry 10.2.0
bool
Indicates if a WiFi Direct scan is currently being performed.
True if the device is currently scanning, False otherwise.
BlackBerry 10.2.0
QDateTime
The timestamp of the last time the current list of discovered devices has been updated.
If no scan has been performed or if the list of discovered devices is unavailable (or being updated), the QDateTime returned will have isValid() set to false.
Q_INVOKABLE QString
Obtains the name of the device specified by the supplied hardware address.
Parameters | |
---|---|
hardwareAddress |
The unique identifier for the device. |
A QString containing the name of the device specified by hardwareAddress, if it could be obtained, otherwise an empty string is returned.
BlackBerry 10.2.0
QString
The name of the network interface for this group.
A QString containing the network interface name for the established network group.
BlackBerry 10.2.0
QString
The MAC address of the group owner for the network group.
A QString containing the MAC address of the network group owner.
BlackBerry 10.2.0
QString
The IP address of the network group owner.
A QString containing the IP address of the network group owner.
BlackBerry 10.2.0
QString
The password for the network group.
A QString containing the password for the network group.
BlackBerry 10.2.0
bb::device::WiFiDirectRole::Type
Your role within the network group.
The role indicated for the network group, otherwise bb::device::WiFiDirectRole::Unknown. See bb::device::WiFiDirectRole for more details.
BlackBerry 10.2.0
QString
The SSID of the network group.
A QString containing the network group SSID.
BlackBerry 10.2.0
Q_INVOKABLE bb::device::WiFiDirectResult::Type
Attempts to connect to the specified device using the supplied method.
The target device must not be part of a WiFiDirect group, otherwise the connection will fail.
Parameters | |
---|---|
hardwareAddress |
The unique identifier of the device to which the connection will be attempted. |
intent |
See bb::device::WiFiDirectIntent for more details. |
wpsMethod |
See bb::device::WiFiDirectWpsMethod for more details. |
wpsPin |
The PIN to use for the connection attempt. Leave blank for none. The PIN will only be used for connections with bb::device::WiFiDirectWpsMethod::PresetPin. |
Returns one of bb::device::WiFiDirectResult.
BlackBerry 10.2.0
Q_INVOKABLE bb::device::WiFiDirectResult::Type
Enables scanning mode on the device, scanning for new visible devices every 5 seconds.
The scan lasts for 60 seconds. A device must call the requestScan() method in order to be visible for discovery.
One of bb::device::WiFiDirectResult, indicating the result of the attempt to enable scanning mode.
BlackBerry 10.2.0
Q_INVOKABLE bb::device::WiFiDirectResult::Type
Creates a session with the WiFiDirect service.
The requestStartSession() should be called once the device is connected.
Without a registered session, the underlying service will close any connections after 20 seconds.
One of bb::device::WiFiDirectResult::Type. If WiFiDirectResult::Success is returned the session key will be delivered by the sessionStarted signal.
BlackBerry 10.2.0
Q_INVOKABLE bb::device::WiFiDirectResult::Type
Destroys a session established with the WiFiDirect service.
Parameters | |
---|---|
session |
The identifier for the established session to be torn down. |
One of bb::device::WiFiDirectResult::Type. If WiFiDirectResult::Success is returned the session will be gone when the sessionStopped signal is emitted.
BlackBerry 10.2.0
Q_INVOKABLE QStringList
Returns the hardwareAddress for each device currently visible.
A QStringList containing the hardware addresses for all devices currently visible to the WiFi Direct service.
BlackBerry 10.2.0
Static Public Functions
bool
Indicates if the WiFi Direct service is supported on this device or not.
True if the service is supported, False otherwise.
BlackBerry 10.2.0
Signals
void
Emitted when the network group connection state changes.
Parameters | |
---|---|
connectionState |
Indicates the new state of the connection to the network group. |
Blackberry 10.2.0
void
Emitted when a device joins the network group.
Parameters | |
---|---|
name |
The name of the device that has joined. |
hardwareAddress |
The unique identifier for the new device. |
type |
See bb::device::WiFiDirectDeviceType for details. |
ipAddress |
The IP address of the new device. |
intent |
See bb::device::WiFiDirectIntent for details. |
BlackBerry 10.2.0
void
Emitted when a previously connected device is removed from the list of connected devices.
Parameters | |
---|---|
hardwareAddress |
The unique identifier for the device that disconnected. |
BlackBerry 10.2.0
void
Emitted when a WiFi Direct device is discovered during a scan.
Parameters | |
---|---|
name |
The device-assigned human readable name for the device. |
hardwareAddress |
The unique identifier for the device. |
type |
One of bb::device::WiFiDirectDeviceType. |
secondaryType |
Zero, one or more of bb::device::WiFiDirectSecondaryDeviceType. |
role |
One of bb:device::WiFiDirectRole. |
BlackBerry 10.3.0
void
Emitted when a WiFi Direct device is discovered during a scan.
This signal has been deprecated. Please use the deviceDiscovered signal instead.
Parameters | |
---|---|
name |
The device-assigned human readable name for the device. |
hardwareAddress |
The unique identifier for the device. |
type |
One of bb::device::WiFiDirectDeviceType. |
BlackBerry 10.2.0
void
Emitted when a device held in the visibleDevices list is determined to be no longer visible.
Since the visibleDevices list is only updated after a scan, it is possible to have this signal be raised for devices that were no longer available a considerable time ago.
Parameters | |
---|---|
hardwareAddress |
The unique identifier for the device that is no longer visible. |
BlackBerry 10.2.0
void
Emitted when the state of the WiFi Direct service changes.
Parameters | |
---|---|
enabled |
True if the service is enabled, False otherwise. |
BlackBerry 10.2.0
void
Emitted whenever the list of visible devices is updated.
Parameters | |
---|---|
lastUpdate |
The timestamp when the list of visible devices has been updated last. |
BlackBerry 10.2.0
void
Emitted when the interface associated with the network group changes.
Parameters | |
---|---|
networkInterfaceName |
The name of the network interface. |
BlackBerry 10.2.0
void
Emitted when the Group Owner hardware address changes.
Parameters | |
---|---|
networkHardwareAddress |
The unique identifier of the hardware of the group owner |
BlackBerry 10.2.0
void
Emitted when the IP address of the network group owner changes.
Parameters | |
---|---|
networkIpAddress |
The new IP address of the group owner. |
BlackBerry 10.2.0
void
Emitted when the network group password changes.
Parameters | |
---|---|
networkPassword |
The new network group password. |
BlackBerry 10.2.0
void
Emitted when your role within the network group has changed.
Parameters | |
---|---|
networkRole |
Your new role within the network group. |
BlackBerry 10.2.0
void
Emitted when the SSID of the network group changes.
Parameters | |
---|---|
networkSsid |
The new SSID of the network group. |
BlackBerry 10.2.0
void
Emitted when the device is no longer scanning for visible devices.
BlackBerry 10.2.0
void
Emitted when the device changes its scanning mode.
Parameters | |
---|---|
scanning |
True if the device is now scanning, False otherwise. |
BlackBerry 10.2.0
void
Emitted when a session is established on a connection.
Parameters | |
---|---|
session |
The identifier for the session that has been established. |
BlackBerry 10.2.0
void
Emitted when the session identified in requestStopSession is torn down.
BlackBerry 10.2.0