Skip to content

Commit

Permalink
Properly handle Aliro credential validation in door lock server (#31932)
Browse files Browse the repository at this point in the history
* Handle Aliro credential in door lock server

* Restyled by clang-format (#31933)

Co-authored-by: Restyled.io <[email protected]>

* Update src/app/clusters/door-lock-server/door-lock-server.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

* Restyled by clang-format (#31935)

Co-authored-by: Restyled.io <[email protected]>

* Update constant name from git chage

* Update to use SupportsAliroProvisioning API

---------

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
4 people authored and pull[bot] committed Apr 11, 2024
1 parent 64883ba commit 1039126
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ using namespace chip::app::Clusters::DoorLock;
using namespace chip::app::Clusters::DoorLock::Attributes;
using chip::Protocols::InteractionModel::Status;

static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_HOUR = 23;
static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_MINUTE = 59;
static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_HOUR = 23;
static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_MINUTE = 59;
static constexpr uint8_t DOOR_LOCK_ALIRO_CREDENTIAL_SIZE = 65;

static constexpr uint32_t DOOR_LOCK_MAX_LOCK_TIMEOUT_SEC = MAX_INT32U_VALUE / MILLISECOND_TICKS_PER_SECOND;

Expand Down Expand Up @@ -1556,6 +1557,11 @@ DlStatus DoorLockServer::credentialLengthWithinRange(chip::EndpointId endpointId
case CredentialTypeEnum::kFace:
statusMin = statusMax = emberAfPluginDoorLockGetFaceCredentialLengthConstraints(endpointId, minLen, maxLen);
break;
case CredentialTypeEnum::kAliroCredentialIssuerKey:
case CredentialTypeEnum::kAliroEvictableEndpointKey:
case CredentialTypeEnum::kAliroNonEvictableEndpointKey:
minLen = maxLen = DOOR_LOCK_ALIRO_CREDENTIAL_SIZE;
break;
default:
return DlStatus::kFailure;
}
Expand Down Expand Up @@ -2555,6 +2561,10 @@ bool DoorLockServer::credentialTypeSupported(chip::EndpointId endpointId, Creden
return SupportsFingers(endpointId);
case CredentialTypeEnum::kFace:
return SupportsFace(endpointId);
case CredentialTypeEnum::kAliroEvictableEndpointKey:
case CredentialTypeEnum::kAliroCredentialIssuerKey:
case CredentialTypeEnum::kAliroNonEvictableEndpointKey:
return SupportsAliroProvisioning(endpointId);
default:
return false;
}
Expand Down

0 comments on commit 1039126

Please sign in to comment.