diff options
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/assets')
-rw-r--r-- | examples/bluetooth/lowenergyscanner/assets/Characteristics.qml | 26 | ||||
-rw-r--r-- | examples/bluetooth/lowenergyscanner/assets/Services.qml | 23 |
2 files changed, 33 insertions, 16 deletions
diff --git a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml index ef1538ab..4a7db471 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml @@ -54,12 +54,23 @@ Rectangle { Dialog { id: info anchors.centerIn: parent - visible: false + visible: true + dialogText: "Scanning for characteristics..."; } - Component.onCompleted: { - info.visible = true; - info.dialogText = "Scanning for characteristics..."; + Connections { + target: device + onCharacteristicsUpdated: { + menu.menuText = "Back" + if (characteristicview.count === 0) + info.dialogText = "No characteristic found" + else + info.visible = false; + } + + onDisconnected: { + pageLoader.source = "main.qml" + } } ListView { @@ -80,11 +91,6 @@ Rectangle { border.color: "black" radius: 5 - Component.onCompleted: { - menu.menuText = "Back" - info.visible = false - } - Label { id: characteristicName textContent: modelData.characteristicName @@ -132,7 +138,7 @@ Rectangle { id: menu anchors.bottom: parent.bottom menuWidth: parent.width - menuText: device.update + menuText: "Scanning" menuHeight: (parent.height/6) onButtonClick: { pageLoader.source = "Services.qml" diff --git a/examples/bluetooth/lowenergyscanner/assets/Services.qml b/examples/bluetooth/lowenergyscanner/assets/Services.qml index de3eb187..361f14c1 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Services.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Services.qml @@ -54,12 +54,22 @@ Rectangle { Dialog { id: info anchors.centerIn: parent - visible: false + visible: true + dialogText: "Scanning for services..."; } - Component.onCompleted: { - info.visible = true; - info.dialogText = "Scanning for services..."; + Connections { + target: device + onServicesUpdated: { + if (servicesview.count === 0) + info.dialogText = "No services found" + else + info.visible = false; + } + + onDisconnected: { + pageLoader.source = "main.qml" + } } ListView { @@ -78,7 +88,9 @@ Rectangle { border.color: "black" radius: 5 width: parent.width - Component.onCompleted: info.visible = false + Component.onCompleted: { + info.visible = false + } MouseArea { anchors.fill: parent @@ -113,7 +125,6 @@ Rectangle { menuHeight: (parent.height/6) onButtonClick: { device.disconnectFromDevice() - pageLoader.source = "main.qml" } } } |