Skip to content

Commit

Permalink
[wifi-network-diagnostic] Remove WiFiVersionType from weak-enum-list.…
Browse files Browse the repository at this point in the history
…yaml (#24942)

* [wifi-network-diagnostic] Remove WiFiVersionType from weak-enum-list.yaml

* Update generated code
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 16, 2024
1 parent ba01629 commit 1677908
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 43 deletions.
1 change: 0 additions & 1 deletion src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions src/app/tests/suites/include/ConstraintsChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,25 @@ class ConstraintsChecker
return true;
}

template <typename T, typename U, std::enable_if_t<std::is_enum<T>::value && !std::is_pointer<U>::value, int> = 0>
template <typename T, typename U,
std::enable_if_t<std::is_enum<T>::value && !std::is_enum<U>::value && !std::is_pointer<U>::value, int> = 0>
bool CheckConstraintMinValue(const char * itemName, T current, U expected)
{
return CheckConstraintMinValue(itemName, chip::to_underlying(current), expected);
}

template <typename T, typename U, std::enable_if_t<std::is_enum<T>::value && std::is_enum<U>::value, int> = 0>
bool CheckConstraintMinValue(const char * itemName, T current, U expected)
{
return CheckConstraintMinValue(itemName, chip::to_underlying(current), chip::to_underlying(expected));
}

template <typename T, typename U, std::enable_if_t<!std::is_enum<T>::value && std::is_enum<U>::value, int> = 0>
bool CheckConstraintMinValue(const char * itemName, T current, U expected)
{
return CheckConstraintMinValue(itemName, current, chip::to_underlying(expected));
}

template <typename T, typename U, std::enable_if_t<!std::is_pointer<U>::value, int> = 0>
bool CheckConstraintMinValue(const char * itemName, chip::BitFlags<T> current, U expected)
{
Expand Down Expand Up @@ -309,12 +322,25 @@ class ConstraintsChecker
return true;
}

template <typename T, typename U, std::enable_if_t<std::is_enum<T>::value && !std::is_pointer<U>::value, int> = 0>
template <typename T, typename U,
std::enable_if_t<std::is_enum<T>::value && !std::is_enum<U>::value && !std::is_pointer<U>::value, int> = 0>
bool CheckConstraintMaxValue(const char * itemName, T current, U expected)
{
return CheckConstraintMaxValue(itemName, chip::to_underlying(current), expected);
}

template <typename T, typename U, std::enable_if_t<std::is_enum<T>::value && std::is_enum<U>::value, int> = 0>
bool CheckConstraintMaxValue(const char * itemName, T current, U expected)
{
return CheckConstraintMaxValue(itemName, chip::to_underlying(current), chip::to_underlying(expected));
}

template <typename T, typename U, std::enable_if_t<!std::is_enum<T>::value && std::is_enum<U>::value, int> = 0>
bool CheckConstraintMaxValue(const char * itemName, T current, U expected)
{
return CheckConstraintMaxValue(itemName, current, chip::to_underlying(expected));
}

template <typename T, typename U, std::enable_if_t<!std::is_pointer<U>::value, int> = 0>
bool CheckConstraintMaxValue(const char * itemName, chip::BitFlags<T> current, U expected)
{
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Ameba/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/Beken/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/mw320/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/platform/webos/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions zzz_generated/app-common/app-common/zap-generated/enums.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1677908

Please sign in to comment.