From 085bca89e3ecd5f81b26cd2bc45c415d90924679 Mon Sep 17 00:00:00 2001 From: shasaicha Date: Tue, 6 Dec 2022 20:01:36 +0530 Subject: [PATCH 1/2] Adds fix for wifi diagnostics attributes --- examples/platform/silabs/efr32/wf200/host_if.cpp | 2 ++ src/platform/silabs/DiagnosticDataProviderImpl.cpp | 12 ++++++++++++ src/platform/silabs/DiagnosticDataProviderImpl.h | 1 + 3 files changed, 15 insertions(+) diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index c7224962adf1ad..d988c2ba0fc505 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -357,6 +357,8 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication { uint8_t * mac = connect_indication_body.mac; uint32_t status = connect_indication_body.status; + ap_info.chan = connect_indication_body.channel; + memcpy(&ap_info.security, &wifi_provision.security,sizeof(wifi_provision.security)); switch (status) { case WFM_STATUS_SUCCESS: { diff --git a/src/platform/silabs/DiagnosticDataProviderImpl.cpp b/src/platform/silabs/DiagnosticDataProviderImpl.cpp index 0b62542afbf3dd..9924f8f3a1691a 100644 --- a/src/platform/silabs/DiagnosticDataProviderImpl.cpp +++ b/src/platform/silabs/DiagnosticDataProviderImpl.cpp @@ -479,6 +479,18 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiOverrunCount(uint64_t & overrunCou return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } +CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBeaconRxCount(uint32_t & beaconRxCount) +{ + wfx_wifi_scan_ext_t extra_info; + int32_t err = wfx_get_ap_ext(&extra_info); + if (err == 0) + { + beaconRxCount = extra_info.beacon_rx_count; + return CHIP_NO_ERROR; + } + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() { int32_t err = wfx_reset_counts(); diff --git a/src/platform/silabs/DiagnosticDataProviderImpl.h b/src/platform/silabs/DiagnosticDataProviderImpl.h index b6f45c1b5d292b..869a50bc636319 100644 --- a/src/platform/silabs/DiagnosticDataProviderImpl.h +++ b/src/platform/silabs/DiagnosticDataProviderImpl.h @@ -63,6 +63,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetWiFiChannelNumber(uint16_t & channelNumber) override; CHIP_ERROR GetWiFiRssi(int8_t & rssi) override; CHIP_ERROR GetWiFiBeaconLostCount(uint32_t & beaconLostCount) override; + CHIP_ERROR GetWiFiBeaconRxCount(uint32_t & beaconRxCount) override; CHIP_ERROR GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) override; CHIP_ERROR GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) override; CHIP_ERROR GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount) override; From 3fd574af4c70d6d997072f02708329a07b2190a3 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Tue, 6 Dec 2022 14:36:19 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- examples/platform/silabs/efr32/wf200/host_if.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/platform/silabs/efr32/wf200/host_if.cpp b/examples/platform/silabs/efr32/wf200/host_if.cpp index d988c2ba0fc505..a22735ae448529 100644 --- a/examples/platform/silabs/efr32/wf200/host_if.cpp +++ b/examples/platform/silabs/efr32/wf200/host_if.cpp @@ -357,8 +357,8 @@ static void sl_wfx_connect_callback(sl_wfx_connect_ind_body_t connect_indication { uint8_t * mac = connect_indication_body.mac; uint32_t status = connect_indication_body.status; - ap_info.chan = connect_indication_body.channel; - memcpy(&ap_info.security, &wifi_provision.security,sizeof(wifi_provision.security)); + ap_info.chan = connect_indication_body.channel; + memcpy(&ap_info.security, &wifi_provision.security, sizeof(wifi_provision.security)); switch (status) { case WFM_STATUS_SUCCESS: {