summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* QBluetoothSocket::connectToService - check a socket type firstTimur Pocheptsov2016-08-261-0/+47
| | | | | | | | | | | | | Attempt to connect to a service using a socket with UnknownProtocol socket type will fail, but can result in an incorrect UnknownSocketError reported and also can start a device discovery (then finally failing to connect after all). Check this condition early before trying to actually connect/do device discovery and report error properly as UnsupportedProtocolError. Task-number: QTBUG-55073 Change-Id: Ib39e1ca7ad401e07d6387201a4664a1185d38d39 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* 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>
* Increase test coverage in bttestuiAlex Blasche2016-04-281-1/+1
| | | | | | | | | | QBluetoothSocket::connectDevice(QBluetoothServiceInfo, OpenMode) was not used so far. This call is even more efficient as it can avoid a complete service discovery. In summary quicker testing can be achieved. Change-Id: I6f9ef9eec6b773b9b90bf46e24a07878d81633cd Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* 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>
* Bluetooth autotests - remove outdated insignificantTimur Pocheptsov2015-11-254-5/+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>
* Add security flag support for tests with bttestuiAlex Blasche2015-07-063-3/+73
| | | | | | | | | | The user presses the "Cycle SecFlag" button and chooses the required sec level. The sec level is set on client and server socket shortly before connectToService() and listen() are called. Change-Id: Ic841fb22eb2acaf738435d6d34897b7efb59e22e Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Add test for QBluetoothSocket::preferredSecurityFlags() and setterAlex Blasche2015-07-062-1/+32
| | | | | | Task-number: QTBUG-46377 Change-Id: I12de86befe60c7d4167a6b630e3fddaf55863039 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-06-294-8/+0
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/nfc/doc/src/nfc-index.qdoc Change-Id: Ie12d3023ff934f6579ae93617c95fc654e85a7f0
| * Port from Q_ENUMS to new macro Q_ENUMKonstantin Ritt2015-06-234-8/+0
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove QNX/BlackBerry implementation for QtBluetoothAlex Blasche2015-06-175-15/+0
|/ | | | | | | | | [ChangeLog][QtBluetooth][Platform Specific Changes] Removed support for Blackberry 10. Change-Id: I431c4f34bb10aa3668542df7a8b3403b61bf4705 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Test Q_DECLARE_OPERATORS_FOR_FLAGS operatorsAlex Blasche2015-05-284-1/+132
| | | | | | | | | This global operator was added to QBluetoothDeviceInfo and QLowEnergyService flags. Change-Id: Ic841cf8c08a2289a9c112dc6283c8891dcc8750e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Unit test for new QBluetoothHostInfo comparison operatorsAlex Blasche2015-05-271-0/+58
| | | | | Change-Id: I40ac86ccf94e8575220e6094dfec0d5537eba3a1 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Reduce platform specific code linesAlex Blasche2015-05-122-65/+46
| | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-248-0/+23331
|\ | | | | | | Change-Id: Ie5ce761b77cc5c02647a9f7d52f427401b85d6b0
| * bic: Add 5.{2,3,4}.0 bic data for QtBluetooth and QtNfcSergio Ahumada2015-02-178-0/+23331
| | | | | | | | | | | | Change-Id: I0b98c18e0943b250debcf6e5461ddb19fba024ab Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-1626-181/+181
| | | | | | | | | | | | | | | | | | 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>
* | Optimize qRegisterMetaType() calls for QBluetoothTransferReplyAlex Blasche2015-01-281-1/+0
| | | | | | | | | | | | | | | | | | | | This reduces the number of registration calls since a QBluetoothTransferManager is created once or twice whereas multiple QBluetoothTransferReply instances are common. Change-Id: I14bc636cb91d9bd399d8dae55140808ec6bf7fe5 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Convert qRegisterMetaType<T>(const char*) to qRegisterMetaType<T>()Alex Blasche2015-01-2812-31/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QBluetoothServiceDiscoveryAgent - auto test on OS XTimur Pocheptsov2014-12-032-1/+9
| | | | | | | | | | | | | | | | Enable this test back (removing 'insignificant') + modify a test to make it pass if BT adapter is OFF. Change-Id: Ia2951eeed75a6695ed9ac8fc803cb2ba6668e469 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QBluetoothServiceInfo - auto test on OS XTimur Pocheptsov2014-12-031-1/+0
| | | | | | | | | | | | | | This test was already protected against 'Bluetooth is OFF' state. Change-Id: I03f58ed740baab24bfbe331e80df92193af5428b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QBluetoothSocket - auto test on OS XTimur Pocheptsov2014-12-031-1/+0
| | | | | | | | | | | | | | The test works ok even with BT adapter off. Change-Id: I3b1743fd92f41a57803a5c9df82fb1fc0788834b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QBluetoothDeviceDiscoveryAgent - test on OS XTimur Pocheptsov2014-12-031-1/+0
| | | | | | | | | | | | | | This test works ok even if BT is OFF. Change-Id: I5b3ce3f0aebc2b58df5e59d42e620385116daba1 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QBluetoothServer - auto test on OS XTimur Pocheptsov2014-12-031-0/+8
| | | | | | | | | | | | | | Modify the test to deal with Bluetooth adapter OFF on OS X. Change-Id: If45b620bb7a7c86016da0bb1cd04ed60af73662b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QBluetoothLocalDevice - isValid, tests (OS X and iOS)Timur Pocheptsov2014-12-032-1/+8
| | | | | | | | | | | | | | | | | | | | | | Cancel the previous modification - even if BT is off, the device is valid unless we create it with some address (in the 'OFF' state I can not verify any address and the device is considered invalid). Enable (back) auto-test - if BT is off we just skip the test (as it's done in other test functions). Change-Id: I8b013af6a73eab9699a91834e197716836b00e78 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth auto test - OS X and iOSTimur Pocheptsov2014-12-036-3/+6
| | | | | | | | | | | | | | | | Since now we run OS X on virtual machines without BT adapters, tests will fail unless specially adjusted. Disable them for the moment. Change-Id: I23e1c8be30354f4c1c481d1e3c6fb38ce4804630 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>
* | Fix test warning about missing meta type registrationAlex Blasche2014-11-131-0/+3
| | | | | | | | | | | | Change-Id: I79970d1f460e2384b459a967405c849b5c0aae03 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* | Prepare BTLE unit tests for platforms which don't provide handle accessAlex Blasche2014-11-132-82/+104
| | | | | | | | | | | | 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>
* | Bluetooth - device (LE) discovery for iOSTimur Pocheptsov2014-11-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Add a QBluetoothDeviceDiscoveryAgent for iOS, implementation is based on Core Bluetooth framework. Low Energy devices scan only. - Ctor with address: set error as invalid bluetooth adapter error, Core Bluetooth framework does not provide access to the local adapter's address. - Adjust a test - we do not have access to the 'local device' information on iOS (no address, no number of devices etc.) - skip the last test in tst_deviceDiscovery. Change-Id: I49080d021c340016aebc548cc8ed758777c66397 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth - device discovery test on OS XTimur Pocheptsov2014-11-051-0/+2
| | | | | | | | | | | | | | | | | | | | Print a debug message with an exact error code if device inquiry fails to start/fails - otherwise it can be converted into UnknownError, which does not help if tests are failing. -Make it even more verbose Change-Id: I2b3de396de071757022274563d4f60d3064a0228 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Bluetooth - service discovery bugfix/test update on OS XTimur Pocheptsov2014-11-051-0/+3
| | | | | | | | | | | | | | | | | | | | SDP inquiry either fails to start, or ends with an error. The failure at start was not handled correctly (probably messing with failing tests as a result). Print the original IOKit return code, set an error (thus emitting signal) + also make a test case verbose to see these error codes. Change-Id: Ica3cc5681b91f02a6b7f7e2681a653b5a9dbfd46 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Make compile unit testsAlex Blasche2014-11-043-12/+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>
* | QBluetoothDeviceInfo - update auto testTimur Pocheptsov2014-11-031-25/+98
| | | | | | | | | | | | | | | | Update auto test for LE on OS X and iOS - new ctor/assignment/copy-ctor - test that deviceUuid works properly. Change-Id: I0e19f2a9fd30f53642e793418d1c7a3dbc38417e Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Remove test assumption that each SDP discovery must find a serviceAlex Blasche2014-10-281-1/+3
| | | | | | | | | | | | Change-Id: Ica8cbd55c70f5d68e8de5d6cef0c094502284b18 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>
* | Add QLeController ctor that takes QBluetoothDeviceInfoAlex Blasche2014-10-171-6/+6
| | | | | | | | | | | | | | | | | | | | This ctor is required for OSX as the remote device address cannot be retrieved. On other platforms this ctor is syntactic sugar to be able to directly feed the device search results into the controller. Change-Id: I4839a48861ebc625740e37aee5a779deeb32f96d Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Merge remote-tracking branch 'gerrit/5.4' into btleAlex Blasche2014-10-171-1/+3
|\| | | | | | | Change-Id: Id28ba006101e64d2b0acd294ffc84be50993cb9e