summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix \since version for createCentral()v5.14.0-alpha1Alex Blasche2019-09-161-1/+1
| | | | | Change-Id: I8d26fc7c4b7a93c4f839683feedd76cfbc1b5979 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* Merge remote-tracking branch 'origin/dev' into wip/winOliver Wolff2019-08-071-2/+39
|\ | | | | | | Change-Id: I83175151c0eef1a11d2f21648cc04c86e46777c1
| * QLowEnergyController: Introduce AuthorizationErrorKonstantin Ritt2019-07-051-0/+3
| | | | | | | | | | | | | | | | | | intended to distinguish an arbitrary disconnection from disconnection due to insufficient authorization/encryption Change-Id: Ifcf73d0444fe6fd3a8d5d90155f3db572d6e23d1 Reviewed-by: Evgeniy Gagarin <eeiaao@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * LE controller/service remove code duplication (Darwin)Timur Pocheptsov2019-06-171-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make our private controller class to inherit the shared base as other platforms do. Rename it into PrivateDarwin. Remove QLowEnergyController's code duplicate on Darwin. Get rid of Darwin's copy of QLowEnergyService. As a bonus, a number of bugs/inconsistencies were fixed in setting the state and not emitting stateChanged. Reduced the usage of 'isValid'. Task-number: QTBUG-75348 Change-Id: I77495870597b61fecae8bca1617590fd9ad2def4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| * Add QLowEnergyController::createCentral() with localDevice overloadAlex Blasche2019-02-111-0/+23
| | | | | | | | | | | | | | | | | | | | The QLowEnergyController ctor with localDevice overload was obsoleted but the new API did not provide an equivalent createCentral() overload. This patch fixes the problem. Fixes: QTBUG-63019 Change-Id: I4c5a249bbf20c78da5507fecc874daa67e3dce46 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Enable the use of the Win32 Bluetooth backendAndre de la Rocha2019-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change enables the optional use of the Win32-based Bluetooth backend on Windows. By default, the WinRT backend is used, if supported by the platform. The use of the Win32 backend must be selected by the -native-win32-bluetooth configuration option. Task-number: QTBUG-40698 Change-Id: I6904bf077467d826e3ff5ad026ebae5f955f2e37 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'gerrit/dev' into win32Alex Blasche2018-11-221-0/+10
|\| | | | | | | Change-Id: Ie99a67b63f8259227f42f5b464c6bbc16e79313b
| * Don't require pairing when connecting to BLE on WinRTLauri Laanmets2018-10-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we are running on a Windows version with Creators Update or newer (>=15063) we can use new bluetooth low energy API that allows us to do device discovery without the requirement of having paired the device. Instead of connecting to the device and fetching its services, we can use UUIDs from advertisement packages to get an initial service list. By using that approach we can get rid of the pairing process in 'connectToDevice' and replace it with 'GetGattServicesAsync' if no services are yet available. The old behavior was kept as a fallback for the case where the device has already been paired. If the backend is built with an older Windows Kit or the machine running the application does not support the new API we fall back to the old implementation which still requires pairing. Task-number: QTBUG-58660 Change-Id: Ice262d4d993a0119efb8b6c8fe9a21830717569f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'gerrit/dev' into wip/winAlex Blasche2018-07-251-11/+27
|\| | | | | | | Change-Id: Ia5d83a88d6231984d9745d1c64f03553499a5882
| * Properly invalidate services when calling disconnectService() on BlueZAlex Blasche2018-05-291-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the central role implementation properly invalidates all the LowEnergyServicePrivate instances, peripheral mode was leaking service instances. This is triggered when the peripheral disconnects from a client or when the user calls disconnectService(). On the other hand stopAdvertising() does not do that. This patch fixes the service instance leak and ensures that the class docs specifically state the behavior difference between stopAdvertising() and disconnectService(). Change-Id: Ia52b141096dc1db3d0cefe3ed18c230eecccd9c0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Fix compiler warningAlex Blasche2018-03-211-0/+3
| | | | | | | | | | | | | | | | qlowenergycontroller.cpp:295:82: warning: unused parameter 'role' [-Wunused-parameter] static QLowEnergyControllerPrivate *privateController(QLowEnergyController::Role role) Change-Id: I4d3d2ad1e2dbabd0101efd6294a2481491587926 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Enable new DBus LE backed for central role use casesv5.11.0-beta2Alex Blasche2018-03-081-7/+9
| | | | | | | | | | | | | | | | | | | | The manual override env variable was renamed. The new name is more fitting for the use case. Task-number: QTBUG-46819 Task-number: QTBUG-66908 Change-Id: I9202ebf3f847d5c7dcc9e3c84b060b35343dd2fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Merge remote-tracking branch 'gerrit/dev' into winAlex Blasche2018-02-201-2/+3
|\| | | | | | | Change-Id: I4e86dcfe5088b0bd5087de309c435250c76d4718
| * Implement bluetoothd version testAlex Blasche2017-12-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the ability to detect the underlying version of bluetoothd. The bluetoothd version provides the means to decide whether the DBUS LE API is sufficient to fullfil the QLEController requirements. Bluez DBus LE API is usable since Bluez 5.42. Prior versions only had experimental DBus LE APIs. Task-number: QTBUG-46819 Change-Id: Ic047fba27c01ee40571abb0c4eb45828f4a64475 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'gerrit/dev' into winAlex Blasche2017-11-151-253/+45
|\| | | | | | | Change-Id: I3a3557c6b8d565322358825d4b07c61cf6b97c9f
| * Consolidate the QLEControllerPrivate instanciationsAlex Blasche2017-11-031-49/+23
| | | | | | | | | | | | | | This patch removes repeated code patterns. Change-Id: Ica931958b1d4072429ed197d5e44ad77670c3485 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Unify meta type registration for QLEDescriptor and QLECharacteristicAlex Blasche2017-11-031-0/+2
| | | | | | | | | | | | | | | | | | The QLEControllerPrivate objects use the same function (apart from Apple platforms) and unit tests do not have to register those types at all anymore. Change-Id: I06a4a035f5a8fba9a146a3c05d1157b47c22e056 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Provide UWP specific header for QLEControllerPrivateAlex Blasche2017-11-031-0/+10
| | | | | | | | | | Change-Id: Ic2ee2a76e2da4c236415f1eb3b98ab642ee3d1fc Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Provide own header for QLEControllerPrivate on AndroidAlex Blasche2017-11-031-0/+10
| | | | | | | | | | Change-Id: I63d107092e3e404f6b2c38f28d5d9b286711db77 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Provide own header for QLowEnergyControllerPrivate instance on BluezAlex Blasche2017-11-031-54/+7
| | | | | | | | | | | | | | | | | | | | | | 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-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Move common helper function from QLECPrivate to QLECPrivateBaseAlex Blasche2017-11-031-117/+0
| | | | | | | | | | Change-Id: I5f126fabebf36b61a25e23ddc12c4dae21156cbc Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * Introduce Base class for QLowEnergyControllerPrivateAlex Blasche2017-11-031-95/+51
|/ | | | | | | | 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>
* Replace Q_NULLPTR with nullptrKevin Funk2017-09-291-1/+1
| | | | | Change-Id: Ica194c2568465a94d851ddeaf62ca71b33fe4464 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QLowEnergyController: introduce ConnectionClosedErrorKonstantin Ritt2017-07-101-0/+5
| | | | | | | | | | Unlike ConnectionError, this shall be used to mention errors occurred due to the remote device's intent (term, power loss, etc) Change-Id: I6918879e3918a5131841f012b2824c30b99e472d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* 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