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

Public Functions Index

WiFiDirect (QObject *parent=0)
virtual ~WiFiDirect ()
Q_INVOKABLE bb::device::WiFiDirectResult::TypecancelConnectRequest ()
Q_INVOKABLE QStringListconnectedDevices () const
bb::device::WiFiDirectConnectionState::TypeconnectionState () const
Q_INVOKABLE bb::device::WiFiDirectDeviceType::TypedeviceType (const QString &hardwareAddress) const
Q_INVOKABLE QStringipAddress (const QString &hardwareAddress) const
boolisEnabled () const
boolisScanning () const
QDateTimelastUpdate () const
Q_INVOKABLE QStringname (const QString &hardwareAddress) const
QStringnetworkInterfaceName () const
QStringnetworkOwnerHardwareAddress () const
QStringnetworkOwnerIpAddress () const
QStringnetworkPassword () const
bb::device::WiFiDirectRole::TypenetworkRole () const
QStringnetworkSsid () const
Q_INVOKABLE bb::device::WiFiDirectResult::TyperequestConnect (const QString &hardwareAddress, bb::device::WiFiDirectIntent::Type intent, bb::device::WiFiDirectWpsMethod::Type wpsMethod, const QString &wpsPin)
Q_INVOKABLE bb::device::WiFiDirectResult::TyperequestScan ()
Q_INVOKABLE bb::device::WiFiDirectResult::TyperequestStartSession ()
Q_INVOKABLE bb::device::WiFiDirectResult::TyperequestStopSession (const QString &session)
Q_INVOKABLE QStringListvisibleDevices () const

Static Public Functions Index

Signals Index

voidconnectionStateChanged (bb::device::WiFiDirectConnectionState::Type connectionState)
voiddeviceConnected (const QString &name, const QString &hardwareAddress, bb::device::WiFiDirectDeviceType::Type type, const QString &ipAddress, bb::device::WiFiDirectIntent::Type intent)
voiddeviceDisconnected (const QString &hardwareAddress)
voiddeviceFound (const QString &name, const QString &hardwareAddress, bb::device::WiFiDirectDeviceType::Type type)
voiddeviceLost (const QString &hardwareAddress)
voidenabledChanged (bool enabled)
voidlastUpdateChanged (QDateTime lastUpdate)
voidnetworkInterfaceNameChanged (QString networkInterfaceName)
voidnetworkOwnerHardwareAddressChanged (QString networkHardwareAddress)
voidnetworkOwnerIpAddressChanged (QString networkIpAddress)
voidnetworkPasswordChanged (QString networkPassword)
voidnetworkRoleChanged (bb::device::WiFiDirectRole::Type networkRole)
voidnetworkSsidChanged (QString networkSsid)
voidscanCompleted ()
voidscanningChanged (bool scanning)
voidsessionStarted (const QString &session)
voidsessionStopped ()

Properties

bb::device::WiFiDirectConnectionState::Type connectionState[read-only]

The current state of the connection to the network group.

See bb::device::WiFiDirectConnectionState for more details.

Since:

BlackBerry 10.2.0

bool enabled[read-only]

Indicates if the WiFi Direct service is enabled or not.

Since:

BlackBerry 10.2.0

QDateTime lastUpdate[read-only]

The last point in time in which the results of the WiFi Direct scan were reported.

Since:

BlackBerry 10.2.0

QString networkInterfaceName[read-only]

The name of the network interface used to connect to the network group.

Since:

BlackBerry 10.2.0

QString networkOwnerHardwareAddress[read-only]

The MAC address of the network group owner.

Since:

BlackBerry 10.2.0

QString networkOwnerIpAddress[read-only]

The IP address of the network group owner.

Since:

BlackBerry 10.2.0

QString networkPassword[read-only]

The password for the network group.

Since:

BlackBerry 10.2.0

bb::device::WiFiDirectRole::Type networkRole[read-only]

Your role within the network group.

See bb::device::WiFiDirectRole for more details.

Since:

BlackBerry 10.2.0

QString networkSsid[read-only]

The SSID for the network group.

Since:

BlackBerry 10.2.0

bool scanning[read-only]

Indicates if WiFi Direct is currently scanning for available devices or not.

Since:

BlackBerry 10.2.0

bool supported[read-only]

Indicates if the WiFi Direct service is supported on this device or not.

Since:

BlackBerry 10.2.0

Public Functions

WiFiDirect (

Construct a WiFiDirect instance.

Parameters
parent

If not 0, the supplied parent is responsible for deleting this instance.

Since:

BlackBerry 10.2.0

virtual~WiFiDirect ()

Destructor.

Q_INVOKABLE bb::device::WiFiDirectResult::Type cancelConnectRequest ()

Attempts to abort a connection attempt that is in progress.

Return:

One of bb::device::WiFiDirectResult, indicating the result of the attempt.

Since:

BlackBerry 10.2.0

Q_INVOKABLE QStringList connectedDevices ()

Returns the hardwareAddress for each connected device.

Return:

A QStringList containing the hardware address for each device currently connected to the network group.

Since:

BlackBerry 10.2.0

bb::device::WiFiDirectConnectionState::Type connectionState ()

The current state of the connection to a network group.

See bb::device::WiFiDirectConnectionState for more details.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::device::WiFiDirectDeviceType::Type deviceType (

Obtains the type of the device specified by the supplied hardware address.

Parameters
hardwareAddress

The unique identifier for the device.

Return:

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.

Since:

BlackBerry 10.2.0

Q_INVOKABLE QString ipAddress (

Obtains the IP address for the device specified by the supplied hardware address.

Parameters
hardwareAddress

The unique identifier for the device.

Return:

A QString containing the IP address of the device specified by hardwareAddress, if it could be obtained, otherwise an empty string is returned.

Since:

BlackBerry 10.2.0

bool isEnabled ()

Indicates if the WiFi Direct service is enabled or not.

Return:

True if the service is enabled, False otherwise.

Since:

BlackBerry 10.2.0

bool isScanning ()

Indicates if a WiFi Direct scan is currently being performed.

Return:

True if the device is currently scanning, False otherwise.

Since:

BlackBerry 10.2.0

QDateTime lastUpdate ()

The timestamp of the last time a network scan has been performed.

If no scan has been performed the value returns will have isValid() set to false.

Return:

A QDateTime indicating the last time a WiFi Direct scan has been performed.

Since:

BlackBerry 10.2.0

Q_INVOKABLE QString name (

Obtains the name of the device specified by the supplied hardware address.

Parameters
hardwareAddress

The unique identifier for the device.

Return:

A QString containing the name of the device specified by hardwareAddress, if it could be obtained, otherwise an empty string is returned.

Since:

BlackBerry 10.2.0

QString networkInterfaceName ()

The name of the network interface for this group.

Return:

A QString containing the network interface name for the established network group.

Since:

BlackBerry 10.2.0

QString networkOwnerHardwareAddress ()

The MAC address of the group owner for the network group.

Return:

A QString containing the MAC address of the network group owner.

Since:

BlackBerry 10.2.0

QString networkOwnerIpAddress ()

The IP address of the network group owner.

Return:

A QString containing the IP address of the network group owner.

Since:

BlackBerry 10.2.0

QString networkPassword ()

The password for the network group.

Return:

A QString containing the password for the network group.

Since:

BlackBerry 10.2.0

bb::device::WiFiDirectRole::Type networkRole ()

Your role within the network group.

Return:

The role indicated for the network group, otherwise bb::device::WiFiDirectRole::Unknown. See bb::device::WiFiDirectRole for more details.

Since:

BlackBerry 10.2.0

QString networkSsid ()

The SSID of the network group.

Return:

A QString containing the network group SSID.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::device::WiFiDirectResult::Type requestConnect (

Attempts to connect to the specified device using the supplied method.

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.

Return:

Returns one of bb::device::WiFiDirectResult.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::device::WiFiDirectResult::Type requestScan ()

Enables scanning mode on the device, scanning for new visible devices every 5 seconds.

Return:

One of bb::device::WiFiDirectResult, indicating the result of the attempt to enable scanning mode.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::device::WiFiDirectResult::Type requestStartSession ()

Creates a session with the WiFiDirect service.

Without a registered session, the underlying service will close any connections after 20 seconds.

Return:

One of bb::device::WiFiDirectResult::Type. If WiFiDirectResult::Success is returned the session key will be delivered by the sessionStarted signal.

Since:

BlackBerry 10.2.0

Q_INVOKABLE bb::device::WiFiDirectResult::Type requestStopSession (

Destroys a session established with the WiFiDirect service.

Parameters
session

The identifier for the established session to be torn down.

Return:

One of bb::device::WiFiDirectResult::Type. If WiFiDirectResult::Success is returned the session will be gone when the sessionStopped signal is emitted.

Since:

BlackBerry 10.2.0

Q_INVOKABLE QStringList visibleDevices ()

Returns the hardwareAddress for each device currently visible.

Return:

A QStringList containing the hardware addresses for all devices currently visible to the WiFi Direct service.

Since:

BlackBerry 10.2.0

Static Public Functions

bool isSupported ()

Indicates if the WiFi Direct service is supported on this device or not.

Return:

True if the service is supported, False otherwise.

Since:

BlackBerry 10.2.0

Signals

void connectionStateChanged (

Emitted when the network group connection state changes.

Parameters
connectionState

Indicates the new state of the connection to the network group.

Since:

Blackberry 10.2.0

void deviceConnected (

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.

Since:

BlackBerry 10.2.0

void deviceDisconnected (

Emitted when a previously connected device is removed from the list of connected devices.

Parameters
hardwareAddress

The unique identifier for the device that disconnected.

Since:

BlackBerry 10.2.0

void deviceFound (

Emitted when an available 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.

Since:

BlackBerry 10.2.0

void deviceLost (

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.

Since:

BlackBerry 10.2.0

void enabledChanged (
  • boolenabled)

Emitted when the state of the WiFi Direct service changes.

Parameters
enabled

True if the service is enabled, False otherwise.

Since:

BlackBerry 10.2.0

void lastUpdateChanged (

Emitted whenever a scan is completed.

Parameters
lastUpdate

The timestampt that the scan was completed.

Since:

BlackBerry 10.2.0

void networkInterfaceNameChanged (

Emitted when the interface associated with the network group changes.

Parameters
networkInterfaceName

The name of the network interface.

Since:

BlackBerry 10.2.0

void networkOwnerHardwareAddressChanged (

Emitted when the Group Owner hardware address changes.

Parameters
networkHardwareAddress

The unique identifier of the hardware of the group owner

Since:

BlackBerry 10.2.0

void networkOwnerIpAddressChanged (

Emitted when the IP address of the network group owner changes.

Parameters
networkIpAddress

The new IP address of the group owner.

Since:

BlackBerry 10.2.0

void networkPasswordChanged (

Emitted when the network group password changes.

Parameters
networkPassword

The new network group password.

Since:

BlackBerry 10.2.0

void networkRoleChanged (

Emitted when your role within the network group has changed.

Parameters
networkRole

Your new role within the network group.

Since:

BlackBerry 10.2.0

void networkSsidChanged (

Emitted when the SSID of the network group changes.

Parameters
networkSsid

The new SSID of the network group.

Since:

BlackBerry 10.2.0

void scanCompleted ()

Emitted when the device is no longer scanning for visible devices.

Since:

BlackBerry 10.2.0

void scanningChanged (
  • boolscanning)

Emitted when the device changes its scanning mode.

Parameters
scanning

True if the device is now scanning, False otherwise.

Since:

BlackBerry 10.2.0

void sessionStarted (

Emitted when a session is established on a connection.

Parameters
session

The identifier for the session that has been established.

Since:

BlackBerry 10.2.0

void sessionStopped ()

Emitted when the session identified in requestStopSession is torn down.

Since:

BlackBerry 10.2.0

Last modified: 2014-03-13

comments powered by Disqus