diff options
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] |