From 1063461c062b7309e5c6fb996ce569a51df7b381 Mon Sep 17 00:00:00 2001 From: Andy Salisbury Date: Mon, 25 Oct 2021 10:31:30 -0400 Subject: [PATCH] Update the Ameba platform's ConfigurationManager. (#10906) --- .../Ameba/ConfigurationManagerImpl.cpp | 22 +++++++++---------- src/platform/Ameba/ConfigurationManagerImpl.h | 19 ++++++---------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/platform/Ameba/ConfigurationManagerImpl.cpp b/src/platform/Ameba/ConfigurationManagerImpl.cpp index 3e18dbdd90b27f..24a6c273889187 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.cpp +++ b/src/platform/Ameba/ConfigurationManagerImpl.cpp @@ -39,22 +39,22 @@ using namespace ::chip::DeviceLayer::Internal; */ ConfigurationManagerImpl ConfigurationManagerImpl::sInstance; -CHIP_ERROR ConfigurationManagerImpl::_Init() +CHIP_ERROR ConfigurationManagerImpl::Init() { CHIP_ERROR err; bool failSafeArmed; // Initialize the generic implementation base class. - err = Internal::GenericConfigurationManagerImpl::_Init(); + err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); // TODO: initialize NVM component // If the fail-safe was armed when the device last shutdown, initiate a factory reset. - if (_GetFailSafeArmed(failSafeArmed) == CHIP_NO_ERROR && failSafeArmed) + if (GetFailSafeArmed(failSafeArmed) == CHIP_NO_ERROR && failSafeArmed) { ChipLogProgress(DeviceLayer, "Detected fail-safe armed on reboot; initiating factory reset"); - _InitiateFactoryReset(); + InitiateFactoryReset(); } err = CHIP_NO_ERROR; @@ -62,31 +62,31 @@ CHIP_ERROR ConfigurationManagerImpl::_Init() return err; } -CHIP_ERROR ConfigurationManagerImpl::_GetPrimaryWiFiMACAddress(uint8_t * buf) +CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -bool ConfigurationManagerImpl::_CanFactoryReset() +bool ConfigurationManagerImpl::CanFactoryReset() { // TODO: query the application to determine if factory reset is allowed. return true; } -void ConfigurationManagerImpl::_InitiateFactoryReset() +void ConfigurationManagerImpl::InitiateFactoryReset() { PlatformMgr().ScheduleWork(DoFactoryReset); } -CHIP_ERROR ConfigurationManagerImpl::_ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey, - uint32_t & value) +CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey, + uint32_t & value) { // TODO return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ConfigurationManagerImpl::_WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey, - uint32_t value) +CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key persistedStorageKey, + uint32_t value) { // TODO return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; diff --git a/src/platform/Ameba/ConfigurationManagerImpl.h b/src/platform/Ameba/ConfigurationManagerImpl.h index 7a6aa50c339da3..4dab60d474208e 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.h +++ b/src/platform/Ameba/ConfigurationManagerImpl.h @@ -38,14 +38,9 @@ class NetworkProvisioningServerImpl; /** * Concrete implementation of the ConfigurationManager singleton object for the Ameba platform. */ -class ConfigurationManagerImpl final : public ConfigurationManager, - public Internal::GenericConfigurationManagerImpl, +class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl, private Internal::AmebaConfig { - // Allow the ConfigurationManager interface class to delegate method calls to - // the implementation methods provided by this class. - friend class ConfigurationManager; - // Allow the GenericConfigurationManagerImpl base class to access helper methods and types // defined on this class. #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -55,12 +50,12 @@ class ConfigurationManagerImpl final : public ConfigurationManager, private: // ===== Members that implement the ConfigurationManager public interface. - CHIP_ERROR _Init(void); - CHIP_ERROR _GetPrimaryWiFiMACAddress(uint8_t * buf); - bool _CanFactoryReset(void); - void _InitiateFactoryReset(void); - CHIP_ERROR _ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value); - CHIP_ERROR _WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value); + CHIP_ERROR Init(void) override; + CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override; + bool CanFactoryReset(void) override; + void InitiateFactoryReset(void) override; + CHIP_ERROR ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value) override; + CHIP_ERROR WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value) override; // NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.