QBluetoothLocalDevice Class
The QBluetoothLocalDevice class enables access to the local Bluetooth device. More...
Header: | #include <QBluetoothLocalDevice> |
qmake: | QT += bluetooth |
Since: | Qt 5.2 |
Inherits: | QObject |
This class was introduced in Qt 5.2.
Public Types
enum | Error { NoError, PairingError, UnknownError } |
enum | HostMode { HostPoweredOff, HostConnectable, HostDiscoverable, HostDiscoverableLimitedInquiry } |
enum | Pairing { Unpaired, Paired, AuthorizedPaired } |
Public Functions
virtual | ~QBluetoothLocalDevice() |
bool | isValid() const |
- 16 public functions inherited from QObject
Related Non-Members
typedef | QObjectList |
Macros
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
Q_CLASSINFO(Name, Value) | |
Q_DISABLE_COPY(Class) | |
Q_DISABLE_COPY_MOVE(Class) | |
Q_DISABLE_MOVE(Class) | |
Q_EMIT | |
Q_ENUM(...) | |
Q_ENUM_NS(...) | |
Q_FLAG(...) | |
Q_FLAG_NS(...) | |
Q_GADGET | |
Q_INTERFACES(...) | |
Q_INVOKABLE | |
Q_NAMESPACE | |
Q_OBJECT | |
Q_PROPERTY(...) | |
Q_REVISION | |
Q_SET_OBJECT_NAME(Object) | |
Q_SIGNAL | |
Q_SIGNALS | |
Q_SLOT | |
Q_SLOTS |
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from QObject
- 5 static public members inherited from QObject
- 8 protected functions inherited from QObject
Detailed Description
QBluetoothLocalDevice provides functions for getting and setting the state of local Bluetooth devices.
On iOS and Windows, this class cannot be used because the platform does not expose any data or API which may provide information on the local Bluetooth device.
Member Type Documentation
enum QBluetoothLocalDevice::Error
This enum describes errors that maybe returned
Constant | Value | Description |
---|---|---|
QBluetoothLocalDevice::NoError | 0 | No known error |
QBluetoothLocalDevice::PairingError | 1 | Error in pairing |
QBluetoothLocalDevice::UnknownError | 100 | Unknown error |
enum QBluetoothLocalDevice::HostMode
This enum describes the most of the local Bluetooth device.
Constant | Value | Description |
---|---|---|
QBluetoothLocalDevice::HostPoweredOff | 0 | Power off the device |
QBluetoothLocalDevice::HostConnectable | 1 | Remote Bluetooth devices can connect to the local Bluetooth device if they have previously been paired with it or otherwise know its address. This powers up the device if it was powered off. |
QBluetoothLocalDevice::HostDiscoverable | 2 | Remote Bluetooth devices can discover the presence of the local Bluetooth device. The device will also be connectable, and powered on. On Android, this mode can only be active for a maximum of 5 minutes. |
QBluetoothLocalDevice::HostDiscoverableLimitedInquiry | 3 | Remote Bluetooth devices can discover the presence of the local Bluetooth device when performing a limited inquiry. This should be used for locating services that are only made discoverable for a limited period of time. This can speed up discovery between gaming devices, as service discovery can be skipped on devices not in LimitedInquiry mode. In this mode, the device will be connectable and powered on, if required. This mode is is not supported on Android. On macOS, it is not possible to set the hostMode() to HostConnectable or HostPoweredOff. |
enum QBluetoothLocalDevice::Pairing
This enum describes the pairing state between the two Bluetooth devices.
Constant | Value | Description |
---|---|---|
QBluetoothLocalDevice::Unpaired | 0 | The Bluetooth devices are not paired. |
QBluetoothLocalDevice::Paired | 1 | The Bluetooth devices are paired. The system will prompt the user for authorization when the remote device initiates a connection to the local device. |
QBluetoothLocalDevice::AuthorizedPaired | 2 | The Bluetooth devices are paired. The system will not prompt the user for authorization when the remote device initiates a connection to the local device. |
Member Function Documentation
[virtual]
QBluetoothLocalDevice::~QBluetoothLocalDevice()
Destroys the QBluetoothLocalDevice.
bool QBluetoothLocalDevice::isValid() const
Returns true
if the QBluetoothLocalDevice represents an available local Bluetooth device; otherwise return false.
If the local Bluetooth adapter represented by an instance of this class is removed from the system (e.g. removal of the underlying Bluetooth dongle) then this instance will become invalid. An already invalid QBluetoothLocalDevice instance remains invalid even if the same Bluetooth adapter is returned to the system.
See also allDevices().