summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/lowenergyscanner')
-rw-r--r--examples/bluetooth/lowenergyscanner/characteristicinfo.cpp3
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp4
2 files changed, 4 insertions, 3 deletions
diff --git a/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
index 58f91f5d..f64ddf79 100644
--- a/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
+++ b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
@@ -76,7 +76,8 @@ QString CharacteristicInfo::getName() const
return name;
// find descriptor with CharacteristicUserDescription
- foreach (const QLowEnergyDescriptor &descriptor, m_characteristic.descriptors()) {
+ const QList<QLowEnergyDescriptor> descriptors = m_characteristic.descriptors();
+ for (const QLowEnergyDescriptor &descriptor : descriptors) {
if (descriptor.type() == QBluetoothUuid::CharacteristicUserDescription) {
name = descriptor.value();
break;
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 2ae30c16..cfbf4596 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -256,7 +256,7 @@ void Device::connectToService(const QString &uuid)
//discovery already done
const QList<QLowEnergyCharacteristic> chars = service->characteristics();
- foreach (const QLowEnergyCharacteristic &ch, chars) {
+ for (const QLowEnergyCharacteristic &ch : chars) {
CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
m_characteristics.append(cInfo);
}
@@ -326,7 +326,7 @@ void Device::serviceDetailsDiscovered(QLowEnergyService::ServiceState newState)
//! [les-chars]
const QList<QLowEnergyCharacteristic> chars = service->characteristics();
- foreach (const QLowEnergyCharacteristic &ch, chars) {
+ for (const QLowEnergyCharacteristic &ch : chars) {
CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
m_characteristics.append(cInfo);
}