Add iOS bluetooth verfifcation
This commit is contained in:
parent
57b1172a88
commit
75c7421a10
@ -30,6 +30,7 @@ BluetoothDiscovery::BluetoothDiscovery(QObject *parent) :
|
||||
m_deviceInfos(new BluetoothDeviceInfos(this))
|
||||
{
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
// Check if bluetooth is available
|
||||
QBluetoothLocalDevice localDevice;
|
||||
if (!localDevice.isValid()) {
|
||||
@ -57,6 +58,11 @@ BluetoothDiscovery::BluetoothDiscovery(QObject *parent) :
|
||||
}
|
||||
|
||||
m_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(m_localDevice->address(), this);
|
||||
#else
|
||||
setBluetoothAvailable(true);
|
||||
m_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
|
||||
#endif
|
||||
|
||||
connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BluetoothDiscovery::deviceDiscovered);
|
||||
connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BluetoothDiscovery::discoveryFinished);
|
||||
connect(m_discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(onError(QBluetoothDeviceDiscoveryAgent::Error)));
|
||||
@ -130,7 +136,6 @@ void BluetoothDiscovery::deviceDiscovered(const QBluetoothDeviceInfo &deviceInfo
|
||||
|
||||
qDebug() << "BluetoothDiscovery: [+]" << deviceInformation->name() << "(" << deviceInformation->address() << ")" << (isLowEnergy ? "LE" : "");
|
||||
|
||||
|
||||
if (!isLowEnergy || deviceInformation->name().isEmpty()) {
|
||||
delete deviceInformation;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user