Skip to content

Commit

Permalink
[Silabs] Remove generic base class init from configuration manager (#…
Browse files Browse the repository at this point in the history
…24346)

* Fix factory data provider init

* remove commented code

* Add missing function to data provider
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Sep 19, 2023
1 parent 692e951 commit 5089737
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
19 changes: 18 additions & 1 deletion examples/platform/silabs/efr32/EFR32DeviceDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,24 @@ CHIP_ERROR EFR32DeviceDataProvider::GetManufacturingDate(uint16_t & year, uint8_
ChipLogError(DeviceLayer, "Invalid manufacturing date: %s", dateStr);
}
return err;
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR EFR32DeviceDataProvider::GetPartNumber(char * buf, size_t bufSize)
{
size_t partNumberLen = 0; // without counting null-terminator
return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_PartNumber, buf, bufSize, partNumberLen);
}

CHIP_ERROR EFR32DeviceDataProvider::GetProductURL(char * buf, size_t bufSize)
{
size_t productUrlLen = 0; // without counting null-terminator
return SILABSConfig::ReadConfigValueStr(SILABSConfig::kConfigKey_ProductURL, buf, bufSize, productUrlLen);
}

CHIP_ERROR EFR32DeviceDataProvider::GetProductLabel(char * buf, size_t bufSize)
{
size_t productLabelLen = 0; // without counting null-terminator
return SILABSConfig::ReadConfigValueStr(SILABSConfig::KConfigKey_ProductLabel, buf, bufSize, productLabelLen);
}

EFR32DeviceDataProvider & EFR32DeviceDataProvider::GetDeviceDataProvider()
Expand Down
3 changes: 3 additions & 0 deletions examples/platform/silabs/efr32/EFR32DeviceDataProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class EFR32DeviceDataProvider : public CommissionableDataProvider,
CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override;
CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override;
CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override;
CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override;
CHIP_ERROR GetProductURL(char * buf, size_t bufSzie) override;
CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override;
};

} // namespace EFR32
Expand Down
11 changes: 1 addition & 10 deletions src/platform/silabs/EFR32/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance()

CHIP_ERROR ConfigurationManagerImpl::Init()
{
CHIP_ERROR err;

// Initialize the generic implementation base class.
err = Internal::GenericConfigurationManagerImpl<SILABSConfig>::Init();
SuccessOrExit(err);

// TODO: Initialize the global GroupKeyStore object here (#1626)

IncreaseBootCount();
Expand All @@ -63,10 +57,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
rebootCause = RMU_ResetCauseGet();
RMU_ResetCauseClear();

err = CHIP_NO_ERROR;

exit:
return err;
return CHIP_NO_ERROR;
}

bool ConfigurationManagerImpl::CanFactoryReset()
Expand Down
3 changes: 3 additions & 0 deletions src/platform/silabs/SilabsConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class SILABSConfig
static constexpr Key kConfigKey_VendorName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0D);
static constexpr Key kConfigKey_ProductName = SILABSConfigKey(kMatterFactory_KeyBase, 0x0E);
static constexpr Key kConfigKey_HardwareVersionString = SILABSConfigKey(kMatterFactory_KeyBase, 0x0F);
static constexpr Key KConfigKey_ProductLabel = SILABSConfigKey(kMatterFactory_KeyBase, 0x10);
static constexpr Key kConfigKey_ProductURL = SILABSConfigKey(kMatterFactory_KeyBase, 0x11);
static constexpr Key kConfigKey_PartNumber = SILABSConfigKey(kMatterFactory_KeyBase, 0x12);
static constexpr Key kConfigKey_UniqueId = SILABSConfigKey(kMatterFactory_KeyBase, 0x1F);
// Matter Config Keys
static constexpr Key kConfigKey_ServiceConfig = SILABSConfigKey(kMatterConfig_KeyBase, 0x01);
Expand Down

0 comments on commit 5089737

Please sign in to comment.