Commit Graph

26 Commits

Author SHA1 Message Date
Marc Mutz 4d975c3ffc Port simple cases of count() to size()
The count() methods on QByteArray and QString are deprecated. The ones
on other Qt containers will likely follow soon, so port them all to
size().

The changes which also require int -> qsizetype will come in a
follow-up patch.

Pick-to: 6.3
Change-Id: I23e364019b9cfc457d93f4a3bb4660fe8d790da8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-11 15:21:46 +02:00
Marc Mutz 330efe20f7 Replace count() comparisons against 0 with isEmpty()
Pick-to: 6.3
Change-Id: I0a14c1737cda87fa30d207bdf5b2a697214b7e70
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-08 07:11:30 +02:00
Juha Vuolle a508b9092b Re-enable BT tests on macOS and add appropriate Info.plist
The custom Info.plist is needed to run the tests on macOS 12+
If the bluetooth adapter is OFF (as it is in CI) the tests pass
fast. If the bluetooth adapter is ON there is one fail that will
be addressed with another task (QTBUG-98955).

In addition fixed one invokeMethod error which the testing revealed.

Pick-to: 6.2 6.3
Task-number: QTBUG-99222
Change-Id: Ia9fb10f0c3d00f5519fafc56234dcaacbb8013e8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-22 17:33:25 +02:00
Ivan Solovev 397c4fb935 Skip failing bluetooth tests on macOS
Temporary solution to unblock submodule update

Task-number: QTBUG-95686
Change-Id: I20ea960693bbf78026152fa5f6477ae0f78f87b3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-08-10 10:12:21 +02:00
Andreas Buhr bff824d67b Make QLECharacteristic::handle() and QLEDescriptor::handle() private
Task-number: QTBUG-62877
Task-number: QTBUG-94138
Change-Id: Id8c98e267c9b16f77a63f63f41638efbe627acaa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-06-03 11:47:38 +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
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 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
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
Alex Blasche 175dca8f8b Remove direct usage of QLowEnergyController::ctor
QLowEnergyController::createCentral() is the official API to do the same.

Change-Id: Idbd26d201b24add6697f6f9cdf1194511c160273
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2018-08-21 06:55:28 +00:00
Oliver Wolff a0ade06800 Replace foreach with for loop and set QT_NO_FOREACH
To avoid unnecessary copies, const is used wherever possible.

Change-Id: Ic743716512751cfd24fad5bd37c244b115dd26fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2018-08-15 07:56:46 +00:00
Antti Kokko 3821f105a8 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I37338c968d8cb5a056cd42e1130cfa077b12d164
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-20 20:14:38 +00:00
Konstantin Ritt acaab9e642 Port from Q_ENUMS to new macro Q_ENUM
Remove Q_ENUMS in favor of the new Q_ENUM macro which provides
registration as meta enum and a debug stream operator.

Register some enums via Q_ENUM to improve debug output
and types auto-registration.

Change-Id: I31c9535a2de7da1783b4ec967612c02a57cb62ff
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
2015-06-23 08:22:31 +00:00
Alex Blasche 193ed20a9d Reduce platform specific code lines
QLEController(QBluetoothAddress) ctor is not usable on iOS and OSX.
On those platforms we have to use QLECOntroller(QBluetoothDeviceInfo).

We mark the QBluetoothAddress based ctors of QLEController obsolete
and remove most uses of them. This cleans up some ifdefs throughout
the QtBluetooth code base.

Change-Id: Ibe1e3fa271a29461e39fc3c0eeba7a910a250077
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
2015-05-12 09:00:45 +00:00
Jani Heikkinen 7354c6d393 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-16 11:48:42 +00:00
Alex Blasche cc94fad463 Fix test warning about missing meta type registration
Change-Id: I79970d1f460e2384b459a967405c849b5c0aae03
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
2014-11-13 14:32:21 +01:00
Alex Blasche e63351bbfd Prepare BTLE unit tests for platforms which don't provide handle access
Change-Id: I63a6d31aaa13bf94ef0cc9664dd365ddb1d84b52
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
2014-11-13 14:32:12 +01:00
Alex Blasche cc5a370e2d Make compile unit tests
The ControllerState and Error enums were recently registered declared
via Q_DECLARE_METATYPE. This fix removes the duplication and resulting
compile error.

Change-Id: I38233bc067f7d94fd0dbfefbf5a6a2b08d2c6a49
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-11-04 09:47:35 +01:00
Alex Blasche 877420119f Misc TODO and test fixes
1.) Use updateValueOf*() where possible to channel all value changes
through the same gate.

2.) BTLE connects have a much larger timeout when the remote device is
not present. The device discovery could still turn up this device due
to existing pairing information.

3.) Remove obsolete write long characteristic TODO

Change-Id: I5b5815b0c3b99f8c4f87e0f1747ac6f1e274e592
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-09-08 14:40:31 +02:00
Alex Blasche bb4de7e992 Add a way to detect that the QLEController is performing a discovery
Change-Id: Ie3146c136461ad4ecde4169f3b30dda0c814ca7b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-02 20:18:09 +02:00
Jani Heikkinen ac0b7ac671 Update license headers and add new licenses
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL

Change-Id: I7a8b8b787fcae9a178794364efdefe1021d10b1b
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-08-24 17:23:37 +02:00
Alex Blasche f1b1896889 Remove QBluetoothServiceDiscoveryAgent dependency from QLE unit tests
Services cannot always discovered via SDP. Therefore we can only run
a device discovery and let QLEController do the service discovery.

In addition we add the missing Connection Control service to
the QLEController unit test. This service was introduced by a firmware
update on the TI SensorTag.

Change-Id: I52f172c0c4968c393779cd42275c548998dde8ce
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-07-23 15:28:44 +02:00
Alex Blasche 45536c645b Rename QLowEnergyControllerNew -> QLowEnergyController
Moves the new API into its place and completes the removal of the old
API.

Change-Id: I10a285e24e288aeb747cb1606574e27a4bf57308
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-07-23 12:13:21 +02:00
Alex Blasche f399837b3a Add simpler API to retrieve descriptor/characteristic for certain uuid
This new API is mostly syntactic sugar and reduces the amount of code
to be written by API users.

Change-Id: I51ff1ea706ac97199646d211e39e79c8140ee74b
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-07-16 08:28:46 +02:00
Alex Blasche e1fdef843f Add comparison operators for QLECharacteristic & QLEDescriptor
Change-Id: I5e23af887aa423c6c80335399d0342bec964f6d2
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-07-02 16:17:20 +02:00
Alex Blasche a354431ba0 Rewrite QLowEnergyCharacteristic unit test
This change incorporates the change from QLECharacteristicInfo to
QLECharacteristic.

Change-Id: I0fc6d31b60975e3b0cccc7666df9c0555350f40f
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
2014-07-02 16:17:18 +02:00