Bluetooth: start discovery if address isn't already known

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-09-25 20:04:02 -07:00
parent 2954bc5f22
commit 9491c96103
3 changed files with 9 additions and 0 deletions

View file

@ -301,6 +301,13 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
}
#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)
{

View file

@ -49,6 +49,7 @@ public:
QList<btVendorProduct> getBtDcs();
QBluetoothLocalDevice localBtDevice;
void BTDiscoveryReDiscover();
void discoverAddress(QString address);
private:
static BTDiscovery *m_instance;

View file

@ -311,6 +311,7 @@ void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device)
// ensure we have a discovery running
if (btd == nullptr)
btd = BTDiscovery::instance();
btd->discoverAddress(device);
}
#else
Q_UNUSED(device)