summaryrefslogtreecommitdiffstats
path: root/src/bluetooth
Commit message (Collapse)AuthorAgeFilesLines
* Catch SecurityException during pairing on AndroidAlex Blasche2018-09-262-1/+16
| | | | | | | | | | | | | | | 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>
* Fix various qdoc warnings in QtBluetoothAlex Blasche2018-09-183-7/+7
| | | | | Change-Id: I49653a6ac6fa004987d32365f96a6407f50e207c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix wrong logging messageAlex Blasche2018-09-141-1/+1
| | | | | | | | This was caused by mindless copy & paste. Change-Id: I129a5f52753e7aa825cf7f6337b5f24644d9b9a0 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove duplicated closure code and add missing cases of itAlex Blasche2018-09-142-33/+24
| | | | | | Change-Id: I4f33ec95b2af858b8d0c3ff60882b550a91563df Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement handling of BTLE Battery servicesAlex Blasche2018-09-147-16/+299
| | | | | | | | | | | | | | 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>
* Remove dead/unused member variablev5.12.0-alpha1Alex Blasche2018-09-112-4/+1
| | | | | Change-Id: I8a30d5d12fad73a714159ebe3e1d54e8c0b3e407 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-081-1/+5
|\ | | | | | | Change-Id: I576079e30f4075117ca764f45198bc1e5269d887
| * winrt: Do proper error handling if connecting to a LE device failsOliver Wolff2018-08-311-1/+5
| | | | | | | | | | | | Task-number: QTBUG-70162 Change-Id: I4556cbf1965121b042a55e3e36e24383f8fa8dc9 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Fix QNearFieldManager related override warningsAlex Blasche2018-09-031-0/+1
| | | | | | | | | | Change-Id: If7adc165e063445ee0c34291a3e3840ddae0f570 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Ensure that local services have state LocalServiceAlex Blasche2018-08-302-4/+6
| | | | | | | | | | | | | | | | and invalidate the state once they have been disconnected. This affects Android, Bluez and Apple code lines. Change-Id: I2b87577930b6ae78e7ef7ef061e597beba946594 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Fix LEController peripheral mode on BlueZAlex Blasche2018-08-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | LEController in peripheral mode uses QBluetoothSocket::setSocketDescriptor(). Since QBluetoothsocket was ported to DBus (enabled when Bluez is 5.46 or later) setSocketDescriptor()/server mode does not work. That's why f602d7fef2e2f067e123e5740d4b0bf16c4ec0e2 made sure that QBluetoothServer uses the old raw socket implementation. Unfortunately QLowEnergyController was forgotten and needs the same workaround. Change-Id: I6ba3654ee199d0ffcf4b69f16dfbc5508d6b13d4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Normalize QObject::connect() statementsAlex Blasche2018-08-299-104/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some cases use the Q_PRIVATE_SLOT logic which does not require QObject inheritance. Those cases were converted to lambda logic to avoid need for QObject inheritance. The Q_PRIVATE_SLOT macro was removed from qbluetoothdevicediscoveryagent.h. This is not a BC problem because the macro expands to nothing. Only moc recognizes the pattern. Change-Id: Ic7cb4cde397f9b230b6fd0b4046e59e504583e58 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | qRegisterMetaType for QBluetoothServiceInfoAlex Blasche2018-08-281-0/+1
| | | | | | | | | | | | | | | | Android internals seem to require it. All other existing test related registrations are removed as they are obsolete after this patch. Change-Id: I49aa3b79bdc8ca5f463f4f7a88cbb612db39d15e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Code cleanup: Use nullptr wherever possibleAlex Blasche2018-08-2444-168/+146
| | | | | | | | | | Change-Id: I7dd2d055c8d667f049d7cb2c371619137bf76030 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Add QBluetoothDeviceDiscoveryAgent::deviceUpdated signalAlex Blasche2018-08-236-10/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For iBeacons and such, it's normal to keep discovering indefinitely, while the advertisement can sometimes carry changing payload data. This signal helps keep the UI up-to-date. Changed setManufacturerData to return a bool indicating whether the data was really modified or not, to avoid sending deviceUpdated in case it was not changed. For convenience QBluetoothDeviceInfo::manufacturerData() was added. WinRT and Apple platforms do not emit the new signal yet and relevant TODO items were added. Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Task-number: QTBUG-46008 Task-number: QTBUG-69747 Change-Id: I6d6b373f6cc5ee3dd6af2ad05d8640dbd25c5d6a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Spell QBluetoothDeviceInfo::manufacturerIds correctlyShawn Rutledge2018-08-212-2/+2
| | | | | | | | | | | | | | Amends 0f930cddefe386c6b6f65b8b11342c9e76876a9b Change-Id: Ic3769d30198d3607a1fee218d9f2e90b9addf2d3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Remove direct usage of QLowEnergyController::ctorAlex Blasche2018-08-211-1/+1
| | | | | | | | | | | | | | | | QLowEnergyController::createCentral() is the official API to do the same. Change-Id: Idbd26d201b24add6697f6f9cdf1194511c160273 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Add Qt 6 API todoAlex Blasche2018-08-211-0/+1
| | | | | | | | | | Change-Id: Ibc8a3e86b7671381c5a00f6421878961e8e2f4a6 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-181-4/+10
|\| | | | | | | Change-Id: I3ea075969f9a9b8e94a34b3c7cd92aaea72175af
| * Android: Fix QBluetoothServiceDiscoveryAgent::uuidFilter() behaviorAlex Blasche2018-08-151-4/+10
| | | | | | | | | | | | Task-number: QTBUG-69700 Change-Id: Ib8082156f81949926380e4e296d91c8dfc01b231 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Add manufacturer data to QBluetoothDeviceInfoAlex Blasche2018-08-176-7/+108
| | | | | | | | | | | | | | The initial patch was contributed by Thiemo van Engelen. Change-Id: I45fad793ba092ab2820e606d8bf8807afa3e911e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Enable new QBluetoothSocket backend for dbus sockets on Bluez 5.46+Alex Blasche2018-08-161-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API was introduced earlier than 5.46 already but so far it has not been tested. For now we use 5.46. There is another dependency to QLowEnergyController's GATT custom implementation. Custom GATT only works with the QBluetoothSocket raw socket implementation. By setting the minimal version for QBluetoothSocket slightly higher than the 5.42 version for custom gatt, we ensure that the new dbus socket code is never run together with the GATT custom stack. Task-number: QTBUG-68550 Change-Id: I240f7fc8acb116c71e7601df8baf82f61e53c33e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Ensure that QBluetoothServer works with new DBus based socketsAlex Blasche2018-08-164-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or better ensure that the DBus based socket is not used for QBluetoothServer. The server implementation will continue to use the raw socket implementation for the foreseeable future. The reason being the DBus version not yet working. convertAddress() in the server cpp was removed because it was a duplicate implementation. Including qbluetoothsocket_bluez_p.h pulls in the qbluetoothsocketbase_p.h which provides the official convertAddress() implementations. Unfortunately this requires a new ctor for QBluetoothSocket which is only specified for BlueZ builds. It is used to permit QBluetoothServer to set the correct dptr for QBluetoothSocket. Task-number: QTBUG-68550 Change-Id: I19298f75e9bc2ab93322d9f34e1816ad733ac6d9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | winrt: Properly handle sequences in SDP registrationOliver Wolff2018-08-161-12/+25
| | | | | | | | | | Change-Id: Ic0e9a18b73915fee1458578ca49359a3647159c1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | winrt: Properly handle strings in SDP registrationOliver Wolff2018-08-161-11/+40
| | | | | | | | | | Change-Id: Ifb9531830ef11d0e49c205eada5884906051e467 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | winrt: Add helper functionality for more complex sdp typesOliver Wolff2018-08-161-1/+44
| | | | | | | | | | | | | | | | | | | | In preparation for following patches which will add proper support for strings, sequences, alternatives, and urls as SDP attributes, their base IDs as well 2 helper functions (typeIsOfBase and getLEngthForBaseType) are added. Change-Id: I40982c83435985a7f57d7854ac1e353350c29da5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | winrt: Add missing error handling in connectToServiceHelperOliver Wolff2018-08-161-1/+2
| | | | | | | | | | | | | | | | | | QBluetoothSocketPrivateWinRT::connectToServiceHelper was missing one hr check. Change-Id: Iae357df99881874b2d672dde6625e36d6221de0f Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | QBluetoothSocket: Move (dis-)connected logic into setSocketStateOliver Wolff2018-08-165-20/+16
| | | | | | | | | | | | | | | | | | | | | | | | Instead of duplicating that logic everywhere, it can be handled in one place. Additionally setOpenMode should be called before setSocketState so that every member variable is changed, before signals are emitted. Change-Id: Ic1d4317ba31046d78d97874ec00c59481a67bb50 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-1531-78/+110
| | | | | | | | | | | | | | | | 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>
* | winrt: Handle UUID cases in service registrationOliver Wolff2018-08-151-13/+11
| | | | | | | | | | | | Change-Id: I227f9bd81e666d398366fc573573a0df973a5ff8 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Bluez: Fix missing signalling for QBluetoothSocket::abortAlex Blasche2018-08-151-0/+7
| | | | | | | | | | | | | | | | This is a bug introduced by 45c843ceca9fac1aa1246043730eaeeb3ed23235 where this backend was simply forgotten. Change-Id: I11c9eb1476a3ded7d0c12aaf1d203ff61194f3c4 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Android: Fix missing connected() signal emission for QBluetoothSocketAlex Blasche2018-08-141-1/+1
| | | | | | | | | | | | | | | | This only happens when QBluetoothSocket was used in connection with QBluetoothServer. Change-Id: I9fcc3026415f815f9a44a10d721056437465f8b8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | winrt: Support additional data types for service registrationOliver Wolff2018-08-131-18/+55
| | | | | | | | | | Change-Id: I7ec6b6ef65a8754b22d1b97e508d7231b2a410c0 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | winrt: Unify logging format and give additional informationOliver Wolff2018-08-131-8/+11
| | | | | | | | | | Change-Id: I9f28e94556e596794e52bd571b36590487bd3cc1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | winrt: Make device radio discoverable when listening on socketOliver Wolff2018-08-131-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | Microsoft changed the default behavior so that the device is no longer radio discoverable, when advertising is started. By creating the service provider from the Xaml thread we avoid messages, that it cannot be used in the background by default (even though this does not seem to have an effect on its functionality). Change-Id: Ib199adc53ef02b14fcea2884fe4359ad2fe81b8e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-111-61/+63
|\| | | | | | | Change-Id: I0f03c92b104e3d8280c0647cd13ce92c505e6472
| * QBluetoothServiceInfo - disentangle q<->d madnessTimur Pocheptsov2018-08-091-61/+63
| | | | | | | | | | | | | | | | | | | | Having d_ptr as a shared pointer in a copyable q-object, and a q_ptr in this d-object was probably the dumbest idea ever, not sure how this happened at all. Task-number: QTBUG-69857 Change-Id: I845394604d42879ca36f0b376ba94819e223df77 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Fix QBluetoothSocket::socketDescriptor() for BlueZ DBusAlex Blasche2018-08-091-0/+3
| | | | | | | | | | | | Task-number: QTBUG-68550 Change-Id: Ibc22b9a51336855c0a981f9280e6ae9ede9437b4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Shift close/abort signaling from QBluetoothSocket to private implementationsAlex Blasche2018-08-095-19/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The private implementation can much more easily determine whether the socket closure is already done or not. On Bluez DBus, this avoids disconnected() being emitted twice. Another platform that is still delayed is Android. The patch permits the removal of Android specific ifdefs. Last but not least the patch cleans up missing signals in WinRT. Task-number: QTBUG-68550 Change-Id: I189e1dbc9f6d410522da1a82113fdf4fe79a4cbd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Implement QBluetoothSocket Client support for Bluez5 DBusAlex Blasche2018-08-097-15/+640
| | | | | | | | | | | | | | | | | | | | 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-035-9/+9
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-312-8/+10
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/bluetooth/qbluetoothsocket.cpp Change-Id: If622e4915a9c5f6711978ef8c0fa88f4c5084270
| * Cleanup meaningless code in QBluetoothSocketAlex Blasche2018-07-261-1/+1
| | | | | | | | | | Change-Id: I0407e6c1d2074e7102763002d94fc7170f5926d4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * fix use of default constructed QBluetoothSocketEric Lemanissier2018-07-232-9/+11
| | | | | | | | | | | | | | | | | | | | by checking the service passed to QBluetoothSocket::connectToService, instead of the previous protocol of the socket fixes up 21e7cb1bafdfc06c263e10067d02f9b103ff660f Change-Id: I2aa30cdd618f834e718508c5f492fc211d328565 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Small QBluetoothSocketDummy header fix upAlex Blasche2018-07-251-2/+3
| | | | | | | | | | Change-Id: Iff2927391150e8ec299a4968a90448611c516412 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Rename qbluetoothsocket_p files to qbluetoothsocket_dummyAlex Blasche2018-07-254-9/+9
| | | | | | | | | | | | | | | | | | The new name fits the class better. Task-number: QTBUG-68550 Change-Id: I7445f48134f8a9fe8b6b6291184f404b3b2faa89 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
* | Add override to all overridden QBluetoothSocketPrivate functionsAlex Blasche2018-07-255-103/+102
| | | | | | | | | | | | | | Task-number: QTBUG-68550 Change-Id: Ie8a21d2f239c9aa63635a07e3ff6ee27d2ec4b46 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com>
* | Move QBluetoothSocket::connectToService() to private implementationsAlex Blasche2018-07-2512-134/+384
| | | | | | | | | | | | | | | | | | | | | | This permits each platform to customize the implementations without the need for ifdefs. Upcoming changes such as the BLuez DBuS addition will increase the platform differences. Task-number: QTBUG-68550 Change-Id: I8fc9a74d3ce704466f0bf2c16287e32f222c4376 Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Rename QBluetoothSocketBasePrivate::connectToService()Alex Blasche2018-07-2512-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to move the various QBluetoothSocket::connectoService() implementations into the private classes. Common parts can be split into QBluetoothSocketBasePrivate and the platform specific code. The code becomes cleaner and has less ifdefs. However this creates a symbol clash with the currently existing private implementation as it has a function with the same signature but different purpose. This rename provides the foundation for future changes. Task-number: QTBUG-68550 Change-Id: I121f08d93e00790c1619c0449629f47bca8a964d Reviewed-by: Lubomir I. Ivanov <neolit123@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>