From 03315474880cf11522415a1538d49805edcfca85 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 19 Jul 2022 12:48:53 -0700 Subject: [PATCH] =?UTF-8?q?We=20should=20not=20call=20SetDiagnosticDataPro?= =?UTF-8?q?vider=20within=20PaltformMgr=20on=20ea=E2=80=A6=20(#20806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * We should not call SetDiagnosticDataProvider within PaltformMgr on each platfrom * Update src/include/platform/DiagnosticDataProvider.h Co-authored-by: Boris Zbarsky * Allow app to overwrite the default implantation of DiagnosticDataProvider Co-authored-by: Boris Zbarsky --- src/include/platform/DiagnosticDataProvider.h | 15 +++++++++++++-- src/platform/Ameba/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/Ameba/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/Ameba/PlatformManagerImpl.cpp | 1 - .../CYW30739/DiagnosticDataProviderImpl.cpp | 5 +++++ .../CYW30739/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/CYW30739/PlatformManagerImpl.cpp | 1 - .../Darwin/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/Darwin/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/Darwin/PlatformManagerImpl.cpp | 1 - src/platform/DiagnosticDataProvider.cpp | 9 +++++++-- src/platform/EFR32/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/EFR32/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/EFR32/PlatformManagerImpl.cpp | 1 - src/platform/ESP32/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/ESP32/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/ESP32/PlatformManagerImpl.cpp | 1 - src/platform/Linux/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/Linux/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/Linux/PlatformManagerImpl.cpp | 1 - src/platform/P6/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/P6/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/P6/PlatformManagerImpl.cpp | 1 - src/platform/Tizen/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/Tizen/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/Tizen/PlatformManagerImpl.cpp | 1 - .../Zephyr/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/Zephyr/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/Zephyr/PlatformManagerImpl.cpp | 1 - .../android/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/android/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/android/PlatformManagerImpl.cpp | 1 - .../BL602/DiagnosticDataProviderImpl.cpp | 5 +++++ .../BL602/DiagnosticDataProviderImpl.h | 8 ++++++++ .../bouffalolab/BL602/PlatformManagerImpl.cpp | 1 - .../cc13x2_26x2/DiagnosticDataProviderImpl.cpp | 5 +++++ .../cc13x2_26x2/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/cc13x2_26x2/PlatformManagerImpl.cpp | 1 - .../cc32xx/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/cc32xx/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/cc32xx/PlatformManagerImpl.cpp | 1 - src/platform/fake/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/fake/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/mbed/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/mbed/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/mbed/PlatformManagerImpl.cpp | 1 - .../nxp/k32w/k32w0/DiagnosticDataProviderImpl.cpp | 5 +++++ .../nxp/k32w/k32w0/DiagnosticDataProviderImpl.h | 8 ++++++++ .../nxp/k32w/k32w0/PlatformManagerImpl.cpp | 1 - .../nxp/mw320/DiagnosticDataProviderImpl.cpp | 5 +++++ .../nxp/mw320/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/nxp/mw320/PlatformManagerImpl.cpp | 1 - src/platform/qpg/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/qpg/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/qpg/PlatformManagerImpl.cpp | 1 - src/platform/webos/DiagnosticDataProviderImpl.cpp | 5 +++++ src/platform/webos/DiagnosticDataProviderImpl.h | 8 ++++++++ src/platform/webos/PlatformManagerImpl.cpp | 1 - 58 files changed, 267 insertions(+), 22 deletions(-) diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index a53ee3d8979411..8e26e6153207fe 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -62,6 +62,8 @@ struct NetworkInterface : public app::Clusters::GeneralDiagnostics::Structs::Net NetworkInterface * Next; /* Pointer to the next structure. */ }; +class DiagnosticDataProviderImpl; + /** * Defines the WiFi Diagnostics Delegate class to notify WiFi network events. */ @@ -184,12 +186,21 @@ class DiagnosticDataProvider }; /** - * Returns a reference to a DiagnosticDataProvider object. + * Returns a reference to the public interface of the DiagnosticDataProvider singleton object. * - * Applications should use this to access the features of the DiagnosticDataProvider. + * Applications should use this to access features of the DiagnosticDataProvider object + * that are common to all platforms. */ DiagnosticDataProvider & GetDiagnosticDataProvider(); +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +extern DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + /** * Sets a reference to a DiagnosticDataProvider object. * diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp index 110e9cb4c1b4d8..0acf14fbb87490 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp @@ -423,5 +423,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.h b/src/platform/Ameba/DiagnosticDataProviderImpl.h index d6c062fdbf0812..1ef6ee1b0a35a4 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.h +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.h @@ -70,5 +70,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Ameba/PlatformManagerImpl.cpp b/src/platform/Ameba/PlatformManagerImpl.cpp index b3231cd371ca7f..1d5a8d8aa2e9c8 100644 --- a/src/platform/Ameba/PlatformManagerImpl.cpp +++ b/src/platform/Ameba/PlatformManagerImpl.cpp @@ -60,7 +60,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) CHIP_ERROR err; SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // Make sure the LwIP core lock has been initialized err = Internal::InitLwIPCoreLock(); diff --git a/src/platform/CYW30739/DiagnosticDataProviderImpl.cpp b/src/platform/CYW30739/DiagnosticDataProviderImpl.cpp index a205ffb84a23be..2af3114c1ad148 100644 --- a/src/platform/CYW30739/DiagnosticDataProviderImpl.cpp +++ b/src/platform/CYW30739/DiagnosticDataProviderImpl.cpp @@ -141,5 +141,10 @@ void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * net } #endif /* CHIP_DEVICE_CONFIG_ENABLE_THREAD */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/CYW30739/DiagnosticDataProviderImpl.h b/src/platform/CYW30739/DiagnosticDataProviderImpl.h index 8776da5f43157b..cc9d42fcb7b0ca 100644 --- a/src/platform/CYW30739/DiagnosticDataProviderImpl.h +++ b/src/platform/CYW30739/DiagnosticDataProviderImpl.h @@ -50,5 +50,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif /* CHIP_DEVICE_CONFIG_ENABLE_THREAD */ }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/CYW30739/PlatformManagerImpl.cpp b/src/platform/CYW30739/PlatformManagerImpl.cpp index 35c48fcf99a53c..c8b547d199fba8 100644 --- a/src/platform/CYW30739/PlatformManagerImpl.cpp +++ b/src/platform/CYW30739/PlatformManagerImpl.cpp @@ -46,7 +46,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); /* Create the thread object. */ mThread = wiced_rtos_create_thread(); diff --git a/src/platform/Darwin/DiagnosticDataProviderImpl.cpp b/src/platform/Darwin/DiagnosticDataProviderImpl.cpp index b45de23707b190..4ad47ac1dba41b 100644 --- a/src/platform/Darwin/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Darwin/DiagnosticDataProviderImpl.cpp @@ -77,5 +77,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks() return CHIP_NO_ERROR; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Darwin/DiagnosticDataProviderImpl.h b/src/platform/Darwin/DiagnosticDataProviderImpl.h index 2bc8a5d73d26bc..6554c03041346b 100644 --- a/src/platform/Darwin/DiagnosticDataProviderImpl.h +++ b/src/platform/Darwin/DiagnosticDataProviderImpl.h @@ -44,5 +44,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR ResetWatermarks() override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index adacd2800d4a5c..d47d8830c215e5 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -53,7 +53,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); #endif // CHIP_DISABLE_PLATFORM_KVS SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); mRunLoopSem = dispatch_semaphore_create(0); diff --git a/src/platform/DiagnosticDataProvider.cpp b/src/platform/DiagnosticDataProvider.cpp index 2c58eb637e01c8..b9eab8cfc7846d 100644 --- a/src/platform/DiagnosticDataProvider.cpp +++ b/src/platform/DiagnosticDataProvider.cpp @@ -21,6 +21,7 @@ */ #include +#include namespace chip { namespace DeviceLayer { @@ -37,8 +38,12 @@ DiagnosticDataProvider * gInstance = nullptr; DiagnosticDataProvider & GetDiagnosticDataProvider() { - VerifyOrDie(gInstance != nullptr); - return *gInstance; + if (gInstance != nullptr) + { + return *gInstance; + } + + return GetDiagnosticDataProviderImpl(); } void SetDiagnosticDataProvider(DiagnosticDataProvider * diagnosticDataProvider) diff --git a/src/platform/EFR32/DiagnosticDataProviderImpl.cpp b/src/platform/EFR32/DiagnosticDataProviderImpl.cpp index 598e2ca1255662..ffdeff5b8e29a9 100644 --- a/src/platform/EFR32/DiagnosticDataProviderImpl.cpp +++ b/src/platform/EFR32/DiagnosticDataProviderImpl.cpp @@ -481,5 +481,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() } #endif // SL_WIFI +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/EFR32/DiagnosticDataProviderImpl.h b/src/platform/EFR32/DiagnosticDataProviderImpl.h index 7a9ce7c95577dd..b6f45c1b5d292b 100644 --- a/src/platform/EFR32/DiagnosticDataProviderImpl.h +++ b/src/platform/EFR32/DiagnosticDataProviderImpl.h @@ -73,5 +73,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif // SL_WIFI }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/EFR32/PlatformManagerImpl.cpp b/src/platform/EFR32/PlatformManagerImpl.cpp index ab3c20d3fc503c..29dc7bbe1e17e7 100644 --- a/src/platform/EFR32/PlatformManagerImpl.cpp +++ b/src/platform/EFR32/PlatformManagerImpl.cpp @@ -51,7 +51,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); #if CHIP_SYSTEM_CONFIG_USE_LWIP // Initialize LwIP. diff --git a/src/platform/ESP32/DiagnosticDataProviderImpl.cpp b/src/platform/ESP32/DiagnosticDataProviderImpl.cpp index ecab9d96252190..78855b9095ebeb 100644 --- a/src/platform/ESP32/DiagnosticDataProviderImpl.cpp +++ b/src/platform/ESP32/DiagnosticDataProviderImpl.cpp @@ -353,5 +353,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts() } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/ESP32/DiagnosticDataProviderImpl.h b/src/platform/ESP32/DiagnosticDataProviderImpl.h index 1142a7dcdcbb9c..a63a4c375d42b1 100644 --- a/src/platform/ESP32/DiagnosticDataProviderImpl.h +++ b/src/platform/ESP32/DiagnosticDataProviderImpl.h @@ -68,5 +68,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index 51413c612b9ca1..535674b8c2782a 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -61,7 +61,6 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInfoProvider(&DeviceInfoProviderImpl::GetDefaultInstance()); esp_err_t err; diff --git a/src/platform/Linux/DiagnosticDataProviderImpl.cpp b/src/platform/Linux/DiagnosticDataProviderImpl.cpp index 7c1965cd47df8f..78d6cfe42bb612 100644 --- a/src/platform/Linux/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Linux/DiagnosticDataProviderImpl.cpp @@ -826,5 +826,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityTyp } #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/DiagnosticDataProviderImpl.h b/src/platform/Linux/DiagnosticDataProviderImpl.h index f47e41c8f8e9a4..19ea033ef5e3f7 100644 --- a/src/platform/Linux/DiagnosticDataProviderImpl.h +++ b/src/platform/Linux/DiagnosticDataProviderImpl.h @@ -105,5 +105,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index 1bd7de58e2db2d..23ca6af8d07903 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -176,7 +176,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() // Initialize the configuration system. ReturnErrorOnFailure(Internal::PosixConfig::Init()); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); // Call _InitChipStack() on the generic implementation base class diff --git a/src/platform/P6/DiagnosticDataProviderImpl.cpp b/src/platform/P6/DiagnosticDataProviderImpl.cpp index 95ada778450295..9b8fd37a23172b 100644 --- a/src/platform/P6/DiagnosticDataProviderImpl.cpp +++ b/src/platform/P6/DiagnosticDataProviderImpl.cpp @@ -543,5 +543,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::WiFiCounters(WiFiStatsCountType type, uin return err; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/P6/DiagnosticDataProviderImpl.h b/src/platform/P6/DiagnosticDataProviderImpl.h index 908f28afdbf2a7..cba4725b43eaf4 100644 --- a/src/platform/P6/DiagnosticDataProviderImpl.h +++ b/src/platform/P6/DiagnosticDataProviderImpl.h @@ -113,5 +113,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider app::DataModel::Nullable mipv6_offpremise; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/P6/PlatformManagerImpl.cpp b/src/platform/P6/PlatformManagerImpl.cpp index 90b99a66d1faf8..112c9c779745aa 100644 --- a/src/platform/P6/PlatformManagerImpl.cpp +++ b/src/platform/P6/PlatformManagerImpl.cpp @@ -44,7 +44,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) CHIP_ERROR err; SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // Make sure the LwIP core lock has been initialized err = Internal::InitLwIPCoreLock(); diff --git a/src/platform/Tizen/DiagnosticDataProviderImpl.cpp b/src/platform/Tizen/DiagnosticDataProviderImpl.cpp index c1513741e5e925..17e11e56162f1e 100644 --- a/src/platform/Tizen/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Tizen/DiagnosticDataProviderImpl.cpp @@ -36,5 +36,10 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() return sInstance; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/DiagnosticDataProviderImpl.h b/src/platform/Tizen/DiagnosticDataProviderImpl.h index 731f445fec8671..1019bc9ec66ab0 100644 --- a/src/platform/Tizen/DiagnosticDataProviderImpl.h +++ b/src/platform/Tizen/DiagnosticDataProviderImpl.h @@ -36,5 +36,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider static DiagnosticDataProviderImpl & GetDefaultInstance(); }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/PlatformManagerImpl.cpp b/src/platform/Tizen/PlatformManagerImpl.cpp index 78ee755146680c..b053ab44d7aaaf 100644 --- a/src/platform/Tizen/PlatformManagerImpl.cpp +++ b/src/platform/Tizen/PlatformManagerImpl.cpp @@ -40,7 +40,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) { ReturnErrorOnFailure(Internal::PosixConfig::Init()); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); return Internal::GenericPlatformManagerImpl_POSIX::_InitChipStack(); diff --git a/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp b/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp index e3cee6927ea74b..6aebf3d2c8a583 100644 --- a/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp @@ -321,5 +321,10 @@ void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * net } } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Zephyr/DiagnosticDataProviderImpl.h b/src/platform/Zephyr/DiagnosticDataProviderImpl.h index b23fb5778466d7..2b46051d27b125 100644 --- a/src/platform/Zephyr/DiagnosticDataProviderImpl.h +++ b/src/platform/Zephyr/DiagnosticDataProviderImpl.h @@ -58,5 +58,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider const BootReasonType mBootReason; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Zephyr/PlatformManagerImpl.cpp b/src/platform/Zephyr/PlatformManagerImpl.cpp index 32380be2153f99..22c9961fba989b 100644 --- a/src/platform/Zephyr/PlatformManagerImpl.cpp +++ b/src/platform/Zephyr/PlatformManagerImpl.cpp @@ -107,7 +107,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::ZephyrConfig::Init(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); #if !CONFIG_NORDIC_SECURITY_BACKEND // Add entropy source based on Zephyr entropy driver diff --git a/src/platform/android/DiagnosticDataProviderImpl.cpp b/src/platform/android/DiagnosticDataProviderImpl.cpp index 4af6611657b009..5785a24833f245 100644 --- a/src/platform/android/DiagnosticDataProviderImpl.cpp +++ b/src/platform/android/DiagnosticDataProviderImpl.cpp @@ -230,5 +230,10 @@ void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * net } } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/android/DiagnosticDataProviderImpl.h b/src/platform/android/DiagnosticDataProviderImpl.h index ddfb9be57b294d..26903d5d3ad3a4 100644 --- a/src/platform/android/DiagnosticDataProviderImpl.h +++ b/src/platform/android/DiagnosticDataProviderImpl.h @@ -53,5 +53,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider jmethodID mGetNifMethod = nullptr; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/android/PlatformManagerImpl.cpp b/src/platform/android/PlatformManagerImpl.cpp index a6bc9ddf86c58b..0fe62600ad6e0c 100644 --- a/src/platform/android/PlatformManagerImpl.cpp +++ b/src/platform/android/PlatformManagerImpl.cpp @@ -47,7 +47,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() err = Internal::AndroidConfig::Init(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); // Call _InitChipStack() on the generic implementation base class diff --git a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp index a1ed8ae7e1a732..3e6e3c64f867ff 100644 --- a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp +++ b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp @@ -133,5 +133,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(BootReasonType & bootReason return err; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.h b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.h index dadada68c197a5..390ce75bb31f4a 100644 --- a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.h +++ b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.h @@ -49,5 +49,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetBootReason(BootReasonType & bootReason) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp b/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp index c2c2ef5410e3ab..3e359ff707fbc6 100644 --- a/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/PlatformManagerImpl.cpp @@ -189,7 +189,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) CHIP_ERROR err; SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // Initialize the configuration system. err = Internal::BL602Config::Init(); diff --git a/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.cpp b/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.cpp index ffb2411d0f4f9f..df93e3b1a5456f 100644 --- a/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.cpp +++ b/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.cpp @@ -117,5 +117,10 @@ void DiagnosticDataProviderImpl::ReleaseThreadMetrics(ThreadMetrics * threadMetr } } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.h b/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.h index b742146267621d..add65a231d0be8 100644 --- a/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.h +++ b/src/platform/cc13x2_26x2/DiagnosticDataProviderImpl.h @@ -42,5 +42,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider void ReleaseThreadMetrics(ThreadMetrics * threadMetrics) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp index 9174b2a8418d3a..b9b85e67845717 100644 --- a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp @@ -108,7 +108,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::CC13X2_26X2Config::Init(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // DMM Addition DMMPolicy_Params dmmPolicyParams; diff --git a/src/platform/cc32xx/DiagnosticDataProviderImpl.cpp b/src/platform/cc32xx/DiagnosticDataProviderImpl.cpp index 17f9fbbe3cca41..86e5272ddb49c2 100644 --- a/src/platform/cc32xx/DiagnosticDataProviderImpl.cpp +++ b/src/platform/cc32xx/DiagnosticDataProviderImpl.cpp @@ -56,5 +56,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics(ThreadMetrics ** threadM void DiagnosticDataProviderImpl::ReleaseThreadMetrics(ThreadMetrics * threadMetrics) {} +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/cc32xx/DiagnosticDataProviderImpl.h b/src/platform/cc32xx/DiagnosticDataProviderImpl.h index b742146267621d..add65a231d0be8 100644 --- a/src/platform/cc32xx/DiagnosticDataProviderImpl.h +++ b/src/platform/cc32xx/DiagnosticDataProviderImpl.h @@ -42,5 +42,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider void ReleaseThreadMetrics(ThreadMetrics * threadMetrics) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/cc32xx/PlatformManagerImpl.cpp b/src/platform/cc32xx/PlatformManagerImpl.cpp index a8795b4891ddcc..36a81fb2330ca4 100644 --- a/src/platform/cc32xx/PlatformManagerImpl.cpp +++ b/src/platform/cc32xx/PlatformManagerImpl.cpp @@ -70,7 +70,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::CC32XXConfig::Init(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // Initialize LwIP. tcpip_init(NULL, NULL); diff --git a/src/platform/fake/DiagnosticDataProviderImpl.cpp b/src/platform/fake/DiagnosticDataProviderImpl.cpp index 6158e9bca2483e..9a40d6b9e80e15 100644 --- a/src/platform/fake/DiagnosticDataProviderImpl.cpp +++ b/src/platform/fake/DiagnosticDataProviderImpl.cpp @@ -36,5 +36,10 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() return sInstance; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/fake/DiagnosticDataProviderImpl.h b/src/platform/fake/DiagnosticDataProviderImpl.h index dd69739f15563b..9c2309197363f5 100644 --- a/src/platform/fake/DiagnosticDataProviderImpl.h +++ b/src/platform/fake/DiagnosticDataProviderImpl.h @@ -55,5 +55,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetActiveNetworkFaults(GeneralFaults & networkFaults) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/mbed/DiagnosticDataProviderImpl.cpp b/src/platform/mbed/DiagnosticDataProviderImpl.cpp index f7b2dd0aa4bed5..aab84eb334f39b 100644 --- a/src/platform/mbed/DiagnosticDataProviderImpl.cpp +++ b/src/platform/mbed/DiagnosticDataProviderImpl.cpp @@ -36,5 +36,10 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() return sInstance; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/mbed/DiagnosticDataProviderImpl.h b/src/platform/mbed/DiagnosticDataProviderImpl.h index 731f445fec8671..1019bc9ec66ab0 100644 --- a/src/platform/mbed/DiagnosticDataProviderImpl.h +++ b/src/platform/mbed/DiagnosticDataProviderImpl.h @@ -36,5 +36,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider static DiagnosticDataProviderImpl & GetDefaultInstance(); }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/mbed/PlatformManagerImpl.cpp b/src/platform/mbed/PlatformManagerImpl.cpp index 089f1d86ea3f10..6040d36b36eae3 100644 --- a/src/platform/mbed/PlatformManagerImpl.cpp +++ b/src/platform/mbed/PlatformManagerImpl.cpp @@ -93,7 +93,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) #endif SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); auto err = System::Clock::InitClock_RealTime(); SuccessOrExit(err); diff --git a/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.cpp index 6df2cfb5b1785b..0eefc9063c2209 100644 --- a/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.cpp @@ -134,5 +134,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(BootReasonType & bootReason return err; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.h b/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.h index dadada68c197a5..390ce75bb31f4a 100644 --- a/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.h +++ b/src/platform/nxp/k32w/k32w0/DiagnosticDataProviderImpl.h @@ -49,5 +49,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetBootReason(BootReasonType & bootReason) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp index a25fe9214960a8..911b2e9ad73d71 100644 --- a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp @@ -112,7 +112,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) } SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); mStartTime = System::SystemClock().GetMonotonicTimestamp(); diff --git a/src/platform/nxp/mw320/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/mw320/DiagnosticDataProviderImpl.cpp index 47bbaeeb4d5444..b13f11e8f96106 100644 --- a/src/platform/nxp/mw320/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/mw320/DiagnosticDataProviderImpl.cpp @@ -79,5 +79,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & cu return CHIP_NO_ERROR; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nxp/mw320/DiagnosticDataProviderImpl.h b/src/platform/nxp/mw320/DiagnosticDataProviderImpl.h index 6505cf5eedff17..ab6e1ed09bb8d4 100644 --- a/src/platform/nxp/mw320/DiagnosticDataProviderImpl.h +++ b/src/platform/nxp/mw320/DiagnosticDataProviderImpl.h @@ -44,5 +44,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nxp/mw320/PlatformManagerImpl.cpp b/src/platform/nxp/mw320/PlatformManagerImpl.cpp index a75a2ec541d3f7..0ad103dc2babad 100644 --- a/src/platform/nxp/mw320/PlatformManagerImpl.cpp +++ b/src/platform/nxp/mw320/PlatformManagerImpl.cpp @@ -62,7 +62,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) SuccessOrExit(err); // SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); // Initialize LwIP. // tcpip_init(NULL, NULL); diff --git a/src/platform/qpg/DiagnosticDataProviderImpl.cpp b/src/platform/qpg/DiagnosticDataProviderImpl.cpp index d38eb22c4150c3..bde10b3cac0d71 100644 --- a/src/platform/qpg/DiagnosticDataProviderImpl.cpp +++ b/src/platform/qpg/DiagnosticDataProviderImpl.cpp @@ -69,5 +69,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & cu return CHIP_NO_ERROR; } +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/qpg/DiagnosticDataProviderImpl.h b/src/platform/qpg/DiagnosticDataProviderImpl.h index 6505cf5eedff17..ab6e1ed09bb8d4 100644 --- a/src/platform/qpg/DiagnosticDataProviderImpl.h +++ b/src/platform/qpg/DiagnosticDataProviderImpl.h @@ -44,5 +44,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override; }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/qpg/PlatformManagerImpl.cpp b/src/platform/qpg/PlatformManagerImpl.cpp index da95db8949b5e0..737ac78533e623 100644 --- a/src/platform/qpg/PlatformManagerImpl.cpp +++ b/src/platform/qpg/PlatformManagerImpl.cpp @@ -45,7 +45,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::QPGConfig::Init(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); #if CHIP_SYSTEM_CONFIG_USE_LWIP // Initialize LwIP. diff --git a/src/platform/webos/DiagnosticDataProviderImpl.cpp b/src/platform/webos/DiagnosticDataProviderImpl.cpp index 60782415622093..b70bdf9a6fe2f3 100644 --- a/src/platform/webos/DiagnosticDataProviderImpl.cpp +++ b/src/platform/webos/DiagnosticDataProviderImpl.cpp @@ -796,5 +796,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(uint8_t & securityTyp } #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA +DiagnosticDataProvider & GetDiagnosticDataProviderImpl() +{ + return DiagnosticDataProviderImpl::GetDefaultInstance(); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/webos/DiagnosticDataProviderImpl.h b/src/platform/webos/DiagnosticDataProviderImpl.h index b67c93f392d365..184c6d6c779b6b 100644 --- a/src/platform/webos/DiagnosticDataProviderImpl.h +++ b/src/platform/webos/DiagnosticDataProviderImpl.h @@ -103,5 +103,13 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider #endif }; +/** + * Returns the platform-specific implementation of the DiagnosticDataProvider singleton object. + * + * Applications can use this to gain access to features of the DiagnosticDataProvider + * that are specific to the selected platform. + */ +DiagnosticDataProvider & GetDiagnosticDataProviderImpl(); + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/webos/PlatformManagerImpl.cpp b/src/platform/webos/PlatformManagerImpl.cpp index c2e6845368aeb9..ec04141e621dd1 100644 --- a/src/platform/webos/PlatformManagerImpl.cpp +++ b/src/platform/webos/PlatformManagerImpl.cpp @@ -166,7 +166,6 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() // Initialize the configuration system. ReturnErrorOnFailure(Internal::PosixConfig::Init()); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); - SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInfoProvider(&DeviceInfoProviderImpl::GetDefaultInstance()); SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl());