Skip to content

Commit

Permalink
[ESP32] Read product label and product url from the factory partition if
Browse files Browse the repository at this point in the history
available
  • Loading branch information
shubhamdp committed Aug 24, 2022
1 parent 82d974b commit 457997a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/platform/ESP32/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,26 @@ CHIP_ERROR ConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOp
return WriteConfigValue(ESP32Config::kCounterKey_TotalOperationalHours, totalOperationalHours);
}

CHIP_ERROR ConfigurationManagerImpl::GetProductURL(char * buf, size_t bufSize)
{
CHIP_ERROR err = ReadConfigValueStr(ESP32Config::kConfigKey_ProductURL, buf, bufSize, bufSize);
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}
return err;
}

CHIP_ERROR ConfigurationManagerImpl::GetProductLabel(char * buf, size_t bufSize)
{
CHIP_ERROR err = ReadConfigValueStr(ESP32Config::kConfigKey_ProductLabel, buf, bufSize, bufSize);
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}
return err;
}

CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf)
{
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ESP32/ConfigurationManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp
CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override;
CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override;
CHIP_ERROR StoreTotalOperationalHours(uint32_t totalOperationalHours) override;
CHIP_ERROR GetProductURL(char * buf, size_t bufSize) override;
CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override;
static ConfigurationManagerImpl & GetDefaultInstance();

private:
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ESP32/ESP32Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const ESP32Config::Key ESP32Config::kConfigKey_VendorId = { kConfig
const ESP32Config::Key ESP32Config::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" };
const ESP32Config::Key ESP32Config::kConfigKey_ProductId = { kConfigNamespace_ChipFactory, "product-id" };
const ESP32Config::Key ESP32Config::kConfigKey_ProductName = { kConfigNamespace_ChipFactory, "product-name" };
const ESP32Config::Key ESP32Config::kConfigKey_ProductLabel = { kConfigNamespace_ChipFactory, "product-label" };
const ESP32Config::Key ESP32Config::kConfigKey_ProductURL = { kConfigNamespace_ChipFactory, "product-url" };
const ESP32Config::Key ESP32Config::kConfigKey_SupportedCalTypes = { kConfigNamespace_ChipFactory, "cal-types" };
const ESP32Config::Key ESP32Config::kConfigKey_SupportedLocaleSize = { kConfigNamespace_ChipFactory, "locale-sz" };
const ESP32Config::Key ESP32Config::kConfigKey_RotatingDevIdUniqueId = { kConfigNamespace_ChipFactory, "rd-id-uid" };
Expand Down
2 changes: 2 additions & 0 deletions src/platform/ESP32/ESP32Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class ESP32Config
static const Key kConfigKey_VendorName;
static const Key kConfigKey_ProductId;
static const Key kConfigKey_ProductName;
static const Key kConfigKey_ProductLabel;
static const Key kConfigKey_ProductURL;
static const Key kConfigKey_SupportedCalTypes;
static const Key kConfigKey_SupportedLocaleSize;
static const Key kConfigKey_RotatingDevIdUniqueId;
Expand Down

0 comments on commit 457997a

Please sign in to comment.