diff --git a/src/platform/Darwin/DeviceInstanceInfoProviderImpl.cpp b/src/platform/Darwin/DeviceInstanceInfoProviderImpl.cpp index 6e1bb52f37d934..6bb1d1bfd79c65 100644 --- a/src/platform/Darwin/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/Darwin/DeviceInstanceInfoProviderImpl.cpp @@ -18,10 +18,7 @@ #include "DeviceInstanceInfoProviderImpl.h" -#include -#include #include -#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Darwin/DeviceInstanceInfoProviderImpl.h b/src/platform/Darwin/DeviceInstanceInfoProviderImpl.h index 0fd05e46dc5160..630fdbe24c8a12 100644 --- a/src/platform/Darwin/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/Darwin/DeviceInstanceInfoProviderImpl.h @@ -18,6 +18,7 @@ #pragma once +#include #include namespace chip { @@ -29,14 +30,15 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf CHIP_ERROR GetVendorId(uint16_t & vendorId) override; CHIP_ERROR GetProductId(uint16_t & productId) override; -private: - friend DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl(); - static DeviceInstanceInfoProviderImpl sInstance; + DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : + Internal::GenericDeviceInstanceInfoProvider(configManager) + {} }; inline DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl() { - return DeviceInstanceInfoProviderImpl::sInstance; + static DeviceInstanceInfoProviderImpl sInstance(ConfigurationManagerImpl::GetDefaultInstance()); + return sInstance; } } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index 1a80645a0192c1..adacd2800d4a5c 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -24,6 +24,11 @@ #include +#if !CHIP_DISABLE_PLATFORM_KVS +#include +#include +#endif + #include #include @@ -45,6 +50,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() #if !CHIP_DISABLE_PLATFORM_KVS err = Internal::PosixConfig::Init(); SuccessOrExit(err); + SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); #endif // CHIP_DISABLE_PLATFORM_KVS SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); diff --git a/src/platform/Linux/DeviceInstanceInfoProviderImpl.cpp b/src/platform/Linux/DeviceInstanceInfoProviderImpl.cpp index db2f813d7e881a..5cf7f49b64d29a 100644 --- a/src/platform/Linux/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/Linux/DeviceInstanceInfoProviderImpl.cpp @@ -18,10 +18,7 @@ #include "DeviceInstanceInfoProviderImpl.h" -#include -#include #include -#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Linux/DeviceInstanceInfoProviderImpl.h b/src/platform/Linux/DeviceInstanceInfoProviderImpl.h index 0fd05e46dc5160..7c1135b28d0123 100644 --- a/src/platform/Linux/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/Linux/DeviceInstanceInfoProviderImpl.h @@ -18,6 +18,7 @@ #pragma once +#include #include namespace chip { @@ -29,14 +30,15 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf CHIP_ERROR GetVendorId(uint16_t & vendorId) override; CHIP_ERROR GetProductId(uint16_t & productId) override; -private: - friend DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl(); - static DeviceInstanceInfoProviderImpl sInstance; + DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : + Internal::GenericDeviceInstanceInfoProvider(configManager) + {} }; inline DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl() { - return DeviceInstanceInfoProviderImpl::sInstance; + static DeviceInstanceInfoProviderImpl sInstance(ConfigurationManagerImpl::GetDefaultInstance()); + return sInstance; } } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index 2aa464bb07c2f6..1bd7de58e2db2d 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -175,6 +177,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() ReturnErrorOnFailure(Internal::PosixConfig::Init()); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); + SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); // Call _InitChipStack() on the generic implementation base class // to finish the initialization process. diff --git a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp index a1eaa56cc15f08..67133eaea0b170 100644 --- a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp @@ -18,10 +18,7 @@ #include "DeviceInstanceInfoProviderImpl.h" -#include -#include #include -#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h index 0fd05e46dc5160..b3b7992cb04aaf 100644 --- a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h @@ -18,6 +18,7 @@ #pragma once +#include #include namespace chip { @@ -29,14 +30,15 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf CHIP_ERROR GetVendorId(uint16_t & vendorId) override; CHIP_ERROR GetProductId(uint16_t & productId) override; -private: - friend DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl(); - static DeviceInstanceInfoProviderImpl sInstance; + DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : + Internal::GenericDeviceInstanceInfoProvider(configManager) + {} }; inline DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl() { - return DeviceInstanceInfoProviderImpl::sInstance; + static DeviceInstanceInfoProviderImpl sInstance(ConfigurationManagerImpl::GetDefaultInstance()); + return sInstance; } } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/PlatformManagerImpl.cpp b/src/platform/Tizen/PlatformManagerImpl.cpp index 87b9a36201bad4..78ee755146680c 100644 --- a/src/platform/Tizen/PlatformManagerImpl.cpp +++ b/src/platform/Tizen/PlatformManagerImpl.cpp @@ -25,7 +25,9 @@ #include +#include #include +#include #include #include @@ -39,6 +41,7 @@ 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/android/DeviceInstanceInfoProviderImpl.cpp b/src/platform/android/DeviceInstanceInfoProviderImpl.cpp index 4ffbe5b109850b..4a42791d8bcca6 100644 --- a/src/platform/android/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/android/DeviceInstanceInfoProviderImpl.cpp @@ -19,9 +19,7 @@ #include "DeviceInstanceInfoProviderImpl.h" #include -#include #include -#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/android/DeviceInstanceInfoProviderImpl.h b/src/platform/android/DeviceInstanceInfoProviderImpl.h index 4fa49245d20882..05cb232fd1f98c 100644 --- a/src/platform/android/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/android/DeviceInstanceInfoProviderImpl.h @@ -18,6 +18,7 @@ #pragma once +#include #include namespace chip { @@ -30,15 +31,15 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf CHIP_ERROR GetProductId(uint16_t & productId) override; CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override; -private: - friend DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl(); - static DeviceInstanceInfoProviderImpl sInstance; + DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : + Internal::GenericDeviceInstanceInfoProvider(configManager) + {} }; inline DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl() { - return DeviceInstanceInfoProviderImpl::sInstance; + static DeviceInstanceInfoProviderImpl sInstance(ConfigurationManagerImpl::GetDefaultInstance()); + return sInstance; } - } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/android/PlatformManagerImpl.cpp b/src/platform/android/PlatformManagerImpl.cpp index 44ebf7af8594ee..a6bc9ddf86c58b 100644 --- a/src/platform/android/PlatformManagerImpl.cpp +++ b/src/platform/android/PlatformManagerImpl.cpp @@ -26,7 +26,9 @@ #include #include +#include #include +#include #include #include @@ -46,6 +48,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); + SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); // Call _InitChipStack() on the generic implementation base class // to finish the initialization process. diff --git a/src/platform/webos/DeviceInstanceInfoProviderImpl.cpp b/src/platform/webos/DeviceInstanceInfoProviderImpl.cpp index 48311037c30c29..916c3ef3516bc1 100644 --- a/src/platform/webos/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/webos/DeviceInstanceInfoProviderImpl.cpp @@ -18,9 +18,6 @@ #include "DeviceInstanceInfoProviderImpl.h" -#include -#include -#include #include namespace chip { diff --git a/src/platform/webos/DeviceInstanceInfoProviderImpl.h b/src/platform/webos/DeviceInstanceInfoProviderImpl.h index 0fd05e46dc5160..c05db645ac4626 100644 --- a/src/platform/webos/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/webos/DeviceInstanceInfoProviderImpl.h @@ -19,6 +19,7 @@ #pragma once #include +#include namespace chip { namespace DeviceLayer { @@ -29,14 +30,15 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf CHIP_ERROR GetVendorId(uint16_t & vendorId) override; CHIP_ERROR GetProductId(uint16_t & productId) override; -private: - friend DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl(); - static DeviceInstanceInfoProviderImpl sInstance; + DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : + Internal::GenericDeviceInstanceInfoProvider(configManager) + {} }; inline DeviceInstanceInfoProviderImpl & DeviceInstanceInfoProviderMgrImpl() { - return DeviceInstanceInfoProviderImpl::sInstance; + static DeviceInstanceInfoProviderImpl sInstance(ConfigurationManagerImpl::GetDefaultInstance()); + return sInstance; } } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/webos/PlatformManagerImpl.cpp b/src/platform/webos/PlatformManagerImpl.cpp index 92be732d7ec4eb..c2e6845368aeb9 100644 --- a/src/platform/webos/PlatformManagerImpl.cpp +++ b/src/platform/webos/PlatformManagerImpl.cpp @@ -29,9 +29,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -166,6 +168,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); SetDeviceInfoProvider(&DeviceInfoProviderImpl::GetDefaultInstance()); + SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); // Call _InitChipStack() on the generic implementation base class // to finish the initialization process.