Skip to content

Commit 4767150

Browse files
lpbeliveau-silabspull[bot]
authored andcommitted
Bugfix Silabs LockApp (#28310)
* Updated emberAF callbacks to match the door-lock-server callbacks signatures and added Unbolt function * Fix comment grammar
1 parent b2aafa7 commit 4767150

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

examples/lock-app/silabs/include/LockManager.h

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class LockManager
145145

146146
bool Lock(chip::EndpointId endpointId, const Optional<chip::ByteSpan> & pin, OperationErrorEnum & err);
147147
bool Unlock(chip::EndpointId endpointId, const Optional<chip::ByteSpan> & pin, OperationErrorEnum & err);
148+
bool Unbolt(chip::EndpointId endpointId, const Optional<chip::ByteSpan> & pin, OperationErrorEnum & err);
148149

149150
bool GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user);
150151
bool SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier,

examples/lock-app/silabs/src/LockManager.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ bool LockManager::Unlock(chip::EndpointId endpointId, const Optional<chip::ByteS
298298
return setLockState(endpointId, DlLockState::kUnlocked, pin, err);
299299
}
300300

301+
bool LockManager::Unbolt(chip::EndpointId endpointId, const Optional<chip::ByteSpan> & pin, OperationErrorEnum & err)
302+
{
303+
return setLockState(endpointId, DlLockState::kUnlocked, pin, err);
304+
}
305+
301306
bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user)
302307
{
303308
VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed

examples/lock-app/silabs/src/ZclCallbacks.cpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
5858
*/
5959
void emberAfDoorLockClusterInitCallback(EndpointId endpoint) {}
6060

61-
bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional<ByteSpan> & pinCode,
61+
bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Nullable<chip::FabricIndex> & fabricIdx,
62+
const Nullable<chip::NodeId> & nodeId, const Optional<chip::ByteSpan> & pinCode,
6263
OperationErrorEnum & err)
6364
{
6465
ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId);
@@ -70,7 +71,8 @@ bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const O
7071
return status;
7172
}
7273

73-
bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional<ByteSpan> & pinCode,
74+
bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Nullable<chip::FabricIndex> & fabricIdx,
75+
const Nullable<chip::NodeId> & nodeId, const Optional<chip::ByteSpan> & pinCode,
7476
OperationErrorEnum & err)
7577
{
7678
ChipLogProgress(Zcl, "Door Lock App: Unlock Command endpoint=%d", endpointId);
@@ -82,6 +84,20 @@ bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const
8284

8385
return status;
8486
}
87+
// TODO : Add helper function to call from the Unlock command if we establish Unbolt doesn't need a different behaviour than Unlock
88+
bool emberAfPluginDoorLockOnDoorUnboltCommand(chip::EndpointId endpointId, const Nullable<chip::FabricIndex> & fabricIdx,
89+
const Nullable<chip::NodeId> & nodeId, const Optional<ByteSpan> & pinCode,
90+
OperationErrorEnum & err)
91+
{
92+
ChipLogProgress(Zcl, "Door Lock App: Unbolt Command endpoint=%d", endpointId);
93+
bool status = LockMgr().Unlock(endpointId, pinCode, err);
94+
if (status == true)
95+
{
96+
LockMgr().InitiateAction(AppEvent::kEventType_Lock, LockManager::UNLOCK_ACTION);
97+
}
98+
99+
return status;
100+
}
85101

86102
bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType,
87103
EmberAfPluginDoorLockCredentialInfo & credential)

0 commit comments

Comments
 (0)