diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/btdiscovery.cpp | 8 | ||||
-rw-r--r-- | core/btdiscovery.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index a59bb5ccd..71d6353c5 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -61,6 +61,7 @@ BTDiscovery::BTDiscovery(QObject *parent) localBtDevice.hostMode() == QBluetoothLocalDevice::HostConnectable) { btPairedDevices.clear(); qDebug() << "localDevice " + localBtDevice.name() + " is valid, starting discovery"; + m_btValid = true; #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered); @@ -84,6 +85,7 @@ BTDiscovery::BTDiscovery(QObject *parent) #endif } else { qDebug() << "localBtDevice isn't valid"; + m_btValid = false; } #endif } @@ -175,6 +177,12 @@ QList<BTDiscovery::btVendorProduct> BTDiscovery::getBtDcs() return btDCs; } +bool BTDiscovery::btAvailable() const +{ + return m_btValid; + +} + // Android: As Qt is not able to pull the pairing data from a device, i // a lengthy discovery process is needed to see what devices are paired. On // https://forum.qt.io/topic/46075/solved-bluetooth-list-paired-devices diff --git a/core/btdiscovery.h b/core/btdiscovery.h index 1432df260..4b4e4b802 100644 --- a/core/btdiscovery.h +++ b/core/btdiscovery.h @@ -40,6 +40,7 @@ public: void btDeviceDiscovered(const QBluetoothDeviceInfo &device); void btDeviceDiscoveredMain(const btPairedDevice &device); + bool btAvailable() const; #if defined(Q_OS_ANDROID) void getBluetoothDevices(); #endif @@ -47,6 +48,7 @@ public: #endif private: static BTDiscovery *m_instance; + bool m_btValid; #if defined(BT_SUPPORT) QList<struct btVendorProduct> btDCs; // recognized DCs QList<struct btVendorProduct> btAllDevices; // all paired BT stuff |