summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2014-11-10 10:46:57 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2014-11-11 13:00:56 +0100
commitb299a75a1d90dfd44c0f11ad75665c087c9ea120 (patch)
tree194b3ff27ef599a6a88c2ad0a5ea57f8e1326b06 /examples/bluetooth
parenta1cb63d9c2b3a183a0f4afd97837d1ddd6497977 (diff)
More lowenergyscanner example fixes.
This fixes a UI display bug and a hanging UI when the service discovery aborts with an error. Change-Id: Ic84d7b885d777360c8f1396e3973623c1d2c550a Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'examples/bluetooth')
-rw-r--r--examples/bluetooth/lowenergyscanner/assets/Dialog.qml2
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp13
2 files changed, 13 insertions, 2 deletions
diff --git a/examples/bluetooth/lowenergyscanner/assets/Dialog.qml b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml
index 2b8580f3..190e6b90 100644
--- a/examples/bluetooth/lowenergyscanner/assets/Dialog.qml
+++ b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml
@@ -42,7 +42,7 @@ import QtQuick 2.0
Rectangle {
width: parent.width/3*2
- height: 62
+ height: dialogTextId.height + background.height + 20
z: 50
property string dialogText: ""
property bool busyImage: true
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 1f1e11c4..b9c8b532 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -290,13 +290,24 @@ void Device::deviceDisconnected()
void Device::serviceDetailsDiscovered(QLowEnergyService::ServiceState newState)
{
- if (newState != QLowEnergyService::ServiceDiscovered)
+ if (newState != QLowEnergyService::ServiceDiscovered) {
+ // do not hang in "Scanning for characteristics" mode forever
+ // in case the service discovery failed
+ // We have to queue the signal up to give UI time to even enter
+ // the above mode
+ if (newState != QLowEnergyService::DiscoveringServices) {
+ QMetaObject::invokeMethod(this, "characteristicsUpdated",
+ Qt::QueuedConnection);
+ }
return;
+ }
QLowEnergyService *service = qobject_cast<QLowEnergyService *>(sender());
if (!service)
return;
+
+
//! [les-chars]
const QList<QLowEnergyCharacteristic> chars = service->characteristics();
foreach (const QLowEnergyCharacteristic &ch, chars) {