Skip to content

Commit

Permalink
Implement users and credentials in the Door Lock Cluster (#13789)
Browse files Browse the repository at this point in the history
* Make nextUserIndex nullable in Door Lock as it is required by spec.

* Initial implementation of Get/Set/Clear User command.

* Refactor User-related commands in Door Lock Cluster

* Minor tweaks in commands logging, add todos for events.

* Properly handle nullable command arguments in chip-tool

* Make more door lock command arguments nullable

* Add placeholder implementation for the set credential command

* Add missing argument to SetCredential command in Door Lock CLuster

* Add basic SetCredential handler for Door Lock cluster.

* Add YAML tests for Door Lock cluster (users/credentials)

* Adjust underlying data structures for sample Door Lock credentials manager.

* Move command handler to the door lock server class

* A touch of clean-up in the Door Lock Server.

* Add features bitmap to the Door Lock Cluster.

* Implement GetCredentialStatus command in Door Lock Cluster.

* Fix the door lock cluster feature checks.

* Small refactoring of GetCredentialStatus.

* Enable RFID attributes in the all-clusters app for now.

* Refactor SetCredential command.

* Replace unnecessary parameters in the user management of the door lock.

* Reorder door lock server functions.

Fix compiler errors

* Check credential data range

* Add documentation for application callbacks related to user management in Door Lock cluster.

* Use Span for username and credentials.

* Implement ability to modify credentials.

* Change ZAP files for door lock app to include all necessary features

* Don't use 'using namespace' in header files

* Move users/credential database implementation to the door-lock-app.

* Remove debug prints in the door lock cluster.

* Add more verbose logging to the door lock app.

* Make door-lock XML compliant to spec

* Add clear credential command

* Update door lock test suite to excercise ClearCredential command

* Add Lock User Change event to Door Lock Cluster

* Use credentials instead of hard-coded PIN when operating the lock

* Support programming PIN

* Refactor SetCredential command handler

* Temporary make credential parameter in clearCredential command nullable to avoid generator errors

* Bring back definition to make ESP32 builds work again

* Fix format strings and leave out clearCredential logic that is not longer supported

* Use appropriate format strings for logging in door lock cluster.

* Add implicit casts when adding uint16_t variables to make compiler happy

* Temporally ignore Door Lock tests when starting all test.
- This is done to avoid fixing github actions for now.
- I would like to address the github stuff as a separate fix.

* Fix logging types in the door lock app

* Fix styling issues

* Clear the associated credentials when clearing the user

* Make argument in ClearCredential command nullable again because recent changes improved the ZAP generator

* Update auto-generated files
  • Loading branch information
Morozov-5F authored Jan 27, 2022
1 parent 955e3b4 commit e49d9ca
Show file tree
Hide file tree
Showing 47 changed files with 12,419 additions and 748 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -756,11 +756,6 @@ server cluster DoorLock = 257 {
kModify = 2;
}

enum DlDoorLockStatus : ENUM8 {
kDuplicate = 2;
kOccupied = 3;
}

enum DlDoorState : ENUM8 {
kDoorOpen = 0;
kDoorClosed = 1;
Expand Down Expand Up @@ -968,11 +963,14 @@ server cluster DoorLock = 257 {
attribute int16u openPeriod = 6;
readonly attribute int16u numberOfTotalUsersSupported = 17;
readonly attribute int16u numberOfPINUsersSupported = 18;
readonly attribute int16u numberOfRFIDUsersSupported = 19;
readonly attribute int16u numberOfWeekDaySchedulesSupportedPerUser = 20;
readonly attribute int16u numberOfYearDaySchedulesSupportedPerUser = 21;
readonly attribute int16u numberOfHolidaySchedulesSupported = 22;
readonly attribute int8u maxPINCodeLength = 23;
readonly attribute int8u minPINCodeLength = 24;
readonly attribute int8u maxRFIDCodeLength = 25;
readonly attribute int8u minRFIDCodeLength = 26;
readonly attribute bitmap8 credentialRulesSupport = 27;
attribute char_string<3> language = 33;
attribute int32u autoRelockTime = 35;
Expand All @@ -986,10 +984,11 @@ server cluster DoorLock = 257 {
attribute int8u wrongCodeEntryLimit = 48;
attribute int8u userCodeTemporaryDisableTime = 49;
attribute boolean requirePINforRemoteOperation = 51;
readonly global attribute bitmap32 featureMap = 65532;
readonly global attribute int16u clusterRevision = 65533;

request struct ClearCredentialRequest {
DlCredential credential = 0;
nullable DlCredential credential = 0;
}

request struct ClearUserRequest {
Expand All @@ -1012,18 +1011,19 @@ server cluster DoorLock = 257 {
DlDataOperationType operationType = 0;
DlCredential credential = 1;
LONG_OCTET_STRING credentialData = 2;
INT16U userIndex = 3;
DlUserStatus userStatus = 4;
nullable INT16U userIndex = 3;
nullable DlUserStatus userStatus = 4;
nullable DlUserType userType = 5;
}

request struct SetUserRequest {
DlDataOperationType operationType = 0;
INT16U userIndex = 1;
nullable CHAR_STRING userName = 2;
nullable INT32U userUniqueId = 3;
DlUserStatus userStatus = 4;
DlUserType userType = 5;
DlCredentialRule credentialRule = 6;
nullable DlUserStatus userStatus = 4;
nullable DlUserType userType = 5;
nullable DlCredentialRule credentialRule = 6;
}

request struct UnlockDoorRequest {
Expand All @@ -1046,7 +1046,7 @@ server cluster DoorLock = 257 {
nullable DlCredential credentials[] = 6;
nullable fabric_idx creatorFabricIndex = 7;
nullable fabric_idx lastModifiedFabricIndex = 8;
INT16U nextUserIndex = 9;
nullable INT16U nextUserIndex = 9;
}

response struct SetCredentialResponse {
Expand Down
Loading

0 comments on commit e49d9ca

Please sign in to comment.