Skip to content

Commit 3277660

Browse files
andy31415andreilitvin
authored andcommitted
Decrease dependency on WeakEnum: GeneralDiagnostics::RadioFaultEnum, 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>
1 parent e0bcb65 commit 3277660

32 files changed

+102
-173
lines changed

examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ void AllClustersAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)
235235
GeneralFaults<kMaxRadioFaults> current;
236236

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

241-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
242-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
243-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
244-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
241+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
242+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kCellularFault)));
243+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));
244+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kNFCFault)));
245245
Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current);
246246
}
247247
else if (eventId == Clusters::GeneralDiagnostics::Events::NetworkFaultChange::Id)

examples/lighting-app/linux/LightingAppCommandDelegate.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ void LightingAppCommandHandler::OnGeneralFaultEventHandler(uint32_t eventId)
199199
GeneralFaults<kMaxRadioFaults> current;
200200

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

205-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
206-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
207-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
208-
ReturnOnFailure(current.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
205+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kWiFiFault)));
206+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kCellularFault)));
207+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kThreadFault)));
208+
ReturnOnFailure(current.add(to_underlying(GeneralDiagnostics::RadioFaultEnum::kNFCFault)));
209209
Clusters::GeneralDiagnosticsServer::Instance().OnRadioFaultsDetect(previous, current);
210210
}
211211
else if (eventId == Clusters::GeneralDiagnostics::Events::NetworkFaultChange::Id)

src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerDelegate.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ CHIP_ERROR GenericFaultTestEventTriggerDelegate::HandleEventTrigger(uint64_t eve
5353
GeneralFaults<kMaxRadioFaults> radioFaultsPrevious;
5454
GeneralFaults<kMaxRadioFaults> radioFaultsCurrent;
5555

56-
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
57-
ReturnErrorOnFailure(radioFaultsPrevious.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
58-
59-
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
60-
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
61-
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
62-
ReturnErrorOnFailure(radioFaultsCurrent.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
56+
using app::Clusters::GeneralDiagnostics::RadioFaultEnum;
57+
ReturnErrorOnFailure(radioFaultsPrevious.add(to_underlying(RadioFaultEnum::kWiFiFault)));
58+
ReturnErrorOnFailure(radioFaultsPrevious.add(to_underlying(RadioFaultEnum::kThreadFault)));
59+
60+
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kWiFiFault)));
61+
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kCellularFault)));
62+
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kThreadFault)));
63+
ReturnErrorOnFailure(radioFaultsCurrent.add(to_underlying(RadioFaultEnum::kNFCFault)));
6364

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

src/app/common/templates/config-data.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ WeakEnums:
66
- ColorControlOptions
77
- ColorMode
88
- EnhancedColorMode
9-
- InterfaceTypeEnum
109
- MoveMode
1110
- PHYRateEnum
12-
- RadioFaultEnum
1311
- StepMode
1412

1513
CommandHandlerInterfaceOnlyClusters:

src/platform/ASR/DiagnosticDataProviderImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
165165
ifp->name = CharSpan::fromCharString(ifp->Name);
166166
ifp->isOperational = true;
167167
if ((ifa->flags) & NETIF_FLAG_ETHERNET)
168-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
168+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kEthernet;
169169
else
170-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
170+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
171171
ifp->offPremiseServicesReachableIPv4.SetNull();
172172
ifp->offPremiseServicesReachableIPv6.SetNull();
173173

src/platform/Ameba/DiagnosticDataProviderImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
199199
ifp->name = CharSpan::fromCharString(ifp->Name);
200200
ifp->isOperational = true;
201201
if ((ifa->flags) & NETIF_FLAG_ETHERNET)
202-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
202+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kEthernet;
203203
else
204-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
204+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
205205
ifp->offPremiseServicesReachableIPv4.SetNull();
206206
ifp->offPremiseServicesReachableIPv6.SetNull();
207207

src/platform/Beken/DiagnosticDataProviderImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
134134

135135
Platform::CopyString(ifp->Name, netif->hostname);
136136
ifp->name = CharSpan::fromCharString(ifp->Name);
137-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
137+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
138138
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
139139
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
140140
memcpy(ifp->MacAddress, netif->hwaddr, sizeof(netif->hwaddr));

src/platform/ESP32/DiagnosticDataProviderImpl.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ namespace {
5353
InterfaceTypeEnum GetInterfaceType(const char * if_desc)
5454
{
5555
if (strncmp(if_desc, "ap", strnlen(if_desc, 2)) == 0 || strncmp(if_desc, "sta", strnlen(if_desc, 3)) == 0)
56-
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
56+
return InterfaceTypeEnum::kWiFi;
5757
if (strncmp(if_desc, "openthread", strnlen(if_desc, 10)) == 0)
58-
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_THREAD;
58+
return InterfaceTypeEnum::kThread;
5959
if (strncmp(if_desc, "eth", strnlen(if_desc, 3)) == 0)
60-
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET;
61-
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
60+
return InterfaceTypeEnum::kEthernet;
61+
return InterfaceTypeEnum::kUnspecified;
6262
}
6363

6464
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI

src/platform/Infineon/CYW30739/DiagnosticDataProviderImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
107107
ifp->offPremiseServicesReachableIPv4.SetNull();
108108
ifp->offPremiseServicesReachableIPv6.SetNull();
109109
ifp->hardwareAddress = ByteSpan(ifp->MacAddress);
110-
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_THREAD;
110+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kThread;
111111

112112
static_assert(sizeof(ifp->MacAddress) >= ConfigurationManager::kPrimaryMACAddressLength, "Invalid MacAddress buffer size");
113113
ConfigurationMgr().GetPrimary802154MACAddress(ifp->MacAddress);

src/platform/Infineon/PSOC6/DiagnosticDataProviderImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
161161
/* Update Network Interface list */
162162
ifp->name = CharSpan::fromCharString(net_interface->name);
163163
ifp->isOperational = net_interface->flags & NETIF_FLAG_LINK_UP;
164-
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI;
164+
ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kWiFi;
165165
ifp->offPremiseServicesReachableIPv4 = mipv4_offpremise;
166166
ifp->offPremiseServicesReachableIPv6 = mipv6_offpremise;
167167
ifp->hardwareAddress = ByteSpan(net_interface->hwaddr, net_interface->hwaddr_len);

src/platform/Linux/ConnectivityManagerImpl.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1220,8 +1220,7 @@ CHIP_ERROR ConnectivityManagerImpl::GetWiFiBssId(MutableByteSpan & value)
12201220
// Walk through linked list, maintaining head pointer so we can free list later.
12211221
for (struct ifaddrs * ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
12221222
{
1223-
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
1224-
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
1223+
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
12251224
{
12261225
if (ConnectivityUtils::GetInterfaceHardwareAddrs(ifa->ifa_name, value.data(), kMaxHardwareAddrSize) !=
12271226
CHIP_NO_ERROR)

src/platform/Linux/ConnectivityUtils.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ double ConnectivityUtils::ConvertFrequenceToFloat(const iw_freq * in)
245245

246246
InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifname)
247247
{
248-
InterfaceTypeEnum ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
248+
InterfaceTypeEnum ret = InterfaceTypeEnum::kUnspecified;
249249
int sock = -1;
250250

251251
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
252252
{
253253
ChipLogError(DeviceLayer, "Failed to open socket");
254-
return InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
254+
return InterfaceTypeEnum::kUnspecified;
255255
}
256256

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

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

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

277277
close(sock);
@@ -420,7 +420,7 @@ CHIP_ERROR ConnectivityUtils::GetWiFiInterfaceName(char * ifname, size_t bufSize
420420
can free list later */
421421
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
422422
{
423-
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
423+
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
424424
{
425425
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
426426
err = CHIP_NO_ERROR;
@@ -614,7 +614,7 @@ CHIP_ERROR ConnectivityUtils::GetEthInterfaceName(char * ifname, size_t bufSize)
614614
can free list later */
615615
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
616616
{
617-
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
617+
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
618618
{
619619
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
620620
err = CHIP_NO_ERROR;

src/platform/Linux/DiagnosticDataProviderImpl.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ CHIP_ERROR GetEthernetStatsCount(EthernetStatsCountType type, uint64_t & count)
9191
// Walk through linked list, maintaining head pointer so we can free list later.
9292
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
9393
{
94-
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
95-
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
94+
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
9695
{
9796
ChipLogProgress(DeviceLayer, "Found the primary Ethernet interface:%s", StringOrNullMarker(ifa->ifa_name));
9897
break;
@@ -156,8 +155,7 @@ CHIP_ERROR GetWiFiStatsCount(WiFiStatsCountType type, uint64_t & count)
156155
// Walk through linked list, maintaining head pointer so we can free list later.
157156
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
158157
{
159-
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
160-
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
158+
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
161159
{
162160
ChipLogProgress(DeviceLayer, "Found the primary WiFi interface:%s", StringOrNullMarker(ifa->ifa_name));
163161
break;
@@ -413,10 +411,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetActiveRadioFaults(GeneralFaults<kMaxRa
413411
{
414412
#if CHIP_CONFIG_TEST
415413
// On Linux Simulation, set following radio faults statically.
416-
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_WI_FI_FAULT));
417-
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_CELLULAR_FAULT));
418-
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_THREAD_FAULT));
419-
ReturnErrorOnFailure(radioFaults.add(EMBER_ZCL_RADIO_FAULT_ENUM_NFC_FAULT));
414+
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kWiFiFault)));
415+
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kCellularFault)));
416+
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kThreadFault)));
417+
ReturnErrorOnFailure(radioFaults.add(to_underlying(RadioFaultEnum::kNFCFault)));
420418
#endif
421419

422420
return CHIP_NO_ERROR;
@@ -615,8 +613,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetEthNetworkDiagnosticsCounts()
615613
// Walk through linked list, maintaining head pointer so we can free list later.
616614
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
617615
{
618-
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
619-
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
616+
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
620617
{
621618
ChipLogProgress(DeviceLayer, "Found the primary Ethernet interface:%s", StringOrNullMarker(ifa->ifa_name));
622619
break;
@@ -781,8 +778,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts()
781778
// Walk through linked list, maintaining head pointer so we can free list later.
782779
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
783780
{
784-
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) ==
785-
InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
781+
if (ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
786782
{
787783
ChipLogProgress(DeviceLayer, "Found the primary WiFi interface:%s", StringOrNullMarker(ifa->ifa_name));
788784
break;

src/platform/Tizen/ConnectivityUtils.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ uint8_t ConnectivityUtils::MapFrequencyToChannel(const uint16_t frequency)
7474

7575
InterfaceTypeEnum ConnectivityUtils::GetInterfaceConnectionType(const char * ifname)
7676
{
77-
InterfaceTypeEnum ret = InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_UNSPECIFIED;
77+
InterfaceTypeEnum ret = InterfaceTypeEnum::kUnspecified;
7878
int sock = -1;
7979

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

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

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

106106
close(sock);
@@ -239,7 +239,7 @@ CHIP_ERROR ConnectivityUtils::GetWiFiInterfaceName(char * ifname, size_t bufSize
239239
struct ifaddrs * ifa = nullptr;
240240
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
241241
{
242-
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI)
242+
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kWiFi)
243243
{
244244
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
245245
err = CHIP_NO_ERROR;
@@ -405,7 +405,7 @@ CHIP_ERROR ConnectivityUtils::GetEthInterfaceName(char * ifname, size_t bufSize)
405405
struct ifaddrs * ifa = nullptr;
406406
for (ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next)
407407
{
408-
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET)
408+
if (GetInterfaceConnectionType(ifa->ifa_name) == InterfaceTypeEnum::kEthernet)
409409
{
410410
Platform::CopyString(ifname, bufSize, ifa->ifa_name);
411411
err = CHIP_NO_ERROR;

0 commit comments

Comments
 (0)