Unsolved Remove bluetooth device using Qt Bluetooth - long shot question
-
Since there in no similar post I'll try this.
I fully understand that 99.999% of posts here are NOT about coding but about GUI. NOTHING wrong with that, but makes one wonder why bother posting such long shot question about coding..
Anyway - in QT bluetooth there are TWO classes to "inquire" about "nearby " devices or services.
I am using both and they sort of work.Since my app and my OS and " Bluetooth Manager" are not happily interacting with each other I found out that if I REMOVE the discovered DEVICE ( using Bluetooth Manager) my app will work - discover all "nearby devices" reliably but ONE time only.
I am therefore asking this - anybody has any suggestion how to utilize QT Bluetooth "module" to programmatically ( in code ) REMOVE discovered device ?
Mrs Google just wants to discover not remove.
PS I will be searching for other forums where posting similar question may be more appropriate.
-
If you use
QBluetoothDeviceDiscoveryAgent
for device discovery, you get aQList
of discovered devices. Restarting the discovery will re-populate that list and as long as you haven't connected to any device, you can just refresh that listhttps://doc-snapshots.qt.io/qt5-5.15/qbluetoothdevicediscoveryagent.html#deviceDiscovered
-
@Pl45m4 said in Remove bluetooth device using Qt Bluetooth - long shot question:
If you use
QBluetoothDeviceDiscoveryAgent
for device discovery, you get aQList
of discovered devices. Restarting the discovery will re-populate that list and as long as you haven't connected to any device, you can just refresh that listhttps://doc-snapshots.qt.io/qt5-5.15/qbluetoothdevicediscoveryagent.html#deviceDiscovered
Yes, I am actually looking at the list, after
deviceDiscovered SIGNAL is received .And my expectation is each subsequent time deviceDiscovered SIGNAL is received the info SHOULD contain actual info "discovered".
It does not!
I get the SIGNAL without ANY data in info !
The only time it works as expected is when I manually "delete"
the device found using Bluetooth Manager app.I do not know HOW is SIGNAL deviceDiscovered SIGNAL generated with EMPTY info.
This is easy to observe - real SIGNAL deviceDiscovered is generated after max of 12 second, faulty / empty SIGNAL is generated IMMEDIATELY .
I am open to suggestions how to make sure SUBSEQUENT scan produce real info .
I am actually thinking to implement paring / connect / disconnect...
Maybe that will work.Or find out the source code for Bluetooth Manager and see how they do the device deletion.
void CCC_DiscoverDevice::deviceDiscovered(const QBluetoothDeviceInfo &info)
{qDebug ("void CCC_DiscoverDevice:deviceDiscovered()"); ui->plainTextEdit->appendPlainText("Nearby BT device "); ui->plainTextEdit->appendPlainText(info.name()); ui->plainTextEdit->appendPlainText(info.address().toString()); //exit(42);
}