mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
9686b4cf74
commit
41fc822d56
2 changed files with 12 additions and 12 deletions
|
@ -642,7 +642,7 @@ dc_status_t qt_ble_open(void **io, dc_context_t *, const char *devaddr, device_d
|
||||||
QLowEnergyDescriptor d = l.first();
|
QLowEnergyDescriptor d = l.first();
|
||||||
|
|
||||||
for (const QLowEnergyDescriptor &tmp: l) {
|
for (const QLowEnergyDescriptor &tmp: l) {
|
||||||
if (tmp.type() == QBluetoothUuid::ClientCharacteristicConfiguration) {
|
if (tmp.type() == QBluetoothUuid::DescriptorType::ClientCharacteristicConfiguration) {
|
||||||
d = tmp;
|
d = tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
#if defined(Q_OS_ANDROID)
|
||||||
QBluetoothUuid uuid = QBluetoothUuid(QUuid("{00001101-0000-1000-8000-00805f9b34fb}"));
|
QBluetoothUuid uuid = QBluetoothUuid(QUuid("{00001101-0000-1000-8000-00805f9b34fb}"));
|
||||||
qDebug() << "connecting to Uuid" << uuid;
|
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);
|
serial_port->socket->connectToService(remoteDeviceAddress, uuid, QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||||
#else
|
#else
|
||||||
QBluetoothLocalDevice dev;
|
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);
|
timer.start(msec);
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
if (serial_port->socket->state() == QBluetoothSocket::ConnectingState ||
|
if (serial_port->socket->state() == QBluetoothSocket::SocketState::ConnectingState ||
|
||||||
serial_port->socket->state() == QBluetoothSocket::ServiceLookupState) {
|
serial_port->socket->state() == QBluetoothSocket::SocketState::ServiceLookupState) {
|
||||||
// It seems that the connection step took more than expected. Wait another 20 seconds.
|
// 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";
|
qDebug() << "The connection step took more than expected. Wait another 20 seconds";
|
||||||
timer.start(4 * msec);
|
timer.start(4 * msec);
|
||||||
loop.exec();
|
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
|
// Get the latest error and try to match it with one from libdivecomputer
|
||||||
QBluetoothSocket::SocketError err = serial_port->socket->error();
|
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);
|
free (serial_port);
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case QBluetoothSocket::HostNotFoundError:
|
case QBluetoothSocket::SocketError::HostNotFoundError:
|
||||||
case QBluetoothSocket::ServiceNotFoundError:
|
case QBluetoothSocket::SocketError::ServiceNotFoundError:
|
||||||
return DC_STATUS_NODEVICE;
|
return DC_STATUS_NODEVICE;
|
||||||
case QBluetoothSocket::UnsupportedProtocolError:
|
case QBluetoothSocket::SocketError::UnsupportedProtocolError:
|
||||||
return DC_STATUS_PROTOCOL;
|
return DC_STATUS_PROTOCOL;
|
||||||
case QBluetoothSocket::OperationError:
|
case QBluetoothSocket::SocketError::OperationError:
|
||||||
return DC_STATUS_UNSUPPORTED;
|
return DC_STATUS_UNSUPPORTED;
|
||||||
case QBluetoothSocket::NetworkError:
|
case QBluetoothSocket::SocketError::NetworkError:
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
default:
|
default:
|
||||||
return DC_STATUS_IO;
|
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 (;;) {
|
for (;;) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (device->socket->state() != QBluetoothSocket::ConnectedState)
|
if (device->socket->state() != QBluetoothSocket::SocketState::ConnectedState)
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
|
|
||||||
rc = device->socket->read((char *) data, size);
|
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 (;;) {
|
for (;;) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (device->socket->state() != QBluetoothSocket::ConnectedState)
|
if (device->socket->state() != QBluetoothSocket::SocketState::ConnectedState)
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
|
|
||||||
rc = device->socket->write((char *) data, size);
|
rc = device->socket->write((char *) data, size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue