diff --git a/src/platform/renesas/BUILD.gn b/src/platform/renesas/BUILD.gn index 206debbb006f96..eb09faa6692436 100644 --- a/src/platform/renesas/BUILD.gn +++ b/src/platform/renesas/BUILD.gn @@ -29,8 +29,6 @@ static_library("renesas") { "RenesasConfig.h", "ConfigurationManagerImpl.cpp", "ConfigurationManagerImpl.h", - "ConfigurationManagerNetif.cpp", - "ConfigurationManagerNetif.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", "DiagnosticDataProviderImpl.cpp", diff --git a/src/platform/renesas/ConfigurationManagerImpl.cpp b/src/platform/renesas/ConfigurationManagerImpl.cpp index 72400ce126e792..0dc396a6f7fe69 100644 --- a/src/platform/renesas/ConfigurationManagerImpl.cpp +++ b/src/platform/renesas/ConfigurationManagerImpl.cpp @@ -41,6 +41,10 @@ ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance() return sInstance; } +ConfigurationManagerImpl::ConfigurationManagerImpl() + : m_provider(nullptr) +{ } + CHIP_ERROR ConfigurationManagerImpl::Init() { CHIP_ERROR err; @@ -127,11 +131,6 @@ CHIP_ERROR ConfigurationManagerImpl::StoreBootReason(uint32_t bootReason) return WriteConfigValue(RenesasConfig::kConfigKey_BootReason, bootReason); } -void ConfigurationManagerImpl::RegisterNetif(struct netif* netif) -{ - m_netif = netif; -} - bool ConfigurationManagerImpl::CanFactoryReset(void) { // Implement InitiateFactoryReset first before enabling @@ -224,19 +223,42 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) // Implement factory reset } -ConfigurationManager & ConfigurationMgrImpl() +void ConfigurationManagerImpl::RegisterInformationProvider(ConfigurationInformationProvider& provider) { - return ConfigurationManagerImpl::GetDefaultInstance(); + assert(m_provider == nullptr); + m_provider = &provider; } CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { - if (m_netif != nullptr && buf != nullptr) + if (m_provider != nullptr) { - memcpy(buf, m_netif->hwaddr, m_netif->hwaddr_len); - return CHIP_NO_ERROR; + return m_provider->GetMacAddress(buf); + } + return CHIP_ERROR_INTERNAL; +} + +CHIP_ERROR ConfigurationManagerImpl::GetSoftwareVersion(uint32_t & softwareVer) +{ + if (m_provider != nullptr) + { + return m_provider->GetSoftwareVersion(softwareVer); + } + return CHIP_ERROR_INTERNAL; +} + +CHIP_ERROR ConfigurationManagerImpl::GetSoftwareVersionString(char * buf, size_t bufSize) +{ + if (m_provider != nullptr) + { + return m_provider->GetSoftwareVersionString(buf, bufSize); } - return CHIP_ERROR_NOT_IMPLEMENTED; + return CHIP_ERROR_INTERNAL; +} + +ConfigurationManager & ConfigurationMgrImpl() +{ + return ConfigurationManagerImpl::GetDefaultInstance(); } } // namespace DeviceLayer diff --git a/src/platform/renesas/ConfigurationManagerImpl.h b/src/platform/renesas/ConfigurationManagerImpl.h index 6a56cd0fb40785..4f730acc9fb81a 100644 --- a/src/platform/renesas/ConfigurationManagerImpl.h +++ b/src/platform/renesas/ConfigurationManagerImpl.h @@ -24,6 +24,7 @@ #pragma once #include +#include "ConfigurationInformationProvider.h" #include "RenesasConfig.h" struct netif; @@ -44,12 +45,12 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp CHIP_ERROR StoreBootReason(uint32_t bootReason) override; CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) override; CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override; - void RegisterNetif(struct netif* netif); - CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override; - + CHIP_ERROR GetSoftwareVersion(uint32_t & softwareVer) override; + CHIP_ERROR GetSoftwareVersionString(char * buf, size_t bufSize) override; + void RegisterInformationProvider(ConfigurationInformationProvider& provider); private: - + ConfigurationManagerImpl(); CHIP_ERROR Init(void) override; bool CanFactoryReset(void) override; void InitiateFactoryReset(void) override; @@ -72,7 +73,7 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp static void DoFactoryReset(intptr_t arg); - struct netif* m_netif; + ConfigurationInformationProvider* m_provider; }; /** diff --git a/src/platform/renesas/ConfigurationManagerNetif.cpp b/src/platform/renesas/ConfigurationManagerNetif.cpp deleted file mode 100644 index 2c7d8484296ac0..00000000000000 --- a/src/platform/renesas/ConfigurationManagerNetif.cpp +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @copyright Copyright 2024, (C) Sensorfy B.V. - */ - -#include "ConfigurationManagerImpl.h" -#include "ConfigurationManagerNetif.h" -struct netif; - -void ConfigurationManagerNetif_register(struct netif* netif) -{ - static_cast(chip::DeviceLayer::ConfigurationMgrImpl()).RegisterNetif(netif); -} diff --git a/src/platform/renesas/ConfigurationManagerNetif.h b/src/platform/renesas/ConfigurationManagerNetif.h deleted file mode 100644 index 8fda20af5133ce..00000000000000 --- a/src/platform/renesas/ConfigurationManagerNetif.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @copyright Copyright 2024, (C) Sensorfy B.V. - */ - -#ifdef __cplusplus - extern "C" { -#endif - void ConfigurationManagerNetif_register(struct netif* netif); - -#ifdef __cplusplus - } -#endif