71class QBluetoothDeviceDiscoveryAgentPrivate
72#if defined(QT_ANDROID_BLUETOOTH) || defined(QT_WINRT_BLUETOOTH)
73 || defined(Q_OS_DARWIN)
75#if defined(Q_OS_MACOS)
76 ,
public DarwinBluetooth::DeviceInquiryDelegate
83 Q_DECLARE_PUBLIC(QBluetoothDeviceDiscoveryAgent)
85 QBluetoothDeviceDiscoveryAgentPrivate(
86 const QBluetoothAddress &deviceAdapter,
87 QBluetoothDeviceDiscoveryAgent *parent);
88 ~QBluetoothDeviceDiscoveryAgentPrivate();
90 void start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods);
92 bool isActive()
const;
95 void _q_InterfacesAdded(
const QDBusObjectPath &object_path,
96 InterfaceList interfaces_and_properties);
97 void _q_discoveryFinished();
98 void _q_discoveryInterrupted(
const QString &path);
99 void _q_PropertiesChanged(
const QString &interface,
101 const QVariantMap &changed_properties,
102 const QStringList &invalidated_properties);
106 QList<QBluetoothDeviceInfo> discoveredDevices;
108 QBluetoothDeviceDiscoveryAgent::Error lastError = QBluetoothDeviceDiscoveryAgent::NoError;
110 QBluetoothAddress adapterAddress;
112#ifdef QT_ANDROID_BLUETOOTH
114 void processSdpDiscoveryFinished();
115 void processDiscoveredDevices(
const QBluetoothDeviceInfo &info,
bool isLeResult);
116 friend void QtBluetoothLE_leScanResult(JNIEnv *, jobject, jlong, jobject);
117 void stopLowEnergyScan();
120 void startLowEnergyScan();
121 void processLeDiscoveryFinished(
int epoch);
122 void classicDiscoveryStartFail();
123 bool setErrorIfPowerOff();
125 DeviceDiscoveryBroadcastReceiver *receiver =
nullptr;
128 QJniObject leScanner;
129 QTimer *leScanTimeout =
nullptr;
130 QTimer *deviceDiscoveryStartTimeout =
nullptr;
131 short deviceDiscoveryStartAttemptsLeft;
134 bool pendingCancel =
false;
135 bool pendingStart =
false;
136#elif QT_CONFIG(bluez)
137 bool pendingCancel =
false;
138 bool pendingStart =
false;
139 QtBluetoothPrivate::OrgFreedesktopDBusObjectManagerInterface *manager =
nullptr;
140 QtBluetoothPrivate::OrgBluezAdapter1Interface *adapter =
nullptr;
141 QTimer *discoveryTimer =
nullptr;
142 QList<QtBluetoothPrivate::OrgFreedesktopDBusPropertiesInterface *> propertyMonitors;
144 void deviceFound(
const QString &devicePath,
const QVariantMap &properties);
146 QMap<QString, QVariantMap> devicesProperties;
149#ifdef QT_WINRT_BLUETOOTH
151 void registerDevice(
const QBluetoothDeviceInfo &info);
152 void updateDeviceData(
const QBluetoothAddress &address, QBluetoothDeviceInfo::Fields fields,
153 qint16 rssi, ManufacturerData manufacturerData, ServiceData serviceData);
154 void onErrorOccured(QBluetoothDeviceDiscoveryAgent::Error e);
155 void onScanFinished();
158 void disconnectAndClearWorker();
159 std::shared_ptr<QWinRTBluetoothDeviceDiscoveryWorker> worker =
nullptr;
171 void inquiryFinished() override;
172 void error(IOReturn error) override;
173 void classicDeviceFound(
void *device) override;
175 void setError(IOReturn error,
const QString &text = QString());
180 void LEinquiryFinished();
181 void LEinquiryError(QBluetoothDeviceDiscoveryAgent::Error error);
182 void LEnotSupported();
185 void setError(QBluetoothDeviceDiscoveryAgent::Error,
186 const QString &text = QString());
189 void deviceFound(
const QBluetoothDeviceInfo &newDeviceInfo);
197 bool startPending =
false;
198 bool stopPending =
false;
202 DarwinBluetooth::ScopedPointer controller;
203 DarwinBluetooth::ScopedPointer inquiry;
207 DarwinBluetooth::ScopedPointer inquiryLE;
211 int lowEnergySearchTimeout = 40000;
212 QBluetoothDeviceDiscoveryAgent::DiscoveryMethods requestedMethods;
213 QBluetoothDeviceDiscoveryAgent *q_ptr;