summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_bluez.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Encrypt all read/write commands which come back with related errorsAlex Blasche2014-09-171-29/+94
| | | | | Change-Id: I1249009d90ce9d0a7cc1e1b86a0cde8ca23ad917 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Upgrade ATT reads requests to encrypted links when indicatedAlex Blasche2014-09-161-7/+63
| | | | | | | | | | | | 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>
* Add ability to set the security level of the l2cp connectionAlex Blasche2014-09-161-0/+89
| | | | | | | | Later this will be needed to read/write authorized and encrypted characteristic/descriptor values. Change-Id: Ibc70b65b51723d6e0668ee177f5dbd1df2ba047f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for long descriptor value writesAlex Blasche2014-09-081-27/+51
| | | | | | | | | | | | | | | | | | Use the combination of prepare/execute commands to implement writing of descriptor values which are longer than ATT MTU size. Long characteristic writes are already implemented and the related code was adopted to cater for descriptor writes. At the same time we remove related TODO's from the code base. Last but not least ensure that writing of a descriptor with the same value as the pre-existing value is possible. This restriction is not helpful as some BTLE devices use writing of values as trigger for internal events and notifications. This was encountered on a test device when implementing the long write support. Change-Id: If765dc9393239dbbd1bb6a9bc942287b28d65cd6 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Misc TODO and test fixesAlex Blasche2014-09-081-5/+3
| | | | | | | | | | | | | | 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>
* Rename defines which indicate ATT header sizesAlex Blasche2014-09-081-43/+43
| | | | | | | | Adding HEADER to the name makes it more obvious which part of the message is meant. Change-Id: I207db40134db1ce558ccf89c3fd8b53fa68891f6 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Support writing of long characteristic valuesAlex Blasche2014-09-081-6/+148
| | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | 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-6/+19
| | | | | | | | 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-4/+8
| | | | | Change-Id: Ie3146c136461ad4ecde4169f3b30dda0c814ca7b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for random vs public remote address connectionsAlex Blasche2014-09-021-1/+4
| | | | | | | | | | | | | | | | This is required to be able to connect to devices which use random device addresses. Some platforms can determine this flag based on their last device scan. The flag is likely to be provided as part of QBluetoothDeviceInfo once the information is available. Unfortunately non-le scan on BLuez doesn't inform about the flag. The LE device scan is currently not implemented and, even worse, requires root privileges on Linux. The new API element permits the selection of the correct type when the scan doesn't detect the type properly. Change-Id: I8e7118658a7c927e0ea07b0d639d57f9483cb33c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge the ServiceNotValidError and OperationError of QLEServiceAlex Blasche2014-08-251-1/+0
| | | | | | | | | | | | The invalid service error is essentially the same as the operation error. The OperationError remains and the ServiceNotValidError is removed. Remove an unrelated but obsolete TODO from the source code. We can read larger than MTU values already. That's what the Blob requests are for. Change-Id: I3ed496194d55cd05f8e9e09680e962a2b7638702 Reviewed-by: Fabian Bumberger <fbumberger@rim.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>
* Remove libbluetooth system header dependencies from BTLE code baseAlex Blasche2014-08-131-10/+8
| | | | | Change-Id: I44c2ba2308a786b1ed67a9f89701c2d18fe64f6b Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
* Support reading of chars & descs if their value is larger than MTUAlex Blasche2014-08-131-6/+111
| | | | | Change-Id: I49945b13f9b2ee025541c7f689b55fa994c8057d Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Implement support for QLowEnergyService include hierarchies.Alex Blasche2014-08-131-44/+104
| | | | | Change-Id: Id11d2dcb06bd04bc1d911d746002fbbc53326ffa Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Detect secondary services and display service type in lowenergyscannerAlex Blasche2014-07-231-9/+22
| | | | | | | | QLowEnergyService::ServiceState was converted to a flag because a primary and secondary service can be included by other services. Change-Id: I425ce8e3f39ee07cccee2763b57a049a624f6178 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Characteristic and descriptor value() are no longer hex encodedAlex Blasche2014-07-231-13/+10
| | | | | | | | | | | | | There is no point converting the data to its hex representation. The use case at hand will decide it in the current application context. The returned QByteArray is the raw byte array as it comes from the device. This behavior was legacy (introduced by the previous API) and subsequently it was simply adopted. Change-Id: If662c02a5e3c3d37cccb374add02e75522352894 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Rename QLowEnergyControllerNew -> QLowEnergyControllerAlex Blasche2014-07-231-0/+1019
| | | | | | | | 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>
* Remove old GATT APIAlex Blasche2014-07-231-475/+0
| | | | | | | | | The subsequent patches will rename QLowEnergyControllerNew to QLowEnergyController and fix up the documentation fragments which still point to the old API. Change-Id: I084e6b1a85a17f424702018f3ad7047bda35d46a Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Convert QLowEnergyHandle from quint32 to quint16Alex Blasche2014-07-161-6/+6
| | | | | | | | | | | This is in accordence with the maximal possible handle size of 0xffff as per Bluetooth spec. As a side effect processReply() had to be modified since endHandle (0xffff) + 1 caused a type overrun. Change-Id: Ibdd0ec49f6f5fba7cf875f92a52659c6961076e9 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Convert characteristic and descriptor handles to intAlex Blasche2014-06-111-16/+18
| | | | | | | | | | | | | | ATT protocol defines them as int and just because Bluez5 happens to parse them from command line doesn't mean all other platforms have to deal with strings too. This avoids a lot of string to int conversions and vice versa. Handles should probably fit into short as well but this needs further verification. For we play safe. Change-Id: If75ca539b4b2956b9a65ee2a9ef738b0fe3aa2ee Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Rename permission related API in QLowEnergyCharacteristicInfoAlex Blasche2014-06-041-4/+6
| | | | | | | | | | | | | | 1.) Rename QLowEnergyCharacteristicInfo::Property to QLowEnergyCharacteristicInfo::PropertyType 2.) Rename permissions() to properties() 3.) Return PropertyTypes as return value for permissions()/properties() Change-Id: I5c4037876047354fd691cadc54d3ac6098db4522 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Cleanup of BTLE classesAlex Blasche2014-06-041-9/+1
| | | | | | | | | There are a lot of unused internal variables and helper functions which are left-overs from the last code rearrangement. Change-Id: I48d6e6aa015dea628d2467141ea1e44814d228c0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Streamline some of the QLowEnergyDescriptorInfo related codeAlex Blasche2014-06-041-14/+18
| | | | | | | | | | | | | | | | 1. QLowEnergyDescriptorInfo::type() added 2. QLowEnergyDescriptorInfo ctor signature modified 3. QBluetoothUuid::DescriptorId enum renamed 4. QLowEnergyDescriptorInfo::uuid() changed its meaning 5. QBluetoothUuid(CharacteristicDescriptor) ctor added Starting from this change QNX is going to be broken. In particular point 2 cause breaks or bug. The focus is on santizing the API at this point in time. Change-Id: I7838f550410b6a0f94026b68ecf0751533eba3cb Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Fix abortion of QLowEnergyController processing of given serviceAlex Blasche2014-06-021-17/+26
| | | | | | | | | | | | This is caused when the BTLE service has read-only characteristics only. This prevented the controller from ever emitting the connected() signal for the particular service. The patch further improves the comments and debugging capabilities of QLowEnergyController on Linux/Bluez4. Change-Id: Ic8f92e8fce964ac562ca4a01de06902f2da5d437 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
* Added and improved error handling in controller classNedim Hadzic2014-03-251-7/+12
| | | | | | | Error enums added and implemented together with examples. Change-Id: I912c396080ee9a6b87f41104eb7e41f8c62abf8b Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Bind QLowEnergyController to a particular local adapter.Alex Blasche2014-03-151-1/+9
| | | | | | | | | This simplifies the internal LEServiceInfo logic and let's us later deal with multiple adapters. Change-Id: I7d3e991207cd6571b5d644ae99c6bf1a2c99ec68 Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Cleanup of BtLE codeAlex Blasche2014-03-151-19/+11
| | | | | | | | | | 1.) Remove dead pieces of code 2.) Fix warnings 3.) Optimize some code lines Change-Id: I952fe34e8966a501a54c9ef42e9624c1fc46a2a1 Reviewed-by: Nedim Hadzic <nhadzic@blackberry.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* QNX BLE communication moved to controller classNedim Hadzic2014-03-141-57/+0
| | | | | | | Moving communication with device to QLowEnergyController class. Change-Id: Id783d3aac81c215fbda7c1390bb2abf8ecd2fb2a Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Bluez BLE write characteristic and descriptor value moved to controllerNedim Hadzic2014-03-131-0/+26
| | | | | | | | In the QLowEnergyController class write options for characteristic and descriptors are added. Change-Id: I5cc5dab1d3d2ef75d99eae045959f70524e65c91 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* BLE characteristic notification moved to controller classNedim Hadzic2014-03-111-1/+88
| | | | | | | | Enable and disable notification communication moved to the QLowEnergyController class. Change-Id: I34ceb10a5dec067133399257d544dd56db7e626e Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* BLE communication moved to controller classNedim Hadzic2014-03-111-0/+405
BLE communication code was implemented in QLowEnergyServiceInfo class. It is moved now to the QLowEnergyController class. Needed adjustments are done in order to make this work. Change-Id: I9206d2324ad59f79f4e035509e23f5c7f7cfb328 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>