diff options
author | Lubomir I. Ivanov (VMware) <neolit123@gmail.com> | 2018-07-15 23:55:29 +0300 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-08-01 11:18:21 +0000 |
commit | 922e37e25b8d361597f1764a71baf75b340d8cf4 (patch) | |
tree | 537e6419384a42317b8ba53dd186f25dfd04c46c /src/bluetooth/qlowenergyserviceprivate_p.h | |
parent | 2a382272a4b6891d4603e1cb9f2d357b374d7a74 (diff) |
win32-ble: store service handles until a service is destroyed
Recently, a problem was discovered that adding event registration
on a descriptor does not work because the associated service handle
is closed right after. For events to work a service should remain
open if an event is registered for it.
Store service handles (hService) is QLowEnergyServicePrivate.
A handle is opened by
QLowEnergyControllerPrivateWin32::discoverServiceDetails()
and remains open until the device is disconnected.
This removes the need to open/close services each time a Write/Read
operation is performed on GATT characteristics / descriptors.
Move the creation of the worker thread to connectToDevice().
Quit the thread in disconnectFromDevice() and also close any
open service handles.
Change-Id: Ia634af2e4225f5c1be93b0ddd17639c2dbd70c21
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergyserviceprivate_p.h')
-rw-r--r-- | src/bluetooth/qlowenergyserviceprivate_p.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h index 26ca56f6..35c8de7e 100644 --- a/src/bluetooth/qlowenergyserviceprivate_p.h +++ b/src/bluetooth/qlowenergyserviceprivate_p.h @@ -60,6 +60,9 @@ #if defined(QT_ANDROID_BLUETOOTH) #include <QtAndroidExtras/QAndroidJniObject> #endif +#if defined(QT_WIN_BLUETOOTH) +#include <qt_windows.h> +#endif QT_BEGIN_NAMESPACE @@ -131,6 +134,9 @@ public: // reference to the BluetoothGattService object QAndroidJniObject androidService; #endif +#if defined(QT_WIN_BLUETOOTH) + Qt::HANDLE hService = nullptr; +#endif }; |