Class BluetoothDeviceModel
ClassList > BluetoothDeviceModel
#include <bluetoothdevicemodel.h>
Inherits the following classes: QAbstractListModel
Public Types
| Type | Name |
|---|---|
| enum | BluetoothDeviceRoles The roles provided by this model. |
| enum | ScanningStatus The status telling the result of the scanning. |
Public Properties
| Type | Name |
|---|---|
| property QString | lastError |
| property ScanningStatus | scanningStatus |
Public Signals
| Type | Name |
|---|---|
| signal void | lastErrorChanged (QString lastError) |
| signal void | scanningStatusChanged (ScanningStatus scanningStatus) |
Public Functions
| Type | Name |
|---|---|
| BluetoothDeviceModel (QObject * parent=nullptr) |
|
| Q_INVOKABLE int | addDevice (const QString & name, const QString & address) |
| QVariant | data (const QModelIndex & index, int role=Qt::DisplayRole) override const |
| Q_INVOKABLE int | findIndexFromAddress (const QString & address) const |
| QString | lastError () const |
| QHash< int, QByteArray > | roleNames () override const |
| int | rowCount (const QModelIndex & parent=QModelIndex()) override const |
| ScanningStatus | scanningStatus () const |
| Q_INVOKABLE void | startServiceDiscovery () |
| Q_INVOKABLE void | stopServiceDiscovery () |
| ~BluetoothDeviceModel () |
Detailed Description
A model that provides all paired bluetooth devices name/address that are accessible over the serial port.
Public Types Documentation
enum BluetoothDeviceRoles
The roles provided by this model.
enum BluetoothDeviceModel::BluetoothDeviceRoles {
DeviceAddressRole = Qt::UserRole + 1,
DeviceNameRole
};
enum ScanningStatus
The status telling the result of the scanning.
enum BluetoothDeviceModel::ScanningStatus {
FastScanning,
FullScanning,
Succeeded,
Failed,
Canceled,
NoStatus
};
Public Properties Documentation
property lastError [1/2]
QString BluetoothDeviceModel::lastError;
property scanningStatus [1/2]
ScanningStatus BluetoothDeviceModel::scanningStatus;
Public Signals Documentation
signal lastErrorChanged
void BluetoothDeviceModel::lastErrorChanged;
signal scanningStatusChanged
void BluetoothDeviceModel::scanningStatusChanged;
Public Functions Documentation
function BluetoothDeviceModel
explicit BluetoothDeviceModel::BluetoothDeviceModel (
QObject * parent=nullptr
)
function addDevice
Q_INVOKABLE int BluetoothDeviceModel::addDevice (
const QString & name,
const QString & address
)
Adds a Bluetooth device if not already in the model
Parameters:
namefriendly device name used as identifier in the user interfaceaddressBluetooth address of the device
Returns:
returns index of the Bluetooth device
function data
QVariant BluetoothDeviceModel::data (
const QModelIndex & index,
int role=Qt::DisplayRole
) override const
function findIndexFromAddress
Q_INVOKABLE int BluetoothDeviceModel::findIndexFromAddress (
const QString & address
) const
Returns the row index for a given Bluetooth device address
function lastError [2/2]
inline QString BluetoothDeviceModel::lastError () const
function roleNames
QHash< int, QByteArray > BluetoothDeviceModel::roleNames () override const
function rowCount
int BluetoothDeviceModel::rowCount (
const QModelIndex & parent=QModelIndex()
) override const
function scanningStatus [2/2]
inline ScanningStatus BluetoothDeviceModel::scanningStatus () const
function startServiceDiscovery
Q_INVOKABLE void BluetoothDeviceModel::startServiceDiscovery ()
Starts a scan to discover nearby Bluetooth devices, sequentially going through a fast scan then a full, deeper scan for devices.
function stopServiceDiscovery
Q_INVOKABLE void BluetoothDeviceModel::stopServiceDiscovery ()
Stops any ongoing scan to discover nearby Bluetooth devices.
function ~BluetoothDeviceModel
BluetoothDeviceModel::~BluetoothDeviceModel ()
The documentation for this class was generated from the following file src/core/positioning/bluetoothdevicemodel.h