mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Bluetooth: start discovery if address isn't already known
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2954bc5f22
commit
9491c96103
3 changed files with 9 additions and 0 deletions
|
@ -301,6 +301,13 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
|
||||||
}
|
}
|
||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
|
|
||||||
|
void BTDiscovery::discoverAddress(QString address)
|
||||||
|
{
|
||||||
|
if (!btDeviceInfo.keys().contains(address) && !discoveryAgent->isActive()) {
|
||||||
|
qDebug() << "restarting discovery agent";
|
||||||
|
discoveryAgent->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool isBluetoothAddress(const QString &address)
|
bool isBluetoothAddress(const QString &address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
QList<btVendorProduct> getBtDcs();
|
QList<btVendorProduct> getBtDcs();
|
||||||
QBluetoothLocalDevice localBtDevice;
|
QBluetoothLocalDevice localBtDevice;
|
||||||
void BTDiscoveryReDiscover();
|
void BTDiscoveryReDiscover();
|
||||||
|
void discoverAddress(QString address);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static BTDiscovery *m_instance;
|
static BTDiscovery *m_instance;
|
||||||
|
|
|
@ -311,6 +311,7 @@ void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device)
|
||||||
// ensure we have a discovery running
|
// ensure we have a discovery running
|
||||||
if (btd == nullptr)
|
if (btd == nullptr)
|
||||||
btd = BTDiscovery::instance();
|
btd = BTDiscovery::instance();
|
||||||
|
btd->discoverAddress(device);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(device)
|
Q_UNUSED(device)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue