Skip to content

Commit

Permalink
Generate LockUserChange events when clearing a credential.
Browse files Browse the repository at this point in the history
We were passing false for sendUserChangeEvent at all callsites of
clearCredential(), which is not correct for the "clear a single credential"
case.  The other cases generate their own LockUserChange events.
  • Loading branch information
bzbarsky-apple committed Jun 7, 2024
1 parent d84f13e commit 0ec10da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ void DoorLockServer::clearCredentialCommandHandler(
}

commandObj->AddStatus(commandPath,
clearCredential(commandPath.mEndpointId, modifier, sourceNodeId, credentialType, credentialIndex, false));
clearCredential(commandPath.mEndpointId, modifier, sourceNodeId, credentialType, credentialIndex, true));
}

void DoorLockServer::setWeekDayScheduleCommandHandler(chip::app::CommandHandler * commandObj,
Expand Down
16 changes: 16 additions & 0 deletions src/app/tests/suites/DL_UsersAndCredentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,22 @@ tests:
- name: "NextUserIndex"
value: 2

- label: "Make sure a LockUserChange event was generated"
command: "readEvent"
event: "LockUserChange"
# I wish there were a way to not hardcode this 25, but it's experimentally
# determined: doing a read without an eventNumber filter here shows 24
# LockUserChange events before this removal.
eventNumber: 25
response:
value: {
LockDataType: LockDataTypeEnum.PIN,
DataOperationType: DataOperationTypeEnum.Clear,
OperationSource: OperationSourceEnum.Remote,
UserIndex: 1,
DataIndex: 1,
}

- label: "Clear the second PIN credential"
command: "ClearCredential"
timedInteractionTimeoutMs: 10000
Expand Down

0 comments on commit 0ec10da

Please sign in to comment.