| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| | |
tqtc/lts-5.15-opensource
Change-Id: I0445e0f773a4a9fff593002859a9fdea779796e7
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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: Ivan Solovev <ivan.solovev@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are two private QBluetoothSocket backends on Linux:
- QBluetoothSocketBluez is native linux socket implementation
It is always used by the linux QBluetoothServer, and by
QBluetoothSocket if Bluez version is < 5.46
- QBluetoothSocketBluezDbus used by QBluetoothSocket when
Bluez >= 5.46
Leaving the native socket unclosed leaks the resource and eventually
we may run out of descriptors. This is reproducible by creating and
destroying QBluetoothServer instances in a loop.
As a related drive-by:
- Fix bluetooth socket autotest version check. DBus socket is used
with bluez 5.46+ (for clarity: DBus lowenergycontroller
is used with bluez 5.42+). This is needed for the test to pass
with Bluez < 5.46
- Add a clarifying comment on socket close()
Fixes: QTBUG-103067
Change-Id: Idc38c743be09e559ea82bf09c2f9e44e4b80d666
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 3aafe9d5ce117858143dbb527f742cf875aa83e8)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Updated the LGPL license header to the following
files that were added as a new file in Qt 5.15.10:
- qtconnectivity/src/bluetooth/android/androidutils.cpp
- qtconnectivity/src/bluetooth/android/androidutils_p.h
Change-Id: I37d1941e1021153c8c3f5c7194323de1776733a6
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
|
|\|
| |
| |
| |
| |
| | |
tqtc/lts-5.15-opensource
Change-Id: I19a002f2b52eb02d4bfdf32c336811a71d42e9f2
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit addresses two related issues:
- From Bluez 5.55 onwards the battery service is available
through both GattService1 and Battery1 interface. This
broke the current implementation in a way that the battery
level was always '0'. This patch uses the GattService1
interface if available
- The Battery1 interface is not always available during the
service discovery, it's not generated yet. This causes
the service to be missed. This patch also checks if the
battery remote service is available also from 'Device1'
interface
This commit has been tested with Bluez versions 5.42..5.63
with Qt6, and with few selected versions with Qt5
Fixes: QTBUG-70222
Change-Id: I963947937cf85c8082fb044afe223f41e141b7c0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit e7604172ff7bdab8f3936c84a866476aee576e54)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Starting from Android 13 (API level 33) the BluetoothAdapter enable()
and disable() methods have been deprecated. In addition both methods
are strongly discouraged as they do not necessarily trigger a permission
dialogue to turn the bluetooth ON/OFF.
The methods are replaced with preferred 'action requests' which are
available since API level 5 and have the benefit of triggering a
user dialogue when powering Bluetooth ON/OFF.
The calls to these replacing APIs are surrounded by sdkVersion checks
with one exception: it appears that the old enable() call
does not work well when performing a multi-state transition from
Discoverable => PoweredOff => Connectable. The replacing API fairs
better there and hence it is replaced unconditionally.
Elsewhere the sdkVersion check is for >= 31 in order to be able to test
with devices available at the moment (API level 31 corresponds with
Android 12).
As a drive-by few related code changes:
- handle hostmode enum in a switch-case instead of if-elseif
- rename the opaque tokens and setConnectable() method in the broadcast
receiver to better reflect their role
Fixes: QTBUG-102442
Change-Id: I5d9395ce9e5ecd28b1f8e2f37d13e8aea7cfcdd3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit b865d41be6181b309808f432ee825dc84a670e62)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Including moc files directly into their classes' TU tends to improve
codegen and enables extended compiler warnings, e.g. about unused
private functions or fields.
Manual conflict resolutions:
- qbluetooth.h doesn't have the Q_NAMESPACE_NS(), yet
- QNearFieldTargetPrivate wasn't a QObject, yet
(why is it one now?!)
Fixes: QTBUG-103207
Change-Id: I1811aaef25fe4c1dbc66ebd2354cbf2308ede6dc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit 3f7cf949375458bc614c9961a44bfc712ed84872)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The class doesn't have signals, slots or Q_PROPERTYs, but adding
Q_OBJECT is idiomatic, and makes sure qobject_cast and
metaObject()->className() work as expected.
Change-Id: I6819605a26f5bd8b41ba68e74e03b03a177da3ea
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit 100c46689e997af4b8d72f221cd443c5f5c82d95)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It's only used by the bluez code, so a) let the name reflect that (as
the .cpp file already did) and b) remove the header from non-bluez
builds.
Manual conflict resolutions:
- port from cmake to qmake
Change-Id: Idc9cabcf24b8f639e6e2b9e25f8c92ce10198e8a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit bc07549c1b93b275be93f915c433a22c66188e60)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
qSwap() is a monster that looks for ADL overloads of swap() and also
detects the noexcept of the wrapped swap() function, so it should only
be used when the argument type is unknown. In the vast majority of
cases, the type is known to be efficiently std::swap()able or to have
a member-swap. Call either of these.
For the common case of pointer types, circumvent the expensive trait
checks on std::swap() by using our hand-rolled qt_ptr_swap() template,
the advantage being that it can be unconditionally noexcept, removing
all type traits instantiations.
As a drive-by, port Q_DECL_NOTHROW to noexcept, which has been
available to us since Qt 5.7.
Task-number: QTBUG-97601
Change-Id: I08ef8e0c252854e4a9905da77448f280681cc7a3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4ae9fb1ebff91bee1f59a0cbb40fcb51005123a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The SDA emits serviceDiscovered() signals for found services while
processing them. The application code receiving the signal may call
stop() on the SDA when it has received a service-of-interest, which
in turn can lead to use of already released resources once the service
processing resumes.
While the signal is emitted in the populateDiscoveredServices(),
the immediate crash was in _q_fetchUuidsTimeout() which calls it.
That function unregisters the broadcast receiver, which was already
released in stop(). This commit fixes this by making the
serviceDiscovered() emission queued so that the service discovery
reporting can finish before allowing further SDA calls.
Fixes: QTBUG-102319
Change-Id: I0059c1eaf3756e49b06b12da9e9f332602aa956e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 246ed1d9289c0ea576643c12fcde1ebdfb941500)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Change-Id: I7c95c177ab1e8ed6a0767d77f9500b1daf723857
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 4fa6f76cdd458cf76ae2217b1c2685994d0a4689)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original commit to add support for new Android-12 (API Level 31)
Bluetooth permissions covered the possible codepaths the QtBluetooth
module user might use. This commit seeks to improve the error reporting
insofar as they are due to missing permissions.
Since there are many possible codepaths to take, the following
elaborates function-by-function the details for easier understanding.
QBluetoothDeviceDiscoveryAgent::start()
This is the main entry point for using device discovery and checks the
needed permissions.
QBluetoothServiceDiscoveryAgent::start()
This is the main entry point for using service discovery. In most use
cases it uses device discovery first which ensures adequate permissions
/ failure if not granted. There is one codepath bypassing this when
setRemoteAddress() has been called, for which reason there is a
permission check.
QBluetoothSocket::localName() localAddress() connectToServiceHelper()
These functions require permissions and can be called in any order so
all of them check for permissions. Notably this commit moves the
permission check from the constructor to these functions.
QBluetoothServiceInfo::registerService()
This function creates a local device and initiates active listening.
The local device creation in this function will fail if it is not
granted permissions, but this commit adds an earlier permission check
for slightly improved error reporting.
QBluetoothServer::listen()
This is the main entry point for using the server and it checks for
permission. The local device iteration in the function would also fail
without permissions, but the permission check is added for slightly
improved error reporting. Notably the initiateActiveListening() does not
have permission check as there is no code path to it without already
having the permission.
QBluetoothLocalDevice::allDevices() constructor() setHostMode
The local device needs permissions already at construction time. This
commit documents this on the local device documentation. In addition
the local device has a widely used allDevices() static function for
iterating devices which needs its own permission checks. Also the
setHostMode() function requires Advertise permission as it ultimately
uses ACTION_REQUEST_DISCOVERABLE Intent.
QLowEnergyController::connectToDevice() startAdvertising() addService()
This commit moves the permission check from the construction time to
these individual entry functions, as the creation itself does not seem
to require permissions (tested this with a somewhat contrived setup
which dodges earlier permission checks *). The aim here is to
slightly improve the error reporting if an error is suspected to be due
to missing permissions. User may decline the first permission requests
and call subsequent functions which may or may not trigger a new
permission query. For this reason this commit also adds another
permission to startAdvertising().
*) In most if not all practical scenarios a local device and a device
discovery has been made which both perform the permission checks.
In addition the header include order was reorganized to preferred order
where this commit touches them
This commit amends a0542cff15d58db83a835f1a378a55a0ec117c9c
Task-number: QTBUG-99590
Change-Id: Ic34a0184a79f6ea7c4a6643b9603e8ddaa18e28e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit cc121cdef160a4ef528d1483ac365ac8319a1e42)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| | |
Change-Id: Icf2e614905b68406727a51399e0af6209b57a92e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 64741d6be0b9d0c2d1910f3433219f9b272d86af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Android 12 introduces three new bluetooth runtime permissions
which are required to use bluetooth. This commit introduces these
permissions.
The permission requirements are sprinkled throughout
the Android bluetooth APIs, and we need to make sure all user codepaths
are covered.
As next step we can also reduce the < 31 permissions when building
for 31+ target, but this possibly requires some buildsystem related
support as well.
Task-number: QTBUG-99590
Change-Id: Iab4b7d6d9935509e669265ed6851990d49a3a7e1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit a0542cff15d58db83a835f1a378a55a0ec117c9c)
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The private macOS socket class first calls
QBluetoothSocket::setSocketState(Connected) which emits the "connected"
signal, and after that call the private class emits another
"connected" signal. The latter signal seems extra, causing
tst_qbluetoothsocket test to fail when run against a real device.
Fixes: QTBUG-101721
Change-Id: Ibf9cddcab65286c5decb920b7998086d18a13e18
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3282843229e4a2b7945ec707a5a4fa9ccade9ecd)
|
|\|
| |
| |
| |
| |
| | |
tqtc/lts-5.15-opensource
Change-Id: I6f5b5789b64c033f10223c2147ce7a312d868230
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
At least on Linux the QIODevice parent class reads and buffers a
large chunk of data when readLine() is called. This call effectively
empties the private linear data buffer, and subsequent canReadLine()
calls to the private buffer returns false. This is problematic if
the data contained several lines of data; the
QBluetoothSocket::canReadLine() returns false but readLine() returns
valid lines of data.
This commit adds a parent class call so that it's buffers are also
taken into account as per QIODevice documentation.
Fixes: QTBUG-101690
Change-Id: I8130aff217e9e6c5525101901ed55721430b6dd0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 393fd47ab64ce80fb0e852027591840aef8e135d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Newer bluetooth devices may trigger (only) a
HCI_LE_Enhanced_Connection_Complete instead of
HCI_LE_Connection_Complete.
This commit adds handling of this so we get a proper bluetooth handle.
Task-number: QTBUG-101309
Change-Id: Ibb5cf8ca063df9345a0ef0bcb12ae0dd780bab78
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 12afa962ebb5a6eac4b598bdd1b1804c9a3ca089)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The QBluetoothSocket::connectToService(QBluetoothServiceInfo) should
extract the socket protocol info (rfcomm/l2cap) from the provided
service info.
Fixes: QTBUG-101018
Change-Id: Ibbf4daef28a2661e4699759d6f834779d27ac750
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 29b51e28a961a09fb25d668da5a5e3c9d89390b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The application code may call stop() for the service discovery agent
when it has detected the service-of-interest.
The crash occurs because the stop() will clear the list of discovered
devices, but the service discovery result handling loop may still be in
the middle of processing the services. If the loop accesses
the by-now cleared device list on its next iteration, it will cause a
list access violation assert.
Fixes: QTBUG-100894
Change-Id: Ica300cd8461543b533800ca06551b21d9b256613
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 2de33f78ec374ce6963b9c1715e4942c8cf70bb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original problem is that on macOS Monterey the service discovery,
and subsequent usage of the services, is unreliable. This commit
improves the situation a bit by checking the connectivity status
of the device instead of relying on IOBluetooth callbacks which
quite often don't arrive.
Also there was a crash due to stray callbacks from IOBluetooth.
These seem to cease when we now close the connection we have
established for SDP inquiry purposes. The crash happened especially
if the remote device got paired during the service scan.
In addition this commit introduces more event logging which helps
when debugging these issues.
Fixes: QTBUG-100303
Change-Id: Id063401390b141cff412cbb47d20d441cc394d3f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e09bf6c57c8cb0c1069b562ab2451ec8b68c27a)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1. Connection monitor: instead of asserting on 'monitor != nullptr' -
issue a warning and bail-out early. Despite of us unregistering from
connection notifications and trying to release the monitor,
IOBluetooth seems to keep references and sometimes it's possible to
trigger this assert in our autotests.
2. IOBluetoothDeviceInquiry - stop reporting errors completely, they are
not mapped to any error in QtBluetooth and give nothing but failing
auto-tests.
Change-Id: I8fc2e23d3685b912759df91c65b02537f39d1b5f
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit ba38f64e22c98ba6b0d3bdccbd00ea5a643404f8)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch amends bf69c830419a7cda87d6aa71c962804a946011ea.
After fixing the thread affinity issue, Qt is using QueuedConnection
for the charListObtained signal. As a result, the signal's arguments
need to be registered for the metatype system.
This patch provides such registration.
This is a 5.15-only change, as Qt 6 is does not require to register
the types explicitly.
Fixes: QTBUG-99767
Change-Id: I50e6314669bd6e779b85373f417c92b57f23a7e9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For example the "Bt Chat Server" example application service
would always show up as a "Custom Service".
Change-Id: If73423d90d5681ee0c3655ef7ee3ad6cd7638755
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e27c6600eca2c9b704c73a0b6d28780eb236cefb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit fixes four SDP record issues
1. The nested sequences were created too "shallow", missing one layer
of depth
2. The attribute keys are expected to be in hex format but were
given as decimals
3. The matching with variant.canConvert<QString> results in too
broad acceptance, and for example ushort was interpreted as a
string
4. With fix for "3" above in place, the UINT16 attributes were put in
as UINT32 because of how macOS by default interprets the NSNumbers
as part of SDP dictionary
Without these fixes Windows client does not find the service, and
Linux client misses some of the details.
Fixes: QTBUG-100445
Change-Id: I4f063e49bd8832d0e97bdf69acbd1ee7dacf0f87
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 119ef898806d8f67f13877a655b7e2c6b6eb168b)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
-performSDPQuery:self - does not open a baseband connection anymore to a
device, if not connected yet (despite it's documented to do so). Now we
have to ensure isConnected == true first. An attempt to connect is not guaranteed
to ever complete (with/out errors), so we need a timeout logic in place.
-performSDPQuery:self uuids:filter is simply a noop function on Monterey,
we have to filter services manually, after SDP query finished.
In addition, it was discovered that service class ID list attribute
(its id is 0x0001) as reported by Apple may have a non-sequence type,
but UUID itself instead.
Fixes: QTBUG-99673
Change-Id: I5464faa0a2eb350f738be0531e726f464c6f2caa
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit f00ea686c841e14a89bd776ac3b86766a4980bb3)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Windows IDataReader::ReadGuid function, which is used to read long
128 bit UUIDs from the SDP results, gives the last 8 bytes of the UUID
in reverse order. This commit reverses the byte order.
Without the correct byte order the UUIDs of the services are
reported wrong, and for example the uuidFilter does not work reliably.
The original bug was that the "pingpong" Windows client never finds a
Linux pingpong server. It turned out that it finds it, but interprets
the UUID wrong. The same interpretation error can also be seen against
an Android server. Running the pingpong client against an Android server
however works for the reason below.
This issue has gone undetected so far because the serviceID field is
read differently using different interface and method, and as a
consequence has made the uuid filters to work against some platforms.
Fixes: QTBUG-99689
Change-Id: I71ab44264579f9eb46461ed8fdd7a49dbf402531
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0dd124498e91308eb7ac16e976049b431770f7ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes: QTBUG-99410
Change-Id: I600a861821b87978b9bbcd425d30f49ba6b1aeea
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6224fee61f0e8a77031dbd7edbb87bd77c43d710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The m_pendingPairedDevices variable keeps track of if there are more
devices which should be discovered. The counter was decrement twice
instead of once leading to possibly non-ending discovery or missing
a discovered device.
This patch also introduces a helper method to decrement-and-check
the amount of pending paired devices.
Using this method in classicBluetoothInfoFromDeviceIdAsync allows
to properly finish device discovery in case of an async operation
error for the last device in the list.
Task-number: QTBUG-99685
Done-with: Ivan Solovev <ivan.solovev@qt.io>
Change-Id: Iaa36b212e8754940d9d574a60379fa0c32fdad2c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0c76617b0cbb7ad4903c2573c206e00bfb6add59)
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The service scan is split in two phases. First we discover the available
devices and then we scan each discovered device for their services.
The problem was that the Windows bluetooth backend scanned only the
device that was discovered the last and then stopped. This patch
addresses this by making the scanning logic to follow that of the
other backends (Bluez, macOS, and Android).
The change required also some adjustments to the stop() logic where
the Windows backend did not send the canceled() signal. The worker
"cancel logic" is nonexistent and does not produce the signal. A related
issue was that the stop() function is called both by
the baseclass and the windows specialization itself for slightly differing
purposes => needed to be split in two: releaseWorker() and stop().
Fixes: QTBUG-99687
Change-Id: Ie9e25cf0261c5259125dd0f4c6305ef1a99051e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 30390a1285c631b766d98fc8dd79d9d9ec6a5eb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Android implementation uses timers to check for services with a delay.
At some point it could lead to a state, when all discovered devices are
handled, but the timers for service discoveries were still active.
Before the patch, a finished() signal was emitted in such case, and
later, when the timer expires, the services got populated and we
received a serviceDiscovered() signal.
With this patch, we do not emit a finished() signal when the timers
are still pending. Instead the signal is emitted from the slot (which
was done anyway).
Change-Id: I55485ed842ff45f8aedfdca92b3fb1ee0adbae37
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit c24a04ba4beb719ed423f69f80850d0bea5903b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Normally, we set it to 15 s. when creating inquiry instance, since Monterey
our 15 s. are ignored and we had a timer to stop the scan in 30 s. Now that
tests are runing on CI a painfully long timeout is not needed. Make it 17 s.
in case IOBluetooth will be able to stop in 15.
Change-Id: I8e07c2a3f3c46bed3780f3287e637b5324660305
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
(cherry picked from commit 24674633ecebc85f09fe8bd5babeba9abe0ee3e0)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The last onReadyRead callback can come after the object is destroyed.
Protect against it by wrapping 'this' in a QPointer, and checking
the QPointer in the callback.
Fixes: QTBUG-98719
Change-Id: I3d5200e29744012815cd168a340bc617f85c6540
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 79a1523ed6262ccd148173ec8732865c0721063a)
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 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>
|
|\|
| |
| |
| |
| |
| | |
tqtc/lts-5.15-opensource
Change-Id: I4d53774cfe0783f50a123158d8bac7a02c382968
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 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)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\|
| |
| |
| |
| |
| | |
tqtc/lts-5.15-opensource
Change-Id: I5f92cce8507becd3683f24177d0f0251848b9cdc
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|