From 02b415fe5d538645e95896eb70c9d38628388841 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 14 Nov 2014 20:02:16 +0300 Subject: Add discovering for BLE devices on Windows BLE devices are supported in Windows 8 and above. Windows has not public API to discovering/pairing of BLE devices. A user shall do it by means of standard "bluetooth" application which are inbox into Windows. Only after that there is an opportunity to display the discovered devices. Change-Id: Idd3d2949456a32c8c333744205755853aef80422 Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/bluetooth/windows/qwinlowenergybluetooth_p.h (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h new file mode 100644 index 00000000..aa9127a4 --- /dev/null +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Denis Shienkov +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtBluetooth module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINLOWENERGYBLUETOOTH_P_H +#define QWINLOWENERGYBLUETOOTH_P_H + +#include + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace WinLowEnergyBluetooth { + +struct DeviceInfo +{ + DeviceInfo(const QBluetoothAddress &address, + const QString &name, + const QString &systemPath); + QBluetoothAddress address; + QString name; + QString systemPath; +}; + +struct DeviceDiscoveryResult +{ + DeviceDiscoveryResult(); + QList devices; + DWORD error; +}; + +bool hasLocalRadio(); + +DeviceDiscoveryResult startDiscoveryOfRemoteDevices(); + +} // namespace WinLowEnergyBluetooth + +QT_END_NAMESPACE + +#endif // QWINLOWENERGYBLUETOOTH_P_H -- cgit v1.2.3 From ee9a7a91abda21d66a3162da1273bbe1e69adf23 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 5 Dec 2014 13:50:18 +0300 Subject: Add native wrapper for BLE API on Windows Wrapper trying to resolve of the BLE functions from the "bluetoothapis.dll" library in runtime. It is necessary by the following reasons: 1) MinGW has not necessary headers. 2) MSVC has incorrect sequence of headers that lead to compilation errors. 3) BLE supports beginning from Windows 8 and above, thus the function isSupported() just returns false for lower versions of Windows. Change-Id: I19254779227e045241f14b152dcb5fe5ac0ccd5e Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 111 +++++++++++++++++++++++ 1 file changed, 111 insertions(+) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index aa9127a4..d7987966 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -46,6 +46,116 @@ QT_BEGIN_NAMESPACE namespace WinLowEnergyBluetooth { +#define BLUETOOTH_GATT_FLAG_NONE 0x00000000 +#define BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED 0x00000001 +#define BLUETOOTH_GATT_FLAG_CONNECTION_AUTHENTICATED 0x00000002 +#define BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE 0x00000004 +#define BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_CACHE 0x00000008 +#define BLUETOOTH_GATT_FLAG_SIGNED_WRITE 0x00000010 +#define BLUETOOTH_GATT_FLAG_WRITE_WITHOUT_RESPONSE 0x00000020 +#define BLUETOOTH_GATT_FLAG_RETURN_ALL 0x00000040 + +typedef enum _BTH_LE_GATT_DESCRIPTOR_TYPE { + CharacteristicExtendedProperties, + CharacteristicUserDescription, + ClientCharacteristicConfiguration, + ServerCharacteristicConfiguration, + CharacteristicFormat, + CharacteristicAggregateFormat, + CustomDescriptor +} BTH_LE_GATT_DESCRIPTOR_TYPE, *PBTH_LE_GATT_DESCRIPTOR_TYPE; + +typedef enum _BTH_LE_GATT_EVENT_TYPE { + CharacteristicValueChangedEvent +} BTH_LE_GATT_EVENT_TYPE; + +typedef struct _BTH_LE_UUID { + BOOLEAN IsShortUuid; + union { + USHORT ShortUuid; + GUID LongUuid; + } Value; +} BTH_LE_UUID, *PBTH_LE_UUID; + +typedef struct _BTH_LE_GATT_SERVICE { + BTH_LE_UUID ServiceUuid; + USHORT AttributeHandle; +} BTH_LE_GATT_SERVICE, *PBTH_LE_GATT_SERVICE; + +typedef struct _BTH_LE_GATT_CHARACTERISTIC { + USHORT ServiceHandle; + BTH_LE_UUID CharacteristicUuid; + USHORT AttributeHandle; + USHORT CharacteristicValueHandle; + BOOLEAN IsBroadcastable; + BOOLEAN IsReadable; + BOOLEAN IsWritable; + BOOLEAN IsWritableWithoutResponse; + BOOLEAN IsSignedWritable; + BOOLEAN IsNotifiable; + BOOLEAN IsIndicatable; + BOOLEAN HasExtendedProperties; +} BTH_LE_GATT_CHARACTERISTIC, *PBTH_LE_GATT_CHARACTERISTIC; + +typedef struct _BTH_LE_GATT_CHARACTERISTIC_VALUE { + ULONG DataSize; + UCHAR Data[1]; +} BTH_LE_GATT_CHARACTERISTIC_VALUE, *PBTH_LE_GATT_CHARACTERISTIC_VALUE; + +typedef struct _BTH_LE_GATT_DESCRIPTOR { + USHORT ServiceHandle; + USHORT CharacteristicHandle; + BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType; + BTH_LE_UUID DescriptorUuid; + USHORT AttributeHandle; +} BTH_LE_GATT_DESCRIPTOR, *PBTH_LE_GATT_DESCRIPTOR; + +typedef struct _BTH_LE_GATT_DESCRIPTOR_VALUE { + BTH_LE_GATT_DESCRIPTOR_TYPE DescriptorType; + BTH_LE_UUID DescriptorUuid; + union { + struct { + BOOLEAN IsReliableWriteEnabled; + BOOLEAN IsAuxiliariesWritable; + } CharacteristicExtendedProperties; + struct { + BOOLEAN IsSubscribeToNotification; + BOOLEAN IsSubscribeToIndication; + } ClientCharacteristicConfiguration; + struct { + BOOLEAN IsBroadcast; + } ServerCharacteristicConfiguration; + struct { + UCHAR Format; + UCHAR Exponent; + BTH_LE_UUID Unit; + UCHAR NameSpace; + BTH_LE_UUID Description; + } CharacteristicFormat; + }; + ULONG DataSize; + UCHAR Data[1]; +} BTH_LE_GATT_DESCRIPTOR_VALUE, *PBTH_LE_GATT_DESCRIPTOR_VALUE; + +typedef struct _BLUETOOTH_GATT_VALUE_CHANGED_EVENT { + USHORT ChangedAttributeHandle; + size_t CharacteristicValueDataSize; + PBTH_LE_GATT_CHARACTERISTIC_VALUE CharacteristicValue; +} BLUETOOTH_GATT_VALUE_CHANGED_EVENT, *PBLUETOOTH_GATT_VALUE_CHANGED_EVENT; + +typedef struct _BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION { + USHORT NumCharacteristics; + BTH_LE_GATT_CHARACTERISTIC Characteristics[1]; +} BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION, *PBLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION; + +typedef VOID (CALLBACK *PFNBLUETOOTH_GATT_EVENT_CALLBACK)( + BTH_LE_GATT_EVENT_TYPE EventType, + PVOID EventOutParameter, + PVOID Context + ); + +typedef ULONG64 BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, *PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT; + struct DeviceInfo { DeviceInfo(const QBluetoothAddress &address, @@ -63,6 +173,7 @@ struct DeviceDiscoveryResult DWORD error; }; +bool isSupported(); bool hasLocalRadio(); DeviceDiscoveryResult startDiscoveryOfRemoteDevices(); -- cgit v1.2.3 From fd96b0aa5ae37188f63e6bd1503024c1b5b3cf60 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Mon, 8 Dec 2014 19:47:03 +0300 Subject: Add discovering of primary GATT services on Windows It is still partially implemented where are discovered only the primary services UUID's. Change-Id: I2765a8f83be4716cfe875a2f7a3593ba1af211a4 Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index d7987966..cf83f331 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -36,6 +36,7 @@ #define QWINLOWENERGYBLUETOOTH_P_H #include +#include #include @@ -173,10 +174,18 @@ struct DeviceDiscoveryResult DWORD error; }; +struct ServicesDiscoveryResult +{ + ServicesDiscoveryResult(); + QVector services; + DWORD error; +}; + bool isSupported(); bool hasLocalRadio(); DeviceDiscoveryResult startDiscoveryOfRemoteDevices(); +ServicesDiscoveryResult startDiscoveryOfPrimaryServices(HANDLE hDevice); } // namespace WinLowEnergyBluetooth -- cgit v1.2.3 From e9be1330bad04c6afbc6894b621b68f3b32b696b Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 27 Feb 2015 10:56:30 +0100 Subject: Update Digia headers to QtCompany headers Change-Id: I07b67d4bd879994a480a70f4776d68256f51d736 Reviewed-by: Denis Shienkov Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index cf83f331..08a99b38 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2014 Denis Shienkov -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtBluetooth module of the Qt Toolkit. ** @@ -11,9 +11,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -24,8 +24,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ -- cgit v1.2.3 From c18927e87e65eefccd8cda9e6671d234e95d387c Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 13 Oct 2015 17:18:15 +0300 Subject: Windows: Refactor code related to discovering of a remote devices * There is no need to do parallel scan for LE and Classic devices. It is enough to do it one after another by using one QFutureWatcher instead of two QFutureWatchers. * Now the qwinclassicbluetooth(h).cpp files are deleted from the 'windows' directory, and its related code is moved into QBluetoothDeviceDiscoveryAgentPrivate. Change-Id: I2acf102c3a8d313d078b351e9a2ce54ebca79dee Reviewed-by: Timur Pocheptsov --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index 08a99b38..adc8650e 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -157,23 +157,6 @@ typedef VOID (CALLBACK *PFNBLUETOOTH_GATT_EVENT_CALLBACK)( typedef ULONG64 BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, *PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT; -struct DeviceInfo -{ - DeviceInfo(const QBluetoothAddress &address, - const QString &name, - const QString &systemPath); - QBluetoothAddress address; - QString name; - QString systemPath; -}; - -struct DeviceDiscoveryResult -{ - DeviceDiscoveryResult(); - QList devices; - DWORD error; -}; - struct ServicesDiscoveryResult { ServicesDiscoveryResult(); @@ -184,7 +167,6 @@ struct ServicesDiscoveryResult bool isSupported(); bool hasLocalRadio(); -DeviceDiscoveryResult startDiscoveryOfRemoteDevices(); ServicesDiscoveryResult startDiscoveryOfPrimaryServices(HANDLE hDevice); } // namespace WinLowEnergyBluetooth -- cgit v1.2.3 From e624e7e63c6ac2b330720fea465b05190c70023b Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 14 Oct 2015 12:41:24 +0300 Subject: Windows: Removal of dead code Change-Id: I6d9c681dec978e507373c703784111cdf6808d2f Reviewed-by: Timur Pocheptsov --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index adc8650e..c591a93d 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -165,7 +165,6 @@ struct ServicesDiscoveryResult }; bool isSupported(); -bool hasLocalRadio(); ServicesDiscoveryResult startDiscoveryOfPrimaryServices(HANDLE hDevice); -- cgit v1.2.3 From 4cb5575e9ce38f74c471bbecde139bf4f83fa22f Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 14 Oct 2015 18:49:15 +0300 Subject: Windows: Refactor code related to a services discovering * We do not need QtConcurrent for a services discovering because they returns from a cache immediately. * We don't need to hold the opened device all the time after connection to it. It is enough to open a device only for a some time to request of services. * Now the windows/qwinlowenergybluetooth_p.h file contains only resolved system LE functions and data types. Change-Id: I248666d78cc9141bf987987dfd5dd9280decf4b8 Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 77 +++++++++++++++++------- 1 file changed, 56 insertions(+), 21 deletions(-) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index c591a93d..c12ea4ae 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -35,17 +35,9 @@ #ifndef QWINLOWENERGYBLUETOOTH_P_H #define QWINLOWENERGYBLUETOOTH_P_H -#include -#include - -#include +#include #include -#include - -QT_BEGIN_NAMESPACE - -namespace WinLowEnergyBluetooth { #define BLUETOOTH_GATT_FLAG_NONE 0x00000000 #define BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED 0x00000001 @@ -157,19 +149,62 @@ typedef VOID (CALLBACK *PFNBLUETOOTH_GATT_EVENT_CALLBACK)( typedef ULONG64 BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, *PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT; -struct ServicesDiscoveryResult +#define DEFINEFUNC(ret, func, ...) \ + typedef ret (WINAPI *fp_##func)(__VA_ARGS__); \ + static fp_##func func; + +#define RESOLVEFUNC(func) \ + func = (fp_##func)resolveFunction(library, #func); \ + if (!func) \ + return false; + +DEFINEFUNC(HRESULT, BluetoothGATTGetServices, HANDLE, USHORT, PBTH_LE_GATT_SERVICE, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTGetIncludedServices, HANDLE, PBTH_LE_GATT_SERVICE, USHORT, PBTH_LE_GATT_SERVICE, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTGetCharacteristics, HANDLE, PBTH_LE_GATT_SERVICE, USHORT, PBTH_LE_GATT_CHARACTERISTIC, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTGetDescriptors, HANDLE, PBTH_LE_GATT_CHARACTERISTIC, USHORT, PBTH_LE_GATT_DESCRIPTOR, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTGetCharacteristicValue, HANDLE, PBTH_LE_GATT_CHARACTERISTIC, ULONG, PBTH_LE_GATT_CHARACTERISTIC_VALUE, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTGetDescriptorValue, HANDLE, PBTH_LE_GATT_DESCRIPTOR, ULONG, PBTH_LE_GATT_DESCRIPTOR_VALUE, PUSHORT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTBeginReliableWrite, HANDLE, PBTH_LE_GATT_RELIABLE_WRITE_CONTEXT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTEndReliableWrite, HANDLE, BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTAbortReliableWrite, HANDLE, BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTSetCharacteristicValue, HANDLE, PBTH_LE_GATT_CHARACTERISTIC, PBTH_LE_GATT_CHARACTERISTIC_VALUE, BTH_LE_GATT_RELIABLE_WRITE_CONTEXT, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTSetDescriptorValue, HANDLE, PBTH_LE_GATT_DESCRIPTOR, PBTH_LE_GATT_DESCRIPTOR_VALUE, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTRegisterEvent, HANDLE, BTH_LE_GATT_EVENT_TYPE, PVOID, PFNBLUETOOTH_GATT_EVENT_CALLBACK, PVOID, PHANDLE, ULONG) +DEFINEFUNC(HRESULT, BluetoothGATTUnregisterEvent, HANDLE, ULONG) + +static inline QFunctionPointer resolveFunction(QLibrary *library, const char *func) { - ServicesDiscoveryResult(); - QVector services; - DWORD error; -}; - -bool isSupported(); + QFunctionPointer symbolFunctionPointer = library->resolve(func); + if (!symbolFunctionPointer) + qWarning("Cannot resolve '%s' in '%s'.", func, qPrintable(library->fileName())); + return symbolFunctionPointer; +} -ServicesDiscoveryResult startDiscoveryOfPrimaryServices(HANDLE hDevice); - -} // namespace WinLowEnergyBluetooth - -QT_END_NAMESPACE +static inline bool resolveFunctions(QLibrary *library) +{ + if (!library->isLoaded()) { + library->setFileName(QStringLiteral("bluetoothapis")); + if (!library->load()) { + qWarning("Unable to load '%s' library.", qPrintable(library->fileName())); + return false; + } + } + + RESOLVEFUNC(BluetoothGATTGetServices) + RESOLVEFUNC(BluetoothGATTGetIncludedServices) + RESOLVEFUNC(BluetoothGATTGetCharacteristics) + RESOLVEFUNC(BluetoothGATTGetDescriptors) + RESOLVEFUNC(BluetoothGATTGetCharacteristicValue) + RESOLVEFUNC(BluetoothGATTGetDescriptorValue) + RESOLVEFUNC(BluetoothGATTBeginReliableWrite) + RESOLVEFUNC(BluetoothGATTEndReliableWrite) + RESOLVEFUNC(BluetoothGATTAbortReliableWrite) + RESOLVEFUNC(BluetoothGATTSetCharacteristicValue) + RESOLVEFUNC(BluetoothGATTSetDescriptorValue) + RESOLVEFUNC(BluetoothGATTRegisterEvent) + RESOLVEFUNC(BluetoothGATTUnregisterEvent) + + return true; +} #endif // QWINLOWENERGYBLUETOOTH_P_H -- cgit v1.2.3 From a18338b552d45b6877e89221a5d6205081a54308 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 20 Nov 2017 16:27:59 +0100 Subject: Add warning to private header qwinlowenergybluetooth_p.h Without this warning the build would not succeed. Change-Id: Ie43c494d80db2dfffa1f45c8896d996928678df0 Reviewed-by: Denis Shienkov Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index c12ea4ae..43fffbf8 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -35,6 +35,17 @@ #ifndef QWINLOWENERGYBLUETOOTH_P_H #define QWINLOWENERGYBLUETOOTH_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include -- cgit v1.2.3 From e78eb675e89fba8d6a518b7a9f02dd3086f6f52a Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov (VMware)" Date: Mon, 19 Feb 2018 20:17:14 +0200 Subject: Update license information for Windows files Change-Id: Iec42df246c5faec4260bbeb0dbf806477530d30f Reviewed-by: Alex Blasche --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 34 ++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index 43fffbf8..ea7fc0c8 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -1,32 +1,38 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2014 Denis Shienkov -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtBluetooth module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** -- cgit v1.2.3 From bb570997e645413efec1a4426baf997cf36767bd Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 26 Jan 2018 17:34:25 +0300 Subject: Use WIN32_FROM_HRESULT macro to decode BLE system errors The GetLastError() function always returns the NO_ERROR code when any of the BluetoothGATTXXX() function fails. The reason is that the BluetoothGATTXXX() function uses the COM API, but the GetLastError() function uses the WIN32 API. We need to convert the HRESULT error code to the WIN32 error code directly, using a macro such as WIN32_FROM_HRESULT. Note: At least, it is reproduced with BluetoothGATTSetCharacteristicValue() function on Windows 10. Change-Id: I548e90bb16647c885b06c32397c277255fd362f4 Reviewed-by: Oliver Wolff Reviewed-by: Lubomir I. Ivanov --- src/bluetooth/windows/qwinlowenergybluetooth_p.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bluetooth/windows/qwinlowenergybluetooth_p.h') diff --git a/src/bluetooth/windows/qwinlowenergybluetooth_p.h b/src/bluetooth/windows/qwinlowenergybluetooth_p.h index ea7fc0c8..39b88a5f 100644 --- a/src/bluetooth/windows/qwinlowenergybluetooth_p.h +++ b/src/bluetooth/windows/qwinlowenergybluetooth_p.h @@ -56,6 +56,10 @@ #include +#define WIN32_FROM_HRESULT(hr) \ + (SUCCEEDED(hr) ? ERROR_SUCCESS : \ + (HRESULT_FACILITY(hr) == FACILITY_WIN32 ? HRESULT_CODE(hr) : (hr))) + #define BLUETOOTH_GATT_FLAG_NONE 0x00000000 #define BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED 0x00000001 #define BLUETOOTH_GATT_FLAG_CONNECTION_AUTHENTICATED 0x00000002 -- cgit v1.2.3