summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/android
Commit message (Collapse)AuthorAgeFilesLines
* Android: JNI_OnLoad return JNI_VERSION_1_6 instead of JNI_VERSION_1_4Assam Boudjelthia2020-01-171-2/+2
| | | | | | | | Update instance of old code using JNI_VERSION_1_4 to make the code consistent. Change-Id: I79bf1dc18c45dbdfe6e246e396adcf856dfee63f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Timur Pocheptsov2019-09-121-1/+11
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm src/bluetooth/qbluetoothserver_osx.mm src/bluetooth/qbluetoothserviceinfo_osx.mm src/bluetooth/qbluetoothsocket_osx.mm Change-Id: I24485ae835560fa1e57007fb684f6532db3e7922
| * Do not handle PAIRING_VARIANT_PINAlex Blasche2019-07-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The user has to enter a pin in such cases. Since QBluetoothLocalDevice does not have an API to return a pin it makes no sense for QtBluetooth to handle this type of request. Android will provide its own fall back form. This patch is mostly a revert of f8c0572ddcd. Fixes: QTBUG-76565 Task-number: QTBUG-70295 Change-Id: I61062ac84ce508f3b82c7359a60d5c9c5bba86a4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Remove usage of deprecated QBluetoothServiceInfo::DataCompleteAlex Blasche2019-05-071-2/+2
|/ | | | | | | The related functions were deprecated by fac56a229b45395488f3e41bf178361c72b3ee1e. Change-Id: Ia94b1824bb6ea7d1a8e3bb8eb5e82074e9facb7a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix possible leakBogDan Vatra2019-04-051-2/+1
| | | | | Change-Id: Ide883a3c354eb42ea0017e1d623843967b522083 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* LE/Android: fix crash when destroying DiscoveryAgent during scanKonstantin Marchenko2019-01-251-0/+3
| | | | | | | happens due to accessing already destroyed receiver from the queued call Change-Id: Ibc4a9abbb8c00ef9c8985f481b70db36fa508df8 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Don't trigger passkey pairing notification if remote device is unknownAlex Blasche2018-09-261-0/+3
| | | | | | | | | | The device address is essential for proper processing of pairingDisplayConfirmation() signal on Android. If it is not available abort immediately. This brings the passkey pairing code in line with pincode pairing. Change-Id: I174a2478d48463c58ba937e71ced377d45892f1a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Properly handle pin code pairing on AndroidAlex Blasche2018-09-262-0/+42
| | | | | | | | | | | Most likely this paring variant was forgotten when Android support for QBluetoothLocalDevice was implemented. This variant is rather uncommon and Android's default pairing handler are likely to automatically handle such requests too. Fixes: QTBUG-70295 Change-Id: I618242da415574245e5a213a6e34f190c685c8e9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Catch SecurityException during pairing on AndroidAlex Blasche2018-09-261-0/+10
| | | | | | | | | | | | | | | QBluetoothLocalDevice::pairingConfirmation(bool) requires BLUETOOTH_PRIVILEGED permission which cannot be obtained by 3rdparty apps. I believe this used to be different as suggested by https://android.googlesource.com/platform/frameworks/base/+/b1dc1757071ba46ee653d68f331486e86778b8e4 This patch ensures that the thrown SecurityException is caught and displays an appropriate warning. Change-Id: Ib5a0e0fc0c9f3b4f33690493ed74aa4b7cb8864b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Code cleanup: Use nullptr wherever possibleAlex Blasche2018-08-246-6/+6
| | | | | Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add manufacturer data to QBluetoothDeviceInfoAlex Blasche2018-08-171-0/+7
| | | | | | | The initial patch was contributed by Thiemo van Engelen. Change-Id: I45fad793ba092ab2820e606d8bf8807afa3e911e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add QBluetoothSocketPrivate interface for AndroidAlex Blasche2018-07-252-5/+5
| | | | | | | Task-number: QTBUG-68550 Change-Id: Iac05cccd4f6e1b44a30568fb9b6c9171204b53fd Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* LE/Android: replace activity()/service() with context()Konstantin Ritt2018-02-192-4/+2
| | | | | Change-Id: I3fc082b42b6d56890039b482643ed41b9c9456ce Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-211-1/+1
|\ | | | | | | | | | | | | Conflicts: src/bluetooth/bluetooth.pro Change-Id: Ibccccc974b545696ae053f1fbffcc973d8be43cc
| * Update to new QRandomGenerator APIv5.10.0-beta4Thiago Macieira2017-11-031-1/+1
| | | | | | | | | | | | Change-Id: I69f37f9304f24709a823fffd14e676c097712329 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Various cleanups following the recent QLEControllerPrivate header splitsAlex Blasche2017-11-031-1/+2
| | | | | | | | | | Change-Id: Ia98a7a16c3e1e478d1c6e30d9e70dc703c1fe091 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Replace Q_NULLPTR with nullptrKevin Funk2017-09-291-14/+14
|/ | | | | Change-Id: Ica194c2568465a94d851ddeaf62ca71b33fe4464 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename qbluetoothglobal.h to qtbluetoothglobal.hOliver Wolff2017-08-301-1/+1
| | | | | | | | | | | | | ... and deprecate the former. By doing so we get the header file in line with other modules - see qtnetworkglobal.h for example. The include is not used in the examples so it is removed there. Change-Id: Ie6267738d4a45e45a0350d458a40654d8a952f4a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-063-1/+8
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I7a55929aefa1f7a4dc96f841317b78b248899f67
| * Fix concurrent access to QBluetoothSocket::canReadLine() on AndroidAlex Blasche2017-06-292-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android, the socket's read buffer is managed in the Java thread. QBluetoothSocket::canReadLine() is public API (most likely) being called by in the main Qt thread though. The function directly called into the Java buffer instance without proper locking. This can create race conditions. Starting with this patch canReadLine() calls another QBluetoothSocketPrivate indirection to allow a platform specific implementation. This affects WinRT, BlueZ and the dummy backend too. This is not an issue on macOS as its implementation of QBluetoothSocket is separate and does not have to deal with multiple QBluetoothSocketPrivate implementations. Task-number: QTBUG-58190 Task-number: QTBUG-60830 Change-Id: Idae19f1aee6f809699d36519b01a3c68ad9c563d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Remove last qdoc warning from qtconnectivityAlex Blasche2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | src/bluetooth/android/devicediscoverybroadcastreceiver.cpp:240: warning: Cannot tie this documentation to anything [I found a /*! ... */ comment, but there was no topic command (e.g., '\fn', '\page') in the comment and no function definition following the comment.] The file referenced in the warning does not contribute to the QtBluetooth documentation. The patch removes qdoc annotation from the file. Change-Id: Ie5699d79a12e5fc1851a924adbf50ebcb5059454 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Use QRandomGenerator instead of q?randThiago Macieira2017-06-301-3/+2
|/ | | | | Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a lot of minor issues in the new Android peripheral backendAlex Blasche2017-01-241-2/+2
| | | | | | 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-243-0/+27
| | | | | Change-Id: I60e5bdce4256804754909c2538aebe581897e1e9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Android: Implement QLEService::characteristicChanged() for peripheral modeAlex Blasche2017-01-243-0/+27
| | | | | | | | | 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-233-0/+18
| | | | | | | | | | 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-0/+10
| | | | | | Change-Id: Id2cabd9df7b5387fe5e6f1c898fe02e40f7c0a3d 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-232-6/+13
| | | | | | | | | | | | | 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>
* LE/Android: Fix crash due to references leakKonstantin Ritt2016-12-301-1/+4
| | | | | | | | | | in f945ffc90f8f11d73dc87f2d82bb2d246d446e71, a very basic scanRecord parser has been added, which calls GetByteArrayElements without releasing the elemnts, causing JNI core exception > E/dalvikvm: Failed adding to JNI pinned array ref table (1023 entries) Change-Id: I272593c232f0c87c1983f1f568aa6c3599d44253 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* LE/Android: Pass list of advertised services found in scan recordAlex Blasche2016-11-116-12/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the advertising packet (scan record) received from BLE devices during scanning on Android devices is ignored. Consequently, the serviceUuids() method of the QBluetoothDeviceInfo class returns an empty list for BLE devices. However, this list provides important information needed by clients to identify whether a given device is of interest. This changeset implements parsing of the scan record received from the Android Bluetooth layer. The Java byte array is passed over JNI to the C++ adapter classes, where it's parsed to find any service UUIDs being advertised by the device. Parsing the scan record ourselves is required for compatibility (Qt uses "old-style" LE scan API from Android api level 18.) All found UUIDs are added to a list which is subsequently passed to the user of the QBluetoothDeviceDiscoveryAgent class via the deviceDiscovered(QBluetoothDeviceInfo&) signal. Note: not all Android devices pass the full advertisement data. The service UUID list may be empty in those cases. [ChangeLog][QtBluetooth][Android] Parse list of advertised services found in LE scan record and pass them to API client via QBluetoothDeviceInfo::serviceUuids() Task-number: QTBUG-56625 Change-Id: I253f1b841c7b15b3bbabc9e478de87c81979815e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove not needed Log output from Android Device DiscoveryAlex Blasche2016-11-071-1/+0
| | | | | Change-Id: Ibe1871578394fa1e0f039425036ab0dd5223be49 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-11/+298
|\ | | | | | | Change-Id: I3eec9a22565585d4fc40831d609a3083ce99a52c
| * Android: Device discovery doesn't provide major & minor device class infoAlex Blasche2016-08-011-11/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QBluetoothDeviceDiscoveryAgent did not extract the QBluetoothDeviceInfo::majorDeviceClass() and QBluetoothDeviceInfo::minorDeviceClass() information. The Android API provides info for all major device classes. However not each major device class has its set of API for the minor device class information. Caching is applied to match Android major device class values against their matching Qt enum. When a matching entry is found, the value is added to the cache. In principle, the mechanism is applied for minor device class values. However since there are many many more minor device class fields, the caching is a bit more proactive. The patch will proactively read and cache all minor device class values for a given major device class. This avoids a large overhead of very long if..else if...else if..else statements. Change-Id: I26a6c29c6f5dca6d4f3b4b25902cda03a10ae5de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Make QtBluetooth Low Energy work when Qt runs as Android serviceAlex Blasche2016-08-031-2/+2
| | | | | | | | | | Change-Id: Ic0814c3f5a65ce9ac9236c41397400fc42abb572 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Make Classic QtBluetooth work as an Android serviceAlex Blasche2016-08-032-4/+6
| | | | | | | | | | Change-Id: Ibde0242b058f728fd7e060b37f427c208325db13 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-0/+5
|\| | | | | | | Change-Id: I64352b6cc066255972874e2f9c28abff35f0d613
| * Make sure JNI_OnLoad is not called more than onceBogDan Vatra2016-07-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Since Android 5.0 Google introduce a nasty bug[1] which calls JNI_OnLoad more than once. Basically every time when a library is loaded JNI_OnLoad is called if found, but it calls *again* JNI_OnLoad of its .so dependencies! [1] Workaround https://code.google.com/p/android/issues/detail?id=215069 Change-Id: I2894dd24afa9c51582f20ab44d83e9ce86751716 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-162-2/+2
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qlowenergycontroller_bluez.cpp Change-Id: I00f45a2a22a045e7836f2caeb76cc5599ced6279
| * Android: Fix QBluetoothSocket::bytesAvailable()Alex Blasche2016-01-072-2/+2
| | | | | | | | | | | | | | Task-number: QTBUG-50345 Change-Id: I721b98f9b6ccff2a987a6c477d08902332ce848c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Updated license headersAntti Kokko2016-01-2016-231/+327
|/ | | | | | | | | | 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>
* Fix trivial typosKonstantin Ritt2015-12-041-1/+1
| | | | | | | | | Braodcast -> Broadcast subsequemtly -> subsequently discovred -> discovered Change-Id: I1e9d83bb0b33ad15da1f05d8a7cdd8ba82232f42 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-091-0/+11
| | | | | Change-Id: I4e78a2b263fb779253556201fd20fe47a2afc58e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Port from Q_ENUMS to new macro Q_ENUMKonstantin Ritt2015-06-231-2/+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>
* Android: Implement error reporting for char & desc readingAlex Blasche2015-04-153-0/+20
| | | | | | Change-Id: I5652075b4fde4d4927e86f5394baf176f263104f Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1616-112/+112
| | | | | | | | | 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>
* Merge remote-tracking branch 'gerrit/5.4' into devAlex Blasche2015-02-111-2/+2
|\ | | | | | | Change-Id: Ia70c3fe64e2ffcb27181bf912b06e6af59d2bc92
| * Android: Enable pairing for Android v15+Alex Blasche2015-02-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The required API became public in Android v19 which is what was used as check so far. However the same API was already privately provided since Android v15. THis patch ensures that older Android versions can create pairing requests too. This patch was provided by George Najarian. Task-number: QTBUG-43757 Change-Id: I0f38e538a972341a6acf719098f1010e52b639b7 Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* | Convert qRegisterMetaType<T>(const char*) to qRegisterMetaType<T>()Alex Blasche2015-01-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Android: characteristic changed notification supportAlex Blasche2014-11-243-0/+26
| | | | | | | | | | | | Change-Id: I4c50df7d758390989c2e2127f7646e5d2dc34712 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Support for QLEService::writeDescriptor() on AndroidAlex Blasche2014-11-143-0/+32
| | | | | | | | | | | | Change-Id: I1c7f0491506c6f0512d097a419660c5f5e7fb144 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>