summaryrefslogtreecommitdiffstats
path: root/core/qtserialbluetooth.cpp
diff options
context:
space:
mode:
authorGravatar Andreas Buhr <andreas.buhr@qt.io>2021-03-12 13:20:38 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-03-12 08:41:31 -0800
commit41fc822d56e7d0866129ef6b68ccfb947300bffd (patch)
tree2d89a683316b54fb991a63d1c9e906f4701e086a /core/qtserialbluetooth.cpp
parent9686b4cf740d38bc8d1262f368cf5edfe0c68f0d (diff)
downloadsubsurface-41fc822d56e7d0866129ef6b68ccfb947300bffd.tar.gz
Use QtBluetooth enums from their namespace
For increased type safety, some enums have been changed to scoped enums in Qt 6.2, see https://codereview.qt-project.org/c/qt/qtconnectivity/+/337069 https://codereview.qt-project.org/c/qt/qtconnectivity/+/336678 This patch adapts subsurface to this change. Since C++11, enums inject their symbols in both their own and their parent namespace, so this patch can be merged right now. Signed-off-by: Andreas Buhr <andreas.buhr@qt.io>
Diffstat (limited to 'core/qtserialbluetooth.cpp')
-rw-r--r--core/qtserialbluetooth.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/qtserialbluetooth.cpp b/core/qtserialbluetooth.cpp
index 1dd57c592..f2242f899 100644
--- a/core/qtserialbluetooth.cpp
+++ b/core/qtserialbluetooth.cpp
@@ -63,7 +63,7 @@ static dc_status_t qt_serial_open(qt_serial_t **io, dc_context_t*, const char* d
#if defined(Q_OS_ANDROID)
QBluetoothUuid uuid = QBluetoothUuid(QUuid("{00001101-0000-1000-8000-00805f9b34fb}"));
qDebug() << "connecting to Uuid" << uuid;
- serial_port->socket->setPreferredSecurityFlags(QBluetooth::NoSecurity);
+ serial_port->socket->setPreferredSecurityFlags(QBluetooth::Security::NoSecurity);
serial_port->socket->connectToService(remoteDeviceAddress, uuid, QIODevice::ReadWrite | QIODevice::Unbuffered);
#else
QBluetoothLocalDevice dev;
@@ -74,15 +74,15 @@ static dc_status_t qt_serial_open(qt_serial_t **io, dc_context_t*, const char* d
timer.start(msec);
loop.exec();
- if (serial_port->socket->state() == QBluetoothSocket::ConnectingState ||
- serial_port->socket->state() == QBluetoothSocket::ServiceLookupState) {
+ if (serial_port->socket->state() == QBluetoothSocket::SocketState::ConnectingState ||
+ serial_port->socket->state() == QBluetoothSocket::SocketState::ServiceLookupState) {
// It seems that the connection step took more than expected. Wait another 20 seconds.
qDebug() << "The connection step took more than expected. Wait another 20 seconds";
timer.start(4 * msec);
loop.exec();
}
- if (serial_port->socket->state() != QBluetoothSocket::ConnectedState) {
+ if (serial_port->socket->state() != QBluetoothSocket::SocketState::ConnectedState) {
// Get the latest error and try to match it with one from libdivecomputer
QBluetoothSocket::SocketError err = serial_port->socket->error();
@@ -90,14 +90,14 @@ static dc_status_t qt_serial_open(qt_serial_t **io, dc_context_t*, const char* d
free (serial_port);
switch(err) {
- case QBluetoothSocket::HostNotFoundError:
- case QBluetoothSocket::ServiceNotFoundError:
+ case QBluetoothSocket::SocketError::HostNotFoundError:
+ case QBluetoothSocket::SocketError::ServiceNotFoundError:
return DC_STATUS_NODEVICE;
- case QBluetoothSocket::UnsupportedProtocolError:
+ case QBluetoothSocket::SocketError::UnsupportedProtocolError:
return DC_STATUS_PROTOCOL;
- case QBluetoothSocket::OperationError:
+ case QBluetoothSocket::SocketError::OperationError:
return DC_STATUS_UNSUPPORTED;
- case QBluetoothSocket::NetworkError:
+ case QBluetoothSocket::SocketError::NetworkError:
return DC_STATUS_IO;
default:
return DC_STATUS_IO;
@@ -140,7 +140,7 @@ static dc_status_t qt_serial_read(void *io, void* data, size_t size, size_t *act
for (;;) {
int rc;
- if (device->socket->state() != QBluetoothSocket::ConnectedState)
+ if (device->socket->state() != QBluetoothSocket::SocketState::ConnectedState)
return DC_STATUS_IO;
rc = device->socket->read((char *) data, size);
@@ -179,7 +179,7 @@ static dc_status_t qt_serial_write(void *io, const void* data, size_t size, size
for (;;) {
int rc;
- if (device->socket->state() != QBluetoothSocket::ConnectedState)
+ if (device->socket->state() != QBluetoothSocket::SocketState::ConnectedState)
return DC_STATUS_IO;
rc = device->socket->write((char *) data, size);