Skip to content

Commit

Permalink
Decrease dependency on WeakEnum: GeneralDiagnostics::RadioFaultEnum…
Browse files Browse the repository at this point in the history
…, InterfaceTypeEnum (#29694)

* First update for radio fault enum

* Fix compile (I hope)

* Fix compilation again

* Fix BLE constant as well

* Undo submodule update

* Remove InterfaceTypeEnum from the list of weak enums

* Replace all scoped constants with new names

* Also convert all InterfaceTypeEnum calls

* Fix compilation

* Fix boufallolab build

* Better namespace names for all other platforms (fix compile)

---------

Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
2 people authored and pull[bot] committed Feb 16, 2024
1 parent beb42b0 commit 2173221
Show file tree
Hide file tree
Showing 32 changed files with 102 additions and 173 deletions.
12 changes: 6 additions & 6 deletions examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)
GeneralFaults<kMaxRadioFaults> current;

// On Linux Simulation, set following radio faults statically.
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnOnFailure(previous.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
ReturnOnFailure(previous.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));

ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kCellularFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kNFCFault)));
Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current);
}
else if (eventId == Clusters::GeneralDiagnostics::Events::NetworkFaultChange::Id)
Expand Down
12 changes: 6 additions & 6 deletions examples/lighting-app/linux/LightingAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ void LightingAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)
GeneralFaults<kMaxRadioFaults> current;

// On Linux Simulation, set following radio faults statically.
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnOnFailure(previous.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnOnFailure(previous.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
ReturnOnFailure(previous.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));

ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kCellularFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kNFCFault)));
Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current);
}
else if (eventId == Clusters::GeneralDiagnostics::Events::NetworkFaultChange::Id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ CHIP_ERROR GenericFaultTestEventTriggerDelegate::HandleEventTrigger(uint64_t eve
GeneralFaults<kMaxRadioFaults> radioFaultsPrevious;
GeneralFaults<kMaxRadioFaults> radioFaultsCurrent;

ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));

ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
using app::Clusters::GeneralDiagnostics::RadioFaultEnum;
ReturnErrorOnFailure(radioFaultsPrevious.add(to_underlying(RadioFaultEnum::kWiFiFault)));
ReturnErrorOnFailure(radioFaultsPrevious.add(to_underlying(RadioFaultEnum::kThreadFault)));

ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kWiFiFault)));
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kCellularFault)));
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kThreadFault)));
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kNFCFault)));

app::Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(radioFaultsPrevious, radioFaultsCurrent);

Expand Down
2 changes: 0 additions & 2 deletions src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ WeakEnums:
- ColorControlOptions
- ColorMode
- EnhancedColorMode
- InterfaceTypeEnum
- MoveMode
- PHYRateEnum
- RadioFaultEnum
- StepMode

CommandHandlerInterfaceOnlyClusters:
Expand Down
4 changes: 2 additions & 2 deletions src/platform/ASR/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->isOperational = true;
if ((ifa->flags) & NETIF_FLAG_ETHERNET)
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kEthernet;
else
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

Expand Down
4 changes: 2 additions & 2 deletions src/platform/Ameba/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->isOperational = true;
if ((ifa->flags) & NETIF_FLAG_ETHERNET)
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kEthernet;
else
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

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 @@ -134,7 +134,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **

Platform::CopyString(ifp->Name, netif->hostname);
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
memcpy(ifp->MacAddress, netif->hwaddr, sizeof(netif->hwaddr));
Expand Down
8 changes: 4 additions & 4 deletions src/platform/ESP32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ namespace {
InterfaceTypeEnum GetInterfaceType(const char * if_desc)
{
if (strncmp(if_desc, "ap", strnlen(if_desc, 2)) == 0 || strncmp(if_desc, "sta", strnlen(if_desc, 3)) == 0)
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
return InterfaceTypeEnum::kWiFi;
if (strncmp(if_desc, "openthread", strnlen(if_desc, 10)) == 0)
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_THREAD;
return InterfaceTypeEnum::kThread;
if (strncmp(if_desc, "eth", strnlen(if_desc, 3)) == 0)
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
return InterfaceTypeEnum::kEthernet;
return InterfaceTypeEnum::kUnspecified;
}

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();
ifp->hardwareAddress = ByteSpan(ifp->MacAddress);
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_THREAD;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kThread;

static_assert(sizeof(ifp->MacAddress) >= ConfigurationManager::kPrimaryMACAddressLength, "Invalid MacAddress buffer size");
ConfigurationMgr().GetPrimary802154MACAddress(ifp->MacAddress);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
/* Update Network Interface list */
ifp->name = CharSpan::fromCharString(net_interface->name);
ifp->isOperational = net_interface->flags & NETIF_FLAG_LINK_UP;
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
ifp->offPremiseServicesReachableIPv4 = mipv4_offpremise;
ifp->offPremiseServicesReachableIPv6 = mipv6_offpremise;
ifp->hardwareAddress = ByteSpan(net_interface->hwaddr, net_interface->hwaddr_len);
Expand Down
3 changes: 1 addition & 2 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,8 +1220,7 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiBssId(MutableByteSpan & value)
// Walk through linked list, maintaining head pointer so we can free list later.
for (struct ifaddrs * ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
{
if (ConnectivityUtils::GetInterfaceHardwareAddrs(ifa->ifa_name, value.data(), kMaxHardwareAddrSize) !=
CHIP_NO_ERROR)
Expand Down
12 changes: 6 additions & 6 deletions src/platform/Linux/ConnectivityUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ double ConnectivityUtils::ConvertFrequenceToFloat(const iw_freq * in)

InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifname)
{
InterfaceTypeEnum ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
InterfaceTypeEnum ret = InterfaceTypeEnum::kUnspecified;
int sock = -1;

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
ChipLogError(DeviceLayer, "Failed to open socket");
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
return InterfaceTypeEnum::kUnspecified;
}

// Test wireless extensions for CONNECTION_WIFI
Expand All @@ -260,7 +260,7 @@ InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifn

if (ioctl(sock, SIOCGIWNAME, &pwrq) != -1)
{
ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ret = InterfaceTypeEnum::kWiFi;
}
else if ((strncmp(ifname, "en", 2) == 0) || (strncmp(ifname, "eth", 3) == 0))
{
Expand All @@ -271,7 +271,7 @@ InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifn
Platform::CopyString(ifr.ifr_name, ifname);

if (ioctl(sock, SIOCETHTOOL, &ifr) != -1)
ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
ret = InterfaceTypeEnum::kEthernet;
}

close(sock);
Expand Down Expand Up @@ -420,7 +420,7 @@ CHIP_ERROR ConnectivityUtils::GetWiFiInterfaceName(char * ifname, size_t bufSize
can free list later */
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
{
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -614,7 +614,7 @@ CHIP_ERROR ConnectivityUtils::GetEthInterfaceName(char * ifname, size_t bufSize)
can free list later */
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
{
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
err = CHIP_NO_ERROR;
Expand Down
20 changes: 8 additions & 12 deletions src/platform/Linux/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ CHIP_ERROR GetEthernetStatsCount(EthernetStatsCountType type, uint64_t & count)
// Walk through linked list, maintaining head pointer so we can free list later.
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
{
ChipLogProgress(DeviceLayer, "Found the primary Ethernet interface:%s", StringOrNullMarker(ifa->ifa_name));
break;
Expand Down Expand Up @@ -156,8 +155,7 @@ CHIP_ERROR GetWiFiStatsCount(WiFiStatsCountType type, uint64_t & count)
// Walk through linked list, maintaining head pointer so we can free list later.
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
{
ChipLogProgress(DeviceLayer, "Found the primary WiFi interface:%s", StringOrNullMarker(ifa->ifa_name));
break;
Expand Down Expand Up @@ -413,10 +411,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetActiveRadioFaults(GeneralFaults<kMaxRa
{
#if CHIP_CONFIG_TEST
// On Linux Simulation, set following radio faults statically.
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kWiFiFault)));
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kCellularFault)));
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kThreadFault)));
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kNFCFault)));
#endif

return CHIP_NO_ERROR;
Expand Down Expand Up @@ -615,8 +613,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetEthNetworkDiagnosticsCounts()
// Walk through linked list, maintaining head pointer so we can free list later.
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
{
ChipLogProgress(DeviceLayer, "Found the primary Ethernet interface:%s", StringOrNullMarker(ifa->ifa_name));
break;
Expand Down Expand Up @@ -781,8 +778,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts()
// Walk through linked list, maintaining head pointer so we can free list later.
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
{
ChipLogProgress(DeviceLayer, "Found the primary WiFi interface:%s", StringOrNullMarker(ifa->ifa_name));
break;
Expand Down
10 changes: 5 additions & 5 deletions src/platform/Tizen/ConnectivityUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uint8_t ConnectivityUtils::MapFrequencyToChannel(const uint16_t frequency)

InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifname)
{
InterfaceTypeEnum ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
InterfaceTypeEnum ret = InterfaceTypeEnum::kUnspecified;
int sock = -1;

if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
Expand All @@ -89,7 +89,7 @@ InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifn

if (ioctl(sock, SIOCGIWNAME, &pwrq) != -1)
{
ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
ret = InterfaceTypeEnum::kWiFi;
}
else if ((strncmp(ifname, "en", 2) == 0) || (strncmp(ifname, "eth", 3) == 0))
{
Expand All @@ -100,7 +100,7 @@ InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifn
Platform::CopyString(ifr.ifr_name, ifname);

if (ioctl(sock, SIOCETHTOOL, &ifr) != -1)
ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
ret = InterfaceTypeEnum::kEthernet;
}

close(sock);
Expand Down Expand Up @@ -239,7 +239,7 @@ CHIP_ERROR ConnectivityUtils::GetWiFiInterfaceName(char * ifname, size_t bufSize
struct ifaddrs * ifa = nullptr;
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
{
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -405,7 +405,7 @@ CHIP_ERROR ConnectivityUtils::GetEthInterfaceName(char * ifname, size_t bufSize)
struct ifaddrs * ifa = nullptr;
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
{
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
{
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
err = CHIP_NO_ERROR;
Expand Down
Loading

0 comments on commit 2173221

Please sign in to comment.