From c612defe4155fb90ba7928abe4150e6dcd2c9dbd Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Sun, 16 Jan 2022 21:24:40 +0530 Subject: [PATCH] [ESP32] Correct Wi-Fi Network Diagnostics data Fixed the bssid attribute value, it was reported as zero. Return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE instead of zero for unsupported attributes. --- .../ESP32/DiagnosticDataProviderImpl.cpp | 23 +++++++------------ .../ESP32/DiagnosticDataProviderImpl.h | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/platform/ESP32/DiagnosticDataProviderImpl.cpp b/src/platform/ESP32/DiagnosticDataProviderImpl.cpp index 82396710972711..eb99c5597e8e8d 100644 --- a/src/platform/ESP32/DiagnosticDataProviderImpl.cpp +++ b/src/platform/ESP32/DiagnosticDataProviderImpl.cpp @@ -245,7 +245,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(ByteSpan & BssId) { wifi_ap_record_t ap_info; esp_err_t err; - uint8_t macAddress[kMaxHardwareAddrSize]; + static uint8_t macAddress[kMaxHardwareAddrSize]; err = esp_wifi_sta_get_ap_info(&ap_info); if (err == ESP_OK) @@ -314,44 +314,37 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiRssi(int8_t & rssi) CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBeaconLostCount(uint32_t & beaconLostCount) { - beaconLostCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiCurrentMaxRate(uint64_t & currentMaxRate) { - currentMaxRate = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketMulticastRxCount(uint32_t & packetMulticastRxCount) { - packetMulticastRxCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) { - packetMulticastTxCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount) { - packetUnicastRxCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount) { - packetUnicastTxCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiOverrunCount(uint64_t & overrunCount) { - overrunCount = 0; - return CHIP_NO_ERROR; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() diff --git a/src/platform/ESP32/DiagnosticDataProviderImpl.h b/src/platform/ESP32/DiagnosticDataProviderImpl.h index 158cf96eae8be7..46257d5ce1a0d6 100644 --- a/src/platform/ESP32/DiagnosticDataProviderImpl.h +++ b/src/platform/ESP32/DiagnosticDataProviderImpl.h @@ -30,7 +30,7 @@ namespace chip { namespace DeviceLayer { /** - * Concrete implementation of the PlatformManager singleton object for Linux platforms. + * Concrete implementation of the PlatformManager singleton object for ESP32 platforms. */ class DiagnosticDataProviderImpl : public DiagnosticDataProvider {