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))
|
m_deviceInfos(new BluetoothDeviceInfos(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef Q_OS_IOS
|
||||||
// Check if bluetooth is available
|
// Check if bluetooth is available
|
||||||
QBluetoothLocalDevice localDevice;
|
QBluetoothLocalDevice localDevice;
|
||||||
if (!localDevice.isValid()) {
|
if (!localDevice.isValid()) {
|
||||||
@ -57,6 +58,11 @@ BluetoothDiscovery::BluetoothDiscovery(QObject *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(m_localDevice->address(), this);
|
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::deviceDiscovered, this, &BluetoothDiscovery::deviceDiscovered);
|
||||||
connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BluetoothDiscovery::discoveryFinished);
|
connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BluetoothDiscovery::discoveryFinished);
|
||||||
connect(m_discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(onError(QBluetoothDeviceDiscoveryAgent::Error)));
|
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" : "");
|
qDebug() << "BluetoothDiscovery: [+]" << deviceInformation->name() << "(" << deviceInformation->address() << ")" << (isLowEnergy ? "LE" : "");
|
||||||
|
|
||||||
|
|
||||||
if (!isLowEnergy || deviceInformation->name().isEmpty()) {
|
if (!isLowEnergy || deviceInformation->name().isEmpty()) {
|
||||||
delete deviceInformation;
|
delete deviceInformation;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user