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 classicDiscoveryStartFail();
122 bool setErrorIfPowerOff();
124 DeviceDiscoveryBroadcastReceiver *receiver =
nullptr;
127 QJniObject leScanner;
128 QTimer *leScanTimeout =
nullptr;
129 QTimer *deviceDiscoveryStartTimeout =
nullptr;
130 short deviceDiscoveryStartAttemptsLeft;
132 bool pendingCancel =
false;
133 bool pendingStart =
false;
134#elif QT_CONFIG(bluez)
135 bool pendingCancel =
false;
136 bool pendingStart =
false;
137 QtBluetoothPrivate::OrgFreedesktopDBusObjectManagerInterface *manager =
nullptr;
138 QtBluetoothPrivate::OrgBluezAdapter1Interface *adapter =
nullptr;
139 QTimer *discoveryTimer =
nullptr;
140 QList<QtBluetoothPrivate::OrgFreedesktopDBusPropertiesInterface *> propertyMonitors;
142 void deviceFound(
const QString &devicePath,
const QVariantMap &properties);
144 QMap<QString, QVariantMap> devicesProperties;
147#ifdef QT_WINRT_BLUETOOTH
149 void registerDevice(
const QBluetoothDeviceInfo &info);
150 void updateDeviceData(
const QBluetoothAddress &address, QBluetoothDeviceInfo::Fields fields,
151 qint16 rssi, ManufacturerData manufacturerData, ServiceData serviceData);
152 void onErrorOccured(QBluetoothDeviceDiscoveryAgent::Error e);
153 void onScanFinished();
156 void disconnectAndClearWorker();
157 std::shared_ptr<QWinRTBluetoothDeviceDiscoveryWorker> worker =
nullptr;
169 void inquiryFinished() override;
170 void error(IOReturn error) override;
171 void classicDeviceFound(
void *device) override;
173 void setError(IOReturn error,
const QString &text = QString());
178 void LEinquiryFinished();
179 void LEinquiryError(QBluetoothDeviceDiscoveryAgent::Error error);
180 void LEnotSupported();
183 void setError(QBluetoothDeviceDiscoveryAgent::Error,
184 const QString &text = QString());
187 void deviceFound(
const QBluetoothDeviceInfo &newDeviceInfo);
195 bool startPending =
false;
196 bool stopPending =
false;
200 DarwinBluetooth::ScopedPointer controller;
201 DarwinBluetooth::ScopedPointer inquiry;
205 DarwinBluetooth::ScopedPointer inquiryLE;
209 int lowEnergySearchTimeout = 40000;
210 QBluetoothDeviceDiscoveryAgent::DiscoveryMethods requestedMethods;
211 QBluetoothDeviceDiscoveryAgent *q_ptr;