Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle [EFR32] Added functionality for scan-network, network interfaces and increased the heap size for multiadmin #20107

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/platform/efr32/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */

#ifndef configTOTAL_HEAP_SIZE
#ifdef SL_WIFI
#define configTOTAL_HEAP_SIZE ((size_t)(28 * 1024))
#define configTOTAL_HEAP_SIZE ((size_t)(30 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t)(20 * 1024))
#endif
Expand Down
69 changes: 68 additions & 1 deletion src/platform/EFR32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,74 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->offPremiseServicesReachableIPv6.SetNull();
ifp->type = InterfaceType::EMBER_ZCL_INTERFACE_TYPE_THREAD;
#else
/* TODO */
NetworkInterface * head = NULL;
for (Inet::InterfaceIterator interfaceIterator; interfaceIterator.HasCurrent(); interfaceIterator.Next())
{
interfaceIterator.GetInterfaceName(ifp->Name, Inet::InterfaceId::kMaxIfNameLength);
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->isOperational = true;
Inet::InterfaceType interfaceType;
if (interfaceIterator.GetInterfaceType(interfaceType) == CHIP_NO_ERROR)
{
switch (interfaceType)
{
case Inet::InterfaceType::Unknown:
ifp->type = EMBER_ZCL_INTERFACE_TYPE_UNSPECIFIED;
break;
case Inet::InterfaceType::WiFi:
ifp->type = EMBER_ZCL_INTERFACE_TYPE_WI_FI;
break;
case Inet::InterfaceType::Ethernet:
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ETHERNET;
break;
case Inet::InterfaceType::Thread:
ifp->type = EMBER_ZCL_INTERFACE_TYPE_THREAD;
break;
case Inet::InterfaceType::Cellular:
ifp->type = EMBER_ZCL_INTERFACE_TYPE_CELLULAR;
break;
}
}
else
{
ChipLogError(DeviceLayer, "Failed to get interface type");
}

ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

uint8_t addressSize;
if (interfaceIterator.GetHardwareAddress(ifp->MacAddress, addressSize, sizeof(ifp->MacAddress)) != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Failed to get network hardware address");
}
else
{
ifp->hardwareAddress = ByteSpan(ifp->MacAddress, addressSize);
}

// Assuming IPv6-only support
Inet::InterfaceAddressIterator interfaceAddressIterator;
uint8_t ipv6AddressesCount = 0;
while (interfaceAddressIterator.HasCurrent() && ipv6AddressesCount < kMaxIPv6AddrCount)
{
if (interfaceAddressIterator.GetInterfaceId() == interfaceIterator.GetInterfaceId())
{
chip::Inet::IPAddress ipv6Address;
if (interfaceAddressIterator.GetAddress(ipv6Address) == CHIP_NO_ERROR)
{
memcpy(ifp->Ipv6AddressesBuffer[ipv6AddressesCount], ipv6Address.Addr, kMaxIPv6AddrSize);
ifp->Ipv6AddressSpans[ipv6AddressesCount] = ByteSpan(ifp->Ipv6AddressesBuffer[ipv6AddressesCount]);
ipv6AddressesCount++;
}
}
interfaceAddressIterator.Next();
}

ifp->IPv6Addresses = chip::app::DataModel::List<chip::ByteSpan>(ifp->Ipv6AddressSpans, ipv6AddressesCount);
head = ifp;
}
*netifpp = head;
#endif
uint8_t macBuffer[ConfigurationManager::kPrimaryMACAddressLength];
ConfigurationMgr().GetPrimary802154MACAddress(macBuffer);
Expand Down