diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index d21325e2ba812b..32521d3798a7e5 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -38,7 +38,6 @@ WeakEnums: - SecurityType - StepMode - TemperatureDisplayMode - - WiFiVersionType # We need a more configurable way of deciding which clusters have which init functions.... # See https://github.com/project-chip/connectedhomeip/issues/4369 diff --git a/src/app/tests/suites/include/ConstraintsChecker.h b/src/app/tests/suites/include/ConstraintsChecker.h index 2298ac422d2ddd..84f2dc8dff6321 100644 --- a/src/app/tests/suites/include/ConstraintsChecker.h +++ b/src/app/tests/suites/include/ConstraintsChecker.h @@ -246,12 +246,25 @@ class ConstraintsChecker return true; } - template ::value && !std::is_pointer::value, int> = 0> + template ::value && !std::is_enum::value && !std::is_pointer::value, int> = 0> bool CheckConstraintMinValue(const char * itemName, T current, U expected) { return CheckConstraintMinValue(itemName, chip::to_underlying(current), expected); } + template ::value && std::is_enum::value, int> = 0> + bool CheckConstraintMinValue(const char * itemName, T current, U expected) + { + return CheckConstraintMinValue(itemName, chip::to_underlying(current), chip::to_underlying(expected)); + } + + template ::value && std::is_enum::value, int> = 0> + bool CheckConstraintMinValue(const char * itemName, T current, U expected) + { + return CheckConstraintMinValue(itemName, current, chip::to_underlying(expected)); + } + template ::value, int> = 0> bool CheckConstraintMinValue(const char * itemName, chip::BitFlags current, U expected) { @@ -309,12 +322,25 @@ class ConstraintsChecker return true; } - template ::value && !std::is_pointer::value, int> = 0> + template ::value && !std::is_enum::value && !std::is_pointer::value, int> = 0> bool CheckConstraintMaxValue(const char * itemName, T current, U expected) { return CheckConstraintMaxValue(itemName, chip::to_underlying(current), expected); } + template ::value && std::is_enum::value, int> = 0> + bool CheckConstraintMaxValue(const char * itemName, T current, U expected) + { + return CheckConstraintMaxValue(itemName, chip::to_underlying(current), chip::to_underlying(expected)); + } + + template ::value && std::is_enum::value, int> = 0> + bool CheckConstraintMaxValue(const char * itemName, T current, U expected) + { + return CheckConstraintMaxValue(itemName, current, chip::to_underlying(expected)); + } + template ::value, int> = 0> bool CheckConstraintMaxValue(const char * itemName, chip::BitFlags current, U expected) { diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp index d0ad922905b85d..e7ca68fff83d9c 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp @@ -273,7 +273,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId) CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(uint8_t & wifiVersion) { // Support 802.11a/n Wi-Fi in AmebaD chipset - wifiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + wifiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kN); return CHIP_NO_ERROR; } diff --git a/src/platform/Beken/DiagnosticDataProviderImpl.cpp b/src/platform/Beken/DiagnosticDataProviderImpl.cpp index f3077a074950b8..1c27da06511eb6 100644 --- a/src/platform/Beken/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Beken/DiagnosticDataProviderImpl.cpp @@ -173,7 +173,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId) CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(uint8_t & wifiVersion) { // Support 802.11a/n Wi-Fi in Beken chipset - wifiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + wiFiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kN); return CHIP_NO_ERROR; } diff --git a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp index 1c9ccfbf098f5a..69b7705217099e 100644 --- a/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp @@ -260,17 +260,17 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(uint8_t & wiFiVersion) /* VHT Capable */ if (bss_info.vht_cap) { - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_AC; + wiFiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kAc); } /* HT Capable */ else if (bss_info.n_cap) { - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + wiFiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kN); } /* 11g Capable */ else { - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_G; + wiFiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kG); } exit: diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index dfeed0e2db5374..df0ef5602db5f2 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -1241,8 +1241,8 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiSecurityType(uint8_t & securityType) CHIP_ERROR ConnectivityManagerImpl::GetWiFiVersion(uint8_t & wiFiVersion) { - // We don't have driect API to get the WiFi version yet, retrun 802.11n on Linux simulation. - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + // We don't have direct API to get the WiFi version yet, return 802.11n on Linux simulation. + wiFiVersion = to_underlying(WiFiVersionType::kN); return CHIP_NO_ERROR; } diff --git a/src/platform/nxp/mw320/ConnectivityManagerImpl.cpp b/src/platform/nxp/mw320/ConnectivityManagerImpl.cpp index e78aa6ef406a76..75b6058a28b58b 100644 --- a/src/platform/nxp/mw320/ConnectivityManagerImpl.cpp +++ b/src/platform/nxp/mw320/ConnectivityManagerImpl.cpp @@ -244,7 +244,7 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiSecurityType(uint8_t & securityType) CHIP_ERROR ConnectivityManagerImpl::GetWiFiVersion(uint8_t & wiFiVersion) { - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + wiFiVersion = to_underlying(WiFiVersionType::kN); ChipLogProgress(DeviceLayer, "GetWiFiVersion: %u", wiFiVersion); return CHIP_NO_ERROR; } diff --git a/src/platform/silabs/DiagnosticDataProviderImpl.cpp b/src/platform/silabs/DiagnosticDataProviderImpl.cpp index 033886de027027..0cce168fc3b298 100644 --- a/src/platform/silabs/DiagnosticDataProviderImpl.cpp +++ b/src/platform/silabs/DiagnosticDataProviderImpl.cpp @@ -374,7 +374,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityTyp CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(uint8_t & wifiVersion) { - wifiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + wifiVersion = to_underlying(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType::kN); return CHIP_NO_ERROR; } diff --git a/src/platform/webos/ConnectivityManagerImpl.cpp b/src/platform/webos/ConnectivityManagerImpl.cpp index 9a2cf9f2038640..be4b9a57f23f07 100644 --- a/src/platform/webos/ConnectivityManagerImpl.cpp +++ b/src/platform/webos/ConnectivityManagerImpl.cpp @@ -1203,8 +1203,8 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiSecurityType(uint8_t & securityType) CHIP_ERROR ConnectivityManagerImpl::GetWiFiVersion(uint8_t & wiFiVersion) { - // We don't have driect API to get the WiFi version yet, retrun 802.11n on Linux simulation. - wiFiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_N; + // We don't have direct API to get the WiFi version yet, return 802.11n on Linux simulation. + wiFiVersion = to_underlying(WiFiVersionType::kN); return CHIP_NO_ERROR; } diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 612c1653ca5f65..e8435a7aee186b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -914,23 +914,12 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(WiFiNetworkDiagnostics: using EnumType = WiFiNetworkDiagnostics::WiFiVersionType; switch (val) { -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM case EnumType::kA: case EnumType::kB: case EnumType::kG: case EnumType::kN: case EnumType::kAc: case EnumType::kAx: -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM - case EMBER_ZCL_WI_FI_VERSION_TYPE_A: - case EMBER_ZCL_WI_FI_VERSION_TYPE_B: - case EMBER_ZCL_WI_FI_VERSION_TYPE_G: - case EMBER_ZCL_WI_FI_VERSION_TYPE_N: - case EMBER_ZCL_WI_FI_VERSION_TYPE_AC: - case EMBER_ZCL_WI_FI_VERSION_TYPE_AX: -#endif // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM return val; default: return static_cast(6); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 1d02c01f3c0566..0d1ef41a5e1547 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1049,9 +1049,6 @@ enum class WiFiConnectionStatus : uint8_t kUnknownEnumValue = 2, }; -// Need to convert consumers to using the new enum classes, so we -// don't just have casts all over. -#ifdef CHIP_USE_ENUM_CLASS_FOR_IM_ENUM // Enum for WiFiVersionType enum class WiFiVersionType : uint8_t { @@ -1067,10 +1064,6 @@ enum class WiFiVersionType : uint8_t // enum value. This specific should never be transmitted. kUnknownEnumValue = 6, }; -#else // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM -using WiFiVersionType = EmberAfWiFiVersionType; -static WiFiVersionType __attribute__((unused)) kWiFiVersionTypekUnknownEnumValue = static_cast(6); -#endif // CHIP_USE_ENUM_CLASS_FOR_IM_ENUM // Bitmap for WiFiNetworkDiagnosticsFeature enum class WiFiNetworkDiagnosticsFeature : uint32_t diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index a80c53d062358e..1bd963a9862ab3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -283,17 +283,6 @@ enum EmberAfTemperatureDisplayMode : uint8_t EMBER_ZCL_TEMPERATURE_DISPLAY_MODE_FAHRENHEIT = 1, }; -// Enum for WiFiVersionType -enum EmberAfWiFiVersionType : uint8_t -{ - EMBER_ZCL_WI_FI_VERSION_TYPE_A = 0, - EMBER_ZCL_WI_FI_VERSION_TYPE_B = 1, - EMBER_ZCL_WI_FI_VERSION_TYPE_G = 2, - EMBER_ZCL_WI_FI_VERSION_TYPE_N = 3, - EMBER_ZCL_WI_FI_VERSION_TYPE_AC = 4, - EMBER_ZCL_WI_FI_VERSION_TYPE_AX = 5, -}; - #define EMBER_AF_APPLICATION_LAUNCHER_FEATURE_APPLICATION_PLATFORM (1) #define EMBER_AF_APPLICATION_LAUNCHER_FEATURE_APPLICATION_PLATFORM_OFFSET (0) #define EMBER_AF_AUDIO_OUTPUT_FEATURE_NAME_UPDATES (1)