Issue with Bluetooth LE service discovery - QLowEnergyService::UnknownError
Solved
General and Desktop
-
On Windows 10 (works fine on macOS), I have been getting
QLowEnergyService::UnknownError
whenever I try to rerun the application but works fine when I try to run it after a while (say 15 mins). Whenever I get the UnknownError, theQLowEnergyService::stateChanged
is stuck onQLowEnergyService::DiscoveryRequired
.I tried queuing
QLowEnergyController::serviceDiscovered
, as mentioned in https://forum.qt.io/topic/117241/why-qlowenergyservice-unknownerror, but that didn't help.Not sure what's happening here - any help is appreciated
-
Looks like this is a known issue https://bugreports.qt.io/browse/QTBUG-80770 and https://bugreports.qt.io/browse/QTBUG-78488.
A workaround is to add:
QTimer::singleShot(0, [=]() { service->discoverDetails(); });