Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qbluetoothservicediscoveryagent_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBLUETOOTHSERVICEDISCOVERYAGENT_P_H
5#define QBLUETOOTHSERVICEDISCOVERYAGENT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
22
23#include <QStack>
24#include <QStringList>
25
26#if QT_CONFIG(bluez)
27
28namespace QtBluetoothPrivate {
29
34
35} // namespace QtBluetoothPrivate
36
37#include <QtCore/qprocess.h>
38
43#endif
44
45#ifdef QT_WINRT_BLUETOOTH
46#include <QtCore/QPointer>
47#endif
48
49#ifdef QT_OSX_BLUETOOTH
50#include "darwin/btdelegates_p.h"
51#include "darwin/btraii_p.h"
52#endif
53
54#ifdef QT_ANDROID_BLUETOOTH
55#include <QtCore/QJniObject>
56#include <QtBluetooth/QBluetoothLocalDevice>
57#endif
58
60
61class QBluetoothDeviceDiscoveryAgent;
62#ifdef QT_ANDROID_BLUETOOTH
63class ServiceDiscoveryBroadcastReceiver;
64class LocalDeviceBroadcastReceiver;
65#endif
66
67#ifdef QT_WINRT_BLUETOOTH
68class QWinRTBluetoothServiceDiscoveryWorker;
69#endif
70
72#if defined(QT_WINRT_BLUETOOTH)
73 : public QObject
74{
76#elif defined(QT_OSX_BLUETOOTH)
78{
79#else
80{
81#endif
82 Q_DECLARE_PUBLIC(QBluetoothServiceDiscoveryAgent)
83
84public:
90
91 QBluetoothServiceDiscoveryAgentPrivate(QBluetoothServiceDiscoveryAgent *qp,
92 const QBluetoothAddress &deviceAdapter);
94
99
100 void setDiscoveryState(DiscoveryState s) { state = s; }
101 inline DiscoveryState discoveryState() { return state; }
102
103 void setDiscoveryMode(QBluetoothServiceDiscoveryAgent::DiscoveryMode m) { mode = m; }
105
107 void _q_deviceDiscovered(const QBluetoothDeviceInfo &info);
110#if QT_CONFIG(bluez)
114 const QStringList &xmlRecords);
115#endif
116#ifdef QT_ANDROID_BLUETOOTH
118
120 const QList<QBluetoothUuid> &uuids);
123#endif
124
125private:
126 void start(const QBluetoothAddress &address);
127 void stop();
128 bool isDuplicatedService(const QBluetoothServiceInfo &serviceInfo) const;
129
130#if QT_CONFIG(bluez)
138#endif
139
140public:
143 QBluetoothAddress deviceAddress;
146 QBluetoothAddress m_deviceAdapterAddress;
147
148private:
149 DiscoveryState state;
150 QList<QBluetoothUuid> uuidFilter;
151
152 QBluetoothDeviceDiscoveryAgent *deviceDiscoveryAgent = nullptr;
153
155
156 bool singleDevice;
157#if QT_CONFIG(bluez)
160 QProcess *sdpScannerProcess = nullptr;
161#endif
162
163#ifdef QT_ANDROID_BLUETOOTH
166
168 // The sdpCache caches service discovery results while it is running, and is
169 // cleared once finished. The cache is used as we may (or may not) get more accurate
170 // results after the first result. This temporary caching allows to send the
171 // serviceDiscovered() signal once per service and with the most accurate information.
172 // Partial cache clearing may occur already during the scan if the second (more accurate)
173 // scan result is received.
175#endif
176
177#ifdef QT_WINRT_BLUETOOTH
178private slots:
181 void onError();
182
183private:
184 void releaseWorker();
186#endif
187
188#ifdef QT_OSX_BLUETOOTH
189 // SDPInquiryDelegate:
192
194 //void serviceDiscoveryFinished();
195
197
199#endif // QT_OSX_BLUETOOTH
200
201protected:
203};
204
205QT_END_NAMESPACE
206
207#endif
void _q_deviceDiscovered(const QBluetoothDeviceInfo &info)
void setDiscoveryMode(QBluetoothServiceDiscoveryAgent::DiscoveryMode m)
QBluetoothServiceDiscoveryAgentPrivate(QBluetoothServiceDiscoveryAgent *qp, const QBluetoothAddress &deviceAdapter)
void startServiceDiscovery()
Starts service discovery for the next device.
void _q_deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)
void qt_test_iobluetooth_runloop()
Definition btutility.mm:125