Skip to content

Commit

Permalink
Add missing function to data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Jan 19, 2023
1 parent d270d77 commit c0082f1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
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
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 c0082f1

Please sign in to comment.