diff --git a/src/app/clusters/door-lock-server/door-lock-server.h b/src/app/clusters/door-lock-server/door-lock-server.h index 9273e56ddf81da..2fca20ddfdc628 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -124,7 +124,8 @@ class DoorLockServer /** * @brief Handles a wrong code entry attempt for the endpoint. If the number of wrong entry attempts exceeds the max limit, * engage lockout. Otherwise increment the number of incorrect attempts by 1. This is handled automatically for - * remote operations - lock and unlock. Applications are responsible for calling it for non-remote incorrect credential presentation attempts. + * remote operations - lock and unlock. Applications are responsible for calling it for non-remote incorrect credential + * presentation attempts. * * @param endpointId */ diff --git a/src/app/tests/suites/DL_LockUnlock.yaml b/src/app/tests/suites/DL_LockUnlock.yaml index 9596aa4e407901..7eab03dbc63e44 100644 --- a/src/app/tests/suites/DL_LockUnlock.yaml +++ b/src/app/tests/suites/DL_LockUnlock.yaml @@ -284,6 +284,20 @@ tests: response: value: 2 + - label: "Lock the door back prior to next tests" + command: "LockDoor" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: "Verify that lock state attribute value is set to Locked" + command: "readAttribute" + attribute: "LockState" + response: + value: 1 + - label: "Try to unlock the door with invalid PIN for the first time" command: "UnlockDoor" timedInteractionTimeoutMs: 10000 diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index aad94965ef1bd6..8e396b0c1ca79b 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -78376,7 +78376,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand class DL_LockUnlockSuite : public TestCommand { public: - DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 51, credsIssuerConfig) + DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 53, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -78625,15 +78625,27 @@ class DL_LockUnlockSuite : public TestCommand } break; case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); + } break; case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78642,10 +78654,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 30: + case 32: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 31: + case 33: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78654,7 +78666,7 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 32: + case 34: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { uint8_t value; @@ -78662,26 +78674,26 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 10U)); } break; - case 33: + case 35: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 34: + case 36: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 35: + case 37: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 36: + case 38: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 37: + case 39: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 38: + case 40: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 39: + case 41: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78690,10 +78702,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 40: + case 42: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 41: + case 43: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; @@ -78705,10 +78717,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); } break; - case 42: + case 44: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 43: + case 45: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78717,10 +78729,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 44: + case 46: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 45: + case 47: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78729,10 +78741,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 46: + case 48: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 47: + case 49: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78741,10 +78753,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 48: + case 50: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 49: + case 51: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -78753,7 +78765,7 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 50: + case 52: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; default: @@ -79002,7 +79014,23 @@ class DL_LockUnlockSuite : public TestCommand chip::NullOptional); } case 26: { - LogStep(26, "Try to unlock the door with invalid PIN for the first time"); + LogStep(26, "Lock the door back prior to next tests"); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 27: { + LogStep(27, "Verify that lock state attribute value is set to Locked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, + chip::NullOptional); + } + case 28: { + LogStep(28, "Try to unlock the door with invalid PIN for the first time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79012,8 +79040,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 27: { - LogStep(27, "Try to unlock the door with invalid PIN for the second time"); + case 29: { + LogStep(29, "Try to unlock the door with invalid PIN for the second time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79023,8 +79051,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 28: { - LogStep(28, "Try to unlock the door with valid PIN for the third time"); + case 30: { + LogStep(30, "Try to unlock the door with valid PIN for the third time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79034,13 +79062,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 29: { - LogStep(29, "Verify that lock state attribute value is set to Unlocked"); + case 31: { + LogStep(31, "Verify that lock state attribute value is set to Unlocked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 30: { - LogStep(30, "Lock the door back prior to next tests"); + case 32: { + LogStep(32, "Lock the door back prior to next tests"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -79050,18 +79078,18 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 31: { - LogStep(31, "Verify that lock state attribute value is set to Locked"); + case 33: { + LogStep(33, "Verify that lock state attribute value is set to Locked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 32: { - LogStep(32, "Read the lockout timeout"); + case 34: { + LogStep(34, "Read the lockout timeout"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); } - case 33: { - LogStep(33, "Try to unlock the door with invalid PIN for the first time"); + case 35: { + LogStep(35, "Try to unlock the door with invalid PIN for the first time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79071,8 +79099,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 34: { - LogStep(34, "Try to unlock the door with invalid PIN for the second time"); + case 36: { + LogStep(36, "Try to unlock the door with invalid PIN for the second time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79082,8 +79110,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 35: { - LogStep(35, "Try to unlock the door with invalid PIN for the third time"); + case 37: { + LogStep(37, "Try to unlock the door with invalid PIN for the third time"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79093,8 +79121,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 36: { - LogStep(36, "Try to unlock the door with valid PIN and make sure it fails due to lockout"); + case 38: { + LogStep(38, "Try to unlock the door with valid PIN and make sure it fails due to lockout"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79104,15 +79132,15 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 37: { - LogStep(37, "Wait for the lockout to end"); + case 39: { + LogStep(39, "Wait for the lockout to end"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; value.ms = 10000UL; return WaitForMs(kIdentityAlpha, value); } - case 38: { - LogStep(38, "Try to unlock the door with valid PIN and make sure it succeeds"); + case 40: { + LogStep(40, "Try to unlock the door with valid PIN and make sure it succeeds"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79122,13 +79150,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 39: { - LogStep(39, "Verify that lock state attribute value is set to Unlocked"); + case 41: { + LogStep(41, "Verify that lock state attribute value is set to Unlocked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 40: { - LogStep(40, "Lock the door back prior to next tests"); + case 42: { + LogStep(42, "Lock the door back prior to next tests"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -79138,8 +79166,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 41: { - LogStep(41, "Create a disabled user and credential"); + case 43: { + LogStep(43, "Create a disabled user and credential"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; value.operationType = static_cast(0); @@ -79157,8 +79185,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 42: { - LogStep(42, "Try to unlock the door with disabled user PIN"); + case 44: { + LogStep(44, "Try to unlock the door with disabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79168,13 +79196,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 43: { - LogStep(43, "Verify that lock state attribute value is set to Locked"); + case 45: { + LogStep(45, "Verify that lock state attribute value is set to Locked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 44: { - LogStep(44, "Unlock the door with enabled user PIN"); + case 46: { + LogStep(46, "Unlock the door with enabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -79184,13 +79212,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 45: { - LogStep(45, "Verify that lock state attribute value is set to Unlocked"); + case 47: { + LogStep(47, "Verify that lock state attribute value is set to Unlocked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 46: { - LogStep(46, "Try to lock the door with disabled user PIN"); + case 48: { + LogStep(48, "Try to lock the door with disabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -79200,13 +79228,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 47: { - LogStep(47, "Verify that lock state attribute value stays Unlocked"); + case 49: { + LogStep(49, "Verify that lock state attribute value stays Unlocked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 48: { - LogStep(48, "Lock the door with enabled user PIN"); + case 50: { + LogStep(50, "Lock the door with enabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -79216,13 +79244,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 49: { - LogStep(49, "Verify that lock state attribute value is set to Locked"); + case 51: { + LogStep(51, "Verify that lock state attribute value is set to Locked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 50: { - LogStep(50, "Clean all the users and credentials"); + case 52: { + LogStep(52, "Clean all the users and credentials"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; value.userIndex = 65534U;