summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Windows QBluetoothSocket: remove unneeded variable from SocketWorkerIvan Solovev2021-12-141-22/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The m_initialReadOp member of the SocketWorker class is used only once, to perform initial read. After that m_readOp is used for all other reads. I see no reason why we need a separate variable for the first read, so this patch uses m_readOp instead. This allows to simplify the code by removing some duplication. Change-Id: If4dd57c9f080d90c975cef676c1bf84cedf44178 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 54a856d8f654fb6183c772b4eaacd92703d22062) Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * QLowEnergyController Windows: fix early disconnect crash on Win 11Ivan Solovev2021-12-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QLowEnergyController connection helper object was calling CoInitialize() in connectToDevice() and CoUninitialize() in its destructor. This was working fine on Windows 10, but on Windows 11, in case when the connection attempt is interrupted by a disconnect request, it was crashing. The stack trace showed that Windows 11 is trying to do more COM-related calls after CoUninitialize() is called. Specifically, it was calling CoIncrementMTAUsage(), and some others. This patch replaces CoInitialize(), which uses a single-threaded apartment model, to CoInitializeEx(NULL, COINIT_MULTITHREADED) that uses multi-threaded apartment. It also explicitly clears the ComPtr-based class members before calling CoUninitialize(). These two measures help to prevent the crashes. Although I do not completely understand why it helps. Fixes: QTBUG-98582 Change-Id: I6fe5a877dbc2c0518ba97fddb132c2f87fc397c2 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 6b910367d859504a0bb48b82e6a2400f76e35241) Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into ↵v5.15.8-lts-lgplTarja Sundqvist2022-11-1019-195/+488
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I4d53774cfe0783f50a123158d8bac7a02c382968
| * QBluetoothSocket Windows: check that host info is availableIvan Solovev2021-12-101-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | If we try to query local or remote socket info (name, address, port) before the connection is actually established, WinAPI will return a null instance of HostInfo for both local and remote hosts. This patch adds checks that these objects are not nullptrs before extracting data from them. Change-Id: I137f1270c1c7d95a1935cc8565cda6c9f7814292 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 45f9e9fcb054c28bc59f6cc480eb08e9b13e5f0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Thread protection for Android BT LE ServerJuha Vuolle2021-12-101-176/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Java-side callbacks and the Qt-initiated JNI calls execute in different threads. This commit introduces safeguards on these potentially concurrent activities. The thread protection is done by synchronizing the methods on the BT LE Server object, which owns the shared variables. Task-number: QTBUG-98351 Change-Id: I908cc395c705b21cbebe64fbce6874e351b6ef13 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit e0ee1dc44e57b220f6e9fc628b6f56d4b4d870a5) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| * QBluetoothSocket Windows: fix localAddress and peerAddressIvan Solovev2021-12-101-2/+13
| | | | | | | | | | | | | | | | | | | | | | WinAPI returns the address with parentheses around it. QBluetoothAddress constructor does not understand such form, so we need to explicitly remove the parentheses. Change-Id: Ie2665b3dbe7bd001160ba01aa1db9beb1b8d4d86 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit aba20224710bf66c23909ef1d1f542eaeeeedbce) Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
| * QBluetoothSocket Windows: actually query remote portIvan Solovev2021-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | Before this patch we were querying local port for both localPort() and peerPort() calls. This patch fixes it. Change-Id: Iac1689ab22a010539c27c4890137cab8f7be5e10 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 973f8c6225016fe57d9e62946292f856f369561a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * NFC: Fix PendingIntent creation for Android 12Ivan Solovev2021-12-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Since Android 12 it's mandatory to specify the mutability of each pending intent. In NFC we require a mutable intent, so we need to conditionally use FLAG_MUTABLE. This was a default value for an intent before Android 12, so no adjustment is required for earlier versions. Fixes: QTBUG-98073 Change-Id: I9a478db016bf9646d84d6e458647614785005977 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 3753c53fc810c292db93fcfbafffbc097afb0ed1)
| * CoreBluetooth: fix warning message concatenationTimur Pocheptsov2021-11-261-1/+1
| | | | | | | | | | | | | | | | | | Otherwise word in line join without space in between. Change-Id: I558daa0a26358d435d6000f73c65fb9a0054f53e Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 819629896fe080bdd79c96a5eb75eec6c368e563) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Windows: fix object destruction order when terminating helper threadsIvan Solovev2021-11-262-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows implementation of QLowEnergyController is using helper threads to perform device connection and characteristics read for services. In both cases a new QObject-derived class instance is created and moved to a helper QThread. A QThread::finished signal was used to destroy both the helper thread and the object. This was creating a situation when the order of destruction for a thread and a nested object was not specified. In practice that could lead to hangs when reading multiple service characteristics, which is specially seen on Windows 11. This patch uses QThread::finished signal to destroy only the nested object. Later on, the object's QObject::destroyed signal is used to destroy the thread itself. Task-number: QTBUG-97578 Change-Id: Ic973b835496b6098d47cd1e124315903c143e3e1 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 981e3f10f48580641f5e2365953ec8a17b5c96a2)
| * Bluetooth (Darwin): bail out early, if Info.plist is missingTimur Pocheptsov2021-11-245-25/+91
| | | | | | | | | | | | | | | | | | | | | | | | or not having proper entries that required on iOS and (starting from Monterey) on macOS (but LE only). Without them, app crashes due to exception thrown by the framework. Task-number: QTBUG-97900 Task-number: QTBUG-96557 Change-Id: Ia1463fa4361884936594780312586eb17f8fe075 Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit dfa20ef097459587ef9086dd6f4edd313123676b)
| * Fix thread affinity for charListObtained slotIvan Solovev2021-11-242-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The connection between QWinRTLowEnergyServiceHandler::charListObtained and a corresponding lambda was established using a 3-argument version of QObject::connect, which is implying Qt::DirectConnection. This means that the lambda was actually executed on the same helper thread that was responsible for reading characteristics. This is not the intentional behavior, because it could result in a concurrent access to serviceList. Also registerForValueChanges() could be called from multiple threads. This patch uses the 4-argument version of QObject::connect, so that Qt::AutoConnection is used. It means that the lambda will be executed on the main thread. This patch also removes a duplicated call to thread->exit() from the lambda. The original call is already performed in a method that emits the signal. It was not an issue with Qt::DirectConnection, but can be a problem with the fixed behavior. Task-number: QTBUG-97578 Change-Id: Ia363489024e46e2879a4bd5e56c2ab8cd6606306 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 4ecc718d418689b9b9b66086ef4d041a21f44327)
| * Fix BT LE service addition timing issue on AndroidJuha Vuolle2021-11-221-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If services were added in a tight loop sometimes the services are created wrong. In practice this results in a situation where a client reads a characteristic value from "Service A", but gets the value from "Service B" - even if the client had no knowledge of "Service B". The problem is that according to Android documentation, the BluetoothGattServer::addService() must not be called before the prior added service has received a BluetoothGattServerCallback::onServiceAdded() -callback. This commit serializes/queues the service additions. Fixes: QTBUG-96742 Change-Id: I42c980600419787d4490d1a1059e3893597cb7cf Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 4deb789fe67615ebfa99af6f1071d20b0265a2e9) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| * macOS specific Info.plist file for Bluetooth ExamplesJuha Vuolle2021-11-185-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default-generated Info.plist is not enough on macOS 12 Monterey as the Bluetooth examples require NSBluetoothAlwaysUsageDescription key to work properly. Note that the plist files are only effective if the application is started as an app bundle, ie. not if launching the contained binary directly. Task-number: QTBUG-98090 Change-Id: Iedb7eabbb8fde6ad1ba14ada1a7ee87ec1d708ba (cherry picked from commit 70d590a81cae3c122c68bcb4521f21771cf02d40) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
| * IOBluetooth: avoid over-retaining Obj-C entityTimur Pocheptsov2021-11-103-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the past, QBluetoothLocalDevicePrivate was releasing its instance of DarwinBTConnectionMonitor, and IOBluetoothDevice was not retaining this object, thus the correct behavior was assured. Starting from macOS 12 the behavior changed, just releasing in a dtor is not enough anymore, instead we should unregister 'monitor' manually, so that IOBluetoothDevice releases its ownership too. The problem was found when connecting to LE device which is Classic device at the same moment, resulting in IOBluetooth sending a notification to the monitor object, which has a dandling pointer to QBluetoothLocalDevicePrivate. Fixes: QTBUG-97900 Change-Id: Idcc1233ce51795c561dbee8fd6d9a7aff592a5a2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit 370de7fe8447b8d2216a4cd130df211b05260b8c) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Bump versionTarja Sundqvist2021-11-081-1/+1
| |
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into ↵v5.15.7-lts-lgplTarja Sundqvist2022-09-1217-490/+838
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I5f92cce8507becd3683f24177d0f0251848b9cdc
| * Refactor characteristics read for WinRTIvan Solovev2021-10-131-171/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The characteristics read was using IAsyncOperation->put_Completed() to process the results of descriptor reading. Each of these completed callbacks is executed in its own thread. In our case each of the callbacks is also calling QWinRTFunctions::await() to perform some async operations. As a result, if the service has a lot of characteristics, we could end up spawning multiple threads, each of them doing some CPU-consuming operations. Normally it's not a problem, but looks like for some bluetooth peripherals reading the characteristics can take significant time. Connecting to such devices can result in 100% CPU load for all cores if the number of characteristics exceeds the number of logical CPUs. This patch removes the put_Completed() approach in favor of another QWinRTFunctions::async() call. This will guarantee that all the characteristics read operations are performed in the same worker thread. As a drawback, characteristics reading becomes sequential, which makes it slower. Fixes: QTBUG-97242 Change-Id: If46c3f0afe13a56d93f2b8fc46b87a2c90555bf3 (cherry picked from commit 2a7ef291d696745887e71f8b0e27cb4c8701bdd2) Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * QLowEnergyControllerWinRT: refactor connection to deviceIvan Solovev2021-10-112-224/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a separate worker that will do all the system calls in a separate thread and emit a signal once it's done. This will allow to avoid the crashes caused by disconnectFromDevice() being called while connection is still in progress and spinning in the QWinRTFunctions::await() method. Basically this patch moves the connection code to a separate worker, and introduces new macros to handle the errors. It also makes use of the new early return condition of QWinRTFunctions::await() that was introduced in 1f86957f1dd14cc538e7ad9ffee4eb63001af407. As a drive-by: increased the characteristics read timeout, because the initial one was not always enough even for a turned-on device. Apart from that this patch also solves some other issues and crashes that could happen due to async nature of some calls. For example: - handle the fact that service discovery might finish after the device was disconnected. No need to notify about discovered services in this case. - add missing checks for thisPtr != nullptr in some callbacks that capture thisPtr. Task-number: QTBUG-96057 Change-Id: Ia2d044a89e3427a53d0879e045b6230d16bac3ce Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit a00ffdfc3569a5741bc42739570dea2ec52b7f0f)
| * Move connecting to a LE device to background on WindowsJuha Vuolle2021-09-224-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BT LE connectToDevice() method on Windows was a synchronous operation for the caller by blocking while spinning the event loop to keep rest of the application responsive. Other platforms behave differently. This commit makes the connect call to return immediately while scheduling the connection in the background. The QTBUG-83633 was originally about slightly different crash which seems not be reproducible anymore, but this crash was found while investigating that and is investigated in that item. Task-number: QTBUG-83633 Change-Id: I092a94f2437351d27da758db6746f5b24d5fa9c7 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 3fc3716e0cd209cd9475d632925a9148b40b2f1d) Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * QLowEnergyController(WinRT): introduce timeout for connectionIvan Solovev2021-09-211-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The connection method was infinitely trying to connect to a specified bluetooth device, which does not make much sense and could lead to the application being stuck. This patch limits the connection attempts to a reasonable amount of time. If the connection was not established within this time, ConnectionError is set and controller state is reset to UnconnectedState Fixes: QTBUG-80719 Fixes: QTBUG-89149 Change-Id: Ib8efb690a8b0485c8e9d4844799c7332ab81bf97 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 007dcbf074a9e4d72e2a29a4a28ac5e502830e20) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * winrt: Protect from late AdvertisementReceived callbackIvan Solovev2021-09-211-97/+109
| | | | | | | | | | | | | | | | | | | | | | This commit amends 83a845aa0e5bb155fae3f1d5d27bb80801f90935. The callback can be called after the worker was deleted. Task-number: QTBUG-96057 Change-Id: Ifbd58b240667bd5ff805b4250cf98a9fd2f96e90 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 3573702aa81f3f7ea20e947dbd27c5d1122cc42a) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * IOBluetoothDeviceInquiry: manually interrupt Classic scanTimur Pocheptsov2021-09-101-19/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If 'inquiryLength' was ignored. This change is to be revisited after the official release of macOS 12 - it could be a bug in beta versions and all this additional timer machinery is a waste. The fact I was able to observe the same problem with 10.15.7 is quite troublesome though. Fixes: QTBUG-95960 Task-number: QTBUG-95686 Change-Id: I56685e07791dd751aec81bebbeefde19d31555df Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit cf8ade9fd809e62cb61bb897b3789c75a48f5996)
| * QtBluetooth (examples): add Info.plist for iOSTimur Pocheptsov2021-09-092-0/+43
| | | | | | | | | | | | | | | | | | | | btscanner example can be built and deployed on iOS, but then it requires special entries in its Info.plist, explaining the usage of BT adapter. Change-Id: I86edfe84a19f4da8173bb5374fb10e55811a4b20 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit e01660fbe52963bcdef594cf34eb443c7f6acc65) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * CoreBluetooth: provide a description (in Info.plist) of BT usageTimur Pocheptsov2021-09-092-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | Our lowenergyscanner example can be built and deployed on iOS device. As such, it has to provide an explanation, why it needs an access to BT adapter, otherwise, it would crash with the most recent versions of iOS. Change-Id: Iebcdf8af931002532aada0c452263effd342300e Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 42e1fdacd51c48dd6892e32f8c0d7a2882a3ad7e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Bluetooth docs: mention the Apple's specific requirementsTimur Pocheptsov2021-09-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | Info.plist with a textual description of why and what Bluetooth is needed for by a Qt-based app is required on iOS. Change-Id: If838b57d6c13da9aeaf436dd013bd8496984a8bb Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 5953696dbd294918baf33b26ccad526d3332f967) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Heart-rate example: add a proper Info.plistTimur Pocheptsov2021-09-074-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | Apple (iOS) requires a "proper" Info.plist entries, explaining _why_ we want to use Bluetooth on this particular device. So, let's add it. Both the server and game apps need it. Fixes: QTBUG-93991 Change-Id: I09133c6714f30bc402049cd40969a9b9644a0b4f Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 0e836b5a8b6d7c659a9540e2718918f8cfc28279) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Android: Call handleTargetLost directly on NFC TagLostExceptionJens Trillmann2021-09-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If in a transceive() a TagLostException occurs, subsequent calls to transceive() may lead to an app crash with "JNI DETECTED ERROR IN APPLICATION: GetMethodID received NULL jclass" on Android 11 if the timer did not clean up first. This fix calls handleTargetLost directly. This could lead to a race condition in which the targetLost signal is send twice, which should be handled correctly by the Qt code. Change-Id: I886e0bd436272ee393a92b0193fd4d40ed4e965e Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de> (cherry picked from commit 8362edb220cb77e7bcaf766dc8a9545d1c9246e5) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * Bump versionTarja Sundqvist2021-09-071-1/+1
| | | | | | | | Change-Id: Ied1443054ec7c8b9e835fd1682c3c58ad67935be
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.6' into ↵v5.15.6-lts-lgplTarja Sundqvist2022-08-165-80/+232
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: Idc85041896434539774ca606f1b74002d98dc3ba
| * Doc: Fix typoPaul Wicking2021-07-261-1/+1
| | | | | | | | | | | | | | | | Fixes: QTBUG-95349 Change-Id: Ie1a7c71a33e5d620d914ffce193a89d080d81af9 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit eef11fe06c8458b9668f367502a479497831db62) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QWinRTBluetoothDeviceDiscoveryWorker: Add error handlingOliver Wolff2021-07-202-66/+221
| | | | | | | | | | | | | | | | | | | | | | | | Instead of asserting everywhere, we at least set the error and return gracefully. Fixes: QTBUG-90369 Fixes: QTBUG-95156 Change-Id: I143408b4b30322bb8b490d5848f731f753669015 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> (cherry picked from commit 085af5ef811e293377ba92cd12dbda926db27620)
| * Improve detection of enabled location service on SDK<28Andreas Buhr2021-07-121-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bluetooth seems to be non-functional when location services are disabled. This is not documented in Android's documentations, but several bug entries exist about this which are closed as "works as intended". See the linked bug entry for details. Our code thus tries to detect whether location services are enabled. This patch improves the detection of enabled location services. While the previous code did only check for GPS and Network location providers, the new code should detect any enabled location provider. Fixes: QTBUG-90760 Change-Id: I0c670296d0af62161dbc3fca40889996fa91f0ca Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 4fdcd2d8d2c2b47ec142b744ad291c1e134db7d4) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * Bump versionTarja Sundqvist2021-06-071-1/+1
| |
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-164-11/+24
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: If90eb1db8f874742b028a258d582bdd0a5fd5322
| * Bump versionTarja Sundqvist2021-05-201-1/+1
| | | | | | | | Change-Id: I125f4dceda56f10aa0dff3226d0de62baf7fffaa
| * Fix "loop variable creates a copy" warningKonstantin Ritt2021-05-171-2/+2
| | | | | | | | | | | | | | | | | | > warning: loop variable 'service' creates a copy from type 'const QBluetoothUuid' Change-Id: I37fce9793f4f8a18f64f2de5fa43b56ec430aabf Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 496801629cd44f21986960dc06810e4e481f5035) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * Prefer QChar over QString that consists of a single QCharKonstantin Ritt2021-05-171-3/+2
| | | | | | | | | | | | | | Change-Id: I1465ba2b94fa02ebe4a852dae0747a8530c2968d Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit ec3c1b596455bb69af43cfdcb3b80b182b055162) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * CoreBluetooth: add a workaround to enable using scan optionsTimur Pocheptsov2021-05-111-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, the value for CBCentralManagerScanOptionAllowDuplicatesKey is 'NO' (but either passing it explicitly or passing nil as 'otpions'). According to a report, this disables a proper device discovery (contrary to what is documented by Apple). Since, according to the Apple's docs, "Disabling this filtering can have an adverse effect on battery life; use it only if necessary", we don't set it by default and instead provide a workaround using environment variable to set the option, if needed. The name of this variable is: "QT_BLUETOOTH_SCAN_ENABLE_DUPLICATES". [ChangeLog][QtConnecivity][Bluetooth][Darwin] Enable setting a scan option (that allows duplicates) Change-Id: I08a5a089020c433a87bcb622d08aa2cd260283b9 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit e0e46f3f4cd5f482ef8a95b87a3d341cc3bf4076)
| * Backport a fix from Qt 6 (stop using a deprecated API)Timur Pocheptsov2021-05-071-4/+10
| | | | | | | | | | Change-Id: I740ecdd2a79bb4011b61e751edba918ea64b249e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into ↵v5.15.4-lts-lgplTarja Sundqvist2022-04-077-14/+48
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I86f7492c32a43094f37cfb9b21ad1066aa49ba68
| * Always call setOpenMode before setSocketStateAndreas Buhr2021-03-233-6/+8
| | | | | | | | | | | | | | | | | | | | | | setSocketState emits signals and should thus be called last. I most code, setOpenMode is called before setSocketState. But in some occasions, setSocketState was called before setOpenMode. This patch introduces a consistent call order: setOpenMode before setSocketState. Change-Id: I07f33511c76fbd08c79050a3fcbc1e1dd72fff04 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 62da7abae76b78fdc9385a0d997f3483057cf37c)
| * Fix bug: Let QBluetoothsocket::close emit disconnected only onceAndreas Buhr2021-03-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QBluetoothSocket::close emitted "disconnected" twice on macOS. The first emit is by setSocketState(UnconnectedState). This patch fixes the behavior to only emit it once. Fixes: QTBUG-91164 Change-Id: I7147a28b40c49db947ee97a4f1a14f319da341d1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 2a6ab855c2a4ffc5253126d53bc667b0076dd9c9) Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * Bump versionJani Heikkinen2021-03-031-1/+1
| | | | | | | | Change-Id: I12f3b1fcc0adb4a5243717647cba463904676a15
| * Change tst_qlowenergycontroller to wait for disconnectsAndreas Buhr2021-02-263-2/+30
| | | | | | | | | | | | | | | | | | | | | | Many occurrences in tst_qlowenergycontroller exist where disconnectFromDevice() is called but the code did not wait for the disconnect to happen. This patch changes this. Change-Id: I1df4e68136b8a83640af1fc50298e559d983cc9a Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 180f895023f136a694738667a73674968964bafc) Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
| * Correct error handling in QLowEnergyControllerPrivateBluezDBUSAndreas Buhr2021-02-251-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a DBUS interface was removed for a device, error handling just assumed it was the org.bluez.Device1 interface, without checking. This lead to errors on disconnection if the device has a battery service: The code sends a disconnection request, then an InterfaceRemoved event for org.bluez.Battery1 occurs. This was interpreted as a removal of org.bluez.Device1 which in turn led to the controller going into UnknownRemoteDeviceError error state. This patch adds a check whether it is really org.bluez.Device1 which is removed. Change-Id: I449b29cb9528cda23ce972f36f716a8774f01fe5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit af5f801c6b8de0bf0d21798bddef54cb14759ecd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-24314-6461/+6461
|/ | | | | | | | | | | This reverts commit 0db3b38521e11147cb802798a2cb7811a96029a9. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: Ie82dac4e6a4e2e0e1207d17a10c09701871d6875 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Fix error handling in BlueZ connectToServiceHelperAndreas Buhr2021-02-122-5/+20
| | | | | | | | | | | | | | QBluetoothSocketPrivateBluezDBus uses asynchronous calls, then blocking waits for the result and then does error handling. The blocking wait was missed in one place, rendering the following error handling code dysfunctional. This patch adds the required blocking wait. Fixes: QTBUG-82407 Change-Id: Ia45372e3b6cce3617d6c985fe1800a33631bc0fc Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 7aa19c8a512fdceac12cf4ee6587626e3de61c25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add server role to BlueZ service registrationAndreas Buhr2021-02-121-0/+1
| | | | | | | | | | | | | | | In service registration, a profile is created. This profile had no clien/server flag. If two profiles with the same UUID are created (one for server side, one for client side) this led to the wrong profile being used in connection setup. This patch marks the profile which is created in registerService() as a server profile which prevents it from being used by BlueZ in a client context. Change-Id: I95b22657a7c7e45b334476a8513d79920ba9cc96 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit e74cb54a4cbc8aba188ea48ae3effcf10432df11) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update commercial license headersTarja Sundqvist2021-02-02314-6461/+6461
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtconnectivity. Examples, tests or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in test. Task-number: QTQAINFRA-4159 Change-Id: Icf450df25282ffadf5bcd0950753d17ba6ab57e3 Reviewed-by: Antti Kokko <antti.kokko@qt.io>