From 5e2211994d4bf50aa2fb9303adc4c46e4627ca14 Mon Sep 17 00:00:00 2001 From: Chirag Bansal Date: Thu, 30 Jun 2022 00:27:16 +0530 Subject: [PATCH] added wifinetworkdiagnostics implementation for rs911x --- .../EFR32/DiagnosticDataProviderImpl.cpp | 129 ++++++++++++++++++ .../EFR32/DiagnosticDataProviderImpl.h | 16 +++ third_party/silabs/matter_support | 2 +- third_party/silabs/wiseconnect-wifi-bt-sdk | 2 +- 4 files changed, 147 insertions(+), 2 deletions(-) diff --git a/src/platform/EFR32/DiagnosticDataProviderImpl.cpp b/src/platform/EFR32/DiagnosticDataProviderImpl.cpp index 941acd41655f4d..be74905d0b56cc 100644 --- a/src/platform/EFR32/DiagnosticDataProviderImpl.cpp +++ b/src/platform/EFR32/DiagnosticDataProviderImpl.cpp @@ -341,5 +341,134 @@ void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * net } } +#if SL_WIFI +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId) +{ + wfx_wifi_scan_result_t ap; + int32_t err = wfx_get_ap_info(&ap); + if(err == 0){ + BssId = ByteSpan(ap.bssid,6); + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityType) +{ + wfx_wifi_scan_result_t ap; + int32_t err = wfx_get_ap_info(&ap); + if(err == 0){ + securityType = ap.security; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(uint8_t & wifiVersion) +{ + wifiVersion = EMBER_ZCL_WI_FI_VERSION_TYPE_802__11N; + return CHIP_NO_ERROR; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiChannelNumber(uint16_t & channelNumber) +{ + wfx_wifi_scan_result_t ap; + int32_t err = wfx_get_ap_info(&ap); + if(err == 0){ + channelNumber = ap.chan; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiRssi(int8_t & rssi) +{ + wfx_wifi_scan_result_t ap; + int32_t err = wfx_get_ap_info(&ap); + if(err == 0){ + rssi = ap.rssi; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBeaconLostCount(uint32_t & beaconLostCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + beaconLostCount = extra_info.beacon_lost_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiCurrentMaxRate(uint64_t & currentMaxRate) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + packetMulticastRxCount = extra_info.mcast_rx_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + packetMulticastTxCount = extra_info.mcast_tx_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + packetUnicastRxCount = extra_info.ucast_rx_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + packetUnicastTxCount = extra_info.ucast_tx_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiOverrunCount(uint64_t & overrunCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if(err ==0){ + overrunCount = extra_info.overrun_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() +{ + return CHIP_NO_ERROR; +} +#endif // SL_WIFI + + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/EFR32/DiagnosticDataProviderImpl.h b/src/platform/EFR32/DiagnosticDataProviderImpl.h index f0cee8888f44bc..b2ca59f257231e 100644 --- a/src/platform/EFR32/DiagnosticDataProviderImpl.h +++ b/src/platform/EFR32/DiagnosticDataProviderImpl.h @@ -55,6 +55,22 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetActiveNetworkFaults(GeneralFaults & networkFaults) override; CHIP_ERROR GetNetworkInterfaces(NetworkInterface ** netifpp) override; void ReleaseNetworkInterfaces(NetworkInterface * netifp) override; + + #if SL_WIFI + CHIP_ERROR GetWiFiBssId(ByteSpan & BssId) override; + CHIP_ERROR GetWiFiSecurityType(uint8_t & securityType) override; + CHIP_ERROR GetWiFiVersion(uint8_t & wifiVersion) override; + CHIP_ERROR GetWiFiChannelNumber(uint16_t & channelNumber) override; + CHIP_ERROR GetWiFiRssi(int8_t & rssi) override; + CHIP_ERROR GetWiFiBeaconLostCount(uint32_t & beaconLostCount) override; + CHIP_ERROR GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) override; + CHIP_ERROR GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) override; + CHIP_ERROR GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount) override; + CHIP_ERROR GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount) override; + CHIP_ERROR GetWiFiCurrentMaxRate(uint64_t & currentMaxRate) override; + CHIP_ERROR GetWiFiOverrunCount(uint64_t & overrunCount) override; + CHIP_ERROR ResetWiFiNetworkDiagnosticsCounts() override; + #endif // SL_WIFI }; } // namespace DeviceLayer diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index ff9000cd65c5eb..29cf6063c1aaa6 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit ff9000cd65c5ebc04818e513cb3f803d3536a718 +Subproject commit 29cf6063c1aaa64994d08e94a49a0eef40c2c703 diff --git a/third_party/silabs/wiseconnect-wifi-bt-sdk b/third_party/silabs/wiseconnect-wifi-bt-sdk index 4491826e48bfaa..d0b93569fab142 160000 --- a/third_party/silabs/wiseconnect-wifi-bt-sdk +++ b/third_party/silabs/wiseconnect-wifi-bt-sdk @@ -1 +1 @@ -Subproject commit 4491826e48bfaaa6ce4d42ad5769d7f6447b8cbb +Subproject commit d0b93569fab1420e1d26d418f30564c198571abc