summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/chat/chat.qml
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-10-17 09:42:01 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-10-17 09:42:13 +0200
commitfc2a206322f6190226ebc1f04062f2c9170f0bac (patch)
tree7df8ca41816c24ccfa6e0c6add4612689a933bdd /examples/bluetooth/chat/chat.qml
parentca5490859338f28e30104668a353275d23df1ec6 (diff)
parent125cdccc346903d6e70ed26289cdaed85e26ec3f (diff)
Merge remote-tracking branch 'gerrit/dev' into btle
Diffstat (limited to 'examples/bluetooth/chat/chat.qml')
-rw-r--r--examples/bluetooth/chat/chat.qml25
1 files changed, 21 insertions, 4 deletions
diff --git a/examples/bluetooth/chat/chat.qml b/examples/bluetooth/chat/chat.qml
index ecac39fc..eee29789 100644
--- a/examples/bluetooth/chat/chat.qml
+++ b/examples/bluetooth/chat/chat.qml
@@ -53,7 +53,7 @@ Item {
BluetoothDiscoveryModel {
id: btModel
running: true
- discoveryMode: BluetoothDiscoveryModel.MinimalServiceDiscovery
+ discoveryMode: BluetoothDiscoveryModel.FullServiceDiscovery
//! [BtDiscoveryModel-1]
onRunningChanged : {
if (!btModel.running && top.state == "begin" && !serviceFound) {
@@ -81,7 +81,7 @@ Item {
}
//! [BtDiscoveryModel-2]
//! [BtDiscoveryModel-3]
- uuidFilter: "e8e10f95-1a70-4b27-9ccf-02010264e9c8"
+ uuidFilter: targetUuid //e8e10f95-1a70-4b27-9ccf-02010264e9c8
}
//! [BtDiscoveryModel-3]
@@ -91,8 +91,24 @@ Item {
connected: true
onSocketStateChanged: {
- console.log("Connected to server")
- top.state = "chatActive"
+ switch (socketState) {
+ case BluetoothSocket.Unconnected:
+ case BluetoothSocket.NoServiceSet:
+ searchBox.animationRunning = false;
+ searchBox.setText("\nNo connection. \n\nPlease restart app.");
+ top.state = "begin";
+ break;
+ case BluetoothSocket.Connected:
+ console.log("Connected to server ");
+ top.state = "chatActive"; // move to chat UI
+ break;
+ case BluetoothSocket.Connecting:
+ case BluetoothSocket.ServiceLookup:
+ case BluetoothSocket.Closing:
+ case BluetoothSocket.Listening:
+ case BluetoothSocket.Bound:
+ break;
+ }
}
//! [BluetoothSocket-1]
//! [BluetoothSocket-3]
@@ -107,6 +123,7 @@ Item {
}
//! [BluetoothSocket-4]
//! [BluetoothSocket-2]
+ //...
}
//! [BluetoothSocket-2]