summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_android.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-151-2/+2
| | | | | | | | 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>
* Android: Fix start/stop behavior of QLowEnergyController (peripheral)Alex Blasche2018-04-171-2/+6
| | | | | | | | | | | | | | | This patch addresses two bugs. Firstly it ensures that the correct Java function is executed when disconectFromDevice() is called on Android peripheral. Secondly, it turned out that calling disconnectFromDevice() while a connection to a central exists and restarting the advertisement resulted in a non-functional QLEController instance because BluetoothGattServer was not properly restarted. As a side effects the controller's state tracking stopped as well. Change-Id: I98851fc974ceff2a1fcb03fe754dbda9c4aba271 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Android: Fix QLEController's remoteName() and remoteAddress()Alex Blasche2018-04-161-0/+6
| | | | | | | | The values were never obtained on the Java side. Task-number: QTBUG-67651 Change-Id: Ifceb124b07cf505c4e96fe7ba9d58364b3923c3a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix missing includev5.11.0-beta4Alex Blasche2018-04-091-0/+1
| | | | | | | It caused problems for the code model Change-Id: I57978be203b24a44c67ce826ec9957755029cfd1 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Merge all QLEConrollerPrivate::addServiceHelper() implementationAlex Blasche2017-11-031-51/+0
| | | | | Change-Id: Id346f2f98e63c5c7ea9e2cd3fb7e68e4573ac1e5 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Provide own header for QLEControllerPrivate on AndroidAlex Blasche2017-11-031-43/+43
| | | | | Change-Id: I63d107092e3e404f6b2c38f28d5d9b286711db77 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Provide own header for QLowEnergyControllerPrivate instance on BluezAlex Blasche2017-11-031-0/+51
| | | | | | | | | | | This utilizes the new QLowEnergyController interface and separates the existing Bluez implementation more clearly from other platforms. The existing addServiceHelper() class is moved out into the individual backends to avoid compiling the class into the new dbus backend. Change-Id: I1eea99e493958c61cb1fae830c08a3eb26bda9c3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Rename various QLEControllerPrivate classesAlex Blasche2017-11-031-42/+42
| | | | | | | | | | | | | | | | | The base class is renamed to QLEControllerPrivate and the existing QLEControllerPrivate becomes QLEControllerPrivateCommon. This is necessary to re-enable Q_DECLARE_PRIVATE. The macro uses by convention the "Private" class prefix which is currently broken because not every implementation uses QLEControllerPrivate as d-pointer type. This also avoids a SC/BC break in qlowenergycontroller.h as the d-pointer remains the same and the functions declared via Q_DECLARE_PRIVATE still return the same type. Change-Id: I84890b06280b2c473a4d370606d3bbc58a258eea Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Introduce Base class for QLowEnergyControllerPrivateAlex Blasche2017-11-031-3/+1
| | | | | | | | This permits alternative implementations selectable at runtime. Currently this is only used by Bluez. Change-Id: I3ddeb7f888f3b09bdc62f10d5b9a36320500f329 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Provide support for QLEService::writeDescriptor() on Android PeripheralAlex Blasche2017-02-061-5/+22
| | | | | | | | This permits the server itself to change descriptors at runtime. Change-Id: I5d60cfb1838ba83737cd748671520c7072201bc4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QLowEnergyController: Fix spelling errorFriedemann Kleint2017-02-061-1/+1
| | | | | Change-Id: I5f3e3e415730e36647ec0011c9fe0ed350d4cd62 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement QLEService::writeCharacteristic() for Android peripheralAlex Blasche2017-01-271-21/+35
| | | | | | | | | | | This includes the correct handling of client characteristic notifications (CCNs). As per Bluetooth spec this descriptor is unique for each device. If a characteristic was changed all chars with enabled CCNs are notified. CCN settings are even retained while the remote device is not connected. Change-Id: Iec612e6a5e70206a6be0263e10e615c26def7559 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix a lot of minor issues in the new Android peripheral backendAlex Blasche2017-01-241-9/+9
| | | | | | Change-Id: I3aa89926c5237ee8da18b73f66f0c7a321a83c91 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Android: Implement QLEService::descriptorWritten() signals for peripheralAlex Blasche2017-01-241-0/+67
| | | | | Change-Id: I60e5bdce4256804754909c2538aebe581897e1e9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Android: Implement QLEService::characteristicChanged() for peripheral modeAlex Blasche2017-01-241-2/+55
| | | | | | | | | Emits the above signal when the remote client successfully updates a characteristic. Change-Id: I236b1f92b682028bc10be798192f46bffc981101 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Android: Keep track of peripheral advertisement errorsAlex Blasche2017-01-231-0/+50
| | | | | | | | | | If advertisement fails then we drop back into the unconnected state and provide a more detailed error message for individual advertisement errors. Change-Id: Ic9de02b456409cd1a2dec11e53c884fe368ae267 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Android: Implement QLEC::stateChanged() notificationAlex Blasche2017-01-231-4/+48
| | | | | | Change-Id: Id2cabd9df7b5387fe5e6f1c898fe02e40f7c0a3d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Setup descriptor permissions for Android peripheralAlex Blasche2017-01-231-6/+85
| | | | | | Change-Id: Id40033b0745a720466a8466ad3c82ad804cadd9c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Setup characteristic permissions for Android peripheralAlex Blasche2017-01-231-4/+66
| | | | | | Change-Id: I32a3c4c711ac62ee89570534ae8c658a681bbdb8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Android: Add access to BTLE connection parametersAlex Blasche2017-01-231-2/+20
| | | | | | | | | | | | | | | | | | | | | | Unfortunately, Android only provides access to a very generic connection priority. The patch uses the minimalInterval() to determine the desired priority. Everything below 30ms is high priority and everything above 100ms is low priority. Every other value is balanced priority. QLowEnergyController::requestConnectionUpdate() was modified to permit access when the controller is connected, discovered or in the process of being discovered. The limiting factor is an existing physical connection. The documentation was updated to reflect Android's API limitations. [ChangeLog][QtBluetooth][Android] Added access to BTLE connection parameter settings. Task-number: QTBUG-53476 Change-Id: I3e22c65bd9598296a9219463dd05f0d9fc73599d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add ability to export basic service data and advertiseAlex Blasche2017-01-231-8/+194
| | | | | | | | | | | | Advertisement data and Advertisement parameter in Qt are now connected to the Android/Java side. In addition the basic service structure is supported. Descriptors and char detail export are still missing. Change-Id: I941cba5e832d76ff7beca811d08a2148367c6bf5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Connect QtBluetoothLEServer class to Qt's QLowEnergyController APIAlex Blasche2017-01-231-2/+21
| | | | | | Change-Id: I4403a9d5c79fae2c6bbe9c478660ead01dc16fe4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Protect Android Gatt code behind version checksAlex Blasche2017-01-231-13/+37
| | | | | | | | | | | | Android Bluetooth LE Client support requires API v18 and Server support requires API v21. In fact earlier releases of Qt did not actually catch the v18 border at all. It excisted since Qt 5.5 already. Change-Id: I9baabf5138b2b0d48f8d09670c4feeef688681fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Android: Beginnings of Android Bluetooth Peripheral supportAlex Blasche2017-01-231-1/+1
| | | | | | | | | | | | | Focus is on the Java side of things. The Gatt server & LE advertiser can be started and stopped. This patch builds the foundation for future changes. The C++ side is only very rudimentary and a lot of debugging helper are left inside the new code sections. Change-Id: Ic56da3ec6471ccb438fc2088fbf5eeb3053d5cf1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Bluetooth LE: Add support for Signed Write command in the central role.Christian Kandeler2016-02-171-4/+4
| | | | | | Task-number: QTBUG-41175 Change-Id: I62d74236faf9161681306d952e409e23e0cea24d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-161-0/+4
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qlowenergycontroller_bluez.cpp Change-Id: I00f45a2a22a045e7836f2caeb76cc5599ced6279
| * Bluetooth LE: Fix premature initialization of HCI manager.Christian Kandeler2016-01-151-0/+4
| | | | | | | | | | | | | | | | The private class used a member in its constructor that was only set afterwards. Change-Id: I19b7ca2a5048771a447d63a56ad10ad56c311e91 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2016-01-261-14/+20
|\ \ | | | | | | | | | Change-Id: If9cf6718cbd619dd7ce38db2da274fe9d0a41fb7
| * | Updated license headersAntti Kokko2016-01-201-14/+20
| |/ | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I856c13e2a6d4d12c46e1286b0ca1c092ee4608f8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Bluetooth LE: Add connection update functionality.Christian Kandeler2016-01-181-0/+6
| | | | | | | | | | | | | | Implemented for BlueZ only. Change-Id: I358a98bbc7499d5ce5437fb0d4672fde46c3b831 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2016-01-051-0/+8
|\| | | | | | | | | | | | | Conflicts: src/bluetooth/qlowenergycontroller.cpp Change-Id: I28b116deb3fa87169432eb2d94b70894359a9057
| * Android: Invalidate services after a disconnect from the peripheral sideAlex Blasche2015-12-231-0/+8
| | | | | | | | | | | | | | | | | | | | So far, invalidation only took place when the local/central side disconnected the connection. Task-number: QTBUG-50125 Change-Id: Ic01725d1b83e49ad7df6971d980b480f839d550b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2015-12-221-2/+2
|\| | | | | | | Change-Id: I48826b6a83d8876b97095387cd329165a534eec2
| * Fix assignment of wrong errors values in read operationsDenis Shienkov2015-12-081-2/+2
| | | | | | | | | | Change-Id: I48acb0f4bcac1cc98d74b2793151e62f2051d7c9 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2015-12-031-0/+1
|\| | | | | | | Change-Id: I1fc766d26aadb7cc01d33c4c8a2260411d7bb138
| * Merge remote-tracking branch 'gerrit/5.5' into 5.6Alex Blasche2015-12-011-0/+1
| |\ | | | | | | | | | Change-Id: I4404df69bfdac335e9c1eb63e4ada3ba89b48b6c
| | * Don't register meta types during static init time5.5Alex Blasche2015-11-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QMetaType register my not be up and running by the time we attempt these meta type registration. Change-Id: I1a857a936a24b4b00a49574fac311c08c09b3d5a Task-number: QTBUG-49455 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | Bluetooth: Add API to set up GATT services.Christian Kandeler2015-11-201-0/+7
| | | | | | | | | | | | | | | | | | | | | This is the next step in implementing LE peripheral support. Change-Id: I5e8cb186d556e7bfb9ae8a5e60e051ff7398b77d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | Bluetooth: Introduce API for LE advertising.Christian Kandeler2015-11-171-0/+15
|/ / | | | | | | | | | | | | And provide an implementation for BlueZ. Change-Id: I302aee7c43b77016d9e1e7a0d5bcbf00096abf76 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* / [Bluetooth] Optimize loopsKonstantin Ritt2015-09-161-3/+5
|/ | | | | | | | | | | | Decrease complexity from O(N+N*logN) to just O(N) for cases like foreach (Key key, map.keys()) Value value = map.value(key); , by rewriting with use of iterators. Change-Id: I81f1334797f16b624293fcebdee885b2be3c89f1 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: Fix read/write error reports when failure during initial callAlex Blasche2015-04-151-0/+6
| | | | | | | | | | | | | The BluetoothGatt.[read|write][Characteristic|Descriptor]() functions may immediately return under certain circumstances such as writing a read-only characteristic. So far, this "synchronous" form of error reporting was not handled. Any read error during the initial service dioscovery and its related cache population continues to surpress any read errors. Change-Id: I4987f67f4a0d2afe58cd144a577a19e0f0d43b33 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Android: Implement error reporting for char & desc readingAlex Blasche2015-04-151-0/+12
| | | | | | Change-Id: I5652075b4fde4d4927e86f5394baf176f263104f Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: Implement QLEService:readCharacateristic & readDescriptorAlex Blasche2015-04-151-4/+59
| | | | | | | | | | | | | In general we extend the concept of the write queue. Not only do we queue up write requests but also read requests. The handling of read errors is still missing. Right now the QLEService::error() signal is not emitted when a readCharacteristic() and readDescriptor() call fails. Change-Id: I4b4f086c351c4a29d6e48e8ee9079e9f33f36539 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluez: Implement QLES::readCharacteristic()/readDescriptor()Alex Blasche2015-04-151-0/+15
| | | | | Change-Id: I418db6ea375b8e29def136b28b4fc25154d4ffe8 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.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>
* Don't update cached char value when property is not readableAlex Blasche2014-12-041-2/+8
| | | | | | | | | In addition we update the documentation to reflect the slightly changed API behavior. Change-Id: Ieddee750aa35a32d3c01213dfbf678ee2a1d88d7 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: enable writing of characteristics without response modeAlex Blasche2014-12-041-4/+6
| | | | | | Change-Id: I9c26aaa11857db8dc33a99d42347a9b7f6281ad7 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: Implements QLEService::includedServices() and type()Alex Blasche2014-12-011-0/+26
| | | | | | | | | | Unfortunately it is not possible to say whether a service is primary or secondary on Android. The platform doesn't expose this information. Change-Id: I9b0aad191308120d2d1992a5e7736b985a375e30 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/+2
| | | | | | | | | | 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>
* Android: characteristic changed notification supportAlex Blasche2014-11-241-0/+22
| | | | | | Change-Id: I4c50df7d758390989c2e2127f7646e5d2dc34712 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>