summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * Add QBluetoothDeviceInfo::UnknownCoreConfiguration enum valueAlex Blasche2014-10-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | The value is needed for platforms which do not provide this type information. An example are Android versions below 18. The enum was added in Qt 5.4. Therefore we need to add the missing \since tag too. Change-Id: I23582e7500d8da6740b281ba9821d028c4f33e05 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Merge remote-tracking branch 'gerrit/5.4' into HEADAlex Blasche2014-10-1612-635/+129
|\| | | | | | | Change-Id: Ic6549b3d728fbc9ad2425d0d6902aeac8c81e6be
| * Catch segfault when passing 0 to QBluetoothTransferManager::put()Alex Blasche2014-10-131-0/+16
| | | | | | | | | | | | Change-Id: I8c659233fd6eb2232d7bd9d904ce14f1de8a9d34 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Fix QBluetoothSocket unit test failures on AndroidAlex Blasche2014-10-131-8/+22
| | | | | | | | | | | | Change-Id: Ib8800fa30c74678c74df9ed943b143ea4cf49bb2 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Fix QBluetoothSocket::isReadable()/isOpen()/isWritable()Alex Blasche2014-10-131-12/+35
| | | | | | | | | | | | | | Change-Id: Ifd6b5ed8176aa7959ed8da0edc762266aa2bd6fa Task-number: QTBUG-32704 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Remove nfctestserver test applicationAlex Blasche2014-10-018-609/+0
| | | | | | | | | | | | | | | | | | It is realted to nfc socket streaming which we don't support at this stage. Change-Id: Idae80decad7aa2cdf7eb67b82ddc3e20384df8b8 Reviewed-by: Martin Leutelt <martin.leutelt@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
| * Fix QBluetoothServiceInfo uni test on platforms using fake server portsAlex Blasche2014-09-302-6/+56
| | | | | | | | | | | | | | | | | | | | Those platforms require a running QBluetoothServer to satisfy the prerequisites of calling QBluetoothServiceInfo::registerService(). This requirement is imposed by the public API contract anyway. Change-Id: I2498030fa2787df9745580cd744886693945fe4f Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QtBluetooth - device discovery test on OS X.Timur Pocheptsov2014-10-162-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Enable this auto test on OS X, requires a modification: 'stop' is synchronous and so cancelSpy.isEmpty() == false (the last QVERIFY fails. - Fix several problems with SDK versions (workarounds for non-existing methods in SDK < 10.9). - Change error handling: we set an error in a ctor _only_ if QBluetoothAddress parameter was not null (!isNull()) and we failed to find a local device with such an address. This is the only case documented/expected, all others _do_ _not_ set an error, even if a local adapter is off or does not exits. This fixes a failing (to integrate) auto-test. Change-Id: I9902211078330f296775f1c3249da166c19001a4 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QBluetoothServer - enable auto test on OS X.Timur Pocheptsov2014-10-022-5/+7
| | | | | | | | | | | | | | | | Enable test and skip the part, that tries to set host mode and check the success (setHostMode is a noop on OS X). Change-Id: Ib2583b9d0990c38445aaa44d62e778f5ac820141 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QBluetoothLocalDevice - enable auto test on OS X.Timur Pocheptsov2014-10-022-3/+13
| | | | | | | | | | | | | | | | The patch enables this test, but has to skip several test like powerOn/Off and setHostMode - which is noop on OS X. Change-Id: I6ef5e76294e61808668e46ad53ceaadfd855c9c3 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QtBluetooth - enable auto tests on OS X.Timur Pocheptsov2014-10-013-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | The first patch to enable tests - does not require any modifications in tests, just enabling the test. Add fix for publishedRecordWithDictioinary - this function is new in 10.9, deprecating withSDPRe..., but it crashed the test on 10.7 (and the same must happen on 10.8). Change-Id: I38e92cbc6f72fcaf8034824ef734148111139e0a Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | QtBluetooth - service discovery test.Timur Pocheptsov2014-09-301-1/+1
| | | | | | | | | | | | | | | | | | Run service discovery in 'FullDiscovery' mode (to make sure something is found at all on platforms where MinimalDiscovery works with cached results only). Change-Id: I33441dcba942ec3778b3d071ff90f64d483e497c Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* | Merge branch '5.4' into btleAlex Blasche2014-09-264-9/+77
|\| | | | | | | Change-Id: Ic5f6b510e43afbebc9bb76aa7bcd68a27d4a4a9b
| * Add missing error() signal to QBluetoothTransferReplyAlex Blasche2014-09-181-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | The signal makes error handling much more conveniant. One error situation on QNX did not emit the required finished()/errorType() signals when required. A few minor typo fixes. Task-number: QTBUG-38983 Change-Id: I89c3fbee43921c8894a0ab200ee5550e7dc44543 Reviewed-by: Lars Knoll <lars.knoll@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>
| * Misc TODO and test fixesAlex Blasche2014-09-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * 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>
* | Port QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent to OS X.Timur Pocheptsov2014-09-167-0/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent for OS X - Bluetooth Classic (the implementation based on IOBluetooth). + a very simple non-gui test (requires QApplication to work though). Update 0: style issues reported by Qt-Bot + fix a test. Update 1: QBluetoothLocalDevice - display confirmation Update 2: Device discovery agent - follow the expected logic and apply suggested fixes. Update 3: started/finished delegate methods seems to be synchronous and immediately follow start/stop calls on an inquiry. Update 4: remove unused function and redundant error message. Update 5: the first attempt to fix pairingStatus/requestPairing on a local device. Update 6: on OS X it's impossible (with a given public API) to request 'Unpaired'. I was only able to find some quite terrible hacks with private APIs or even worse - playing with SystemConfiguration frameworks and changing System Preferencies programmatically (requires authorization and looks like a total hack, since it has nothing to do with Bluetooth framework). Update 7: A very limited support for deviceConnected and connectedDevices. Update 8: Fix an invalid invokeMethod's argument. Update 9: Subject changed. Update 10: fixes in a documentation. Update 11: asserts in a coding convetion/style. Update 12: "fix" asserts + emit errors if a start/stop failed. Update 13: deviceDisconnected implemented. Update 14: use not only paired && connected devices (QBluetoothLocalDevice::connectedDevices), but also devices discovered by the connection monitor. Update 15: remove a test, not required (there are 'auto' tests). Update 16: fix private headers - they MUST have _p suffix :( Update 17: tests are known to fail (at the moment) - IOBluetooth requires adjustment (QApplication instead of QCoreApplication, lack of ability to power on/off a device (not possible on Mac) + other things). Change-Id: Iea1c8a98f1fd719f4560ec8920d00cc07eaa8146 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Remove QLowEnergyServiceInfoAlex Blasche2014-09-036-292/+0
| | | | | | | | There is no need for this class anymore as QBluetoothServiceInfo covers the same information. Change-Id: I411a8abb68b34a3a4893a67ee9fac096f44bbd62 Reviewed-by: Lars Knoll <lars.knoll@digia.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>