summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlowenergycontroller
Commit message (Collapse)AuthorAgeFilesLines
* tst_qlowenergycontroller: fix concurrent discovery testTimur Pocheptsov2019-06-171-1/+5
| | | | | | | | | | It was not taking care of the CoreBluetooth's inability to work with addresses. Otherwise, the same code path as Android/WinRT must be used (two connections are possible). Fixes: QTBUG-76203 Change-Id: I523130b916f7e8163f2a4a23617a0076216add80 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Update SensorTag documentation URLAlex Blasche2019-03-251-2/+3
| | | | | Change-Id: Ia97bc59eb1d26aeba00d1c729b327c2eb857987c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-151-8/+10
| | | | | | | | 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>
* Improve robustness of tst_lowenergycontroller testAlex Blasche2018-01-251-15/+36
| | | | | | | | | | | | | | | | | | The test checks the value of various descriptors and characteristics of the TI Sensortag. One of those values are ClientCharacteristicConfiguration descriptors. This type of descriptor is consistent across multiple session for the same connecting central device. Therefore it may change and would create frequent test failures. Even worse, the unit test itself toggles the CCC value and assuming that a test may fail, the CC may remain with an uncertain value. This change makes the CCC value test more generic as it checks that the found value is within the acceptable range w/o expecting a defined value. Change-Id: I004a1037ee9e602807e4df5511c7d2205c92e5fe Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make tst_lowenergycontroller pass on DBUS Bluez backendAlex Blasche2018-01-251-22/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition the patch adds a few improvements making the tests somewhat more reliable. 1.) The 0x1800 BTLE Generic Access service is not exposed by BlueZ's API. That's a deliberate decision by the devs. The patch removes the service from the list of to-be-checked services. 2.) QTBUG-42519 is a limitation of the non-DBus BTLE implementation and cannot be fixed. The new DBus API does permit concurrent QLowEnergyController instances. However the instances share a platform wide singleton which means that if one instance is connected then the other instances connects as well. Other platforms separate the connectivity between instances. Therefore tst_concurrentDiscovery() has to offer three different behavior patterns 3.) Consecutive calls to writeDescriptor() in tst_readWriteDescriptor() cause a crash of bluetoothd (version 5.47 or below) and a premature disconnect from the BLE device in version BlueZ 5.48. To avoid the problem qWait calls were introduced to delay the time between individual calls. 4.) Improves the robustness of the tst_writeCharacteristicNoResponse() test which relied on notifications being enabled for two of its characteristics. So far the notifications for one characteristic were enabled but not for the other. For some magical reason this happened to be the case on all platforms but the new DBUS BTLE implementation. 5.) Swapped out some QVERIFY statements in favor of QCOMPARE. This provides better error visibility when a test fails. 6.) The patch adds a time limitation of BTLE discovery which reduces the time the entire test run takes. This is API that was recently added. Change-Id: Ib633a87614af9cbccdb0253ba47fd059a2013358 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Unify meta type registration for QLEDescriptor and QLECharacteristicAlex Blasche2017-11-031-3/+0
| | | | | | | | | The QLEControllerPrivate objects use the same function (apart from Apple platforms) and unit tests do not have to register those types at all anymore. Change-Id: I06a4a035f5a8fba9a146a3c05d1157b47c22e056 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* winrt: Use config feature when checking for winrt backend in auto testsOliver Wolff2017-08-302-10/+12
| | | | | | | | | | | | As the winrt backend may also be used on desktop Windows, checking for the operating system does no longer work. While touching these lines deprecated OS X checks were fixed as well. Task-number: QTBUG-61566 Change-Id: I247979aa63de6a71ac4908bda946d7db1e29b6c3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'gerrit/5.9' into devAlex Blasche2017-08-071-1/+5
|\ | | | | | | Change-Id: I0ed4afd881f483a166a7e1400043f116c491f30c
| * winrt: Make tst_QLowEnergyController pass if no remote device was givenOliver Wolff2017-08-041-1/+5
| | | | | | | | | | | | | | | | Same as on other platforms initTestCase should return early if no remote device was passed via environment variable. Change-Id: I0b45b9be6247e55c890e6d151541ab034eefa467 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Register additional meta typesLars Schmertmann2017-03-301-3/+0
|/ | | | | | | | | | | | | | | Register QLowEnergyCharacteristic and QLowEnergyDescriptor as meta types because they are used in signals. [ChangeLog][QtBluetooth] Register QLowEnergyCharacteristic and QLowEnergyDescriptor as meta types. It is therefore necessary to declare them as meta types in the header files. This commit will cause conflicts with existing meta type declarations in applications using Qt. These declarations need to be removed. Change-Id: I18f33b1b2f159cffd6efbacc37178286b86a06e0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE controller - add a getter for a remote device UUIDTimur Pocheptsov2016-11-231-1/+2
| | | | | | | | | | | | A device UUID is valid/works on iOS/macOS only: platforms where CoreBluetooth hides addresses and generates 128-bit uuids instead. We connect to a LE device using such a UUID. This patch adds a getter to access a UUID of a remote device our controller works with (similar to 'remoteAddress' method on other platforms). Task-number: QTBUG-52690 Change-Id: I000e17bbea90c508922ac47ce5291e28d938de7c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* tst_qlowenergycontroller: Fixed conditions for WinRTOliver Wolff2016-05-311-9/+9
| | | | | | | | | WinRT has similar restrictions as IOS in several areas like no access to local adapter data. Conditions have to be adapted accordingly for the auto test. Change-Id: I8a58386c3afaccc705a4c86ba24ceb6dc36a72ab Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'gerrit/5.6' into 5.7Alex Blasche2016-05-231-2/+2
|\ | | | | | | Change-Id: I33cfb293df15c82247561d3540a4513cdf63b910
| * tst_qlowenergycontroller.cpp: Fixed typoOliver Wolff2016-05-201-1/+1
| | | | | | | | | | Change-Id: Ib6dc3ae3237f4dfcb158f053276ffc4e378acf43 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
| * tst_qlowenergycontroller: Fixed condition for IOSOliver Wolff2016-05-201-1/+1
| | | | | | | | | | Change-Id: I92e3b8f6b3a9a80d0e59040e15c60062e1f49cc2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-2/+1
|\| | | | | | | | | | | | | Conflicts: examples/nfc/corkboard/corkboard.pro Change-Id: I5d1ea0a8e21a1b55dbf744c2f4b469bc51f05c7a
| * Peripheral Privacy Flag (0x2A02) may not be writable on some platformsAlex Blasche2016-04-271-2/+1
| | | | | | | | | | Change-Id: Ic80fe48fb192ee66f87aabcebc2b84e4ed3049a0 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2016-01-261-17/+12
|\ \ | | | | | | | | | Change-Id: If9cf6718cbd619dd7ce38db2da274fe9d0a41fb7
| * | Updated license headersAntti Kokko2016-01-201-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2016-01-051-3/+3
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/qlowenergycontroller.cpp Change-Id: I28b116deb3fa87169432eb2d94b70894359a9057
| * | tvOS supportMike Krus2016-01-051-3/+3
| |/ | | | | | | | | | | | | | | | | | | Builds but not tested Moved Q_DECLARE_METATYPE outside of namespace to fix namespaced builds Change-Id: I19c1dba904da8fad155f0f612b863e8f5e0c422e Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2015-12-031-1/+0
|\| | | | | | | Change-Id: I1fc766d26aadb7cc01d33c4c8a2260411d7bb138
| * Bluetooth autotests - remove outdated insignificantTimur Pocheptsov2015-11-251-1/+0
| | | | | | | | | | | | | | | | Several tests were marked as 'insignificant' in the past, but nowadays tests can deal with VMs without BT adapters. Change-Id: If657b3723a9a3f88c9c638105a077fd7396931d8 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth: Introduce API for LE advertising.Christian Kandeler2015-11-171-0/+1
|/ | | | | | | And provide an implementation for BlueZ. Change-Id: I302aee7c43b77016d9e1e7a0d5bcbf00096abf76 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Reduce platform specific code linesAlex Blasche2015-05-121-59/+39
| | | | | | | | | | | | 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>
* Make the QLEService unit test more error tolerantAlex Blasche2015-04-151-10/+11
| | | | | | | | | The service discovery sometimes takes longer than 10s on Adroid and there is really no point in testing the value of the System ID characteristic. This value is different for every device. Change-Id: Ib418e852e8a41db7483c5b47d2d0dc61f28b05b2 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add tests for QLEService::readDescriptor()Alex Blasche2015-04-151-4/+31
| | | | | Change-Id: I84f6d76e89036d29f14f8ca326f3fa26e626ff63 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add QLEService tests dealing with read and write error casesAlex Blasche2015-04-151-0/+230
| | | | | Change-Id: If3ea946371583b0011e6fb9533d4d5789db3739b Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Always read/write the GATT hardware even if meta data reports otherwiseAlex Blasche2015-04-151-2/+2
| | | | | | | | | | | | | | | | It is possible that a ATT attribute is not readable or writable. Usually this is reported via descriptors or other types of meta data. However it is possible that the meta data is reporting the wrong information. Therefore we always ensure that every read and write request is forwarded to the hardware. It is up to the hardware to respond to such requests. This change keeps the device usable in cases of buggy device meta data. This only affected writeCharacteristic() calls. Change-Id: Ieb2b95f47aa51c86a8ae7c4bebed4043d7478874 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add writeCharacteristic() test to encrypted characteristicAlex Blasche2015-04-151-4/+26
| | | | | | | The test is not automatic and the right hardware setup is required. Change-Id: I6ad9115e21cbd826cfe647a66f5b58f56a380a6f Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add tests for QLES::readCharacteristic()Alex Blasche2015-04-151-10/+138
| | | | | | | | | | | | | | | | | The following types of tests are performed: 1. reading of char value that fits into single ATT packet 2. reading of char value that is not readable 3. reading of char value that is requires two ATT packets (blob reads) 4. reading of char value that is exactly as long as one ATT packet (this is different than case 1 as it triggers blob reads where the the first blob read packaet is empty) Cases 1 & 2 are done using the TI Sensor Tag. Cases 3 & 4 require programmable CSR dev kit. Those tests are not enabled by default and require manual setup. Change-Id: I402a7369abbbde6b8309bed8bef6b9a9441cabc9 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Update copyright headersJani Heikkinen2015-02-161-7/+7
| | | | | | | | | 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>
* Convert qRegisterMetaType<T>(const char*) to qRegisterMetaType<T>()Alex Blasche2015-01-281-1/+0
| | | | | | | | | | | | | | | This is much safer and cleaner. [ChangeLog][QtBluetooth][Important Behavior Changes] Q_DECLARE_METATYPE added for QBluetoothServiceDiscoveryAgent::Error, QBluetoothSocket::SocketState, QBluetoothSocket::SocketError and QBluetoothDeviceInfo. This breaks source compatibility if application code has defined the above metatypes already. The applications Q_DECLARE_METATYPE must be removed to fix the compile error. Change-Id: I1c7cb1ee25832b7e5337c9aca6f36b21e8caf22e Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - auto test (OS X/iOS)Timur Pocheptsov2014-12-091-6/+86
| | | | | | | | | | | Ajust the test to make it also work with Core Bluetooth: with Core Bluetooth we do not have device address, we have only uuids (Apple's unique NSUUIDs generated for LE peripherals), this patch mainly addresses this issue - controller has to be created with LE device info, not QBluetoothAddress. Change-Id: I236cd55bfc41a8333fce663fb3b780ee219f8cec Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Extend QLEController test to cover non-readable char updatesAlex Blasche2014-12-041-0/+28
| | | | | | | | | When characteristicWritten() and characteristicChanged() signal is emitted for a non-readable characteristic, value() should not update. Change-Id: I28e377e75397e2bf01df535bc8f4b55c3561cdff Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make QLEController unit test pass on AndroidAlex Blasche2014-12-041-2/+30
| | | | | | | | | | | | 1.) Android needs some time in between disconnect/connect attempts. 2.) Adjust unit test to modified charWritten/charChanged signals 3.) Make tst pass on Android when using WriteWithoutResponse mode when writing characteristics. Android seems to ignore this property as the platform keeps sending characteristicWritten() signals. Change-Id: I9879af989471b32ff28acc64c9897da018910515 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix missing update of cached characteristic valueAlex Blasche2014-11-261-0/+7
| | | | | | | | | | When we receive a characteristic update we have to update the cached value on the Qt side. This was accidentally missed during an earlier commit. Change-Id: I0f84e35ee44e38d1e46b7ddcd4e78b7e216e49d5 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Document and test concurrent write requestsAlex Blasche2014-11-141-0/+22
| | | | | | | | | | | | | BTLE communication is serialised. However the Qt API provides the ability to issue multiple write requests while the first is still pending. The backend must enqueue the requests for later on. This behavior was already indirectly tests by a unit test but this patch adds an explicit test section for it and documents the behavior. Change-Id: I089b52940820bf0ba9c3ec872a6f1d5d6bd78a0e Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Prepare BTLE unit tests for platforms which don't provide handle accessAlex Blasche2014-11-131-81/+92
| | | | | | Change-Id: I63a6d31aaa13bf94ef0cc9664dd365ddb1d84b52 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QLowEnergyController - version for OS X and iOSTimur Pocheptsov2014-11-121-0/+4
| | | | | | | | | | | QLowEnergyController/Private for OS X and iOS. This patch contains dummy empty classes required. While LE controller is not fully implemented, I have to disable (marking as insignificant) auto test on this class, otherwise changing the (empty) class to pass the test adds more problem. Change-Id: I54f764f7f6468b1acf58e80555ae454922de9f3b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fixes for QLowEnergyController unit test on AndroidAlex Blasche2014-11-112-0/+15
| | | | | | | | | | | | | | It turns out mutliple connections to the sam remote device are possible. The limitations on Linux are implementation specific. We lift the general API limitation and document the insufficient behavior on Linux. A bug has been filed to track this limitation. On Android, unit tests require widgets support to run as we need a QGuiApplication. Change-Id: I37c487246ea6115d3441ca91a920279adbdf726e Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make compile unit testsAlex Blasche2014-11-041-4/+0
| | | | | | | | | | 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>
* Ensure behavior of QLEController ctor when handling invld remote deviceAlex Blasche2014-10-211-0/+46
| | | | | | Change-Id: I467c57d7466d0cbf57fe6550eb03e23212db3fea Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Upgrade ATT reads requests to encrypted links when indicatedAlex Blasche2014-09-161-1/+65
| | | | | | | | | | | | This is triggered if the GATT server complains about missing authorization/encryption when reading an attribute. The same mechanism has to be applied to all remaining read and write types Change-Id: Ia8330951ffdc61afb98424557bbeffe444e9a812 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Support writing of long characteristic valuesAlex Blasche2014-09-081-5/+3
| | | | | | | | | | | | | | | | | In this context long means the characteristic value is longer than the maximal ATT message size. In such cases the Bluetooth spec demands a combination of PrepareWrite commands finished by an ExecuteWrite. This is very similar to reliable writes which use the same combination of prepare/execute but permit the atomic writing of multiple characteristics at the same time. Reliable writes are not (yet) supported by the public API. Also, this works for characteristics only. Long descriptor writes will follow. Change-Id: Id139ad1848c92ca5ebf1bd1dfe8e3da297312d4f Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Add QLES::characteristicWritten() signalAlex Blasche2014-09-021-123/+83
| | | | | | | | | | | | The previous characteristicChanged() signal was emitted when the characteristic was updated due to a notification and when the value was changed using writeCharacteristic(). This meant that it was not possible to distinguish the two use cases. The new signal is only emitted in response to writeCharacteristic() whereas the old signal is only emitted when the peripheral indicates a change. Change-Id: Ie8797090f9463ae0e7fb053a42a79afa6829ca75 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rename descriptorChanged() to descriptorWritten()Alex Blasche2014-09-021-2/+2
| | | | | | | | | | | | | | | | | This is the part of a change to be able to distinguish characteristic write confirmations from characteristic change notifications. Since descriptors cannot receive notifications they won't have a changed() signal and all existing descriptorChanged() signals become descriptorWritten() signals. The changed() signal is emitted when a value notification is received from the device. The written() signal is emitted when a write request from the API user was successful. Change-Id: Ief2491ead4723eaa1bca65a09a09c34458f33630 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for BTLE write command (BlueZ/Linux)Alex Blasche2014-09-021-15/+282
| | | | | | | | So far, we only supported write requests which reply with write responses. Change-Id: Ibdad36dcf18dec23260f003911b9361cc4ab1e3d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a way to detect that the QLEController is performing a discoveryAlex Blasche2014-09-021-0/+32
| | | | | Change-Id: Ie3146c136461ad4ecde4169f3b30dda0c814ca7b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-241-18/+10
| | | | | | | | | - 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>