summaryrefslogtreecommitdiffstats
path: root/src/android
Commit message (Collapse)AuthorAgeFilesLines
* Don't update cached char value when property is not readableAlex Blasche2014-12-041-1/+1
| | | | | | | | | 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-1/+18
| | | | | | Change-Id: I9c26aaa11857db8dc33a99d42347a9b7f6281ad7 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: Fix automatic notification sending when device demands itAlex Blasche2014-12-031-0/+18
| | | | | | | | | | | | | Some BTLE devices enable notifications be default. However since Android's BTLE API requires a call to BluetoothGatt.setCharacteristicNotification(..) to forward them, we have to peek at the ClientCharacteristicConfigurations during the service detail discovery and tell Android to forward the notification when required. Change-Id: Ief419404694d70a1373218c1b8275ef868a49ddb Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Android: Add characteristic indication supportAlex Blasche2014-12-011-4/+15
| | | | | | | | | | | | | | | | | At this point in time characteristic indication is very much under- documented. We have to make some guesses along the way notifications work. Also, it turns out the code already supported indications but was not very future proof. If the ClientCharacteristicConfiguration is expanded by future Bluetooth specifications the notifications could have been enabled despite the two relevant bits not being set. All that was required was to write {0xFC FF} and the notifications would have been enabled. This was due to assumption that only the byte array {0x00 0xFF} being the disabling data set. Change-Id: I6c54d557f51977418f91baf658b62e1121785029 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/+31
| | | | | | | | | | 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>
* Android: characteristic changed notification supportAlex Blasche2014-11-241-4/+35
| | | | | | Change-Id: I4c50df7d758390989c2e2127f7646e5d2dc34712 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Ensure that Android can deal with concurrent write requests.Alex Blasche2014-11-171-13/+101
| | | | | | Change-Id: Ib4f8381a1975e17b5b142f49e0f3f32398a46bfb Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Apply fixes pointed out by Java code analyzerAlex Blasche2014-11-141-28/+27
| | | | | | | | This covers code optimizations and one minor corner case bug. Change-Id: I9c4df9462e8610ea37a6e43e20840e537c295684 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Support for QLEService::writeDescriptor() on AndroidAlex Blasche2014-11-141-3/+50
| | | | | | Change-Id: I1c7f0491506c6f0512d097a419660c5f5e7fb144 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Support for QLEService::writeCharacteristic() on AndroidAlex Blasche2014-11-121-1/+119
| | | | | | | | Currently only the WriteWithResponse mode works and has been tested. Change-Id: I7947b67f737f5878a01704c09d3a9a532a41b820 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Improve reliability of QLEController connect()/disconnect()/connect()Alex Blasche2014-11-121-6/+49
| | | | | | | | | | | | | | | | | | | | | | | | Quick disconnecting and reconnecting caused some bugs and revealed some unreliabe API behavior on Android. The internal data structures were never cleaned up when disconnecting from the remote device. If multiple QLEService objects of the same QLEController instance requested a service discovery, every request but the first failed. This was fixed by queueing up the service discovery requests. Last but not least, reusing the same BluetoothGatt instance for the reconnect is very error prone. It may well be caused by Android API bugs. The reconnect would sometimes fail or toggle the connect/disconnect flag a couple of times which is not a problem for the Qt API itself but the stability of the related unit test (see tst_QLowEnergyController::tst_concurrentDiscovery()). Therefore we won't reuse the same BluetoothGatt instance but rather request a new one. Change-Id: I314f2a30960284b9bcd4926f4944c415a6d75788 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Don't print the Java stacktrace when reaching last entry of last serviceAlex Blasche2014-11-111-1/+1
| | | | | | | | We jump out and that's it. We expect the exception in those cases. Change-Id: I0fa1b42a0eb5893dec6f68a5353dfb5da3caa137 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* The service->characteristic->descriptor tree becomes available in QtAlex Blasche2014-11-111-22/+160
| | | | | | | | | | | | | | | | At the same time this fixes bugs the following bugs: 1.) Non-readable characteristics were not visible 2.) Crashes when descriptor/characteristic values were empty 3.) QLEService::discoverServiceDetails always finished with an UnknownError Missing/incorrect are still service details such as included services and the service type (which currently always defaults to primary service). Change-Id: Id73013a3784cd3c3f632102f13f5459ab37e95a6 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Propagate Charactereristic data to Qt layerAlex Blasche2014-11-101-0/+11
| | | | | | | | | Although this makes the lowenergyscanner example functionally complete, descriptor data and service meta data are still not accessable via the Qt API. Change-Id: Ifb84010b4fea054357c07424ac30116d1e4f9de0 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Majority of service detail discovery code on AndroidAlex Blasche2014-11-101-2/+252
| | | | | | | | | | Primarily the change adds the required data structures and interfaces on the Java side. What is missing is the reporting of the discovery details back to Qt. Change-Id: I37f2e17bb0f87b4c526f1b43a933b9b09b22be72 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Discover BTLE services on remote device on AndroidAlex Blasche2014-11-041-2/+33
| | | | | | Change-Id: Ia39e2ad21b0e84cb16a355337370ba82a11b75d0 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Android: Add ability to (dis)connect to BTLE devices on AndroidAlex Blasche2014-11-041-1/+72
| | | | | | | | and keep tracking the connection state Change-Id: If4d05fa18c78802ae06096884fba78eed123e77f Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Android: Add BluetoothLE device scanAlex Blasche2014-10-282-2/+86
| | | | | | Change-Id: Ibbb1e9f141d494327082aebaf9e34ffe44039115 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-243-54/+30
| | | | | | | | | - 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>
* Android: Improve QBluetoothLocalDevice::connectedDevices()Alex Blasche2014-03-241-0/+52
| | | | | | | | | | | | | | | There is no API to get the list of connected Bluetooth devices on Android. However there are service API's which return a list of their current clients. In this particular case we find the GATT related service connections. We use that info to complement the internal list of connected devices. Note that although this is using Bluetooth Low Energy related API's the Qt API does not support this feature at this point in time. Task-number: QTBUG-36764 Change-Id: Ia8266f3a9d24fd16afdd636ca2d3d0a0c6b2b499 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Fix crashes due to concurrency issuesAlex Blasche2014-03-111-1/+14
| | | | | | | | | | | | | | | BroadcastReceiver.onReceive() is executed in the main thread whereas the Qt classes are in a different thread. This created issues whereby Java's qtObject pointer was reset by the Qt classes/thread but onReceive still trying to access the same object later on. In most cases the Qt classes using BroadcastReceiver were half way through their object tear down. This patch fixes the problem by guarding qtObject against concurrent thread access and ensures that the qtObject pointer is reset before the object tear down starts. Change-Id: Iab97b0af8e10686d97419ac8504f2fe69e9536f3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix crash when interrupting QBluetoothSocket's input stream threadAlex Blasche2014-02-272-1/+105
| | | | | | | | | | | | The previous QThread did not always properly resume when InputStream.read() was interrupted by BluetoothSocket.close(). This patch converts the QThread to a Java thread which works as the Android API docs suggested. Task-number: QTBUG-37061 Change-Id: Id6ac9b57a28f3b532cbe49ff1dfdc9d1e6432aaa Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Android: Fix crash in QBluetoothServer::close()Alex Blasche2014-02-272-1/+156
| | | | | | | | | | | | | | Java's BluetoothSocketServer.accept() is meant to be interrupted via BluetoothSocketServer.close(). Unfortunately if the surrounding thread is a QThread the returning accept call crashes the thread. This does not happen if it is a Java Thread. This commit changes the server's private backend to a Java thread. Task-number: QTBUG-36754 Change-Id: I5aacc5444bbcd1275a11743b6aa04d2b11a5b22b Reviewed-by: Nedim Hadzic <nedimhadzija@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Port QtBluetooth to AndroidAlex Blasche2014-02-137-0/+144
This is a feature merge to dev targeting Qt 5.3. Known issues: -QTBUG-36754: QBluetoothServer::close() crashes -QTBUG-36763: QBluetothTransferManager port to Android not possible -QTBUG-36764: Improve QBluetoothLocalDevice::connectedDevices() -QTBUG-36810: Remove direct use of Android action strings The above issues and some other minor TODO's will be addressed until final release time. Task-number: QTBUG-33792 [ChangeLog][QtBluetooth][Android] QtBluetooth has been ported to Android. Change-Id: I31ba83e3b7d6aa68e7258b7e43235de7d1a6e68a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>