Skip to content

Commit

Permalink
Add support for ActiveLocale in ConfigurationMgr
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Jan 10, 2022
1 parent b7ff37e commit a304222
Show file tree
Hide file tree
Showing 28 changed files with 67 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/include/platform/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class ConfigurationManager
#else
kPrimaryMACAddressLength = 6,
#endif
kMaxMACAddressLength = 8,
kMaxMACAddressLength = 8,
kMaxLanguageTagLength = 5 // ISO 639-1 standard language codes
};

virtual CHIP_ERROR GetVendorName(char * buf, size_t bufSize) = 0;
Expand All @@ -99,6 +100,7 @@ class ConfigurationManager
virtual CHIP_ERROR GetLifetimeCounter(uint16_t & lifetimeCounter) = 0;
virtual CHIP_ERROR GetRegulatoryLocation(uint8_t & location) = 0;
virtual CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) = 0;
virtual CHIP_ERROR GetActiveLocale(char * buf, size_t bufSize, size_t & codeLen) = 0;
virtual CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) = 0;
virtual CHIP_ERROR StoreSerialNumber(const char * serialNum, size_t serialNumLen) = 0;
virtual CHIP_ERROR StorePrimaryWiFiMACAddress(const uint8_t * buf) = 0;
Expand All @@ -109,6 +111,7 @@ class ConfigurationManager
virtual CHIP_ERROR StoreSetupDiscriminator(uint16_t setupDiscriminator) = 0;
virtual CHIP_ERROR StoreRegulatoryLocation(uint8_t location) = 0;
virtual CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) = 0;
virtual CHIP_ERROR StoreActiveLocale(const char * code, size_t codeLen) = 0;
virtual CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) = 0;
virtual CHIP_ERROR GetRebootCount(uint32_t & rebootCount) = 0;
virtual CHIP_ERROR StoreRebootCount(uint32_t rebootCount) = 0;
Expand Down
12 changes: 12 additions & 0 deletions src/include/platform/internal/GenericConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,24 @@ CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::GetCountryCode(char * b
return ReadConfigValueStr(ConfigClass::kConfigKey_CountryCode, buf, bufSize, codeLen);
}

template <class ConfigClass>
CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::GetActiveLocale(char * buf, size_t bufSize, size_t & codeLen)
{
return ReadConfigValueStr(ConfigClass::kConfigKey_ActiveLocale, buf, bufSize, codeLen);
}

template <class ConfigClass>
CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::StoreCountryCode(const char * code, size_t codeLen)
{
return WriteConfigValueStr(ConfigClass::kConfigKey_CountryCode, code, codeLen);
}

template <class ConfigClass>
CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::StoreActiveLocale(const char * code, size_t codeLen)
{
return WriteConfigValueStr(ConfigClass::kConfigKey_ActiveLocale, code, codeLen);
}

template <class ConfigClass>
CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::GetBreadcrumb(uint64_t & breadcrumb)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class GenericConfigurationManagerImpl : public ConfigurationManager
CHIP_ERROR GetRegulatoryLocation(uint8_t & location) override;
CHIP_ERROR StoreRegulatoryLocation(uint8_t location) override;
CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) override;
CHIP_ERROR GetActiveLocale(char * buf, size_t bufSize, size_t & codeLen) override;
CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override;
CHIP_ERROR StoreActiveLocale(const char * code, size_t codeLen) override;
CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) override;
CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) override;
CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override;
Expand Down
1 change: 1 addition & 0 deletions src/platform/Ameba/AmebaConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const AmebaConfig::Key AmebaConfig::kConfigKey_OperationalDeviceICACerts = { k
const AmebaConfig::Key AmebaConfig::kConfigKey_OperationalDevicePrivateKey = { kConfigNamespace_ChipConfig, "op-device-key" };
const AmebaConfig::Key AmebaConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const AmebaConfig::Key AmebaConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const AmebaConfig::Key AmebaConfig::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const AmebaConfig::Key AmebaConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };

// Keys stored in the Chip-counters namespace
Expand Down
1 change: 1 addition & 0 deletions src/platform/Ameba/AmebaConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class AmebaConfig
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kCounterKey_RebootCount;
static const Key kCounterKey_UpTime;
Expand Down
1 change: 1 addition & 0 deletions src/platform/Darwin/PosixConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNam
const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" };
const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const PosixConfig::Key PosixConfig::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };

// Prefix used for NVS keys that contain Chip group encryption keys.
Expand Down
1 change: 1 addition & 0 deletions src/platform/Darwin/PosixConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class PosixConfig
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;

static const char kGroupKeyNamePrefix[];
Expand Down
1 change: 1 addition & 0 deletions src/platform/EFR32/EFR32Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class EFR32Config
static constexpr Key kConfigKey_CountryCode = EFR32ConfigKey(kChipConfig_KeyBase, 0x0A);
static constexpr Key kConfigKey_Breadcrumb = EFR32ConfigKey(kChipConfig_KeyBase, 0x0B);
static constexpr Key kConfigKey_GroupKeyBase = EFR32ConfigKey(kChipConfig_KeyBase, 0x0C);
static constexpr Key kConfigKey_ActiveLocale = EFR32ConfigKey(kChipConfig_KeyBase, 0x0D);
static constexpr Key kConfigKey_GroupKeyMax = EFR32ConfigKey(kChipConfig_KeyBase, 0x1B); // Allows 16 Group Keys to be created.

// CHIP Counter Keys
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ESP32Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const ESP32Config::Key ESP32Config::kConfigKey_FailSafeArmed = { kConfigNam
const ESP32Config::Key ESP32Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" };
const ESP32Config::Key ESP32Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const ESP32Config::Key ESP32Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const ESP32Config::Key ESP32Config::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const ESP32Config::Key ESP32Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };

// Keys stored in the Chip-counters namespace
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ESP32Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class ESP32Config
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kCounterKey_RebootCount;
static const Key kCounterKey_UpTime;
Expand Down
1 change: 1 addition & 0 deletions src/platform/Linux/PosixConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNam
const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" };
const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const PosixConfig::Key PosixConfig::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };
const PosixConfig::Key PosixConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" };

Expand Down
1 change: 1 addition & 0 deletions src/platform/Linux/PosixConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class PosixConfig
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kConfigKey_LocationCapability;

Expand Down
1 change: 1 addition & 0 deletions src/platform/P6/P6Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const P6Config::Key P6Config::kConfigKey_SetupPinCode = { kConfigNamespac
const P6Config::Key P6Config::kConfigKey_SetupDiscriminator = { kConfigNamespace_ChipFactory, "discriminator" };
const P6Config::Key P6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const P6Config::Key P6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const P6Config::Key P6Config::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const P6Config::Key P6Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };

// Keys stored in the chip-config namespace
Expand Down
1 change: 1 addition & 0 deletions src/platform/P6/P6Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class P6Config
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kCounterKey_RebootCount;
static const Key kCounterKey_UpTime;
Expand Down
1 change: 1 addition & 0 deletions src/platform/Tizen/PosixConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNam
const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };
const PosixConfig::Key PosixConfig::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };

// Prefix used for NVS keys that contain Chip group encryption keys.
const char PosixConfig::kGroupKeyNamePrefix[] = "gk-";
Expand Down
1 change: 1 addition & 0 deletions src/platform/Tizen/PosixConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class PosixConfig
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_Breadcrumb;
static const Key kConfigKey_ActiveLocale;

static const char kGroupKeyNamePrefix[];

Expand Down
3 changes: 2 additions & 1 deletion src/platform/Zephyr/ZephyrConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const ZephyrConfig::Key ZephyrConfig::kConfigKey_LastUsedEpochKeyId = CONFIG_KEY
const ZephyrConfig::Key ZephyrConfig::kConfigKey_FailSafeArmed = CONFIG_KEY(NAMESPACE_CONFIG "fail-safe-armed");
const ZephyrConfig::Key ZephyrConfig::kConfigKey_RegulatoryLocation = CONFIG_KEY(NAMESPACE_CONFIG "regulatory-location");
const ZephyrConfig::Key ZephyrConfig::kConfigKey_CountryCode = CONFIG_KEY(NAMESPACE_CONFIG "country-code");
const ZephyrConfig::Key ZephyrConfig::kConfigKey_ActiveLocale = CONFIG_KEY(NAMESPACE_CONFIG "active-locale");
const ZephyrConfig::Key ZephyrConfig::kConfigKey_Breadcrumb = CONFIG_KEY(NAMESPACE_CONFIG "breadcrumb");

// Keys stored in the counters namespace
Expand All @@ -85,7 +86,7 @@ constexpr const char * sAllResettableConfigKeys[] = {
ZephyrConfig::kConfigKey_FabricSecret, ZephyrConfig::kConfigKey_GroupKeyIndex,
ZephyrConfig::kConfigKey_LastUsedEpochKeyId, ZephyrConfig::kConfigKey_FailSafeArmed,
ZephyrConfig::kConfigKey_RegulatoryLocation, ZephyrConfig::kConfigKey_CountryCode,
ZephyrConfig::kConfigKey_Breadcrumb
ZephyrConfig::kConfigKey_ActiveLocale, ZephyrConfig::kConfigKey_Breadcrumb
};

// Data structure to be passed as a parameter of Zephyr's settings_load_subtree_direct() function
Expand Down
1 change: 1 addition & 0 deletions src/platform/Zephyr/ZephyrConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ZephyrConfig
static const Key kConfigKey_FailSafeArmed;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kCounterKey_RebootCount;
static const Key kCounterKey_BootReason;
Expand Down
1 change: 1 addition & 0 deletions src/platform/android/AndroidConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const AndroidConfig::Key AndroidConfig::kConfigKey_FailSafeArmed = { kConfi
const AndroidConfig::Key AndroidConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" };
const AndroidConfig::Key AndroidConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
const AndroidConfig::Key AndroidConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
const AndroidConfig::Key AndroidConfig::kConfigKey_ActiveLocale = { kConfigNamespace_ChipConfig, "active-locale" };
const AndroidConfig::Key AndroidConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };

// Prefix used for NVS keys that contain Chip group encryption keys.
Expand Down
1 change: 1 addition & 0 deletions src/platform/android/AndroidConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class AndroidConfig
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kConfigKey_ProductId;
static const Key kConfigKey_ProductName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public interface ConfigurationManager {
String kConfigKey_WiFiStationSecType = "sta-sec-type";
String kConfigKey_RegulatoryLocation = "regulatory-location";
String kConfigKey_CountryCode = "country-code";
String kConfigKey_ActiveLocale = "active-locale";
String kConfigKey_Breadcrumb = "breadcrumb";

// Prefix used for NVS keys that contain Chip group encryption keys.
Expand Down
6 changes: 4 additions & 2 deletions src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_CountryCode =
.itemID = 0x001b } };
const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_Breadcrumb = { { .systemID = kCC13X2_26X2ChipFactory_Sysid,
.itemID = 0x001c } };
const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_ActiveLocale = { { .systemID = kCC13X2_26X2ChipFactory_Sysid,
.itemID = 0x001d } };

/* Internal for the KVS interface. */
const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_KVS_key = { { .systemID = kCC13X2_26X2ChipFactory_Sysid,
.itemID = 0x001d } };
.itemID = 0x001e } };
const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_KVS_value = { { .systemID = kCC13X2_26X2ChipFactory_Sysid,
.itemID = 0x001e } };
.itemID = 0x001f } };

/* Static local variables */
static NVINTF_nvFuncts_t sNvoctpFps = { 0 };
Expand Down
1 change: 1 addition & 0 deletions src/platform/cc13x2_26x2/CC13X2_26X2Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class CC13X2_26X2Config
static const Key kConfigKey_WiFiStationSecType;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;
static const Key kConfigKey_KVS_key; // special key for KVS system, key storage
static const Key kConfigKey_KVS_value; // special key for KVS system, value storage
Expand Down
1 change: 1 addition & 0 deletions src/platform/mbed/MbedConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const MbedConfig::Key MbedConfig::kConfigKey_FailSafeArmed = { CONFIG_KEY("
const MbedConfig::Key MbedConfig::kConfigKey_WiFiStationSecType = { CONFIG_KEY("sta-sec-type") };
const MbedConfig::Key MbedConfig::kConfigKey_RegulatoryLocation = { CONFIG_KEY("regulatory-location") };
const MbedConfig::Key MbedConfig::kConfigKey_CountryCode = { CONFIG_KEY("country-code") };
const MbedConfig::Key MbedConfig::kConfigKey_ActiveLocale = { CONFIG_KEY("active-locale") };
const MbedConfig::Key MbedConfig::kConfigKey_Breadcrumb = { CONFIG_KEY("breadcrumb") };

CHIP_ERROR MbedConfig::ReadConfigValue(Key key, bool & val)
Expand Down
1 change: 1 addition & 0 deletions src/platform/mbed/MbedConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class MbedConfig
static const Key kConfigKey_SetupDiscriminator;
static const Key kConfigKey_RegulatoryLocation;
static const Key kConfigKey_CountryCode;
static const Key kConfigKey_ActiveLocale;
static const Key kConfigKey_Breadcrumb;

// Config value accessors.
Expand Down
1 change: 1 addition & 0 deletions src/platform/nxp/k32w/k32w0/K32W0Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class K32WConfig
static constexpr Key kConfigKey_RegulatoryLocation = K32WConfigKey(kPDMId_ChipConfig, 0x07);
static constexpr Key kConfigKey_CountryCode = K32WConfigKey(kPDMId_ChipConfig, 0x08);
static constexpr Key kConfigKey_Breadcrumb = K32WConfigKey(kPDMId_ChipConfig, 0x09);
static constexpr Key kConfigKey_ActiveLocale = K32WConfigKey(kPDMId_ChipConfig, 0x0A);

// CHIP Counter Keys
static constexpr Key kCounterKey_RebootCount = K32WConfigKey(kPDMId_ChipConfig, 0x0A);
Expand Down
5 changes: 3 additions & 2 deletions src/platform/qpg/qpgConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ class QPGConfig
static constexpr Key kConfigKey_RegulatoryLocation = QorvoConfigKey(kFileId_ChipConfig, 0x09);
static constexpr Key kConfigKey_CountryCode = QorvoConfigKey(kFileId_ChipConfig, 0x0A);
static constexpr Key kConfigKey_Breadcrumb = QorvoConfigKey(kFileId_ChipConfig, 0x0B);
static constexpr Key kConfigKey_ActiveLocale = QorvoConfigKey(kFileId_ChipConfig, 0x0C);

static constexpr Key kConfigKey_GroupKeyBase = QorvoConfigKey(kFileId_ChipConfig, 0x0C);
static constexpr Key kConfigKey_GroupKeyMax = QorvoConfigKey(kFileId_ChipConfig, 0x1B); // Allows 16 Group Keys to be created.
static constexpr Key kConfigKey_GroupKeyBase = QorvoConfigKey(kFileId_ChipConfig, 0x0D);
static constexpr Key kConfigKey_GroupKeyMax = QorvoConfigKey(kFileId_ChipConfig, 0x1C); // Allows 16 Group Keys to be created.

static constexpr Key kConfigKey_CounterKeyBase = QorvoConfigKey(kFileId_ChipCounter, 0x00);
static constexpr Key kConfigKey_CounterKeyMax =
Expand Down
19 changes: 19 additions & 0 deletions src/platform/tests/TestConfigurationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ static void TestConfigurationMgr_GetPrimaryMACAddress(nlTestSuite * inSuite, voi
}
}

static void TestConfigurationMgr_ActiveLocale(nlTestSuite * inSuite, void * inContext)
{
CHIP_ERROR err = CHIP_NO_ERROR;

char buf[8];
size_t activeLocaleLen = 0;
const char * activeLocale = "en-US";

err = ConfigurationMgr().StoreActiveLocale(activeLocale, strlen(activeLocale));
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

err = ConfigurationMgr().GetActiveLocale(buf, 8, activeLocaleLen);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

NL_TEST_ASSERT(inSuite, activeLocaleLen == strlen(activeLocale));
NL_TEST_ASSERT(inSuite, strcmp(buf, activeLocale) == 0);
}

/**
* Test Suite. It lists all the test functions.
*/
Expand All @@ -244,6 +262,7 @@ static const nlTest sTests[] = {
NL_TEST_DEF("Test ConfigurationMgr::CountryCode", TestConfigurationMgr_CountryCode),
NL_TEST_DEF("Test ConfigurationMgr::Breadcrumb", TestConfigurationMgr_Breadcrumb),
NL_TEST_DEF("Test ConfigurationMgr::GetPrimaryMACAddress", TestConfigurationMgr_GetPrimaryMACAddress),
NL_TEST_DEF("Test ConfigurationMgr::ActiveLocale", TestConfigurationMgr_ActiveLocale),
NL_TEST_SENTINEL()
};

Expand Down

0 comments on commit a304222

Please sign in to comment.