diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:01 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-10-17 09:42:13 +0200 |
commit | fc2a206322f6190226ebc1f04062f2c9170f0bac (patch) | |
tree | 7df8ca41816c24ccfa6e0c6add4612689a933bdd /examples/bluetooth/chat/chat.qml | |
parent | ca5490859338f28e30104668a353275d23df1ec6 (diff) | |
parent | 125cdccc346903d6e70ed26289cdaed85e26ec3f (diff) |
Merge remote-tracking branch 'gerrit/dev' into btle
Change-Id: Ia1cbaac9774ce2bc1b6972c02bad34fa593d40ff
Diffstat (limited to 'examples/bluetooth/chat/chat.qml')
-rw-r--r-- | examples/bluetooth/chat/chat.qml | 25 |
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] |