summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-11 14:37:26 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-08-12 12:55:12 +0000
commitdaefa8e26073f8d03f9b87af3bfd70e4423c8fb0 (patch)
treeea7b036f980df5293f916ed3458f539474930af2
parent278d2e31cf0d5516600e69b4f0f63b003fe2e616 (diff)
QBluetoothUuid: remove default case labels and fix the fallout
Learn to love -Wswitch and avoid default case labels even at the cost of having a few enumerator cases "too many". They help catch mistakes, like, in this case, the missing handling of QBluetoothUuid::CharacteristicType::WeightScaleFeature. [ChangeLog][QtBluethooth][QBluetoothUuid] Fixed missing result of characteristicToString(CharacteristicType::WeightScaleFeature). Change-Id: I04b7cf9ee058ef5a8d202fff01fb347d315562f6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit 439e818f7843b6a117e1bfe755e313022e14aafa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/qbluetoothuuid.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp
index 506d5bc8..2bed10cf 100644
--- a/src/bluetooth/qbluetoothuuid.cpp
+++ b/src/bluetooth/qbluetoothuuid.cpp
@@ -750,8 +750,6 @@ QString QBluetoothUuid::serviceClassToString(QBluetoothUuid::ServiceClassUuid uu
//: Connection management (Bluetooth)
case QBluetoothUuid::ServiceClassUuid::BondManagement: return QBluetoothServiceDiscoveryAgent::tr("Bond Management");
case QBluetoothUuid::ServiceClassUuid::ContinuousGlucoseMonitoring: return QBluetoothServiceDiscoveryAgent::tr("Continuous Glucose Monitoring");
- default:
- break;
}
return QString();
@@ -794,8 +792,6 @@ QString QBluetoothUuid::protocolToString(QBluetoothUuid::ProtocolUuid uuid)
case QBluetoothUuid::ProtocolUuid::McapControlChannel: return QBluetoothServiceDiscoveryAgent::tr("Multi-Channel Adaptation Protocol - Control");
case QBluetoothUuid::ProtocolUuid::McapDataChannel: return QBluetoothServiceDiscoveryAgent::tr("Multi-Channel Adaptation Protocol - Data");
case QBluetoothUuid::ProtocolUuid::L2cap: return QBluetoothServiceDiscoveryAgent::tr("Layer 2 Control Protocol");
- default:
- break;
}
return QString();
@@ -997,13 +993,13 @@ QString QBluetoothUuid::characteristicToString(CharacteristicType uuid)
case QBluetoothUuid::CharacteristicType::BodyCompositionFeature: return QBluetoothServiceDiscoveryAgent::tr("Body Composition Feature");
case QBluetoothUuid::CharacteristicType::BodyCompositionMeasurement: return QBluetoothServiceDiscoveryAgent::tr("Body Composition Measurement");
case QBluetoothUuid::CharacteristicType::WeightMeasurement: return QBluetoothServiceDiscoveryAgent::tr("Weight Measurement");
+ case QBluetoothUuid::CharacteristicType::WeightScaleFeature:
+ return QBluetoothDeviceDiscoveryAgent::tr("Weight Scale Feature");
case QBluetoothUuid::CharacteristicType::UserControlPoint: return QBluetoothServiceDiscoveryAgent::tr("User Control Point");
case QBluetoothUuid::CharacteristicType::MagneticFluxDensity2D: return QBluetoothServiceDiscoveryAgent::tr("Magnetic Flux Density 2D");
case QBluetoothUuid::CharacteristicType::MagneticFluxDensity3D: return QBluetoothServiceDiscoveryAgent::tr("Magnetic Flux Density 3D");
case QBluetoothUuid::CharacteristicType::Language: return QBluetoothServiceDiscoveryAgent::tr("Language");
case QBluetoothUuid::CharacteristicType::BarometricPressureTrend: return QBluetoothServiceDiscoveryAgent::tr("Barometric Pressure Trend");
- default:
- break;
}
return QString();
@@ -1020,6 +1016,8 @@ QString QBluetoothUuid::characteristicToString(CharacteristicType uuid)
QString QBluetoothUuid::descriptorToString(QBluetoothUuid::DescriptorType uuid)
{
switch (uuid) {
+ case QBluetoothUuid::DescriptorType::UnknownDescriptorType:
+ break; // returns {} below
case QBluetoothUuid::DescriptorType::CharacteristicExtendedProperties:
return QBluetoothServiceDiscoveryAgent::tr("Characteristic Extended Properties");
case QBluetoothUuid::DescriptorType::CharacteristicUserDescription:
@@ -1044,8 +1042,6 @@ QString QBluetoothUuid::descriptorToString(QBluetoothUuid::DescriptorType uuid)
return QBluetoothServiceDiscoveryAgent::tr("Environmental Sensing Measurement");
case QBluetoothUuid::DescriptorType::EnvironmentalSensingTriggerSetting:
return QBluetoothServiceDiscoveryAgent::tr("Environmental Sensing Trigger Setting");
- default:
- break;
}
return QString();