Commit Graph

383 Commits

Author SHA1 Message Date
Ivan Solovev 47d54961c7 QtNFC: remove QNearFieldTarget::ndefMessagesWritten signal
ndefMessagesWritten signal basically duplicates the requestCompleted
signal, but does not provide a request id parameter to track, which
messages were actually written. Given that, the signal is removed. One
should now use requestCompleted and check the request id instead.

[ChangeLog][QtNFC][QNearFieldTarget] Remove ndefMessagesWritten signal.
Use requestCompleted signal instead.

Task-number: QTBUG-93854
Change-Id: Ic7f97eabfa83879b0da0cf34310a2982621cf8de
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-05-27 14:27:35 +02:00
Juha Vuolle 93400a02de Port cmake autotest to Qt6
The cmake test verifies the basic building of applications outside of
the repository. This is an important test as it is similar to how
the typical users of Qt build their projects.

Task-number: QTBUG-92967
Change-Id: I6f15a6270e76db855f387697eeb7faec23bbaf7e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-11 14:44:54 +03:00
Andreas Buhr ef5a2f8d25 Tidy up the autotest setup
We don't need to find_package Qt modules here.

Change-Id: Ib484b4da2cf00145f63f7e6fa6e2614225419d35
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-04 14:48:39 +02:00
Alex Blasche 673f658832 Remove unused variable
Change-Id: Iaf623ee57ca793381f1d692982def26568accd5a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-04-22 16:01:30 +02:00
Kai Köhne 2423f9da78 Rename server target in qlowenergycontroller-gattserver benchmark
This generic name conflicts with targets for other modules.

Change-Id: I623fb03b57cc04d06bf756fd1366835f7806a5af
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-19 17:19:38 +02:00
Alex Blasche 3ab608cfce Fix usage of renamed error signal
qrc:/main.qml:62:9: Cannot assign to non-existent property "onError"
             onError: errorText.text = evaluateError(error)

Change-Id: I1638a5caa2f5c35d571b9876e5d6195fd3ac4357
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-16 19:32:32 +02:00
Andreas Buhr 62cc018b3c Change QLowEnergyService::ServiceState enum to reflect future changes
In the future, discoverDetails() should become optional.
The state of a QLowEnergyService after its creation should have
a name which does not imply it is not functional yet. This patch
changes the name of the initial state from "DiscoveryRequired"
to the neutral "RemoteService".

Task-number: QTBUG-75340
Change-Id: Ib407e60f5fc7264a04a124561dacbcebb01bf252
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-08 16:57:19 +02:00
Oliver Wolff 1cddac5027 QBTDeviceDiscoveryAgentPrivate use declaration initialization
lowEnergySearchTimeout is still initialized to -1 in
qbluetoothdevicediscoveryagent_p.cpp to signal, that this "backend" does
not support le scans.

Change-Id: Icdde8693fc0de79d2b91867e3a98b883000293df
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-04-08 08:14:13 +02:00
Andreas Buhr 091da38e7b Fix unit tests: Set timeout long enough
Unit tests wait for BlueZ to come back after at most 20 seconds.
On Andreas' machine, BlueZ scans for about 25 seconds, causing
tests to fail. This patch increses the timeout to 26.5 seconds.

Change-Id: I4cabc6a20231cb7d148660b2d951ba77b32c0a2f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-04-07 21:39:29 +01:00
Andreas Buhr 1617f94cfc Change QBluetooth::Security and AttAcc. to be a scoped enums
This patch changes QBluetooth::Security and
QBluetooth::AttAccessConstraint to be scoped
enums for improved type safety.

Fixes: QTBUG-91906
Change-Id: Ife4797aa8e106690a10e4fcb7f623877023fbb3c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-30 14:38:51 +02:00
Andreas Buhr d392b6d5e9 Fix tst_qbluetoothdevicediscoveryagent after BlueZ 4 removal
Change in initialization in 87f6d3603b
broke tst_qbluetoothdevicediscoveryagent. The test was looking for
the string "Bluez 5" in the debug output, which is not produced any
more. This patch removes the logic to distinguish between BlueZ 4
and BlueZ 5 from the test, always assuming BlueZ 5.

Change-Id: I8f6cba66ac89f03493a765f4f32b868970e9b666
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-23 14:42:42 +01:00
Andreas Buhr 75c3a3ee9f rename error signals to errorOccurred
Currently, there is a name clash between the error getter and
the error signal. This leads to extensive use of qOverload or
similar. This patch renames all error signals to errorOccurred
to resolve this.

Task-number: QTBUG-62877
Change-Id: I615e2405f855433b6e142d820072c4d3f35ae28f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-22 13:51:28 +01:00
Alex Blasche b18589cd45 Reduce timing issues during manual QBluetoothLocalDevice pairing tests
The manual part of the test requires the user to accept pairing requests
on both devices. Typically this requires the acceptance of a system popup.
The user action requires time and the given timeouts were not sufficient.

Furthermore the use of QTest::qWait() is inefficient because it
waits exactly for the requested amount of time without taking into
consideration that the process may have finished (as highlighted by the
relevant signals). That's the task of QTRY_VERIFY_WITH_TIMEOUT.

30s is the wait time for waits related to manual input and 5s is the
timeout for automatic sections. The latter value is based on the fact
that the previous QTRY_VERIFY uses those 5s waiting time too.

In summary, the test increases timeouts but at the same time blocks the
entire test for a much shorter time frame (and therefore requiring
much less time to execute in total).

Change-Id: If2b21af4949f34c4f15e7794e21c002b24605e91
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-19 13:33:16 +01:00
Alex Blasche a53711af94 Remove Pairing agent related API from QBluetoothLocalDevice
The API was never completely implemented across the platforms. At least
windows and macOS do not provide the APIs to do that. Android requires
BLUETOOTH_PRIVILEGED permissions for pairingConfirmation() which is not
obtainable for regular apps. BLuez5 was never implemented and Bluez4
support has long been obsolete.

At later stages we might bring similar API back via some sort of pairing
agent API. This API would definitely be not cross platform.

Fixes: QTBUG-91477
Change-Id: I7f8ece6fabf14a3357c6275891c66c70ccba1d89
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-15 06:08:34 +01:00
Andreas Buhr e009d67f4b Decouple QBluetoothSocket and QAbstractSocket, introduce scoped enums
QBluetoothSocket enum values were tied to QAbstractSocket enum values.
But there is no dependency, the coupling is not required. This patch
removes the coupling and changes to scoped enums for improved type
safety.

Task-number: QTBUG-62877
Change-Id: I206b1d438d74b976d3e0d32da5713d22b597dd90
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-12 09:05:35 +01:00
Andreas Buhr 66bb9839db Use scoped enum for constants in QBluetoothUuid
QBluetoothUuid contains enums for ProtocolUuid, ServiceClassUuid,
CharacteristicType and DescriptorType. So far, they all
put their constants directly into the QBluetoothUuid
namespace, making it easy to mix them up. This patch changes
those to scoped enums. That way, each enum has its items in
its own namespace.

Change-Id: I86ea08ff31009dc8073d84cfe678e27920d693f7
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-11 13:01:51 +01:00
Andreas Buhr ab01e03bd2 Fix tst_qbluetoothservicediscoveryagent
Only two failures during SDP discovery were allowed. If more than
two devices not supporting SDP are in range, the tests failed.
This is often the case. This patch changes the code to allow
for any number of non-SDP supporting devices in range.

Change-Id: I299cda56858b04f5077929365f2e6e096f11ef1a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-10 12:59:14 +01:00
Andreas Buhr 44e72b713f Fix device discovery unit test
Some bluetooth devices are found multiple times, leading
to tst_qbluetoothdevicediscoveryagent to fail.
This patch fixes the test.

Change-Id: I5bb2a0758a904387855f05b769612267ac6256b9
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-10 12:59:03 +01:00
Andreas Buhr 65ae6075c1 remove QtConcurrent dependency
QtBluetooth used QtConcurrent internally in the past.
This is no longer the case. The dependency can be removed.

Fixes: QTBUG-89494
Change-Id: I7e0657f79bc02ec794311d25d245a7ae5cef02e7
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-04 10:59:10 +01:00
Andreas Buhr cd19f82503 Change tst_qlowenergycontroller to use humidity instead of temperature
After updating to firmware revision 1.50, the temperature service
still exists, but it does not provide any values. Tests which use
it fail.
This patch changes the tests to use the humidity sensor instead.

Change-Id: I996518da3a10b6d5ce9a9ca052a532d8c449c60a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-26 14:10:54 +01:00
Andreas Buhr 6e7911f949 Remove QBluetoothTransferManager and friends
This patch removes QBluetoothTransferManager,
QBluetoothTransferReply and QBluetoothTransferRequest.
Furthermore, the examples "btfiletransfer" and "picturetransfer"
are removed.

Fixes: QTBUG-75353
Task-number: QTBUG-62877
Change-Id: Ife192d80196249185df877fb6a4cae317d7e44ad
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-26 11:49:59 +01:00
Andreas Buhr 143bcc5b8e Fix unit test flakyness by only detecting number of devices once
tst_QBluetoothLocalDevice was flaky. It turns out it queried
the number of available bluetooth adapters in each test. When
no bluetooth adapter is present, this call first tries to
contact Bluez5 and times out after about 20 seconds, then it
tries to contact Bluez4 and times out after about 20 seconds.
This patch fixes the problem by only asking for the number of
bluetooth adapters once and then reusing the result.
A better fix will be available in the future, when Bluez4
support will be dropped.

Change-Id: I2c478479f754bcc8b08e83560b5a78c6060e2329
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-26 11:49:47 +01:00
Andreas Buhr 180f895023 Change tst_qlowenergycontroller to wait for disconnects
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.

Pick-to: 5.15
Change-Id: I1df4e68136b8a83640af1fc50298e559d983cc9a
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-25 15:07:55 +01:00
Alex Blasche e72cc93401 Remove deprecated QLowEnergyController ctors and instance factories
The general access to QLEController is via createCentral() and
createPeripheral(). The direct access to deprecated ctors was
removed. Furthermore all controller initialization must happen
via remote QBluetoothDeviceInfo parameter. The QBluetoothAddress
parameter cannot be used anymore as Apple devices do not
expose Bluetooth addresses but use a device specific UUID. Only
QBluetoothDeviceInfo provides this ability.

While converting the existing unit test to the instance factories,
the opportunity was used to instanciate QLEController
via QScopedPointer's. This removes memory leaks and brings the code
base more in line with the idea that QLEController is handled via
instances and factories returning pointers.

[ChangeLog][QtBluetooth][QLowEnergyController] Made QLowEnergyController
ctors private. The createPeripheral() and createCentral() factories must
be used. Furthermore all instance creation must use QBluetoothDeviceInfo
parameters for remotes due to missing cross compatibility on iOS and macOS.

Task-number: QTBUG-75344
Change-Id: I21edcc32a02a9ed9574241d80c5a79e7aca6da87
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-02-19 09:51:39 +01:00
Andreas Buhr 91c926e753 Remove all *.pro files and all "special case" markers in CMakeLists.txt
To use CMake only in the future to build QtConnectivity, all
the traces from the qmake->CMake conversion can now be removed.
This patch deletes all ".prev_CMakeLists.txt" files, in deletes all
"*.pro" files and it removes all "special case" markers in
CMakeLists.txt files. "special case" in "*.cmake" files are kept.

Change-Id: Ia0f5d4de5d77b9f2e5cc8d97fc8f04077e042a6f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-01-15 13:57:26 +01:00
Juha Vuolle 32ff708d5d Remove deprecation warnings due to QVariant::type() usage
Additionally use typeId() directly instead of userType() as they do
the same thing.

Change-Id: Icae3a05421e1ccfe4de9e32bbb5fc51925d75cfb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-01-05 14:08:38 +02:00
Andreas Buhr 7059487ccb Update CMake scripts in QtConnectivity
Recreated all CMake files in QtConnectivity using
run_pro2cmake.py . --only-existing -- --api-version 3
Furthermore, port bttestui to CMake.

Change-Id: Idb55f1b4c1cff30d7824a42e3ee6923c39e698df
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-12-21 14:26:23 +01:00
Alex Blasche 339de0b3a8 Address failing processing by cmake on gattserver test
Change-Id: I95e09c06d234067e8367655645abe01c4bd1bd25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-26 15:06:44 +02:00
Lars Schmertmann bc1b02ac04 Only scan for NFC tags with the given access method
On iOS it is only possible to search for one type of tags at the time.
See https://developer.apple.com/documentation/corenfc/nfcreadersession

On Android the access mode is controlled by the Intent filter the user
needs to set. So we check the target before targetDetected is emitted.
In the future we will add the readerMode, so we can also avoid the
scanning for wrong tags.
https://developer.android.com/reference/android/nfc/NfcAdapter#enableReaderMode

Task-number: QTBUG-81824
Change-Id: I5aa2580ada619363560cdad354a3a0be4998ea96
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-08-10 08:37:09 +02:00
Oliver Wolff 46c49bd158 Update tests/auto/qbluetoothsocket/CMakeLists.txt with pro2cmake
Change-Id: If702a7dfeeb94dac98122495a96ae82304e22d64
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-03 13:18:23 +02:00
Oliver Wolff 0a9f68ef4d tst_qbluetoothsocket: Fix one ORed preprocessor condition
Change-Id: I4ef69cd51cfa975d60de1d2c817f3827737d03c4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-07-03 09:44:44 +02:00
Oliver Wolff b23aa2b029 Update CMakeLists.txt files
Result of reruns of pro2cmake, some manual fixes after the merge and one
addition of the missing AndroidExtras dependency for Android.

Change-Id: I5a124c51d0cb9be5767ee7185744aa0694cc2c7b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-03 08:05:49 +02:00
Oliver Wolff 4caa0e80c5 Merge remote-tracking branch 'origin/wip/cmake' into dev
Change-Id: Icb3abdf0b150b5b09c13f4b054b402ba5b6a9684
2020-07-03 07:35:56 +02:00
Lars Schmertmann e17a75db6a Change the type of typeInfo in QNdefNfcSmartPosterRecord
This change is motivated by the TODO from 1421e4c482:
"The mimetype should be QString as it is UTF-8"

Task-number: QTBUG-81824
Change-Id: Ia6f345da3602dceef29fa108ac7fedbf29e9b70f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-30 11:48:23 +02:00
Lars Schmertmann 69e38e5338 Refactor QNearFieldTarget
This allows binary compatible changes in the future.

Task-number: QTBUG-81824
Change-Id: I25a5028f7cb0129de5b7ecb5b5e0c2035fcab554
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-30 08:24:33 +02:00
Jarek Kobus fba18bb44a Use QList instead of QVector
Task-number: QTBUG-84469
Change-Id: I2b51afeae462d051a3d62dc34ab8c6a63276853c
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-25 10:06:14 +02:00
Alex Blasche ea28174c9f Fix QString related deprecation warnings in device discovery test
Change-Id: I50f59edfee66e8f032b774355a2397195111b826
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-18 16:18:08 +02:00
Alex Blasche 37741c21d4 Remove QBluetoothDeviceDiscoveryAgent::inquiryType property
This removes the property itself and all related public API interfaces
(incl. InquiryType enum, property getter and setter).

[ChangeLog][QtBluetooth][QBluetoothDeviceDiscoveryAgent] Removed inquiryType property
and related API elements. The property was never implemented except for the publicly
facing API.

Task-number: QTBUG-75344
Change-Id: I775f74615294646fa8f7ee9801df2f6c6919e56d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-05-14 14:53:31 +02:00
Lars Schmertmann 7a0db5d498 Remove the registration mechanism from QNearFieldManager
The removal is proposed by a comment in qNearfieldmanager.h.

[ChangeLog][QtNFC][QNearFieldManager] Removed functions
(un)registerNdefMessageHandler(...).

Task-number: QTBUG-81824
Change-Id: Icf9dc4746a437a775ac40bbe68814daabd1ec13f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-24 12:47:03 +02:00
Lars Schmertmann 3799f043bb Remove QML API from QtNFC
[ChangeLog][QtNFC] Removed QML API

Task-number: QTBUG-81824
Change-Id: Ib7e709728d843eabd9f7e01f8ed5d01515159b5b
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-24 11:46:18 +02:00
Lars Schmertmann 7f88f67919 Remove QNearFieldManagerPrivateVirtualBase
Move the functions from QNearFieldManagerPrivateVirtualBase
to QNearFieldManagerPrivateImpl. There is no need for
QNearFieldManagerPrivateVirtualBase in the inheritance hierarchy.

Task-number: QTBUG-81824
Change-Id: I87e9261f03313df9c157c8ba4ab78dda50da8929
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-03-27 20:28:52 +01:00
Lars Schmertmann a2db2c42e8 Rename isAvailable() to isEnabled() in QNearFieldManager
[ChangeLog][QtNFC][QNearFieldManager] Renamed isAvailable() to isEnabled()

Task-number: QTBUG-81824
Change-Id: I539365282953322442f23578f38340ecb26112ca
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-03-27 12:45:01 +01:00
Qt Forward Merge Bot 778b568a6e Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I85f70b5fe6c7e5451338f4d0d891a326d880e648
2020-03-10 03:06:15 +01:00
Lars Schmertmann 539fce5bf6 Also add a response for a request if reportError is called
When using QNearFieldTarget::sendCommand on Android an exception can
occur. In this case reportError is called and handleResponse is omitted.
A call to QNearFieldTarget::waitForRequestCompleted will result in
a full usage of the specified timeout, even if the exception occurred.
To avoid this behavior also add an (invalid) response in reportError.

Change-Id: Id80b7a97da5628d229b942803ec1a2fb13536d99
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-03-05 10:27:32 +01:00
Alexandru Croitor eb2e434dda Regenerate projects to handle private deps
Change-Id: If29798f67b1a27ffd886a21facb5ca8924aa9604
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 14:39:00 +00:00
Qt Forward Merge Bot 3794dc3294 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I98b8cbf084167c9d07426a14116f1a03dfa896fe
2019-12-31 03:04:54 +01:00
Milla Pohjanheimo 8159beeeb3 Add binary compatibility files for qtconnectivity 5.14 branch
BC files built against 5.14.0 added.

Change-Id: Ida4b77e83f39e69271133a11a5cdaa03ec844ad5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-12-20 10:16:07 +02:00
Qt Forward Merge Bot 24892e6555 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I6a7635841698e6de98d94ac8b21a1764f01569e2
2019-12-10 03:01:16 +01:00
Alex Blasche 85bbb2e2e0 Fix a few compiler warnings in lowenergydescriptor unit test
Change-Id: Ic77df9c81ff0b56408d2636582f976f2140708e2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-04 15:46:47 +01:00
Andre de la Rocha 37b528f082 Fix failing tst_qlowenergydescriptor
tst_qlowenergydescriptor::tst_assignCompare() could fail due to a dependency
on a particular characteristic found in a BLE device used for development
tests. It should work regardless of it.

Fixes: QTBUG-79492
Change-Id: Ia0d640b547c1170523e7b9304c7de175da432886
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-11-29 02:56:52 +01:00