summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/doc
diff options
context:
space:
mode:
authorAndreas Buhr <andreas@andreasbuhr.de>2021-02-26 14:54:33 +0100
committerAndreas Buhr <andreas@andreasbuhr.de>2021-03-11 13:01:51 +0100
commit66bb9839dbccea311cbb85168da86fb6d4a2d136 (patch)
treec9b535e4de503c0a2e0f998203bb6f94fcddf3ce /src/bluetooth/doc
parent61e2bab1d06f3f460f382f911bfd23edaef124e7 (diff)
Use scoped enum for constants in QBluetoothUuid
QBluetoothUuid contains enums for ProtocolUuid, ServiceClassUuid, CharacteristicType and DescriptorType. So far, they all put their constants directly into the QBluetoothUuid namespace, making it easy to mix them up. This patch changes those to scoped enums. That way, each enum has its items in its own namespace. Change-Id: I86ea08ff31009dc8073d84cfe678e27920d693f7 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/doc')
-rw-r--r--src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp10
-rw-r--r--src/bluetooth/doc/src/bluetooth-le-overview.qdoc6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
index 870f7cdf..a571de32 100644
--- a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
+++ b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp
@@ -170,8 +170,8 @@ void MyClass::btleSharedData()
// waiting for connection
- first = control.createServiceObject(QBluetoothUuid::BatteryService);
- second = control.createServiceObject(QBluetoothUuid::BatteryService);
+ first = control.createServiceObject(QBluetoothUuid::ServiceClassUuid::BatteryService);
+ second = control.createServiceObject(QBluetoothUuid::ServiceClassUuid::BatteryService);
Q_ASSERT(first->state() == QLowEnergyService::DiscoveryRequired);
Q_ASSERT(first->state() == second->state());
@@ -190,7 +190,7 @@ void MyClass::enableCharNotifications()
control->connectToDevice();
- service = control->createServiceObject(QBluetoothUuid::BatteryService, this);
+ service = control->createServiceObject(QBluetoothUuid::ServiceClassUuid::BatteryService, this);
if (!service)
return;
@@ -201,12 +201,12 @@ void MyClass::enableCharNotifications()
//! [enable_btle_notifications]
//PreCondition: service details already discovered
QLowEnergyCharacteristic batteryLevel = service->characteristic(
- QBluetoothUuid::BatteryLevel);
+ QBluetoothUuid::CharacteristicType::BatteryLevel);
if (!batteryLevel.isValid())
return;
QLowEnergyDescriptor notification = batteryLevel.descriptor(
- QBluetoothUuid::ClientCharacteristicConfiguration);
+ QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration);
if (!notification.isValid())
return;
diff --git a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc
index aa89745a..7b83316d 100644
--- a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc
+++ b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc
@@ -203,7 +203,7 @@ Low Energy devices.
The \c serviceDiscovered() slot below is triggered as a result of the
\l {QLowEnergyController::serviceDiscovered()} signal and provides an intermittent progress report.
Since we are talking about the heart listener app which monitors HeartRate devices in the vicinity
- we ignore any service that is not of type \l QBluetoothUuid::HeartRate.
+ we ignore any service that is not of type \l QBluetoothUuid::ServiceClassUuid::HeartRate.
\snippet heartrate-game/devicehandler.cpp Filter HeartRate service 1
@@ -225,12 +225,12 @@ Low Energy devices.
\section2 Interaction with the Peripheral Device
In the code example above, the desired characteristic is of type
- \l {QBluetoothUuid::HeartRateMeasurement}{HeartRateMeasurement}. Since the application measures
+ \l {QBluetoothUuid::CharacteristicType::HeartRateMeasurement}{HeartRateMeasurement}. Since the application measures
the heart rate changes, it must enable change notifications for the characteristic.
Note that not all characteristics provide change notifications. Since the HeartRate characteristic
has been standardized it is possible to assume that notifications can be received. Ultimately
\l QLowEnergyCharacteristic::properties() must have the \l {QLowEnergyCharacteristic::Notify} flag
- set and a descriptor of type \l {QBluetoothUuid::ClientCharacteristicConfiguration} must exist to confirm
+ set and a descriptor of type \l {QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration} must exist to confirm
the availability of an appropriate notification.
Finally, we process the value of the HeartRate characteristic, as per Bluetooth Low Energy standard: