diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2016-10-31 15:33:07 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2016-11-01 12:06:05 +0000 |
commit | 18fa398709f28772747008fda5f6d5fa0c11f34e (patch) | |
tree | 1351ea52bc61690441d0b97710bb7c5f0941d208 | |
parent | b825e8e5703c12902112fd96285a81c6f2824f96 (diff) |
winrt: Avoid unnecessary asserts in LowEnergyController
We do not want to assert when a user tries to write an invalid value.
Setting the correct error and returning early is the proper way to
handle this situation.
Change-Id: Ia358023ed186bc4b7c5be0e6319182dbe563f576
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index 868cadb3..10eef246 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -968,7 +968,9 @@ void QLowEnergyControllerPrivate::writeDescriptor( } else if (intValue == 0) { value = GattClientCharacteristicConfigurationDescriptorValue_None; } else { - Q_ASSERT(false); + qCDebug(QT_BT_WINRT) << "Descriptor" << descHandle << "write operation failed: Invalid value"; + service->setError(QLowEnergyService::DescriptorWriteError); + return S_OK; } ComPtr<IAsyncOperation<enum GattCommunicationStatus>> writeOp; HRESULT hr = characteristic->WriteClientCharacteristicConfigurationDescriptorAsync(value, &writeOp); |