diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 9b21708f7d5038..1ba1bd52fcdaef 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -504,10 +504,7 @@ void AppTask::LockStateChanged(BoltLockManager::State state, BoltLockManager::Op break; } - if (source != BoltLockManager::OperationSource::kRemote) - { - sAppTask.UpdateClusterState(state, source); - } + sAppTask.UpdateClusterState(state, source); } void AppTask::PostEvent(AppEvent * aEvent) diff --git a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp index ccb5526344f05c..3b737aa2b472f6 100644 --- a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp +++ b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp @@ -77,12 +77,28 @@ bool emberAfPluginDoorLockSetCredential(EndpointId endpointId, uint16_t credenti bool emberAfPluginDoorLockOnDoorLockCommand(EndpointId endpointId, const Optional & pinCode, DlOperationError & err) { - return BoltLockMgr().ValidatePIN(pinCode, err); + bool result = BoltLockMgr().ValidatePIN(pinCode, err); + + /* Handle changing attribute state on command reception */ + if (result) + { + BoltLockMgr().Lock(BoltLockManager::OperationSource::kRemote); + } + + return result; } bool emberAfPluginDoorLockOnDoorUnlockCommand(EndpointId endpointId, const Optional & pinCode, DlOperationError & err) { - return BoltLockMgr().ValidatePIN(pinCode, err); + bool result = BoltLockMgr().ValidatePIN(pinCode, err); + + /* Handle changing attribute state on command reception */ + if (result) + { + BoltLockMgr().Unlock(BoltLockManager::OperationSource::kRemote); + } + + return result; } void emberAfDoorLockClusterInitCallback(EndpointId endpoint)