diff options
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_winrt.cpp')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index abe3392a..5b14a92c 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -260,14 +260,22 @@ void QLowEnergyControllerPrivateWinRT::init() void QLowEnergyControllerPrivateWinRT::connectToDevice() { qCDebug(QT_BT_WINRT) << __FUNCTION__; - Q_Q(QLowEnergyController); if (remoteDevice.isNull()) { qWarning() << "Invalid/null remote device address"; setError(QLowEnergyController::UnknownRemoteDeviceError); return; } - setState(QLowEnergyController::ConnectingState); + // Queue the device connecting to happen in the background + QMetaObject::invokeMethod(this, + &QLowEnergyControllerPrivateWinRT::doConnectToDevice, + Qt::QueuedConnection); +} + +void QLowEnergyControllerPrivateWinRT::doConnectToDevice() +{ + qCDebug(QT_BT_WINRT) << __FUNCTION__; + Q_Q(QLowEnergyController); ComPtr<IBluetoothLEDeviceStatics> deviceStatics; HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice).Get(), &deviceStatics); |