diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-08-11 14:37:26 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-12 12:55:12 +0000 |
commit | 195f1bafcbba46bfb44c85e5ef5970d07845580a (patch) | |
tree | 7bfe730d6befdb4de1e7eed13f75f03c68755892 | |
parent | dd29b3b99428ab1ba98ee5b30495464e073a6b13 (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.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp index 9449d2f5..c67f704f 100644 --- a/src/bluetooth/qbluetoothuuid.cpp +++ b/src/bluetooth/qbluetoothuuid.cpp @@ -751,8 +751,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(); @@ -795,8 +793,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(); @@ -998,13 +994,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(); @@ -1021,6 +1017,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: @@ -1045,8 +1043,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(); |