diff --git a/examples/lock-app/telink/src/LockManager.cpp b/examples/lock-app/telink/src/LockManager.cpp index 68abacb8235055..a4dbc9e9aa0aab 100644 --- a/examples/lock-app/telink/src/LockManager.cpp +++ b/examples/lock-app/telink/src/LockManager.cpp @@ -455,11 +455,13 @@ bool LockManager::ReadConfigValues() for (uint8_t i = 0; i < kNumCredentialTypes; i++) { - ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_Credential[i], reinterpret_cast(&mLockCredentials[i]), - sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials, outLen); + ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_Credential[i], + reinterpret_cast(&mLockCredentials[i]), + sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials, outLen); - ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData[i], reinterpret_cast(mCredentialData[i]), - kMaxCredentials * kMaxCredentialSize, outLen); + ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData[i], + reinterpret_cast(mCredentialData[i]), kMaxCredentials * kMaxCredentialSize, + outLen); } return true; @@ -668,23 +670,27 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential for (uint8_t i = 0; i < kNumCredentialTypes; i++) { // Save credential information in NVM flash - err = ZephyrConfig::WriteConfigValueBin( - LockSettingsStorage::kConfigKey_Credential[i], reinterpret_cast(&mLockCredentials[i]), - sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials); + err = ZephyrConfig::WriteConfigValueBin(LockSettingsStorage::kConfigKey_Credential[i], + reinterpret_cast(&mLockCredentials[i]), + sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, - "Failed to write kConfigKey_Credential(%d). User data will be resetted during reboot. Not enough storage space \n", i); + ChipLogError( + Zcl, + "Failed to write kConfigKey_Credential(%d). User data will be resetted during reboot. Not enough storage space \n", + i); break; } - err = ZephyrConfig::WriteConfigValueBin( - LockSettingsStorage::kConfigKey_CredentialData[i],reinterpret_cast(&mCredentialData[i]), - kMaxCredentials * kMaxCredentialSize); + err = ZephyrConfig::WriteConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData[i], + reinterpret_cast(&mCredentialData[i]), + kMaxCredentials * kMaxCredentialSize); if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, - "Failed to write kConfigKey_CredentialData(%d). User data will be resetted during reboot. Not enough storage space \n", i); + "Failed to write kConfigKey_CredentialData(%d). User data will be resetted during reboot. Not enough " + "storage space \n", + i); break; } } diff --git a/examples/lock-app/telink/src/LockSettingsStorage.cpp b/examples/lock-app/telink/src/LockSettingsStorage.cpp index 17c8af936c9d93..73b88e2c593dea 100644 --- a/examples/lock-app/telink/src/LockSettingsStorage.cpp +++ b/examples/lock-app/telink/src/LockSettingsStorage.cpp @@ -33,32 +33,24 @@ namespace Internal { (key); \ static_assert(sizeof(key) <= SETTINGS_MAX_NAME_LEN, "Config key too long: " key) -#define CONFIG_KEY_CREDENTIAL(type) (NAMESPACE_CONFIG "credential-" type) -#define CONFIG_KEY_CREDENTIAL_DATA(type) (NAMESPACE_CONFIG "credential-" type "-data") +#define CONFIG_KEY_CREDENTIAL(type) (NAMESPACE_CONFIG "credential-" type) +#define CONFIG_KEY_CREDENTIAL_DATA(type) (NAMESPACE_CONFIG "credential-" type "-data") #define NAMESPACE_CONFIG CHIP_DEVICE_CONFIG_SETTINGS_KEY "/cfg/" -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUser = CONFIG_KEY(NAMESPACE_CONFIG "lock-user"); -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUserName = CONFIG_KEY(NAMESPACE_CONFIG "lock-user-name"); -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_UserCredentials = CONFIG_KEY(NAMESPACE_CONFIG "user-credentials"); -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_WeekDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "week-day-schedules"); -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_YearDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "year-day-schedules"); -const ZephyrConfig::Key LockSettingsStorage::kConfigKey_HolidaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "holiday-schedules"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUser = CONFIG_KEY(NAMESPACE_CONFIG "lock-user"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUserName = CONFIG_KEY(NAMESPACE_CONFIG "lock-user-name"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_UserCredentials = CONFIG_KEY(NAMESPACE_CONFIG "user-credentials"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_WeekDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "week-day-schedules"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_YearDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "year-day-schedules"); +const ZephyrConfig::Key LockSettingsStorage::kConfigKey_HolidaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "holiday-schedules"); const char * LockSettingsStorage::kConfigKey_Credential[kNumCredentialTypes] = { - CONFIG_KEY_CREDENTIAL("programming-pin"), - CONFIG_KEY_CREDENTIAL("pin"), - CONFIG_KEY_CREDENTIAL("rfid"), - CONFIG_KEY_CREDENTIAL("finger-print"), - CONFIG_KEY_CREDENTIAL("finger-vein"), - CONFIG_KEY_CREDENTIAL("face") + CONFIG_KEY_CREDENTIAL("programming-pin"), CONFIG_KEY_CREDENTIAL("pin"), CONFIG_KEY_CREDENTIAL("rfid"), + CONFIG_KEY_CREDENTIAL("finger-print"), CONFIG_KEY_CREDENTIAL("finger-vein"), CONFIG_KEY_CREDENTIAL("face") }; const char * LockSettingsStorage::kConfigKey_CredentialData[kNumCredentialTypes] = { - CONFIG_KEY_CREDENTIAL_DATA("programming-pin"), - CONFIG_KEY_CREDENTIAL_DATA("pin"), - CONFIG_KEY_CREDENTIAL_DATA("rfid"), - CONFIG_KEY_CREDENTIAL_DATA("finger-print"), - CONFIG_KEY_CREDENTIAL_DATA("finger-vein"), - CONFIG_KEY_CREDENTIAL_DATA("face") + CONFIG_KEY_CREDENTIAL_DATA("programming-pin"), CONFIG_KEY_CREDENTIAL_DATA("pin"), CONFIG_KEY_CREDENTIAL_DATA("rfid"), + CONFIG_KEY_CREDENTIAL_DATA("finger-print"), CONFIG_KEY_CREDENTIAL_DATA("finger-vein"), CONFIG_KEY_CREDENTIAL_DATA("face") }; } // namespace Internal