| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The example was assuming that QBluetoothLocalDevice::allDevices() always
returns a non-empty list.
This is not true for the cases when desktop has no bluetooth adapters,
as well as for WinRT implementation (it always returns empty list for now).
This patch fixes the crash and provides some information messages to the
console. Note that WinRT implementation has an extended warning, because
it returns an empty list even if the adapter actually exists.
Fixes: QTBUG-98323
Change-Id: Iaa81465cf6be2febf20526c11909667fd60728b3
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit adcfc156f437b766b7a922d0350d7f03da5c36bd)
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
|
|
|
|
|
| |
Change-Id: Iab5ba3501dae764810d9992ccea5caa0f41345aa
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Idd78cc85201efafc3ee39fa00f06aea64d2dfff8
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Idff6805215181246bacb39a3d92c106ada7c9e04
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I3659bfa6d88d5161aa0bec40c44cc23e1c8e0460
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I5a6ff7e3c14bf838785307d846bb8c2e70590b5b
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default generated Info.plist is not enough as the Bluetooth examples
require NSBluetoothAlwaysUsageDescription key to work. Without this
patch on macOS 12 there are two possible outcomes:
1) If the example is built with qmake, the application will crash
and the crash report will indicate that the key is missing
2) If the example is built with CMake, the application will not start
as it tries to use iOS specific .plist file
The patch uses absolute paths in the example CMakeLists.txt files
to work around a Ninja bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/20181
Using relative paths resulted in "multiple rules generate" errors
if the QtConnectivity module is built with examples.
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
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 70d590a81cae3c122c68bcb4521f21771cf02d40)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Debug builds of QtBluetooth on Windows were throwing asserts when
requesting a bluetooth device by its address, because we did it in a
blocking way on a GUI thread.
This patch is a partial cherry-pick of
457fd75468f56c0582f3128510e95f9bf2fc9ac3. It introduces an asynchronous
way to request a Bluetooth(LE) device.
Fixes: QTBUG-98005
Change-Id: I027607ffa32bdc1a3c77484a46833cf7ead09c77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a unit test which tests various BT LE features.
The test assumes to find a device running the "bluetoothtestdevice"
BT LE server from this same repository.
Finding/matching the server device is based on the BT LE name
which can be provided by an environment variable or by hardcoding
it in the testcase code.
Change-Id: I1c6a1bad168066d274c95e6f2cafb3ef5f9b48c1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit a3eb3acc0087f4ee571f0c336c0843c1911d9ba6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I6ba3aae3752b802b152aca4ad0114036d3514130
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I4826768568439b8d13ff40b1b0d310117f3327f4
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I249e5570dd5e1033638cb6df599258daaf0c1193
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Iae9e0c45726ddbb0ea8198465e43a204e07e2878
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Ie54450a652b4159b5dd01343023994a3701de60f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
|
|
|
|
| |
Change-Id: I43b9fbcbf7be79131e0d379f789cf47581e0fb7f
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A BT LE server can serve multiple remote devices concurrently.
The original problem was that if any of the remote devices disconnected,
the BT LE server would also report itself as disconnected even
if there were still connected devices. This disconnection can happen
even if the remote device was not in any way interested in the
Qt BT LE server (eg. LE headphones disconnecting during pairing).
This commit checks if there are still connected devices and reports
disconnection when the last device has disconnected.
Additionally the remoteAddress and remoteName are updated to reflect
these events:
- if a device is connected, that device's address will be used
- if a device is disconnected and it was the most recent device,
the address is set to that of another still connected device
Fixes: QTBUG-97576
Change-Id: I785e51574aea5e0d0a806a26f07a497101d9bab5
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 0879874ca49042e5a4aeb1a3ec158d04b7578bbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The QLowEnergyCharacteristicData allows user to define minimum and
maximum lengths for the characteristic values. This commit adds
support for Android BT LE to enforce these limits if they are set.
There are four distinct places where these checks are done:
1) When the services and their characteristics are added to the server
by QLowEnergyController::addService(). If developer has set size
limits and a value whose size violates these limits, the
characteristic is ignored with a warning.
2) When the server later on updates its characteristic values.
The update is ignored if the size limits are violated.
3.1) When a remote control device makes a regular write to the
characteristic. If the value size limits are violated, a
GATT error is returned and value will not be updated.
3.2) When a remote control device makes a prepared write to the
characteristic. With prepared write the size cannot decrease,
and we don't need to check against the minimum value length.
If the value size limits are violated, a GATT error is
returned and value will not be updated.
Fixes: QTBUG-96997
Change-Id: Ib804a1d25e54a1767b665e6e2799ac617e8f148f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit b43a85f6d7c134080a7dd30d162a59198d5c3f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Task-number: QTBUG-93991
Change-Id: I09133c6714f30bc402049cd40969a9b9644a0b4f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 0e836b5a8b6d7c659a9540e2718918f8cfc28279)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
|
|
|
|
| |
Change-Id: Ie596e7e0e3b982a98756e5fe8046a7687177dfdb
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I1640d9398620879776ab10e73bfb934c2c20c1f3
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Ic7b23a7ee4d17b6d6542dc470c44c93878a46754
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I29743e0966516472e4c5b3a1fd736b369e165c7a
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a tool "bluetoothtestdevice" which
acts as a partner device in QtBluetooth unit tests.
Change-Id: I5be89cf555a94a209de093d328fb29f91c2fea9a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f3fcf88a0dc03114fc7bce32b87a866c54eede7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I24193b95d200ad88333370b89eb94c1ff12144bd
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Ib25eabbb7a7dbe549f56ae013fa3919df0f537ff
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As per Qt documentation in
https://doc.qt.io/qt-5/qml-qtquick-listview.html#example-usage
the parent of a delegate can change and be 'null' at times.
This commit refers explicitly to the containing view instead.
Change-Id: I9c9a8c907daba2b6de52a246ae71cfde0c27e55b
Fixes: QTBUG-97691
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
(cherry picked from commit f1977883ad561b034ad95c801049a90915e81bc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Ief20d1fb7ac43b5c1a6cc83470267e00dfb32357
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: If93251924f433efff59d9d915551be3ad02caab7
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I30ba45728465acca1e2dc4d63bbd7189f73d834f
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
| |
Change-Id: I342a6c38b75846a451116c506173077780160456
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit e84efc5e26b7c902b7a3ea0204757561b0dc7b70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The prepared writes are used to write descriptors (or characteristics)
values that are larger than MTU (Maximum Transimission Unit), or
to perform partial value writes.
As an example if a descriptor's size
is 50 bytes and single packet's payload size is 20 (== MTU - protocol
overhead), the write will be split into 20 + 20 + 10. This commit adds
the necessary support for the reassembly on the server/peripheral end.
Fixes: QTBUG-96996
Change-Id: I8e1dfdfeb81f92e5b4c52ae29d88abad1e42ba62
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 33958368e0317d8e130ed950d82b5e8250c61ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The mtu() function was available on the control side, this commit
adds this also on the server (peripheral) side.
Task-number: QTBUG-96995
Change-Id: I2f13d2ba8a6d1f228f9da87d4d99b2a45fe5479d
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit c0dd49d88dc2fe89c080d2baa0da1efde559893f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Use Qt 5 connection syntax
- Use a QDialogButtonBox instead of a single button in the service dialog
- Forward-declare the UI classes
- Streamline code
Change-Id: I30db78043a8e3a62ea10223252a59b8415296e55
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit cd540c71ba00b995c484e465abeb93efe171424b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: I0d641b8c65e628bb09a26380f5b12ba2582f210e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 2a7ef291d696745887e71f8b0e27cb4c8701bdd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I09162f09640d75ab73bd801a41a761cc882fa1c2
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I5bfe9ee0c6e8df953b0c44d8563eb7981cd6ddfa
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Qt Bluetooth requires QGuiApplication in certain cases,
make sure that this is covered by the module docs.
Task-number: QTBUG-86796
Change-Id: Ib7918321b84ae51b436d2e47921e3de6d6736ad3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8a1b1ac7f694f50f75a56a1d10f204e66e62ea76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I9574edb5aaeb25bbfabd0b18445d52c5fc33152b
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I124a73aa3b5becde4cc7b10c3da4470142c61bf0
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds support for control devices writing characteristic
values that are larger than the MTU. For instance if MTU payload is
20 bytes, the writes to a 40 byte characteristic will be split in
2 consecutive writes.
With this commit these writes are recorded at the server device
(peripheral) end, and later applied.
Task-number: QTBUG-96688
Change-Id: I43c261c9ea39cca7c744af3222959c85a57ba11d
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 38562c2ba5c3d25127e1a845da673299b40a6473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I71aba7e3ac9e45984ffc2540bb1bdce9bbf09a5c
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I3a5f020a88e819198956ae89382fc585309ca3c4
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: Id60643cbe800b446e3e90ae6f229ffc88b1c51c2
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
|
|
|
|
|
| |
Change-Id: I9795a680a32178ff52edc4854ae45c2f736a7210
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
| |
Change-Id: I8c9f73703979ab2c97649a3d4b006c372ec72be6
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
| |
Current value should be empty to reflect the branch status.
Change-Id: Ife8bbd9f3c3ab625eb9900189151705a0c602281
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit e6d7342681d6d9cdad0d76dbc1c746d03260955e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|