Skip to content

Commit

Permalink
return true if programmingPin is given to GetCredential
Browse files Browse the repository at this point in the history
  • Loading branch information
mykrupp committed Jun 28, 2022
1 parent bc55a4b commit 6e7c275
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions examples/lock-app/efr32/src/LockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,19 +363,21 @@ bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip:
bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType,
EmberAfPluginDoorLockCredentialInfo & credential) const
{
if ((credentialIndex < MIN_CREDENTIAL_INDEX) || (credentialIndex > MAX_CREDENTIAL_PER_USER))
{
ChipLogError(Zcl, "Cannot get credential - credential index is out of range [endpoint=%d,index=%d]", endpointId,
credentialIndex);
return false;
}

// door-lock-server checks for valid credential index
uint16_t adjustedCredentialIndex = credentialIndex - 1;

ChipLogProgress(Zcl, "Lock App: LockManager::GetCredential [credentialType=%u], credentialIndex=%d",
to_underlying(credentialType), adjustedCredentialIndex);

if (credentialType == DlCredentialType::kProgrammingPIN)
{
ChipLogError(Zcl, "Programming user not supported [credentialType=%u], credentialIndex=%d", to_underlying(credentialType),
adjustedCredentialIndex);

return true;
}

const auto & credentialInStorage = mLockCredentials[adjustedCredentialIndex];

credential.status = credentialInStorage.status;
Expand Down

0 comments on commit 6e7c275

Please sign in to comment.