summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/bluez
Commit message (Collapse)AuthorAgeFilesLines
* support building with clang and libc++Denis Pronin2020-03-051-0/+1
| | | | | | | fixed undefined errno when compiling with clang++ and libc++ Change-Id: I30be6e2da36f9189261535f103ce689462634f49 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix up broken PropertiesChanged connectionsv5.14.1Alex Blasche2020-01-142-5/+7
| | | | | | | | | | | | | | | Change b7b979d1735764930cc6f736cfa8e22b71547ea8 introduced a slightly modified version of the OrgFreedesktopDBusPropertiesInterface::PropertiesChanged signal. This signal was taken into use in one case but all other instances of this signal were not modified and broken. This patch modifies the remaining cases and converts the connect statements to function pointer syntax. This forces the compiler to check that signal and slot parameters match. Change-Id: I41b45f7e2f7b66ff29f321acc38ff2ce1c81864e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Thiemo van Engelen <tvanengelen@victronenergy.com>
* bluez: Fix out of sync property cacheThiemo van Engelen2019-12-041-1/+2
| | | | | | | | | | | | | | | Since commit 2c6dcc643, a map containing dbus property values is kept per device to be able to make QBluetoothDeviceInfo instances without having to make dbus calls. However, this map could get out of sync. The reason was that the code started to listen to PropertyChanged signals after it received the initial set of properties. This meant that there was a short amount of time where bluez could send out a signal with changed properties and the DiscoveryAgent would not receive it. In order to keep the map in sync, a PropertyChanged listener is now installed when scanning is started, picking up all changes. Change-Id: Iae5e219b187e94bf280a6dd76ccde49cafd1d9c5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add missing dbus registrations and change documentationAlex Blasche2019-01-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | Qt DBus registration for Bluez specific types was done by isBluez5(). However Qt 5.12 introduced bluetoothdVersion() which is a bit more precise. It became necessary because runtime decisions based on exact minor release versions of Bluez became necessary. Therefore some code paths (depending on the user's use case) never called isBluez5() anymore. Subsequently the dbus registrations were missed out on. In the future isBLuez5() should be replaced by bluetoothdVersion(). QBluetoothSocket changed its underlying implementation when addressing QTBUG-68550. It uses dbus sockets to establish rfcomm socket connections to remote devices. The QBluetoothSocket::connectToService() overload that expects a port number is no longer possible as Bluez DBus API does not support connection establishment based on port numbers. Fixes: QTBUG-72742 Change-Id: If6adb391b0524cabc3a702d761e0cbd263508396 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix various qdoc warnings in QtBluetoothAlex Blasche2018-09-181-1/+1
| | | | | Change-Id: I49653a6ac6fa004987d32365f96a6407f50e207c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement handling of BTLE Battery servicesAlex Blasche2018-09-145-0/+87
| | | | | | | | | | | | | | Since BlueZ 5.48 battery services are no longer exposed via the generic GATT interface but have their own dedicated Battery1 interface. This patch transforms the dedicated interface back into the previous behavior. Essentially we are emulating the old interface to ensure that the QLowEnergyService user does not have to distinguish. Fixes: QTBUG-70222 Change-Id: Ib9fef41cf16f7562f169f51ee45b19f52de6a0c0 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Code cleanup: Use nullptr wherever possibleAlex Blasche2018-08-245-14/+14
| | | | | Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-151-3/+5
| | | | | | | | 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>
* Implement QBluetoothSocket Client support for Bluez5 DBusAlex Blasche2018-08-093-0/+170
| | | | | | | | | | The new code is not yet enabled in QBluetoothSocket because the server side implementation is still missing. Task-number: QTBUG-68550 Change-Id: I2f94dac9f7665c8d4ba5d675e91c5ab81af8504a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add new Profile1 Interface from Bluez DBusAlex Blasche2018-08-035-0/+113
| | | | | | | | This interface is added to the build but not yet functional in the library. Task-number: QTBUG-68550 Change-Id: I59df7761dc02a6afe807a2bbd9377d94e0186784 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Rename profile1_p to profilemanager1_pAlex Blasche2018-08-034-8/+8
| | | | | | | | | | The new QBluetoothSocketPrivateBluezDBus implementation requires the ProfileManger1 and Profile1 interface spec. The old profile1_p header really is the profilemanager1_p header. Task-number: QTBUG-68550 Change-Id: I8ffdb5f7969a2e93b2a167b178b32ff4b5f264c5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add separate interfaces for QBluetoothSocketPrivate on LinuxAlex Blasche2018-07-252-2/+2
| | | | | | | | | | | | | | | | Uses the new QBluetoothSocketBasePrivate interface to separate the Linux implementations from other platforms. On Linux, there will be the existing raw socket implementation and a BlueZ5 DBus implementation. The DBus implementation is required for very recent Bluez5 deployments (v5.4x+) which restrict access to traditional SDP discovery means like sdptool. For now the DBus implementation is non-existing/dysfunctional. Task-number: QTBUG-68550 Change-Id: Idd248ecdb2a443a95cde521ced929218d40df3fe Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add missing headers while generating DBus interfacesLisandro Damián Nicanor Pérez Meyer2018-04-091-2/+2
| | | | | | | | | Make qdbusxml2cpp include bluez5_helper_p.h to make definitions available to device1_bluez5_p.h and objectmanager_p.h. Task-number: QTBUG-66936 Change-Id: If700aeba7c67c10030f3d0fe2ac4e6bc0aeca3ed Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Enable new DBus LE backed for central role use casesv5.11.0-beta2Alex Blasche2018-03-081-2/+3
| | | | | | | | | | 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>
* Make tst_lowenergycontroller pass on DBUS Bluez backendAlex Blasche2018-01-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition the patch adds a few improvements making the tests somewhat more reliable. 1.) The 0x1800 BTLE Generic Access service is not exposed by BlueZ's API. That's a deliberate decision by the devs. The patch removes the service from the list of to-be-checked services. 2.) QTBUG-42519 is a limitation of the non-DBus BTLE implementation and cannot be fixed. The new DBus API does permit concurrent QLowEnergyController instances. However the instances share a platform wide singleton which means that if one instance is connected then the other instances connects as well. Other platforms separate the connectivity between instances. Therefore tst_concurrentDiscovery() has to offer three different behavior patterns 3.) Consecutive calls to writeDescriptor() in tst_readWriteDescriptor() cause a crash of bluetoothd (version 5.47 or below) and a premature disconnect from the BLE device in version BlueZ 5.48. To avoid the problem qWait calls were introduced to delay the time between individual calls. 4.) Improves the robustness of the tst_writeCharacteristicNoResponse() test which relied on notifications being enabled for two of its characteristics. So far the notifications for one characteristic were enabled but not for the other. For some magical reason this happened to be the case on all platforms but the new DBUS BTLE implementation. 5.) Swapped out some QVERIFY statements in favor of QCOMPARE. This provides better error visibility when a test fails. 6.) The patch adds a time limitation of BTLE discovery which reduces the time the entire test run takes. This is API that was recently added. Change-Id: Ib633a87614af9cbccdb0253ba47fd059a2013358 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Support service discovery for BlueZ DBus backendAlex Blasche2018-01-051-1/+1
| | | | | | | | At the same time a typo in a comment is fixed. Task-number: QTBUG-46819 Change-Id: Ic017df4d2d52cf0d226b6e083a9ec5f28657dee0 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Implement bluetoothd version testAlex Blasche2017-12-134-8/+183
| | | | | | | | | | | | | 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 'origin/5.10' into devLiang Qi2017-11-211-1/+4
|\ | | | | | | | | | | | | Conflicts: src/bluetooth/bluetooth.pro Change-Id: Ibccccc974b545696ae053f1fbffcc973d8be43cc
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-301-1/+4
| |\ | | | | | | | | | Change-Id: Iaa053dcb125490ee1e83d7e27cb75d4171297b9f
| | * Fix crash due to inconsistent state in QLEController during JobDisconnectDeviceAlex Blasche2017-10-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug was caused by a problem in the patch for QTBUG-55150. While the termination of an ongoing BTLE connection is being processed, the QLEController instance is in Connecting state and the internal socket is still null. If the user triggers a call to QLEController::disconnectDevice() while the above state is pending, it crashes due to a call to the socket's close() function. The time window for this to happen is very small. It takes the duration of the bluez dbus call to disconnect a device. This patch addresses the above crash bug and adds a bit more debug output to catch similar cases later on. Task-number: QTBUG-63619 Change-Id: I893990a9ce8ccf55ddbf619fe177379f79dc9ee3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | Introduce Base class for QLowEnergyControllerPrivateAlex Blasche2017-11-032-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Hook new gatt dbus classes into build systemAlex Blasche2017-11-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | In addition, we add exception rules for the missing "We mean it" header preamble. The headers are auto generated. Task-number: QTBUG-46819 Change-Id: Ia781e2b3af597518a345019d4e9e817471706652 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | Run a general update of all dbus interface classesAlex Blasche2017-11-0232-186/+190
| | | | | | | | | | | | | | | | | | | | | | | | Mostly this permits the codebase to catchup with changes introduced by the qdbusxml2cpp tool. Change-Id: Ib16b70523b222c6babb3735f91b578e10c7542f3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | Setup GattService1, GattChar1 & GattDesc1 dbus interface classesAlex Blasche2017-11-027-0/+311
| | | | | | | | | | | | | | | | | | | | | | | | | | | The change adds the relevant xml raw description to the generation script and commits the generated dbus accessor classes. Task-number: QTBUG-46819 Change-Id: Ib5f7e15cef9e7225d33b7b4e43f085806a0fb1a4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | | Add DBus XML descriptions for Gatt interfacesAlex Blasche2017-11-023-0/+45
|/ / | | | | | | | | | | | | | | | | GattService1, GattCharacteristic1 and GattDescriptor1 are relevant for central role use cases. Task-number: QTBUG-46819 Change-Id: I5ab12710880ec91565c2e5c510eb55dc3410a7ee Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Provide means to select the Bluetooth discovery type on BlueZAlex Blasche2017-07-243-10/+21
| | | | | | | | | | | | | | | | | | This is an addition since BlueZ 5.30. Task-number: QTBUG-57575 Change-Id: Ib24702ac91ee55e5e0511d93cd9bd43937c0edb1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-064-4/+421
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I7a55929aefa1f7a4dc96f841317b78b248899f67
| * Obtain random bt address flag via Bluetooth Mgmt APIAlex Blasche2017-06-164-4/+421
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add new Bluez Device1 properties to QtBLuetoothAlex Blasche2017-06-225-13/+41
| | | | | | | | | | | | | | | | | | The org.bluez.Device1 interface got a few new properties which this patch makes accessible to QtBluetooth. The new properties will be used later on to enable new use cases and streamline existing code. Change-Id: I8bd28b7df7ead5e46b70f6b7b387ab378f45e7a7 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Remove obsolete define and related commentsAlex Blasche2017-06-211-4/+0
| | | | | | | | | | | | | | | | This define was used a while ago. The code that used the define is long gone but the define was forgotten. Change-Id: Ieebe4ef4f95bbd730c2929083e87a0ee439deda8 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Update DBus interface generation script for Bluez 5Alex Blasche2017-06-201-4/+10
|/ | | | | | | Task-number: QTBUG-32085 Change-Id: I74df2d89a5f8f0d2c58aaa1fea248d26cb0683dd Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com> Reviewed-by: Fabian Bumberger <fabianbumberger@gmail.com>
* Avoid bluetoothd and QtBluetooth collision when connecting to BTLE devAlex Blasche2017-05-293-2/+273
| | | | | | | | | | | | | | | | | | | | | BlueZ's improving support for BTLE creates a new collision when attenpting to connect to remote BTLE devices. There can only ever be one connection. This patch ensures that when QtBluetooth attempts to connect we do not have a pending BTLE connection. This could have been caused via other QtBLuetooth based processes or applications such as bluetoothctl or bluetoothd in general. If a connection is pending we close the connection external to the current QtBLuetooth instance. This is not an ideal situation as several processes can potentially fight over btle access. The long term solution is a port of QtBluetooth to BlueZ's new DBus API. Task-number: QTBUG-55150 Change-Id: I96b30ae180d1348027e8f9f09c997f44409dfc48 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Make it more obvious that another active BTLE connection prevents connectAlex Blasche2017-05-233-0/+52
| | | | | | | Task-number: QTBUG-55150 Change-Id: I223e2b2015e210162e59fb994b9352e790b036d4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'gerrit/5.6' into 5.7Alex Blasche2016-06-091-2/+18
|\ | | | | | | Change-Id: Id8dffff9bb75db396aabf6da2a3acb78505a6476
| * BlueZ5: Prevent premature abortion of device discoveryAlex Blasche2016-06-081-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | This may happen when the device discovery agent is quickly started and stopped and started again. If the stop-start combination is happening quicker than dbus can deliver the Discovering flag of the Adapter1 BlueZ interface, BlueZ's stop response will override the new start discovery request. Task-number: QTBUG-53715 Change-Id: I6a03fc525c7f390db009fc68a5313352ebba7f79 Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth LE: Fix bogus warning output.Christian Kandeler2016-02-251-4/+5
| | | | | | | | | | Change-Id: I9800e80b455c14f0e6086b1d9e21e2b26a385ebe Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth LE: Add support for Signed Write command in the central role.Christian Kandeler2016-02-172-4/+5
| | | | | | | | | | | | 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-1/+1
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qlowenergycontroller_bluez.cpp Change-Id: I00f45a2a22a045e7836f2caeb76cc5599ced6279
| * Bluetooth: Fix mapping of device address to HCI id.Christian Kandeler2016-01-151-1/+1
| | | | | | | | | | | | | | | | The previous code always returned the id of the first device in the list. Change-Id: I6f3cde2405d53eab009d7409d9e3c6b47d97e53b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth LE: Add support for Signed Write command.Christian Kandeler2016-02-033-21/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-267-99/+141
|\ \ | | | | | | | | | Change-Id: If9cf6718cbd619dd7ce38db2da274fe9d0a41fb7
| * | Updated license headersAntti Kokko2016-01-207-99/+141
| |/ | | | | | | | | | | | | | | | | | | 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-183-0/+153
| | | | | | | | | | | | | | 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-052-0/+24
|\| | | | | | | | | | | | | Conflicts: src/bluetooth/qlowenergycontroller.cpp Change-Id: I28b116deb3fa87169432eb2d94b70894359a9057
| * Bluez5: Sanitize app name to be valid DBus object path nameAlex Blasche2015-12-232-0/+24
| | | | | | | | | | | | | | | | This may happen when the app name contains for example a dash ('-'). Task-number: QTBUG-49402 Change-Id: I04b289b0723e2979a67c93e335205556bf1eb30e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | Make more use of Qt's functions for handling endianness and alignment.Christian Kandeler2015-12-211-29/+5
| | | | | | | | | | Change-Id: Iea44e99e8c7b38e3bdece4de989770831d40ff83 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth: Introduce API for LE advertising.Christian Kandeler2015-11-173-2/+80
| | | | | | | | | | | | | | And provide an implementation for BlueZ. Change-Id: I302aee7c43b77016d9e1e7a0d5bcbf00096abf76 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | Bluetooth: Introduce convenience "put data" function for quint* types.Christian Kandeler2015-11-121-0/+14
|/ | | | | | | | | | Users can just call the function regardless of the concrete type, and it will do the right thing with regards to casting and edianness. This will come in handy when implementing GATT server functionality, where lots of generic packet creation needs to happen. Change-Id: Id6315bc1fd628bdfb84c1b91c7c8b50925f24d32 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth: Put some data types into the Qt namespace.Christian Kandeler2015-10-231-0/+4
| | | | | | | There's no reason they should be outside. Change-Id: I597c7c07857c9af820fcdb93e1587f62a2064ab3 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bluetooth socket: Simplify address conversion.Christian Kandeler2015-10-151-6/+2
| | | | | | | | In most cases, callers of convertAddress() feed the result into a QBluetoothAddress, so they have no need for the output parameter. Change-Id: I23b2e8d5d49ac300c35d141b75ffa8e398e22f19 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>