diff options
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index 10eef246..a39078df 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -329,10 +329,12 @@ void QLowEnergyControllerPrivate::connectToDevice() HRESULT hr; hr = dev->get_ConnectionStatus(&status); Q_ASSERT_SUCCEEDED(hr); - if (status == BluetoothConnectionStatus::BluetoothConnectionStatus_Connected) { + if (state == QLowEnergyController::ConnectingState + && status == BluetoothConnectionStatus::BluetoothConnectionStatus_Connected) { setState(QLowEnergyController::ConnectedState); emit q->connected(); - } else if (status == BluetoothConnectionStatus::BluetoothConnectionStatus_Disconnected) { + } else if (state == QLowEnergyController::ConnectedState + && status == BluetoothConnectionStatus::BluetoothConnectionStatus_Disconnected) { setState(QLowEnergyController::UnconnectedState); emit q->disconnected(); } |