diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2019-03-19 10:40:06 +0100 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2019-03-25 10:20:31 +0000 |
commit | 8d513a3a2006efd3e0ca20110e2c4b82045dbfe9 (patch) | |
tree | e8781d36d0ed08da5720b64eb4d126d8939ed5d0 /src/bluetooth | |
parent | 4747a72d9a69f53760793ce0c0bb0154e43eca45 (diff) |
winrt: Fix deprecation warning
IGattCharacteristic::GetAllDescriptor is deprecated and thus should not
be used. As we are calling GetDescriptorsAsync anyways and are inside
the Completed callback of that function we should use its result
anyways.
Change-Id: I362f860d66da75dd899ed89604e426952ce9fe1b
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt_new.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt_new.cpp b/src/bluetooth/qlowenergycontroller_winrt_new.cpp index 95acfbb9..42451e35 100644 --- a/src/bluetooth/qlowenergycontroller_winrt_new.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt_new.cpp @@ -200,7 +200,8 @@ public slots: Q_ASSERT_SUCCEEDED(hr); hr = descAsyncResult->put_Completed( Callback<IAsyncOperationCompletedHandler<GattDescriptorsResult*>>( - [this, characteristic](IAsyncOperation<GattDescriptorsResult*> *, AsyncStatus status) { + [this, characteristic](IAsyncOperation<GattDescriptorsResult *> *op, + AsyncStatus status) { if (status != AsyncStatus::Completed) { qCDebug(QT_BT_WINRT) << "Could not obtain descriptors"; return S_OK; @@ -237,14 +238,12 @@ public slots: ComPtr<IVectorView<GattDescriptor *>> descriptors; - ComPtr<IGattCharacteristic2> characteristic2; - hr = characteristic.As(&characteristic2); + ComPtr<IGattDescriptorsResult> result; + hr = op->GetResults(&result); Q_ASSERT_SUCCEEDED(hr); - - hr = characteristic2->GetAllDescriptors(&descriptors); + hr = result->get_Descriptors(&descriptors); Q_ASSERT_SUCCEEDED(hr); - uint descriptorCount; hr = descriptors->get_Size(&descriptorCount); Q_ASSERT_SUCCEEDED(hr); |