summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Skip few Bluetooth autotests on Android emulator6.3Juha Vuolle2022-10-046-49/+87
| | | | | | | | | | | | | | | | | This is to unblock Android-12 emulator deployment on CI which, unlike the earlier emulators, has a bluetooth emulation. This means that the emulator triggers permission confirmation dialogues which would timeout on CI. This commit replaces the 1ef066bf7d7a67d1b381443b9ecfa60f9204aca8, which attempted to solve the issue by compile-time configuration. Task-number: QTBUG-106614 Change-Id: Idc155bb8617802054d6ab19993f5417cc254f16e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 90251f51be3af2d6db994b92993f2944345e10a6)
* Clear previous bluetooth device/service discovery errors on restartJuha Vuolle2022-09-235-1/+17
| | | | | | | | | | | | | | | | | | | | An example of the problem is when discovery is first tried while bluetooth is OFF, and one gets the corresponding error. Then the bluetooth is switched ON, and the discovery is restarted successfully. However in this case the error() still remains as "power OFF" error instead of "no error", which is misleading. With device discovery agent the clearing is done at each individual backend, rather than at the common public class start(). This is due to the pending cancel/start logic, which we probably shouldn't interfere with by clearing errors amidst pending operation. The Darwin backend already cleared the error in its start(), and with this commit the intent is to add similar clearing to the Android/Bluez/Win. Fixes: QTBUG-104473 Change-Id: I713590a26eb2b8d4ee7873f3fe84e63e504523df Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 14db1fabef1ba2eb1a889c968e3b038f7978d6bd)
* Add windows bluetooth discovery worker metatype registrationJuha Vuolle2022-09-201-0/+1
| | | | | | | | | | | | | The crash fix for QTBUG-106029 introduced a shared_ptr<QWinRTBluetoothDeviceDiscoveryWorker> as a queued method invocation parameter. The missing registration didn't cause any issues on the 'dev' branch, but does cause on earlier branches. Fixes: QTBUG-106654 Change-Id: If03b020877e4eeaacc1db25b3854ba0c6b5447d0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 72af5c8b523e3bd993bb6809128a119b1ec43c83) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix failing BT LE autotest on CI & RHEL 9Juha Vuolle2022-09-191-0/+18
| | | | | | | | | | | | | It appears that with RHEL 9 on CI there is no bluez dbus. This means that the older kernel ATT interface is used instead. With that there is an error already at construction time if there is no local adapter available (QLowEnergyControllerPrivateBluez::init()) Fixes: QTBUG-106282 Change-Id: I8ecab26440a2b533c4d641c31d2345b46b95427e Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 4371448c637f3059824cef22e1c98544cc0f45ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android BT fix deprecated "getDefaultAdapter" method usageJuha Vuolle2022-09-1512-50/+108
| | | | | | | | | | | | The currently used method has been deprecated in Android API 31, and it is strongly recommended not to use anymore. The replacing API has been introduced in API 18. Fixes: QTBUG-105487 Change-Id: I0d1972f600103bf33c7be1f8ba2ddf52a8d4255c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 8a01a353557454042bc9a27a1f38079e884fc807)
* Add missing qt_configure_end_summary_section to fix summary indentationShawn Rutledge2022-09-141-0/+1
| | | | | | | | | | | Everything in the configure summary after the Bluetooth section was indented. Fixes: QTBUG-106626 Change-Id: Ia8bb829273972c321f188ca0e2d18d3fedf61437 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> (cherry picked from commit 0d23d72b02c8d8bb8674d4bdb5545a1c71174027) Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Windows device discovery: fix memory leaksIvan Solovev2022-09-013-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both QBluetoothDeviceWatcherWinRT and AdvertisementWatcherWrapper helper classes have the same issue. They pass a shared_from_this() pointer to the event-handling lambdas to make sure that the object is alive when the event is received. Both classes have unsubscribeFromEvents() private methods, which are used to unsibscribe from windows events, and so release the previously captured shared_from_this() instances. However the initial implementation was trying to call these methods only in destructors. And as a result they never got called, because the captured shared_from_this() pointers prevented the destruction of the objects. This patch moves the unsubscribeFromEvents() calls to the stop() function, which is invoked from the clien code when we stop handling the events. This implies that we need to move the call to subscribeToEvents() function inside start(). In case of QBluetoothDeviceWatcherWinRT this also allows us to simplify the code by getting rid of now redundant m_initialized flag. This commit amends 761a059d5a5ef97e97039f3a34b3a7f92944f1f0 and 36dd802c964f97522d1f5a75c8fb7a67f3061a3d. Fixes: QTBUG-105742 Change-Id: I46f263750a26cc4265081db325302123c7548a1c Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 37a9d533c541db63fd1b7c261ca832ea56ab8203) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows device discovery: fix crash at discovery stopIvan Solovev2022-08-301-27/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash is cannot be reproduced reliably. One of the possible scenarios is: * After finishing the scanning a last QWinRTBluetoothDeviceDiscoveryWorker::onAdvertisementDataReceived() slot is executed on worker's thread (thread A). * This slot starts an async BluetoothLEDevice::FromBluetoothAddressAsync() call, capturing shared_from_this() to make sure that the worker object is alive when the async call completes. The async call executes on some other thread B. * The async call completes on thread B with a failure (that happens with some LE devices), so we call invokeDecrementPendingDevicesCountAndCheckFinished(). This call schedules a decrementPendingDevicesCountAndCheckFinished() function call on thread A. * The lambda in thread B is completed, so shared pointer's counter is decremented. It is the last instance of the worker, so its destructor is called. * At the same time the decrementPendingDevicesCountAndCheckFinished() function is called on thread A. * It refers to an already deleted worker -> crash. This patch fixes it by passing the shared worker instance to the decrementPendingDevicesCountAndCheckFinished() function, making sure that the worker object is alive when this function is invoked. As a drive-by: get rid of the {invoke}IncrementPendingDevicesCount() functions, because we always increment the device count from the worker thread, so we can update the variable directly. This commit amends 2f560d044fec92e94e8438791aa5e4d9daced197 and 36dd802c964f97522d1f5a75c8fb7a67f3061a3d. Fixes: QTBUG-106029 Change-Id: I2d82c34b17c8cef873c9c61a92d874c377501edb Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit e284887e0f6093767a5af16d497549860ca1770d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip parts of Bluetooth autotests on Android 12+ emulatorJuha Vuolle2022-08-305-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | The CI uses Android emulator for running bluetooth tests for Android. Up until Android 12 the emulator didn't have a bluetooth and only the bluetooth parts which don't require actual bluetooth were tested. This is similar to other platforms' bluetooth testing on CI. The Android 12 emulator introduces a Bluetooth emulation. This causes trouble when running tests on CI, as using bluetooth triggers end-user dialogues, and consequently test cases time out waiting for them. This commit skips the problematic parts when tests are built for Android in CI environment. This way the developers and testers can still run the full bluetooth tests locally without need for manually removing the skips. Fixes: QTBUG-105803 Fixes: QTBUG-105808 Change-Id: I20bac041c3a4a0b83058482305dc735122d4c489 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 1ef066bf7d7a67d1b381443b9ecfa60f9204aca8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add tst_qlowenergycontroller_device::testRepeatedCharacteristicsWrite()Ivan Solovev2022-08-262-0/+157
| | | | | | | | | | | | | | | | ... and its counterpart in bluetoothtestdevice. The client side generates multiple writes to the same characteristics. The server side, when receiving each new value, copies it to the notifying characteristic, which sends notification back to the clien. In this way the client can verify that all writes were completed successfully and in the right order. Fixes: QTBUG-105556 Change-Id: Id5ba5b00527a01903b3730733188065c1cc6a94e Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit 5a5abc2d7388504510988df01e840d5dbe222ee0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth Windows: refactor getNativeServiceIvan Solovev2022-08-262-93/+132
| | | | | | | | | | | | | | | | | ... to get rid of await() call. The function now requests the services asynchronously and executes a custom callback, passing the selected service as a parameter. After that the refactoring is quite simple: we put all the code after the getNativeService() call into a lambda, and pass this lambda as a last parameter of the updated method. Task-number: QTBUG-105556 Change-Id: If474a7446ee70059e06d46bab48771c31ba37a89 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 595ce0449b16133d6708c7d0a17ce618f4d01724) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth Windows: refactor getNativeCharacteristicIvan Solovev2022-08-263-105/+213
| | | | | | | | | | | | | | | | | | | | | | ... to get rid of await() call. The function now requests the characteristics asynchronously and executes a custom callback, passing the selected characteristic as a parameter. After that the refactoring is quite simple: we put all the code after the getNativeCharacteristic() call into a lambda, and pass this lambda as a last parameter of the updated method. As a drive-by: improve tst_qlowenergycontroller_device::testNotificationAndIndication() stability by adding QTest::qWait() calls after disabling notification and indication, like it is done in other places. Task-number: QTBUG-105556 Change-Id: I1164bbc677d3549ef930243fd645eed344e27b7c Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 5fee999b242fadc9efca5423aa1296486aa5a880) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-231-2/+2
| | | | | Change-Id: I2baef621373c173b6a3de4dcc695654549972f36 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-221-2/+2
| | | | | Change-Id: I0e619fb4a5205d451278b8ef96b52016885a9478 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix error() to errorOccurred() in documentation (changed in Qt 6)Juha Vuolle2022-08-213-8/+8
| | | | | | | Change-Id: I0529f303fa82210853de8d594e67bcdd46f06fe4 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit e3527a10e9861af25784f1afc549770ec4ad5701) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bump version to 6.3.3Jani Heikkinen2022-08-191-1/+1
| | | | | Change-Id: Id4834cfad6ea68728de19e0a588532727db56141 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-191-2/+2
| | | | | Change-Id: Ifc8daf330d741f43b11bac7223377cdeb7107e1a Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Android: skip tst_qbluetooth{device,service}discoveryagent failing casesAssam Boudjelthia2022-08-182-0/+12
| | | | | | | | | | | This fails on Android 12 in CI. Task-number: QTBUG-105803 Change-Id: Ib3bc224bfe1a4207c638b4f8a0b8043cb8ab2339 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit afa16467b122fb79ff364f7e4201f4447a2c7f29) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth heartrate-server: Handle errorsFriedemann Kleint2022-08-173-3/+18
| | | | | | | | | | | | | Make it a console application and terminate on errors, printing a message. This prevents it from silently hanging, locking up the libraries, on Windows. Change-Id: Ie7d022a2b193cf2c320cb918d35ce2ad52b2ac48 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit 58acbdf11e5e493c2d2d1c70c0b90d4dda34aa07) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth heartrate example: increase scan time and remove QML warningsJuha Vuolle2022-08-172-3/+3
| | | | | | | | | | | | | Increase the time for device discovery as it often takes more than 5 seconds to find the devices. Introduce formal function parameters to QML signal handler functions to remove the related warnings. Change-Id: I79589803a1c6082f02fa13a9e0044a7c03ef0daa Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 868d7702d6efce4e92e712bc51148b3b04596c04) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth heartrate-game example: Use modern QML registrationFriedemann Kleint2022-08-167-5/+32
| | | | | | | | | | Use the modern macros and replace setContextProperty(). Change-Id: If83f8a2dfab13e7c1b3dd18048f633c47709a7b3 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 94cf544ab0590b9f38fda8875f678ca7dcdb1a7b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth heartrate-game example: Make simulation switcheable by command ↵Friedemann Kleint2022-08-159-61/+74
| | | | | | | | | | | line arguments Introduce QCommandLineParser for simulation and verbosity settings. Change-Id: I00d01d2fa73db311944a2df68c6b116f0a31811b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit f2d0f8709d17afac1d7d15ee746397eb17e948f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Bluetooth heartrate-game example: Basic polishFriedemann Kleint2022-08-1524-62/+67
| | | | | | | | | | | | - Reorder includes by module - Reorder Q_OBJECT macros - Use member initialization - Update copyright year - Remove QML import versions Change-Id: I00a817c07bf50efcb9fed60372c374d34d138640 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 4c3d8adc17cdbe80a3eb65727997a4b7db426b3f)
* Windows: properly cache discovered services in QLowEnergyControllerIvan Solovev2022-08-151-0/+1
| | | | | | | | | | | | | | | | | | | | GattDeviceService can return AccessDenied error when queried for service details, if it was not closed properly when it was last used. Commit 0b60ca266f0fe27053a58eff3dbd903e3a1678ca introduces a service cache, which keeps track of the used services, and ensures that they are properly closed before being reused. This patch puts all the newly-discovered services into the service cache, which helps to prevent some errors when later querying for service details. Task-number: QTBUG-94001 Change-Id: Icdf26e2aaece5c44d9268ec907750242b61c64f7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit 093501477f91b2184db3f60f1f87a6d31cbf1577) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QWinRTBluetoothDeviceDiscoveryWorker: properly stop LE scan timerIvan Solovev2022-08-151-0/+2
| | | | | | | | | | | | | | | | | The LE scan timer was never stopped if the device discovery was finished earlier than the timer expires. That could lead to an application crash. This patch fixes it by making sure that the timer is stopped when QWinRTBluetoothDeviceDiscoveryWorker::stop() is called. This commit amends 9ab5122091a65936458c726270e693eca7a99277 Task-number: QTBUG-103263 Task-number: QTBUG-97797 Change-Id: If10d9c1ef9f822b991225736ae36aceabe7e60a7 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 0beadce4cf588633843f41fad51556559f9a6af7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-111-2/+2
| | | | | Change-Id: I4166ccee5bb8d541e00aab84b04bfe83ba7d0147 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-091-2/+2
| | | | | Change-Id: I653b075b440e8a59f738c5acb145d8a229c07909 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-08-021-2/+2
| | | | | Change-Id: If5d30567e6df4c65942f6c7909ee28370c589e82 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-251-2/+2
| | | | | Change-Id: I9b31906c3bec71a95148879c85511420eee48f32 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-221-2/+2
| | | | | Change-Id: I94ca016d6c2f875ce8cb530d033b625831cb3021 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-201-2/+2
| | | | | Change-Id: Ife2330297510a66ecfce1b89c48b77e12afb579c Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Windows: refactor device discoveryIvan Solovev2022-07-192-36/+47
| | | | | | | | | | | | | | | | | | | | - Move the LE scan timer to the worker class - Introduce a separate function to check for scan finish conditions. These changes allow us to be more precise in deciding when to stop device discovery. For example, before this change we were unconditionally stopping the discovery when the LE scan timeout expired, even if the Classic scan was still in progress. That is fixed now. Fixes: QTBUG-103263 Fixes: QTBUG-97797 Change-Id: I8ab457971b95a7573483b9e6f4e8abbec97e9755 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 9ab5122091a65936458c726270e693eca7a99277) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows: refactor low energy device discoveryIvan Solovev2022-07-191-569/+315
| | | | | | | | | | | | | | | | | | | | This is the continuation of porting QWinRTBluetoothDiscoveryWorker to C++/WinRT. This allows to simplify the code and completely get rid of COM APIs in qbluetoothdevicediscoveryagent_winrt.cpp This patch is mostly a plain rewrite, with minimal logic changes. As with classic device discovery, we need to remember that callbacks from async operations come in separate threads. We also wrap BluetoothLEAdvertisementWatcher into a helper class and use signals to notify about new data. Task-number: QTBUG-103263 Change-Id: I3376930d145dccac2ded400e05c409f64fc24897 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 36dd802c964f97522d1f5a75c8fb7a67f3061a3d)
* Windows: fix Classic device discovery by porting to C++/WinRTIvan Solovev2022-07-192-239/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | Start porting QWinRTBluetoothDeviceDiscoveryWorker to C++/WinRT. Use DeviceWatcher to discover both paired and unpaired Bluetooth Classic devices. Unlike old COM implementation, in C++/WinRT each callback for IAsyncOperation comes in its own thread, so we need to care more about thread-safety. As a result, we had to use std::enable_shared_from_this on the QWinRTBluetoothDeviceDiscoveryWorker to guarantee that it is alive when the callback is triggered, and also to use QMetaObject::invokeMethod() to check for the scan finish criteria. This caused some further refactoring of QWinRTBluetoothDeviceDiscoveryWorker. This patch leaves some TODOs to handle LE device discovery. This will be implemented in the following patches. Task-number: QTBUG-103263 Change-Id: I9128fe7a65f1a5aedcba427d6944372ecfe33f2f Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 2f560d044fec92e94e8438791aa5e4d9daced197) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows Bluetooth: move DeviceWatcher wrapper into a separate headerIvan Solovev2022-07-194-57/+275
| | | | | | | | | | | | | | | | | | The DeviceWatcher wrapper seems to be useful not only in QBluetoothLocalDevice implementation, but also for device discovery. This patch moves it to a separate header, so that it can be reused. The class' API is also refactored to suit for more general usecases. This patch also applies the changes to QBluetoothLocalDevice. As a drive-by: clean-up some includes and namespaces in QBluetoothLocalDevice implementation. Task-number: QTBUG-103263 Change-Id: I470c6eab4810065c03d5905032f4288fa9d6de8e Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 761a059d5a5ef97e97039f3a34b3a7f92944f1f0)
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-191-2/+2
| | | | | Change-Id: I827c91cac3d1d312859feb78c2763c16a4a651bd Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-151-2/+2
| | | | | Change-Id: I8699d25b69742631ad500f6f7ef4267e0263d963 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Android: skip some bluetooth test cases that fail on Android 12 CIAssam Boudjelthia2022-07-142-0/+23
| | | | | | | | | | | | | | Android 12 sends popups to user about operations in bluetooth like enbaling or disabling or scanning for devices, and these popops will wait for user action. On CI or in qtconnectivity we don't wait for those so some tests are either failing or timing out. This patch skips the tests on Android 12+. Task-number: QTBUG-104914 Change-Id: Ibadaf3a4d67170e33dcdcbe836c6d1a2e8a55c23 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 969da30250f575afb8b8a1df8a3b063fbc96b98e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-071-2/+2
| | | | | Change-Id: I36cd7c60ef8e7cd7a7ccc5d0740c20ed1b8ecfdb Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-07-051-2/+2
| | | | | Change-Id: Ic890c28ff8c2e1e72088431b122ff2eecc9b2d70 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix bluetooth service discovery not finishing on AndroidJuha Vuolle2022-06-282-10/+22
| | | | | | | | | | | | | | | | | | | The service discovery finished signal is not emitted when the SDP cache is empty when last device inquiry of services finishes. This commit changes the logic so that the the inquiry is finished independent of whether actual services were discovered on (any) of the devices. As a related drive-by: - Document the role of sdpCache to ease understanding - Change raw timeout limits into a variable Fixes: QTBUG-104479 Change-Id: Ifc9e8587a66769a1fc7959a8154f2be72ffd7461 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 7c7d860ca52dc19e994a1166b6e2d0f5fa869455) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix documentation issues and enable documentation testing in CITopi Reinio2022-06-284-5/+14
| | | | | | | | | | | This will fail the integration of changes that introduce new documentation warnings. Change-Id: I503b123417308f7ba264422a78850e6188a10a48 Reviewed-by: Luca Di Sera <luca.disera@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 74215aeed1c27b56acd266673ba4447b287c145d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix Bluez LE advertiser crash on large advertisement dataJuha Vuolle2022-06-281-1/+2
| | | | | | | | | | | | | The calculation to count the number of service UUIDs that fit the 31 bytes resulted in choosing a number of services that doesn't fit, ultimately leading to a memset() crash a bit later. Fixes: QTBUG-104060 Change-Id: Iad170cfded7363f820a92230df27cdb57bce3814 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit efc4541af0f02d254cabf82b3db0412e7b83682e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-06-271-2/+2
| | | | | Change-Id: Ic885a2214b43e42d709eb1ad18c000e0f64e6cf9 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix Bluez LE advertiser delete crashJuha Vuolle2022-06-226-17/+22
| | | | | | | | | | | | | | | | | | | | | | Bluez LE advertiser and Bluez LE controller use/share an instance of HCI manager, and in some circumstances the deletion of the LE controller leads to a crash. This is because: 1) LE advertiser and HCI manager are parented to the LE controller 2) LE advertiser uses HCI manager in its destructor => When LE controller is deleted, its QObject children are deleted. If the HCI manager happens to be deleted first, the advertiser uses a by-now deleted HCI manager in its destructor This commit makes the HCI manager a shared resource so that the exact destruction order does not matter. As a drive-by set deleted cmacCalculator pointer to nullptr. Fixes: QTBUG-104105 Change-Id: I1c5e319af2fc59c4d5bb1fed33b8824eb3c4cb29 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit f1ff9f4d17b82b5e597e28118de62beab705519e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android BT LE advertisement start to fail when bluetooth is OFFJuha Vuolle2022-06-221-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we start a BT LE advertisement while bluetooth is OFF, the advertisement should fail to start, and on the other hand when bluetooth is switched back ON, starting the advertisement should be possible again. This commit adds offline/online check to the startAdvertising function. In addition the creation of the advertiser is delayed until the first advertisement request. This delaying is done for the case when the bluetooth is OFF when the LE controller is created => we don't want the creation of advertisement to fail once during construction and therefore become unusable even if bluetooth is later switched ON. For completeness it should be mentioned that Android documentation mentions that the getBluetoothLeAdvertiser() returns 'null' if the bluetooth is offline. However on all the devices I've tried this, it returns a valid instance. This means that the creation delay of this commit would not be strictly speaking necessary. But we shouldn't rely on it: on some Android devices the advertiser might be returned as null when bluetooth is offline, as documented. Fixes: QTBUG-104106 Change-Id: Ia016e4534c29fac23f42785d68bc95d568c41def Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 4292b32d57f7b6dc2f644ee75403ce8b26f9e1e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add a timeout guard for Android BT device discovery not startingJuha Vuolle2022-06-215-25/+95
| | | | | | | | | | | | | | | | | In some bluetooth environments, after a full SDP service discovery, the device discovery can get stuck indefinitely. Everything seems to be starting fine but we do not get the DISCOVERY_STARTED action. In the normal case this action is received in < 1 second. This commit adds a timeout guard for this. If we don't get the DISCOVERY_STARTED action in time, we silently restart the query. Typically the discovery starts working after 10..20 seconds. Task-number: QTBUG-101066 Change-Id: Id6032ebeec97d1ad9eec07a946bc623c92500fd5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit eedaaca9634d56dce27601749049c81b201ab625) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.3' in qt/qtconnectivityQt Submodule Update Bot2022-06-211-2/+2
| | | | | Change-Id: I5561a84d9698d95750ad6ab3b3cea218292a6103 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Repair tst_QBluetoothDeviceDiscoveryAgent unit test on AndroidAndreas Buhr2022-06-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | tst_QBluetoothDeviceDiscoveryAgent::tst_startStopDeviceDiscoveries was broken on Android. The sequence QBluetoothDeviceDiscoveryAgent::start() QBluetoothDeviceDiscoveryAgent::stop() QBluetoothDeviceDiscoveryAgent::start() QBluetoothDeviceDiscoveryAgent::stop() is called rather quickly. The first stop() results in the state pendingCancel=true, pendingStart=false. The second start() results in the state pendingCancel=true, pendingStart=true. The second stop() then did nothing because pendingCancel=true. Then, after the whole sequence, discovery started because pendingStart=true. This patch repairs it by setting pendingStart=false in the stop() method. Change-Id: I55486b5b494265c90149e72461a1d0529adaa2f0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 32b859dc9c83c7fb440e53335917021ef7eab15d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtNfc: Fix iOS session invalidation/restartMike Achtelik2022-06-161-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a problem where the user is able to get into a state, where iOS NFC implementation deadlocks itself, so the whole app has to be restarted to get it working again. Basically, if we (or the user) abort a scan sessionStoppedByApplication will be set, preventing a new scan until the session is invalidated by the system and sessionStoppedByApplication is cleared. The problem is that sometimes the invalidation by the system takes some time, especially if the sessions is transmitting and waiting for a timeout. In that case, the user is able to quickly start a new scan, which will of course wait for the flag to be cleared. However, if that scan is immediately stopped again self.session will be set to nil. This then becomes a problem, when the original session finally invalidates and we now think it's an unexpected session and return. This means self.sessionStoppedByApplication will never be cleared, preventing any start of the scan. To fix this we should always wait for the system to invalidate the session and not just clear it ourselves. Similarly, if we already have a session don't just to restartPolling, since it has no effect on an invalidated session, so invalidate it to make sure and wait for it to clear and start a new one. Change-Id: I341a114d6ba5c761aa3c61df66b1a17636ec3946 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a113cea72806e3b1302d36532df3a8a58c6640fe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>