summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update dependencies on '6.4.0' in qt/qtconnectivityv6.4.06.4.0Qt Submodule Update Bot2022-09-231-2/+2
| | | | | Change-Id: I2f6fcab5c4d9c8ebc480a3df66f01c93c93725e1 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Add windows bluetooth discovery worker metatype registrationJuha Vuolle2022-09-211-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>
* Update dependencies on '6.4.0' in qt/qtconnectivityQt Submodule Update Bot2022-09-201-2/+2
| | | | | Change-Id: I4ac0c887844dd0205d07d61be5dff2ff8851ade7 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4.0' in qt/qtconnectivityv6.4.0-rc1Qt Submodule Update Bot2022-09-131-2/+2
| | | | | Change-Id: If6292cda807e31963eebbf48f699eb046ed67f63 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4.0' in qt/qtconnectivityQt Submodule Update Bot2022-09-121-2/+2
| | | | | Change-Id: Ifcc438146df5287e93ffea5b359c4c4b14c99bdc Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4.0' in qt/qtconnectivityQt Submodule Update Bot2022-09-091-2/+2
| | | | | Change-Id: I659d40f322aff870a1a1606e170159ae14a72859 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4.0' in qt/qtconnectivityQt Submodule Update Bot2022-09-081-2/+2
| | | | | Change-Id: I5191d76b90a93c835e576bf625471862a81e45c1 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix access to destroyed QtJniTypes::String objectVolker Hilsheimer2022-09-081-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doing const char *value = QtJniTypes::className<Foo>(); is the same as doing const char *value = qstring.toUtf8().constData(); The object owning the data is temporary, and destroyed at the end of the statement. 'value' becomes a dangling pointer. With QtJniTypes::String we have the extra problem that strings of different lengths are different types, so we can't return different ones from non-template functions. Instead, we have to make a deep copy of the data into a QByteArray, and then operate on that. This defeats the purpose of having compile-time string generation in the first place, but fixes the immediate issue. A follow-up commit can turn the valueForStaticField helper into a template function that makes full use of compile-time generated strings. However, this requires changes in the calling code as well. Amends 70afc6721d4331fec0e9ccbb580d7c8b3ce5ec04. Change-Id: I206d58f3a34700042782b77f9a28aa3a61520439 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 3d69e7ee4fa5f9b486a072fdc1ba6f697144351b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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.4' in qt/qtconnectivityv6.4.0-beta4Qt Submodule Update Bot2022-08-261-2/+2
| | | | | Change-Id: Iafd6a62068f2b8a9861b9be3ba61dd0eae020283 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-251-2/+2
| | | | | Change-Id: Id75c0d0d9436f45df12610711b91fb5404089f3c Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-221-2/+2
| | | | | Change-Id: Ia06b5a6602ae42f1d6a4f2f400bc6ec256058ace 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>
* 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>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-181-2/+2
| | | | | Change-Id: Ie805311123cb986b327b2ed2a7f2aa88b2e7134a Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_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>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-161-2/+2
| | | | | Change-Id: Ib1471ac776e2eb87c4764a2436cb43978f513619 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_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) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* 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.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-151-2/+2
| | | | | Change-Id: I6c9c53dd0c07319b7b1df642cb794482c1a83865 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityv6.4.0-beta3Qt Submodule Update Bot2022-08-111-2/+2
| | | | | Change-Id: Ifd691c9e024673b561dfaaa8621a3fa215c4a797 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-081-2/+2
| | | | | Change-Id: If6f2a6936541f96532b8ae8ce13cf25dabd030e3 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Unstringify Android QtBluetooth: native JNI callbacksJuha Vuolle2022-08-046-114/+151
| | | | | | | | | | | This commit removes the plain class/type strings from the JNI callback method registration. Fixes: QTBUG-104183 Change-Id: I5599eb18af2f5934961a66fdcee7b0cba8045269 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 373378e74512de7b566725d4f81a28c1cef8280f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-08-021-2/+2
| | | | | Change-Id: Ib0a43e57d78ffabe19ad91a9384c4a2e6deb0096 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-281-2/+2
| | | | | Change-Id: Iee0ad0abbc0697eb3c008e9b73d32980258cff52 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix several more improperly placed #include mocThiago Macieira2022-07-282-4/+4
| | | | | | | | | | | | | | | Like commit qtbase/638893bea083b619b73b33a7dd5589fb2c4c4242. Script to find them: git grep -l '#include.*moc' \*.cpp \*.mm | \ xargs awk '/QT_BEGIN_NAMESPACE/ { i=1 } /QT_END_NAMESPACE/ { i=0 } /#include.*moc/ && i { print ARGV[ARGIND], $0 }' Change-Id: I6f936da6f6e84d649f70fffd17058fd05cfc5c6d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a27868032b5f84193b23435d2bc87b94320206b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-271-2/+2
| | | | | Change-Id: Idaa1fa30fa6e45c9bc89c671c10a9e5e290822a3 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-201-2/+2
| | | | | Change-Id: I67d7a7642fc888690fc85541a6507bf6c166d066 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-191-2/+2
| | | | | Change-Id: I66afb44c2bfa27de899213e88bb2698d9462320f Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-151-2/+2
| | | | | Change-Id: Ibf3962a99e26d0cbd8743cb8983f1abe1fe6e6cb 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.4' in qt/qtconnectivityQt Submodule Update Bot2022-07-131-2/+2
| | | | | Change-Id: I150f9b0f7bc5825a1c23452e15302554dd0adc7f Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Windows: refactor device discoveryIvan Solovev2022-07-112-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-111-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) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Windows: fix Classic device discovery by porting to C++/WinRTIvan Solovev2022-07-112-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-114-62/+207
| | | | | | | | | | | | | | | | | | | 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) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Unstringify Android QtBluetooth: signatures, types and method callsJuha Vuolle2022-07-0715-273/+285
| | | | | | | | | | | | | | | | | This commit makes use of the new Qt Android facilities to - remove the use of explicit method signatures - remove the use of "Object" version of method calls (eg. callObjectMethod) - in general reduce the amount of plain class/type strings The native callback simplifications allowed by the new facilities will be done in a followup commit. Task-number: QTBUG-104183 Change-Id: I1c9fc79dea4bdcd1ee0ae4bba5eec7cdbc05f467 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 70afc6721d4331fec0e9ccbb580d7c8b3ce5ec04) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update dependencies on '6.4' in qt/qtconnectivityv6.4.0-beta2Qt Submodule Update Bot2022-06-301-2/+2
| | | | | Change-Id: I17d802f978fbb242ca5ace2359beacf7f4e4aeeb 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>