summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Provide a way to define GAP/GATT services for central rolesAlex Blasche2017-06-281-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | Some devices require the Generic Access (GAP) and Generic Attribute (GATT) services to be defined. Otherwise they refuse a proper interaction. This is done implicitly by Android and BlueZ. The reason why BlueZ does not do this for QtBluetooth is because QtBluetooth sets up its own GATT infrastructure. Normally a QLEController in central role cannot do that via public API as the QLEController::addService() function blocks on peripheral use cases. This patch sets the profiles up. In the future the feature really requires a better form of API (beyond the above env variable) or should be enabled by default but since we need this earlier than Qt 5.10 a more subtle approach was chosen. For now the feature can only be enabled if the QT_DEFAULT_CENTRAL_SERVICES was set. Another limitation is that the characteristics of the added services are completely static. Task-number: QTBUG-61554 Change-Id: Id03bddb2e54cc4f0869838e13ddf281311ad3a26 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Obtain random bt address flag via Bluetooth Mgmt APIAlex Blasche2017-06-161-1/+14
| | | | | | | | | | | | | | | DBus does not expose this information. The Bluetooth Management API advertises the information but requires CAP_NET_ADMIN. The Management class monitors DEVICE FOUND events and records the random bit flag of each new device. QBluetoothDeviceDiscoveryAgent can subsequently add this information to the internal data set. Ultimately this makes QLowEnergyController::setRemoteAddressType obsolete. This function was only ever required on Linux. Task-number: QTBUG-46776 Change-Id: If10df86d332dfc7cc98b7c783eb28487c3fa9045 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix a lot of minor issues in the new Android peripheral backendAlex Blasche2017-01-241-1/+1
| | | | | | Change-Id: I3aa89926c5237ee8da18b73f66f0c7a321a83c91 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-7/+23
| | | | | | | | | | | | | | | | | | | | | | 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-1/+6
| | | | | | | | | | | | 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>
* Bluez: Stop advertisement once Bluez Peripheral disconnectFromDevice()Alex Blasche2017-01-041-0/+4
| | | | | | | | | | | | | | | Although this was not explicitly documented this is the behavior that the associated heartrate example exhibits. This change ensures that it is documented and enforced. [ChangeLog][QtBluetooth][BlueZ] Fixed continued advertisement of peripheral data once QLowEnergyController::disconnectFromDevice() was called. Public documentation was added to publically state the behavior. Change-Id: I3678c92fbb0d12cca17cd65ef7566a3ae4b55dc2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-281-1/+4
|\ | | | | | | | | | | | | Conflicts: src/bluetooth/osx/osxbtledeviceinquiry.mm Change-Id: Iefec1aafcb81174b0e1e257246ded08841bf3259
| * Highlight 31 byte limit for scan and response data in BTLE docsAlex Blasche2016-11-091-1/+4
| | | | | | | | | | | | Task-number: QTBUG-54457 Change-Id: Ib97dc769cef757a9997fa80a107ac8df4da958cf Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | LE controller - add a getter for a remote device UUIDTimur Pocheptsov2016-11-231-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | A device UUID is valid/works on iOS/macOS only: platforms where CoreBluetooth hides addresses and generates 128-bit uuids instead. We connect to a LE device using such a UUID. This patch adds a getter to access a UUID of a remote device our controller works with (similar to 'remoteAddress' method on other platforms). Task-number: QTBUG-52690 Change-Id: I000e17bbea90c508922ac47ce5291e28d938de7c Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Do not permit QLEController::connectToDevice() in peripheral modeAlex Blasche2016-08-031-0/+5
| | | | | | | | | | | | Change-Id: Ie6f0e1afdcd81cbd0d3c514d7f02a61109b58d1a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into btleAlex Blasche2016-07-131-1/+22
|\ \ | | | | | | | | | | | | | | | | | | Adds the minimum compile requirements for the new QBluetoothDeviceDiscoveryAgent API. Change-Id: Idfe07bee63de9d2849ab68eb455d0be470591795
| * | Merge remote-tracking branch 'gerrit/5.7' into devAlex Blasche2016-07-121-1/+22
| |\| | | | | | | | | | Change-Id: Id86ae2d8b9f8ebd2a37e8e5fc279916bc92d9982
| | * Add missing \since 5.7 markers to QLE classesAlex Blasche2016-05-191-1/+22
| | | | | | | | | | | | | | | Change-Id: I60f7c4751cb2b1a298a22d2b6d44c1c07967e47c Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | | Assume presence of local bluetooth adapter on WinPhoneOliver Wolff2016-05-261-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | As we cannot obtain any meaningful information (like bluetooth address) or perform operations like pairing using the WinRT API QBluetoothLocalDevice is not implemented for Windows phone. As we assume the presence of a valid bluetooth adapter though isValidLocalAdapter has to return true to enable the functionality. Change-Id: I84d38852d2fa632e0e7cf72bbdd57f1b7a9707fd Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* / LE controller - update docs (iOS/OS X)Timur Pocheptsov2016-03-161-1/+5
|/ | | | | | | | Document that connected/disconnected signals are unreliable on iOS/OS X in the peripheral role. Change-Id: Idd4b10ecdd91a85c7dfc0ec981b0a2aeab3ea8fe Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth LE: Fix crash introduced by latest merge.Christian Kandeler2016-02-231-0/+1
| | | | | Change-Id: Id854c4c412555722bbc01783c0768586eb3ea4ec Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth LE: Give rationale for API design regarding included services.Christian Kandeler2016-02-231-0/+1
| | | | | | Task-number: QTBUG-51152 Change-Id: I5e4eee324f0008291be734db7a9d984071ca57c9 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-161-0/+3
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qlowenergycontroller_bluez.cpp Change-Id: I00f45a2a22a045e7836f2caeb76cc5599ced6279
| * Bluetooth LE: Fix premature initialization of HCI manager.Christian Kandeler2016-01-151-0/+3
| | | | | | | | | | | | | | | | 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>
* | Improve BTLE documentationAlex Blasche2016-02-101-3/+5
| | | | | | | | | | | | | | Fixes a few qdoc warnings and improves the available content. Change-Id: I286cfdeb85d3be2d100e00150efedf7645096f69 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | Bluetooth LE: Add support for Signed Write command.Christian Kandeler2016-02-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This is how we get at the signature resolving key: 1) On connection from a client, we read the key from the respective BlueZ settings file (BlueZ 5 only, as I did not manage to find out where BlueZ 4 keeps this information). 2) Also monitor the HCI traffic for key updates (due to re-pairing). - While there is an autotest for the actual hashing procedure, the overall feature cannot be easily tested for various reasons (there is no signed write support in our client API, for one). However, to help with manual testing, the server part of our autotest now exposes a characteristic that supports signed writes. - This feature requires a Linux kernel >= 3.7. Change-Id: I7ede9b430de167fe1f4519eedf8670d88d79aa25 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/+30
| | | | | | | | | | | | | | 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-2/+3
|\| | | | | | | | | | | | | Conflicts: src/bluetooth/qlowenergycontroller.cpp Change-Id: I28b116deb3fa87169432eb2d94b70894359a9057
| * Handle undefined QLowEnergyController error cases as Unknown errorAlex Blasche2015-12-231-0/+1
| | | | | | | | | | | | | | | | | | This is important on Android as not all error conditions are exposed via QLowEnergyController::Error enum. Change-Id: I442ecffcadc01e1a2b60ae17dc6e63e08e5f4149 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth LE: Implement GATT server write support.Christian Kandeler2015-12-151-0/+2
| | | | | | | | | | | | | | | | | | | | Write Request, Write Command and Execute Write Request are fully implemented now. Signed Write support is still missing. Notifications and Indications are sent. The server side gets informed via the respective signals when a client writes a characteristic or descriptor. Change-Id: Icba6a0270f6e1c4c3ed2ba61b55c1a5fbb69752b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Merge remote-tracking branch 'gerrit/dev' into neardAlex Blasche2015-12-031-6/+5
|\| | | | | | | Change-Id: I1fc766d26aadb7cc01d33c4c8a2260411d7bb138
| * Merge remote-tracking branch 'gerrit/5.5' into 5.6Alex Blasche2015-12-011-6/+5
| |\ | | | | | | | | | Change-Id: I4404df69bfdac335e9c1eb63e4ada3ba89b48b6c
| | * Don't register meta types during static init time5.5Alex Blasche2015-11-301-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Fix reversed logic.Christian Kandeler2015-11-231-1/+1
| | | | | | | | | | | | | | | Change-Id: I8d1856a5ed51a35d0eaca672e1c1ab867086ab4f Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | Bluetooth: Add API to set up GATT services.Christian Kandeler2015-11-201-3/+71
| | | | | | | | | | | | | | | | | | | | | This is the next step in implementing LE peripheral support. Change-Id: I5e8cb186d556e7bfb9ae8a5e60e051ff7398b77d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | QLowEnergyController: Listen for and accept GATT connection requests.Christian Kandeler2015-11-191-3/+5
| | | | | | | | | | | | | | | | | | | | | BlueZ only. No requests are handled yet. Change-Id: I25058989beb5b3ae02a4f43eeaec09c8225198dc Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | Bluetooth: Introduce API for LE advertising.Christian Kandeler2015-11-171-15/+161
|/ / | | | | | | | | | | | | And provide an implementation for BlueZ. Change-Id: I302aee7c43b77016d9e1e7a0d5bcbf00096abf76 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | QLowEnergyController: Add missing error string for ConnectionError.Christian Kandeler2015-11-101-1/+5
| | | | | | | | | | | | | | | | Also remove the default case from the switch so the next such oversight causes a compiler warning. Change-Id: If332a9a00698debb834462f442dddb0dac40b83d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | [Bluetooth] Optimize loopsKonstantin Ritt2015-09-161-21/+38
|/ | | | | | | | | | | | 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>
* Remove some Tech preview remnants from Bluetooth documentationAlex Blasche2015-05-181-3/+0
| | | | | Change-Id: Ifcae07ef5e046f45848495f4d6af973cde713fdf Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* Reduce platform specific code linesAlex Blasche2015-05-121-0/+4
| | | | | | | | | | | | QLEController(QBluetoothAddress) ctor is not usable on iOS and OSX. On those platforms we have to use QLECOntroller(QBluetoothDeviceInfo). We mark the QBluetoothAddress based ctors of QLEController obsolete and remove most uses of them. This cleans up some ifdefs throughout the QtBluetooth code base. Change-Id: Ibe1e3fa271a29461e39fc3c0eeba7a910a250077 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
* add remoteName() method to QLowEnergyControllerKevron Rees2015-05-121-0/+11
| | | | | | Task-number: QTBUG-45435 Change-Id: I3ded6bf88d3980481e386073ce160d5d54520034 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.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>
* Document Android's caching of BTLE service data.Alex Blasche2014-11-261-0/+7
| | | | | | | | | | It can be confusing. As more platforms are supported, this behavior needs to be verified too. The Bluez implementation does not exhibit this cache behavior. Change-Id: I42dd003f2ac2632c32e48b1b1784e4ca529950f3 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-211-1/+3
|\ | | | | | | Change-Id: Ie8293c006bb74cdf324073044a0c622d44651324
| * Fix QLEController::connectToDevice() documentationAlex Blasche2014-11-111-1/+3
| | | | | | | | | | | | | | | | A logical condition was inverted. Change-Id: Ia7b54fe75a8cea4275e3c92c6283bc12f3423b64 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Fixes for QLowEnergyController unit test on AndroidAlex Blasche2014-11-111-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add enum for failure to connect to remote BTLE device.Alex Blasche2014-11-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In addition we restrict the emission of disconnected() signal on Android to those cases when we had an established connection. [ChangeLog][QtBluetooth][QLowEnergyController] QLowEnergyController::ConnectionError enum value added. Change-Id: I3602e303e61a872855925a26e695f2bc880cf540 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-0/+12
| | | | | | | | | | | | | | | | 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>
* | QLEController(QBtDeviceInfo, QObject*) ctor is new, mark it as suchAlex Blasche2014-10-281-1/+3
| | | | | | | | | | | | Change-Id: I861c69c0afc8a85a7c1127a9de4e76b9d486c0bc 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-0/+22
|/ | | | | | | | | | 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>
* Make it more obvious that QLowEnergy* classes are Tech previewAlex Blasche2014-09-261-0/+3
| | | | | | | | Although no larger changes are expected the QLowEnergy* classes only provide a limited API commitment. Change-Id: I244403b8818c2b34a97c8d6f2633e4b94646e49b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
* Support writing of long characteristic valuesAlex Blasche2014-09-081-1/+1
| | | | | | | | | | | | | | | | | 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>