summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-10-12 09:51:43 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2022-10-13 13:55:42 +0300
commit3a550246824a0d4b2c0f370c7f7b08f3cbd1ebd6 (patch)
treece5231d2ba800082861bbbdb0914dfb0a919240b /tests
parent1ccea1efd6f7a0dae74cef92fb4fe8f4e0ed37a7 (diff)
[Darwin BTLE] Fix service discovery timeout assert
If BT LE service discovery times out, an assert activates. This happens due to the following sequence: - DarwinBTCentralManager gets a timeout from service discovery watcher, which leads to 'emit notifier->CBManagerError()' - The handler QLowEnergyControllerPrivateDarwin::_q_CBManagerError() sets state to 'Connected' - A bit later the DarwinBTCentralManager emits a serviceDiscoveryFinished() signal, whose handler QLowEnergyControllerPrivateDarwin::_q_serviceDiscoveryFinished() asserts because state is no longer 'Discovering' Either the assert needs to be changed to an early return, or the service discovery should not send the finished() signal after it has emitted an error. Fixes: QTBUG-106039 Change-Id: Ibff31332524a2c7d20dced7b3af7af5a424db0ef Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/bttestui/btlocaldevice.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index cff7851f..c8e2557b 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -1121,6 +1121,13 @@ void BtLocalDevice::centralCreate()
[](QLowEnergyController::Error error) {
qDebug() << "QLowEnergyController central errorOccurred:" << error;
});
+ QObject::connect(leCentralController.get(), &QLowEnergyController::discoveryFinished, []() {
+ qDebug() << "QLowEnergyController central service discovery finished";
+ });
+ QObject::connect(leCentralController.get(), &QLowEnergyController::serviceDiscovered,
+ [](const QBluetoothUuid &newService){
+ qDebug() << "QLowEnergyController central service discovered:" << newService;
+ });
QObject::connect(leCentralController.get(), &QLowEnergyController::stateChanged,
[this](QLowEnergyController::ControllerState state) {
qDebug() << "QLowEnergyController central stateChanged:" << state;