diff --git a/src/platform/Darwin/PosixConfig.cpp b/src/platform/Darwin/PosixConfig.cpp index e15bab933eb6b6..4959b2ff293c5e 100644 --- a/src/platform/Darwin/PosixConfig.cpp +++ b/src/platform/Darwin/PosixConfig.cpp @@ -70,6 +70,8 @@ const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNam // Prefix used for NVS keys that contain Chip group encryption keys. const char PosixConfig::kGroupKeyNamePrefix[] = "gk-"; +uint16_t PosixConfig::mPosixSetupDiscriminator = 0xF00; // CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR + CHIP_ERROR PosixConfig::Init() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -88,9 +90,12 @@ CHIP_ERROR PosixConfig::ReadConfigValue(Key key, bool & val) CHIP_ERROR PosixConfig::ReadConfigValue(Key key, uint32_t & val) { CHIP_ERROR err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; - SuccessOrExit(err); -exit: + if (key == kConfigKey_SetupDiscriminator) + { + val = mPosixSetupDiscriminator; + return CHIP_NO_ERROR; + } return err; } @@ -133,9 +138,12 @@ CHIP_ERROR PosixConfig::WriteConfigValue(Key key, bool val) CHIP_ERROR PosixConfig::WriteConfigValue(Key key, uint32_t val) { CHIP_ERROR err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; - SuccessOrExit(err); -exit: + if (key == kConfigKey_SetupDiscriminator) + { + mPosixSetupDiscriminator = val; + return CHIP_NO_ERROR; + } return err; } diff --git a/src/platform/Darwin/PosixConfig.h b/src/platform/Darwin/PosixConfig.h index 2964199bce4f49..1dcd7158c39431 100644 --- a/src/platform/Darwin/PosixConfig.h +++ b/src/platform/Darwin/PosixConfig.h @@ -100,6 +100,10 @@ class PosixConfig // NVS Namespace helper functions. static CHIP_ERROR EnsureNamespace(const char * ns); static CHIP_ERROR ClearNamespace(const char * ns); + +private: + // TODO: This is temporary until Darwin implements a proper ReadConfigValue + static uint16_t mPosixSetupDiscriminator; }; struct PosixConfig::Key