summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothutils_winrt_p.h
diff options
context:
space:
mode:
authorLauri Laanmets <lauri.laanmets@eesti.ee>2018-01-29 16:10:05 +0200
committerOliver Wolff <oliver.wolff@qt.io>2018-10-08 05:34:50 +0000
commit6d610e2a2537048dd3908c53847d3bea4c8f2471 (patch)
treefbf4635b8dfb0d47bd0f3b5476ce28072a579fd7 /src/bluetooth/qbluetoothutils_winrt_p.h
parent09fce1ba38f6ceee9207785ff60ce59e3737110d (diff)
Don't require pairing when connecting to BLE on WinRT
If we are running on a Windows version with Creators Update or newer (>=15063) we can use new bluetooth low energy API that allows us to do device discovery without the requirement of having paired the device. Instead of connecting to the device and fetching its services, we can use UUIDs from advertisement packages to get an initial service list. By using that approach we can get rid of the pairing process in 'connectToDevice' and replace it with 'GetGattServicesAsync' if no services are yet available. The old behavior was kept as a fallback for the case where the device has already been paired. If the backend is built with an older Windows Kit or the machine running the application does not support the new API we fall back to the old implementation which still requires pairing. Task-number: QTBUG-58660 Change-Id: Ice262d4d993a0119efb8b6c8fe9a21830717569f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothutils_winrt_p.h')
-rw-r--r--src/bluetooth/qbluetoothutils_winrt_p.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothutils_winrt_p.h b/src/bluetooth/qbluetoothutils_winrt_p.h
new file mode 100644
index 00000000..c272bae1
--- /dev/null
+++ b/src/bluetooth/qbluetoothutils_winrt_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $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 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 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.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QBLUETOOTHUTILS_WINRT_P_H
+#define QBLUETOOTHUTILS_WINRT_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 <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+bool supportsNewLEApi();
+
+QT_END_NAMESPACE
+
+#endif // QBLUETOOTHSOCKET_WINRT_P_H