diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index c0c4416643ad3f..1eeb23642c7ac4 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -52,6 +52,8 @@ static_library("Darwin") { "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", + "DeviceInstanceInfoProviderImpl.cpp", + "DeviceInstanceInfoProviderImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", "DnssdContexts.cpp", @@ -81,8 +83,6 @@ static_library("Darwin") { if (chip_disable_platform_kvs == false) { sources += [ - "DeviceInstanceInfoProviderImpl.cpp", - "DeviceInstanceInfoProviderImpl.h", "KeyValueStoreManagerImpl.h", "KeyValueStoreManagerImpl.mm", ] 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..00e63fb88c6d22 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -24,7 +24,9 @@ #include +#include #include +#include #include // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, @@ -48,6 +50,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() #endif // CHIP_DISABLE_PLATFORM_KVS SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); SetDiagnosticDataProvider(&DiagnosticDataProviderImpl::GetDefaultInstance()); + SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); mRunLoopSem = dispatch_semaphore_create(0); 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.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.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.h b/src/platform/webos/DeviceInstanceInfoProviderImpl.h index 0fd05e46dc5160..d4986c7ace84fb 100644 --- a/src/platform/webos/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/webos/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/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.