Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes QBluetoothDeviceDiscoveryAgent::finished() be called?

I'm using QBluetoothDeviceDiscoveryAgent to search BLE devices on an Android phone.

I request device search to be started by calling QBluetoothDeviceDiscoveryAgent::start(). After a few seconds, QBluetoothDeviceDiscoveryAgent::finished() is emitted, but I did not call QBluetoothDeviceDiscoveryAgent::stop().

At this point, my BLE device was not found yet (it's slow...I know), and it won't as the system decided on its own to stop the search....so I need to restart the search manually.

Why is the system stopping the search? Qt doc says about QBluetoothDeviceDiscoveryAgent::finished():

This signal is emitted when Bluetooth device discovery completes.

What does that mean? How could anyone decide that discovery completes? Does it come from BLE standard? As a end user, I'm the only one who knows when it's completed, i.e. when the device I'm looking for was found....

like image 250
jpo38 Avatar asked Apr 07 '26 06:04

jpo38


1 Answers

As commented by Frank Osterfeld, the android implementation of QBluetoothDeviceDiscoveryAgent (see line 273) silently creates a 10 seconds timeout that stops the search automatically.

It's a pain for users who want to search for longer than 10sec...

Filled a bug report here: https://bugreports.qt.io/browse/QTBUG-53012

like image 150
jpo38 Avatar answered Apr 09 '26 19:04

jpo38



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!