Commit Graph

12 Commits

Author SHA1 Message Date
Andreas Buhr e009d67f4b Decouple QBluetoothSocket and QAbstractSocket, introduce scoped enums
QBluetoothSocket enum values were tied to QAbstractSocket enum values.
But there is no dependency, the coupling is not required. This patch
removes the coupling and changes to scoped enums for improved type
safety.

Task-number: QTBUG-62877
Change-Id: I206b1d438d74b976d3e0d32da5713d22b597dd90
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-12 09:05:35 +01:00
Andreas Buhr 66bb9839db Use scoped enum for constants in QBluetoothUuid
QBluetoothUuid contains enums for ProtocolUuid, ServiceClassUuid,
CharacteristicType and DescriptorType. So far, they all
put their constants directly into the QBluetoothUuid
namespace, making it easy to mix them up. This patch changes
those to scoped enums. That way, each enum has its items in
its own namespace.

Change-Id: I86ea08ff31009dc8073d84cfe678e27920d693f7
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-03-11 13:01:51 +01:00
Andreas Buhr 7aa19c8a51 Fix error handling in BlueZ connectToServiceHelper
QBluetoothSocketPrivateBluezDBus uses asynchronous calls,
then blocking waits for the result and then does error handling.
The blocking wait was missed in one place, rendering the following
error handling code dysfunctional.
This patch adds the required blocking wait.

Fixes: QTBUG-82407
Pick-to: 5.15
Change-Id: Ia45372e3b6cce3617d6c985fe1800a33631bc0fc
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2021-02-12 17:50:39 +01:00
Lars Schmertmann 073deeeca4 Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I74006298cc2d8a40e05775500a794ac1a721a5e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-06-23 07:15:12 +00:00
Alex Blasche 545b282d6d Ensure DBus based QBluetoothSocket emits bytesWritten() signal
[ChangeLog][QtBluetooth][Linux/BlueZ] Fixed missing emission
of QBluetoothSocket::bytesWritten() signal on Bluez v5.46+.

Fixes: QTBUG-74513
Change-Id: I93cb5abe65e13f6a5cc5bb195cc98526a507916a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-03-25 15:28:04 +00:00
Oliver Wolff 0b5da60094 QBluetoothSocket: Move (dis-)connected logic into setSocketState
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>
2018-08-16 06:46:43 +00:00
Alex Blasche b6edd37920 Fix QBluetoothSocket::socketDescriptor() for BlueZ DBus
Task-number: QTBUG-68550
Change-Id: Ibc22b9a51336855c0a981f9280e6ae9ede9437b4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-08-09 11:56:46 +00:00
Alex Blasche 45c843ceca Shift close/abort signaling from QBluetoothSocket to private implementations
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>
2018-08-09 08:55:08 +00:00
Alex Blasche 80bea1f32b Implement QBluetoothSocket Client support for Bluez5 DBus
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>
2018-08-09 08:55:04 +00:00
Alex Blasche e84d9f24cb Move QBluetoothSocket::connectToService() to private implementations
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>
2018-07-25 11:16:30 +00:00
Alex Blasche 81de083e4f Rename QBluetoothSocketBasePrivate::connectToService()
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>
2018-07-25 11:16:27 +00:00
Alex Blasche b20db00c08 Add separate interfaces for QBluetoothSocketPrivate on Linux
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>
2018-07-25 11:16:14 +00:00