diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 98bff77d169c2f..1a8b5bb84ecefa 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -29,6 +29,7 @@ "Test_TC_ACL_2_7", "Test_TC_ACL_2_8", "Test_TC_ACL_2_9", - "Test_TC_ACL_2_10" + "Test_TC_ACL_2_10", + "DL_LockUnlock" ] } diff --git a/src/app/tests/suites/DL_LockUnlock.yaml b/src/app/tests/suites/DL_LockUnlock.yaml index fbaf6d97bc226b..d9b4f4a300e4b6 100644 --- a/src/app/tests/suites/DL_LockUnlock.yaml +++ b/src/app/tests/suites/DL_LockUnlock.yaml @@ -18,6 +18,7 @@ config: nodeId: 0x12344321 cluster: "Door Lock" endpoint: 1 + timeout: 15 tests: - label: "Wait for the commissioned device to be retrieved" @@ -48,7 +49,29 @@ tests: response: value: 1 - - label: "Create new PIN credential and lock/unlock user" + - label: "Create new lock/unlock user" + command: "SetUser" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "xxx" + - name: "UserUniqueID" + value: 6452 + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + + - label: + "Create new PIN credential and associate it with lock/unlock user, + with userIndex != credentialIndex" command: "SetCredential" timedInteractionTimeoutMs: 10000 arguments: @@ -56,11 +79,11 @@ tests: - name: "OperationType" value: 0 - name: "Credential" - value: { CredentialType: 1, CredentialIndex: 1 } + value: { CredentialType: 1, CredentialIndex: 2 } - name: "CredentialData" value: "123456" - name: "UserIndex" - value: null + value: 1 - name: "UserStatus" value: null - name: "UserType" @@ -70,9 +93,9 @@ tests: - name: "Status" value: 0x00 - name: "UserIndex" - value: 1 + value: null - name: "NextCredentialIndex" - value: 2 + value: 3 - label: "Set the WrongCodeEntryLimit to big value so that we can test @@ -106,6 +129,36 @@ tests: - name: "PINCode" value: "123456" + - label: "Read the LockOperation event list" + command: "readEvent" + event: "LockOperation" + response: + - values: + - value: + { + "LockOperationType": 1, + "OperationSource": 7, + "UserIndex": null, + "Credentials": null, + } + - values: + - value: + { + "LockOperationType": 0, + "OperationSource": 7, + "UserIndex": null, + "Credentials": null, + } + - values: + - value: + { + "LockOperationType": 1, + "OperationSource": 7, + "UserIndex": 1, + "Credentials": + [{ "CredentialType": 1, "CredentialIndex": 2 }], + } + - label: "Verify that lock state attribute value is set to Unlocked" command: "readAttribute" attribute: "LockState" @@ -122,6 +175,31 @@ tests: response: error: FAILURE + - label: + "Read the LockOperationError event list; verify null UserIndex and + Credentials" + command: "readEvent" + event: "LockOperationError" + response: + - values: + - value: + { + "LockOperationType": 1, + "OperationSource": 7, + "OperationError": 1, + "UserIndex": null, + "Credentials": null, + } + - values: + - value: + { + "LockOperationType": 0, + "OperationSource": 7, + "OperationError": 1, + "UserIndex": null, + "Credentials": null, + } + - label: "Verify that lock state attribute value is set to Unlocked" command: "readAttribute" attribute: "LockState" @@ -254,7 +332,7 @@ tests: - name: "OperationType" value: 0 - name: "Credential" - value: { CredentialType: 1, CredentialIndex: 2 } + value: { CredentialType: 1, CredentialIndex: 3 } - name: "CredentialData" value: "654321" - name: "UserIndex" @@ -270,7 +348,7 @@ tests: - name: "UserIndex" value: 2 - name: "NextCredentialIndex" - value: 3 + value: 4 - label: "Try to unlock the door with disabled user PIN" command: "UnlockDoor" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 3da7d17159721e..5ab74d47019bee 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -77763,7 +77763,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand class DL_LockUnlockSuite : public TestCommand { public: - DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 38, credsIssuerConfig) + DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 41, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -77773,10 +77773,7 @@ class DL_LockUnlockSuite : public TestCommand ~DL_LockUnlockSuite() {} - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(15)); } private: chip::Optional mNodeId; @@ -77825,24 +77822,26 @@ class DL_LockUnlockSuite : public TestCommand } break; case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); } break; - case 6: + case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: + case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 8: + case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77851,10 +77850,69 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 9: + case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: + case 11: + switch (mTestSubStepIndex) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 1U)); + VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); + VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); + VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); + VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); + } + mTestSubStepIndex++; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 0U)); + VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); + VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); + VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); + VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); + } + mTestSubStepIndex++; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 1U)); + VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); + VerifyOrReturn(CheckValueNonNull("lockOperation.userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("lockOperation.userIndex.Value()", value.userIndex.Value(), 1U)); + VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); + VerifyOrReturn(CheckValueNonNull("lockOperation.credentials.Value()", value.credentials.Value())); + { + auto iter_3 = value.credentials.Value().Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "lockOperation.credentials.Value().Value()", iter_3, 0)); + VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialType", + iter_3.GetValue().credentialType, 1U)); + VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialIndex", + iter_3.GetValue().credentialIndex, 2U)); + VerifyOrReturn(CheckNoMoreListItems( + "lockOperation.credentials.Value().Value()", iter_3, 1)); + } + } + mTestSubStepIndex++; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + break; + } + break; + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77863,10 +77921,46 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 11: + case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 12: + case 14: + switch (mTestSubStepIndex) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Events::LockOperationError::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("lockOperationError.lockOperationType", value.lockOperationType, 1U)); + VerifyOrReturn(CheckValue("lockOperationError.operationSource", value.operationSource, 7U)); + VerifyOrReturn(CheckValue("lockOperationError.operationError", value.operationError, 1U)); + VerifyOrReturn(CheckValueNull("lockOperationError.userIndex", value.userIndex)); + VerifyOrReturn(CheckValuePresent("lockOperationError.credentials", value.credentials)); + VerifyOrReturn(CheckValueNull("lockOperationError.credentials.Value()", value.credentials.Value())); + } + mTestSubStepIndex++; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Events::LockOperationError::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("lockOperationError.lockOperationType", value.lockOperationType, 0U)); + VerifyOrReturn(CheckValue("lockOperationError.operationSource", value.operationSource, 7U)); + VerifyOrReturn(CheckValue("lockOperationError.operationError", value.operationError, 1U)); + VerifyOrReturn(CheckValueNull("lockOperationError.userIndex", value.userIndex)); + VerifyOrReturn(CheckValuePresent("lockOperationError.credentials", value.credentials)); + VerifyOrReturn(CheckValueNull("lockOperationError.credentials.Value()", value.credentials.Value())); + } + mTestSubStepIndex++; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + break; + } + break; + case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77875,10 +77969,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 13: + case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 14: + case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77887,16 +77981,16 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 15: + case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 16: + case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 17: + case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 18: + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { uint8_t value; @@ -77904,29 +77998,29 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 10U)); } break; - case 19: + case 22: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 20: + case 23: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 21: + case 24: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 22: + case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 23: + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 24: + case 27: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 25: + case 28: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 26: + case 29: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77935,10 +78029,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 27: + case 30: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 28: + case 31: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; @@ -77947,13 +78041,13 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); } break; - case 29: + case 32: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 30: + case 33: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77962,10 +78056,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 31: + case 34: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 32: + case 35: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77974,10 +78068,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 33: + case 36: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 34: + case 37: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77986,10 +78080,10 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); } break; - case 35: + case 38: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 36: + case 39: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -77998,7 +78092,7 @@ class DL_LockUnlockSuite : public TestCommand VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); } break; - case 37: + case 40: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; default: @@ -78052,16 +78146,38 @@ class DL_LockUnlockSuite : public TestCommand chip::NullOptional); } case 5: { - LogStep(5, "Create new PIN credential and lock/unlock user"); + LogStep(5, "Create new lock/unlock user"); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 1U; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("xxxgarbage: not in length on purpose", 3); + value.userUniqueID.SetNonNull(); + value.userUniqueID.Value() = 6452UL; + value.userStatus.SetNonNull(); + value.userStatus.Value() = static_cast(1); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(0); + value.credentialRule.SetNonNull(); + value.credentialRule.Value() = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Create new PIN credential and associate it with lock/unlock user, with userIndex != credentialIndex"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; value.operationType = static_cast(0); value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; + value.credential.credentialIndex = 2U; value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; value.userStatus.SetNull(); value.userType.SetNull(); return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, @@ -78069,16 +78185,16 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 6: { - LogStep(6, "Set the WrongCodeEntryLimit to big value so that we can test incorrect PIN entry"); + case 7: { + LogStep(7, "Set the WrongCodeEntryLimit to big value so that we can test incorrect PIN entry"); ListFreer listFreer; uint8_t value; value = 20U; return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, value, chip::NullOptional, chip::NullOptional); } - case 7: { - LogStep(7, "Try to unlock the door with invalid PIN"); + case 8: { + LogStep(8, "Try to unlock the door with invalid PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -78088,13 +78204,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 8: { - LogStep(8, "Verify that lock state attribute value is set to Locked"); + case 9: { + LogStep(9, "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 9: { - LogStep(9, "Try to unlock the door with valid PIN"); + case 10: { + LogStep(10, "Try to unlock the door with valid PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -78104,13 +78220,19 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 10: { - LogStep(10, "Verify that lock state attribute value is set to Unlocked"); + case 11: { + LogStep(11, "Read the LockOperation event list"); + mTestSubStepCount = 3; + return ReadEvent(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Events::LockOperation::Id, false, + chip::NullOptional); + } + case 12: { + LogStep(12, "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 11: { - LogStep(11, "Try to lock the door with invalid PIN"); + case 13: { + LogStep(13, "Try to lock the door with invalid PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -78120,13 +78242,19 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 12: { - LogStep(12, "Verify that lock state attribute value is set to Unlocked"); + case 14: { + LogStep(14, "Read the LockOperationError event list; verify null UserIndex and Credentials"); + mTestSubStepCount = 2; + return ReadEvent(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Events::LockOperationError::Id, false, + chip::NullOptional); + } + case 15: { + LogStep(15, "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 13: { - LogStep(13, "Try to lock the door with valid PIN"); + case 16: { + LogStep(16, "Try to lock the door with valid PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -78136,21 +78264,21 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 14: { - LogStep(14, "Verify that lock state attribute value is set to Locked"); + case 17: { + LogStep(17, "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 15: { - LogStep(15, "Set OperatingMode to NoRemoteLockUnlock"); + case 18: { + LogStep(18, "Set OperatingMode to NoRemoteLockUnlock"); ListFreer listFreer; chip::app::Clusters::DoorLock::OperatingModeEnum value; value = static_cast(3); return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::OperatingMode::Id, value, chip::NullOptional, chip::NullOptional); } - case 16: { - LogStep(16, "Try to unlock the door when OperatingMode is NoRemoteLockUnlock"); + case 19: { + LogStep(19, "Try to unlock the door when OperatingMode is NoRemoteLockUnlock"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, @@ -78158,29 +78286,29 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 17: { - LogStep(17, "Set OperatingMode to Normal"); + case 20: { + LogStep(20, "Set OperatingMode to Normal"); ListFreer listFreer; chip::app::Clusters::DoorLock::OperatingModeEnum value; value = static_cast(0); return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::OperatingMode::Id, value, chip::NullOptional, chip::NullOptional); } - case 18: { - LogStep(18, "Read the lockout timeout"); + case 21: { + LogStep(21, "Read the lockout timeout"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); } - case 19: { - LogStep(19, "Set the WrongCodeEntryLimit to small value so we can test lockout"); + case 22: { + LogStep(22, "Set the WrongCodeEntryLimit to small value so we can test lockout"); ListFreer listFreer; uint8_t value; value = 3U; return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, value, chip::NullOptional, chip::NullOptional); } - case 20: { - LogStep(20, "Try to unlock the door with invalid PIN for the first time"); + case 23: { + LogStep(23, "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(); @@ -78190,8 +78318,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 21: { - LogStep(21, "Try to unlock the door with invalid PIN for the second time"); + case 24: { + LogStep(24, "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(); @@ -78201,8 +78329,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 22: { - LogStep(22, "Try to unlock the door with invalid PIN for the third time"); + case 25: { + LogStep(25, "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(); @@ -78212,8 +78340,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 23: { - LogStep(23, "Try to unlock the door with valid PIN and make sure it fails due to lockout"); + case 26: { + LogStep(26, "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(); @@ -78223,15 +78351,15 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 24: { - LogStep(24, "Wait for the lockout to end"); + case 27: { + LogStep(27, "Wait for the lockout to end"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; value.ms = 10000UL; return WaitForMs(kIdentityAlpha, value); } - case 25: { - LogStep(25, "Try to unlock the door with valid PIN and make sure it succeeds"); + case 28: { + LogStep(28, "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(); @@ -78241,13 +78369,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 26: { - LogStep(26, "Verify that lock state attribute value is set to Unlocked"); + case 29: { + LogStep(29, "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 27: { - LogStep(27, "Lock the door back prior to next tests"); + case 30: { + LogStep(30, "Lock the door back prior to next tests"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -78257,14 +78385,14 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 28: { - LogStep(28, "Create a disabled user and credential"); + case 31: { + LogStep(31, "Create a disabled user and credential"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; value.operationType = static_cast(0); value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; + value.credential.credentialIndex = 3U; value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); value.userIndex.SetNull(); @@ -78276,8 +78404,8 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 29: { - LogStep(29, "Try to unlock the door with disabled user PIN"); + case 32: { + LogStep(32, "Try to unlock the door with disabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -78287,13 +78415,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 30: { - LogStep(30, "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 31: { - LogStep(31, "Unlock the door with enabled user PIN"); + case 34: { + LogStep(34, "Unlock the door with enabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; value.PINCode.Emplace(); @@ -78303,13 +78431,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 32: { - LogStep(32, "Verify that lock state attribute value is set to Unlocked"); + case 35: { + LogStep(35, "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 33: { - LogStep(33, "Try to lock the door with disabled user PIN"); + case 36: { + LogStep(36, "Try to lock the door with disabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -78319,13 +78447,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 34: { - LogStep(34, "Verify that lock state attribute value stays Unlocked"); + case 37: { + LogStep(37, "Verify that lock state attribute value stays Unlocked"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, chip::NullOptional); } - case 35: { - LogStep(35, "Lock the door with enabled user PIN"); + case 38: { + LogStep(38, "Lock the door with enabled user PIN"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; value.PINCode.Emplace(); @@ -78335,13 +78463,13 @@ class DL_LockUnlockSuite : public TestCommand ); } - case 36: { - LogStep(36, "Verify that lock state attribute value is set to Locked"); + case 39: { + LogStep(39, "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 37: { - LogStep(37, "Clean all the users and credentials"); + case 40: { + LogStep(40, "Clean all the users and credentials"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; value.userIndex = 65534U; diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index f5aab183be8509..9cb0ad902e8039 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -230,7 +230,6 @@ class TestList : public Command { printf("TestSubscribe_OnOff\n"); printf("TestSubscribe_AdministratorCommissioning\n"); printf("DL_UsersAndCredentials\n"); - printf("DL_LockUnlock\n"); printf("DL_Schedules\n"); printf("Test_TC_DRLK_1_1\n"); printf("Test_TC_DRLK_2_2\n"); @@ -116724,1232 +116723,6 @@ class DL_UsersAndCredentials : public TestCommandBridge { } }; -class DL_LockUnlock : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - DL_LockUnlock() - : TestCommandBridge("DL_LockUnlock") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~DL_LockUnlock() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: DL_LockUnlock\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: DL_LockUnlock\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Try to unlock the door without PIN\n"); - err = TestTryToUnlockTheDoorWithoutPin_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Try to lock the door without a PIN\n"); - err = TestTryToLockTheDoorWithoutAPin_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Create new PIN credential and lock/unlock user\n"); - err = TestCreateNewPinCredentialAndLockUnlockUser_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Set the WrongCodeEntryLimit to big value so that we can test incorrect PIN entry\n"); - err = TestSetTheWrongCodeEntryLimitToBigValueSoThatWeCanTestIncorrectPinEntry_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Try to unlock the door with invalid PIN\n"); - err = TestTryToUnlockTheDoorWithInvalidPin_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Try to unlock the door with valid PIN\n"); - err = TestTryToUnlockTheDoorWithValidPin_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Try to lock the door with invalid PIN\n"); - err = TestTryToLockTheDoorWithInvalidPin_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Try to lock the door with valid PIN\n"); - err = TestTryToLockTheDoorWithValidPin_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Set OperatingMode to NoRemoteLockUnlock\n"); - err = TestSetOperatingModeToNoRemoteLockUnlock_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Try to unlock the door when OperatingMode is NoRemoteLockUnlock\n"); - err = TestTryToUnlockTheDoorWhenOperatingModeIsNoRemoteLockUnlock_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Set OperatingMode to Normal\n"); - err = TestSetOperatingModeToNormal_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read the lockout timeout\n"); - err = TestReadTheLockoutTimeout_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Set the WrongCodeEntryLimit to small value so we can test lockout\n"); - err = TestSetTheWrongCodeEntryLimitToSmallValueSoWeCanTestLockout_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Try to unlock the door with invalid PIN for the first time\n"); - err = TestTryToUnlockTheDoorWithInvalidPinForTheFirstTime_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Try to unlock the door with invalid PIN for the second time\n"); - err = TestTryToUnlockTheDoorWithInvalidPinForTheSecondTime_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Try to unlock the door with invalid PIN for the third time\n"); - err = TestTryToUnlockTheDoorWithInvalidPinForTheThirdTime_22(); - break; - case 23: - ChipLogProgress( - chipTool, " ***** Test Step 23 : Try to unlock the door with valid PIN and make sure it fails due to lockout\n"); - err = TestTryToUnlockTheDoorWithValidPinAndMakeSureItFailsDueToLockout_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Wait for the lockout to end\n"); - err = TestWaitForTheLockoutToEnd_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Try to unlock the door with valid PIN and make sure it succeeds\n"); - err = TestTryToUnlockTheDoorWithValidPinAndMakeSureItSucceeds_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Lock the door back prior to next tests\n"); - err = TestLockTheDoorBackPriorToNextTests_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Create a disabled user and credential\n"); - err = TestCreateADisabledUserAndCredential_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Try to unlock the door with disabled user PIN\n"); - err = TestTryToUnlockTheDoorWithDisabledUserPin_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Unlock the door with enabled user PIN\n"); - err = TestUnlockTheDoorWithEnabledUserPin_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Try to lock the door with disabled user PIN\n"); - err = TestTryToLockTheDoorWithDisabledUserPin_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Verify that lock state attribute value stays Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueStaysUnlocked_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Lock the door with enabled user PIN\n"); - err = TestLockTheDoorWithEnabledUserPin_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Clean all the users and credentials\n"); - err = TestCleanAllTheUsersAndCredentials_37(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 38; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestTryToUnlockTheDoorWithoutPin_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door without PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToLockTheDoorWithoutAPin_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to lock the door without a PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Locked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = nil; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Create new PIN credential and lock/unlock user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestSetTheWrongCodeEntryLimitToBigValueSoThatWeCanTestIncorrectPinEntry_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:20U]; - [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Set the WrongCodeEntryLimit to big value so that we can test " - @"incorrect PIN entry Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithInvalidPin_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"000000" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with invalid PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Locked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithValidPin_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with valid PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToLockTheDoorWithInvalidPin_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"000000" length:6]; - [cluster - lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to lock the door with invalid PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_12() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToLockTheDoorWithValidPin_13() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to lock the door with valid PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Locked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestSetOperatingModeToNoRemoteLockUnlock_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id operatingModeArgument; - operatingModeArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeOperatingModeWithValue:operatingModeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Set OperatingMode to NoRemoteLockUnlock Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWhenOperatingModeIsNoRemoteLockUnlock_16() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door when OperatingMode is NoRemoteLockUnlock Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestSetOperatingModeToNormal_17() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id operatingModeArgument; - operatingModeArgument = [NSNumber numberWithUnsignedChar:0U]; - [cluster writeAttributeOperatingModeWithValue:operatingModeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"Set OperatingMode to Normal Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheLockoutTimeout_18() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the lockout timeout Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("UserCodeTemporaryDisableTime", actualValue, 10U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestSetTheWrongCodeEntryLimitToSmallValueSoWeCanTestLockout_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id wrongCodeEntryLimitArgument; - wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; - [cluster - writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument - completion:^(NSError * _Nullable err) { - NSLog( - @"Set the WrongCodeEntryLimit to small value so we can test lockout Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithInvalidPinForTheFirstTime_20() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"000000" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with invalid PIN for the first time Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithInvalidPinForTheSecondTime_21() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"000000" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with invalid PIN for the second time Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithInvalidPinForTheThirdTime_22() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"000000" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with invalid PIN for the third time Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithValidPinAndMakeSureItFailsDueToLockout_23() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with valid PIN and make sure it fails due to lockout Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForTheLockoutToEnd_24() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestTryToUnlockTheDoorWithValidPinAndMakeSureItSucceeds_25() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with valid PIN and make sure it succeeds Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_26() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLockTheDoorBackPriorToNextTests_27() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Lock the door back prior to next tests Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCreateADisabledUserAndCredential_28() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; - - params.credentialData = [[NSData alloc] initWithBytes:"654321" length:6]; - params.userIndex = nil; - params.userStatus = [NSNumber numberWithUnsignedChar:3U]; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Create a disabled user and credential Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); - } - - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 3U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToUnlockTheDoorWithDisabledUserPin_29() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"654321" length:6]; - [cluster - unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to unlock the door with disabled user PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_30() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Locked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestUnlockTheDoorWithEnabledUserPin_31() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster unlockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Unlock the door with enabled user PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_32() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestTryToLockTheDoorWithDisabledUserPin_33() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"654321" length:6]; - [cluster - lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Try to lock the door with disabled user PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueStaysUnlocked_34() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value stays Unlocked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 2U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestLockTheDoorWithEnabledUserPin_35() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; - params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; - [cluster lockDoorWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Lock the door with enabled user PIN Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_36() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify that lock state attribute value is set to Locked Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); - VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanAllTheUsersAndCredentials_37() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:65534U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clean all the users and credentials Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class DL_Schedules : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -134877,7 +133650,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),