diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index 18ffe60efb7beb..9390fff692fada 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -83,10 +83,8 @@ class ConfigurationManager virtual CHIP_ERROR GetFirmwareRevision(uint16_t & firmwareRev) = 0; virtual CHIP_ERROR GetSetupPinCode(uint32_t & setupPinCode) = 0; virtual CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator) = 0; -#if CHIP_ENABLE_ROTATING_DEVICE_ID // Lifetime counter is monotonic counter that is incremented only in the case of a factory reset - virtual CHIP_ERROR GetLifetimeCounter(uint16_t & lifetimeCounter) = 0; -#endif + virtual CHIP_ERROR GetLifetimeCounter(uint16_t & lifetimeCounter) = 0; virtual CHIP_ERROR GetRegulatoryLocation(uint32_t & location) = 0; virtual CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) = 0; virtual CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) = 0; @@ -109,9 +107,7 @@ class ConfigurationManager virtual CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo) = 0; -#if !defined(NDEBUG) virtual CHIP_ERROR RunUnitTests() = 0; -#endif virtual bool IsFullyProvisioned() = 0; virtual void InitiateFactoryReset() = 0; diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp index ef8f91f08742eb..4ea6ff3515640f 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.cpp @@ -379,20 +379,26 @@ CHIP_ERROR GenericConfigurationManagerImpl::StoreBootReasons(uint32_t return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -#if CHIP_ENABLE_ROTATING_DEVICE_ID template CHIP_ERROR GenericConfigurationManagerImpl::GetLifetimeCounter(uint16_t & lifetimeCounter) { +#if CHIP_ENABLE_ROTATING_DEVICE_ID lifetimeCounter = static_cast(mLifetimePersistedCounter.GetValue()); return CHIP_NO_ERROR; +#else + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +#endif } template CHIP_ERROR GenericConfigurationManagerImpl::_IncrementLifetimeCounter() { +#if CHIP_ENABLE_ROTATING_DEVICE_ID return mLifetimePersistedCounter.Advance(); -} +#else + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; #endif +} template CHIP_ERROR GenericConfigurationManagerImpl::GetFailSafeArmed(bool & val) @@ -490,16 +496,15 @@ CHIP_ERROR GenericConfigurationManagerImpl::GetSecondaryPairingInstru return CHIP_NO_ERROR; } -#if !defined(NDEBUG) template CHIP_ERROR GenericConfigurationManagerImpl::RunUnitTests() { +#if !defined(NDEBUG) ChipLogProgress(DeviceLayer, "Running configuration unit test"); Impl()->RunConfigUnitTest(); - +#endif return CHIP_NO_ERROR; } -#endif template void GenericConfigurationManagerImpl::LogDeviceConfig() diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.h b/src/include/platform/internal/GenericConfigurationManagerImpl.h index 42a64c7781a32f..26c9e10a5b6604 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -76,10 +76,8 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreSetupPinCode(uint32_t setupPinCode) override; CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator) override; CHIP_ERROR StoreSetupDiscriminator(uint16_t setupDiscriminator) override; -#if CHIP_ENABLE_ROTATING_DEVICE_ID CHIP_ERROR GetLifetimeCounter(uint16_t & lifetimeCounter) override; CHIP_ERROR _IncrementLifetimeCounter(); -#endif CHIP_ERROR GetFailSafeArmed(bool & val) override; CHIP_ERROR SetFailSafeArmed(bool val) override; CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo) override; @@ -103,9 +101,7 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override; CHIP_ERROR GetBootReasons(uint32_t & bootReasons) override; CHIP_ERROR StoreBootReasons(uint32_t bootReasons) override; -#if !defined(NDEBUG) CHIP_ERROR RunUnitTests(void) override; -#endif bool IsFullyProvisioned() override; void InitiateFactoryReset() override; void LogDeviceConfig() override;