BluetoothDevice Class

The BluetoothDevice class controls Bluetooth settings. More...

Header: #include <BluetoothDevice>
qmake: QT += bluetoothsettings
Inherits: QObject

Properties

Public Functions

BluetoothDevice(QObject *parent = Q_NULLPTR)
bool available() const
DiscoveryModel *deviceModel() const
bool powered() const
void requestConnect(const QString &address)
void requestDisconnect(const QString &address)
void requestPairing(const QString &address)
bool scanning() const
void setPowered(const bool &aPowered)
void setScanning(const bool &aScan)

Signals

Detailed Description

The Bluetooth settings contain information about the local Bluetooth device, such as the device model and whether the device is powered on and available for connections with other Bluetooth devices.

The Bluetooth device can scan for other Bluetooth devices in range and retrieve information about them. The Bluetooth device then uses the address of another device to attempt pairing to it, and connects to it if the pairing was successful.

Property Documentation

available : const bool

This property holds whether the Bluetooth device is available.

Access functions:

bool available() const

Notifier signal:

void availabilityChanged()

deviceModel : DiscoveryModel* const

This property holds the model of the Bluetooth device.

Access functions:

DiscoveryModel *deviceModel() const

powered : bool

This property holds whether the power in the Bluetooth device is on or off.

Access functions:

bool powered() const
void setPowered(const bool &aPowered)

Notifier signal:

void poweredChanged()

scanning : bool

This property holds whether the Bluetooth device is scanning for remote devices.

Access functions:

bool scanning() const
void setScanning(const bool &aScan)

Notifier signal:

void scanningChanged()

Member Function Documentation

BluetoothDevice::BluetoothDevice(QObject *parent = Q_NULLPTR)

Creates a new Bluetooth device with the parent parent.

bool BluetoothDevice::available() const

Returns the availability of the Bluetooth device.

Note: Getter function for property available.

DiscoveryModel *BluetoothDevice::deviceModel() const

Returns the model of the Bluetooth device.

Note: Getter function for property deviceModel.

bool BluetoothDevice::powered() const

Returns true if the power is switched on in the Bluetooth device.

Note: Getter function for property powered.

See also setPowered().

void BluetoothDevice::requestConnect(const QString &address)

Connects to the remote device specified by address.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

void BluetoothDevice::requestDisconnect(const QString &address)

Disconnects from the remote device specified by address.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

void BluetoothDevice::requestPairing(const QString &address)

Starts the process of pairing to a remote device specified by address, and connects to it if the pairing was successful.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

See also requestConnect.

bool BluetoothDevice::scanning() const

Returns whether the Bluetooth device is scanning for remote devices.

Note: Getter function for property scanning.

See also setScanning().

void BluetoothDevice::setPowered(const bool &aPowered)

Sets the powered state in the Bluetooth device to aPowered.

Note: Setter function for property powered.

See also powered().

void BluetoothDevice::setScanning(const bool &aScan)

Sets scanning in the Bluetooth device to aScan.

Note: Setter function for property scanning.

See also scanning().

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.