From 9cef58c89cb1fe0ff926775592a3856de80c3dd5 Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Sun, 22 May 2022 20:18:32 +0300 Subject: [PATCH 1/9] Set up the fabric removal handler in the door lock cluster --- .../door-lock-server/door-lock-server.cpp | 32 +++++++++++++++++++ .../door-lock-server/door-lock-server.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 12d919766ce5b2..7b62fd7b8c0ffe 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,29 @@ static constexpr uint32_t DOOR_LOCK_MAX_LOCK_TIMEOUT_SEC = MAX_INT32U_VALUE / (2 DoorLockServer DoorLockServer::instance; +class DoorLockCLusterFabricDelegate : public chip::FabricTable::Delegate +{ + void OnFabricDeletedFromStorage(FabricTable & fabricTable, FabricIndex fabricIndex) override + { + for (auto endpointId : EnabledEndpointsWithServerCluster(chip::app::Clusters::DoorLock::Id)) + { + if (!DoorLockServer::Instance().OnFabricRemoved(endpointId, fabricIndex)) + { + ChipLogError(Zcl, + "Unable to handle fabric removal from the Door Lock Server instance [endpointId=%d,fabricIndex=%d]", + endpointId, fabricIndex); + } + } + } + + // Intentionally left blank + void OnFabricRetrievedFromStorage(FabricTable & fabricTable, FabricIndex fabricIndex) override {} + + // Intentionally left blank + void OnFabricPersistedToStorage(FabricTable & fabricTable, FabricIndex fabricIndex) override {} +}; +static DoorLockCLusterFabricDelegate gFabricDelegate; + void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId); /********************************************************** @@ -1219,6 +1243,13 @@ bool DoorLockServer::HasFeature(chip::EndpointId endpointId, DoorLockFeature fea return success && ((featureMap & to_underlying(feature)) != 0); } +bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) +{ + emberAfDoorLockClusterPrintln("[OnFabricRemoved] Removing a fabric from the door lock server [endpointId=%d,fabricIndex=%d]", + endpointId, fabricIndex); + return true; +} + /********************************************************** * DoorLockServer private methods *********************************************************/ @@ -3340,6 +3371,7 @@ void emberAfPluginDoorLockServerRelockEventHandler(void) {} void MatterDoorLockPluginServerInitCallback() { emberAfDoorLockClusterPrintln("Door Lock server initialized"); + Server::GetInstance().GetFabricTable().AddFabricDelegate(&gFabricDelegate); } void MatterDoorLockClusterServerAttributeChangedCallback(const app::ConcreteAttributePath & attributePath) {} 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 8a08cf7c0b2f4a..7c729b4243d2ce 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -175,6 +175,8 @@ class DoorLockServer return HasFeature(endpointId, DoorLockFeature::kUsersManagement) && SupportsPIN(endpointId); } + bool OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIndex fabricIndex); + private: chip::FabricIndex getFabricIndex(const chip::app::CommandHandler * commandObj); chip::NodeId getNodeId(const chip::app::CommandHandler * commandObj); From 3c53c35071448e5fb94ed407215d01f65c943ffd Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Mon, 23 May 2022 15:36:28 +0300 Subject: [PATCH 2/9] Clear up the fabric index on fabric removal in the users and credentials of the door lock --- .../door-lock-server/door-lock-server.cpp | 135 +++++++++++++++++- .../door-lock-server/door-lock-server.h | 5 + 2 files changed, 138 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 7b62fd7b8c0ffe..d0927ba2941f95 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -1245,8 +1245,25 @@ bool DoorLockServer::HasFeature(chip::EndpointId endpointId, DoorLockFeature fea bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) { - emberAfDoorLockClusterPrintln("[OnFabricRemoved] Removing a fabric from the door lock server [endpointId=%d,fabricIndex=%d]", - endpointId, fabricIndex); + emberAfDoorLockClusterPrintln( + "[OnFabricRemoved] Handling a fabric removal from the door lock server [endpointId=%d,fabricIndex=%d]", endpointId, + fabricIndex); + + // Iterate over all the users and clean up the deleted fabric + if (!cleanFabricFromUsers(endpointId, fabricIndex)) + { + ChipLogError(Zcl, "[OnFabricRemoved] Unable to cleanup fabric from users - internal error [endpointId=%d,fabricIndex=%d]", + endpointId, fabricIndex); + } + + // Iterate over all the credentials and clean up the fabrics + if (!clearFabricFromCredentials(endpointId, fabricIndex)) + { + ChipLogError(Zcl, + "[OnFabricRemoved] Unable to cleanup fabric from credentials - internal error [endpointId=%d,fabricIndex=%d]", + endpointId, fabricIndex); + } + return true; } @@ -1760,6 +1777,43 @@ EmberAfStatus DoorLockServer::clearUser(chip::EndpointId endpointId, chip::Fabri return EMBER_ZCL_STATUS_SUCCESS; } +bool DoorLockServer::cleanFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) +{ + uint16_t maxNumberOfUsers; + VerifyOrReturnError(GetAttribute(endpointId, Attributes::NumberOfTotalUsersSupported::Id, + Attributes::NumberOfTotalUsersSupported::Get, maxNumberOfUsers), + false); + + for (uint16_t userIndex = 1; userIndex <= maxNumberOfUsers; ++userIndex) + { + EmberAfPluginDoorLockUserInfo user; + if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) + { + ChipLogError(Zcl, + "[OnFabricRemoved] Unable to get the user - internal error [endpointId=%d,fabricIndex=%d,userIndex=%d]", + endpointId, fabricIndex, userIndex); + continue; + } + + // Filter out unoccupied slots and users that don't have corresponding fabricIndex in the created/modified fields + if (DlUserStatus::kAvailable == user.userStatus || (fabricIndex != user.createdBy && fabricIndex != user.lastModifiedBy)) + { + continue; + } + + if (!emberAfPluginDoorLockSetUser(endpointId, userIndex, kUndefinedFabricIndex, kUndefinedFabricIndex, user.userName, + user.userUniqueId, user.userStatus, user.userType, user.credentialRule, + user.credentials.data(), user.credentials.size())) + { + ChipLogError( + Zcl, + "[OnFabricRemoved] Unable to update the user fabrics - internal error [endpointId=%d,fabricIndex=%d,userIndex=%d]", + endpointId, fabricIndex, userIndex); + } + } + return true; +} + DlStatus DoorLockServer::createNewCredentialAndUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, const Nullable & userStatus, const Nullable & userType, const DlCredential & credential, @@ -2690,6 +2744,83 @@ EmberAfStatus DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip return EMBER_ZCL_STATUS_SUCCESS; } +bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, DlCredentialType credentialType, + chip::FabricIndex fabricToRemove) +{ + uint16_t maxNumberOfCredentials = 0; + if (!getMaxNumberOfCredentials(endpointId, credentialType, maxNumberOfCredentials)) + { + ChipLogError( + Zcl, + "[clearFabricFromCredentials] Unable to get max number of credentials to clear - can't get max number of credentials " + "[endpointId=%d,credentialType=%u]", + endpointId, to_underlying(credentialType)); + return false; + } + + for (uint16_t credentialIndex = 1; credentialIndex < maxNumberOfCredentials; ++credentialIndex) + { + EmberAfPluginDoorLockCredentialInfo credential; + if (!emberAfPluginDoorLockGetCredential(endpointId, credentialIndex, credentialType, credential)) + { + ChipLogError( + Zcl, + "[clearFabricFromCredentials] Unable to clear fabric from credential - couldn't read credential from database " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,fabricIdToRemove=%d]", + endpointId, to_underlying(credentialType), credentialIndex, fabricToRemove); + + // Go on and try to clear all the remaining credentials + continue; + } + + if (DlCredentialStatus::kAvailable == credential.status || + (credential.createdBy != fabricToRemove && credential.lastModifiedBy != fabricToRemove)) + { + continue; + } + + if (!emberAfPluginDoorLockSetCredential(endpointId, credentialIndex, kUndefinedFabricIndex, kUndefinedFabricIndex, + credential.status, credential.credentialType, credential.credentialData)) + { + ChipLogError(Zcl, + "[clearFabricFromCredentials] Unable to clear fabric from credential - internal error " + "[endpointId=%d,credentialType=%u,credentialIndex=%d,fabricIdToRemove=%d]", + endpointId, to_underlying(credentialType), credentialIndex, fabricToRemove); + continue; + } + } + + return true; +} + +bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, chip::FabricIndex fabricToRemove) +{ + if (SupportsPFID(endpointId)) + { + clearFabricFromCredentials(endpointId, DlCredentialType::kRfid, fabricToRemove); + } + + if (SupportsPIN(endpointId)) + { + clearFabricFromCredentials(endpointId, DlCredentialType::kPin, fabricToRemove); + } + + if (SupportsFingers(endpointId)) + { + clearFabricFromCredentials(endpointId, DlCredentialType::kFingerprint, fabricToRemove); + clearFabricFromCredentials(endpointId, DlCredentialType::kFingerVein, fabricToRemove); + } + + if (SupportsFace(endpointId)) + { + clearFabricFromCredentials(endpointId, DlCredentialType::kFace, fabricToRemove); + } + + clearFabricFromCredentials(endpointId, DlCredentialType::kProgrammingPIN, fabricToRemove); + + return true; +} + bool DoorLockServer::sendRemoteLockUserChange(chip::EndpointId endpointId, DlLockDataType dataType, DlDataOperationType operation, chip::NodeId nodeId, chip::FabricIndex fabricIndex, uint16_t userIndex, uint16_t dataIndex) 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 7c729b4243d2ce..4184e6d2f3816d 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -217,6 +217,8 @@ class DoorLockServer EmberAfStatus clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, uint16_t userIndex, const EmberAfPluginDoorLockUserInfo & user, bool sendUserChangeEvent); + bool cleanFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex); + DlStatus createNewCredentialAndUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, const Nullable & userStatus, const Nullable & userType, const DlCredential & credential, const chip::ByteSpan & credentialData, @@ -249,6 +251,9 @@ class DoorLockServer EmberAfStatus clearCredentials(chip::EndpointId endpointId, chip::FabricIndex modifier, chip::NodeId sourceNodeId, DlCredentialType credentialType); + bool clearFabricFromCredentials(chip::EndpointId endpointId, DlCredentialType credentialType, chip::FabricIndex fabricToRemove); + bool clearFabricFromCredentials(chip::EndpointId endpointId, chip::FabricIndex fabricToRemove); + CHIP_ERROR sendSetCredentialResponse(chip::app::CommandHandler * commandObj, DlStatus status, uint16_t userIndex, uint16_t nextCredentialIndex); From e8ae6447c7ad45374a9b40aa658d2874a6b49487 Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Wed, 25 May 2022 13:18:52 +0300 Subject: [PATCH 3/9] Add modification/creation source in the user/credential structure of the door lock --- examples/lock-app/efr32/src/LockManager.cpp | 12 ++++- examples/lock-app/linux/src/LockEndpoint.cpp | 16 ++++-- .../door-lock-server/door-lock-server.cpp | 52 +++++++------------ .../door-lock-server/door-lock-server.h | 14 +++++ 4 files changed, 56 insertions(+), 38 deletions(-) diff --git a/examples/lock-app/efr32/src/LockManager.cpp b/examples/lock-app/efr32/src/LockManager.cpp index 1d2d30559a24d6..3d9754b55563f2 100644 --- a/examples/lock-app/efr32/src/LockManager.cpp +++ b/examples/lock-app/efr32/src/LockManager.cpp @@ -230,8 +230,12 @@ bool LockManager::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & us user.userUniqueId = userInDb.userUniqueId; user.userType = userInDb.userType; user.credentialRule = userInDb.credentialRule; - user.createdBy = userInDb.createdBy; - user.lastModifiedBy = userInDb.lastModifiedBy; + // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // source to Matter + user.creationSource = DlAssetSource::kMatterIM; + user.createdBy = userInDb.createdBy; + user.modificationSource = DlAssetSource::kMatterIM; + user.lastModifiedBy = userInDb.lastModifiedBy; ChipLogDetail(Zcl, "Found occupied user " @@ -318,6 +322,10 @@ bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credential } credential.credentialType = credentialInStorage.credentialType; credential.credentialData = credentialInStorage.credentialData; + // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // source to Matter + credential.creationSource = DlAssetSource::kMatterIM; + credential.modificationSource = DlAssetSource::kMatterIM; ChipLogDetail(Zcl, "Found occupied credential [type=%u,dataSize=%u]", to_underlying(credential.credentialType), credential.credentialData.size()); diff --git a/examples/lock-app/linux/src/LockEndpoint.cpp b/examples/lock-app/linux/src/LockEndpoint.cpp index 03f1ed92e835fc..605fb1dd2f5537 100644 --- a/examples/lock-app/linux/src/LockEndpoint.cpp +++ b/examples/lock-app/linux/src/LockEndpoint.cpp @@ -55,8 +55,12 @@ bool LockEndpoint::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & u user.userUniqueId = userInDb.userUniqueId; user.userType = userInDb.userType; user.credentialRule = userInDb.credentialRule; - user.createdBy = userInDb.createdBy; - user.lastModifiedBy = userInDb.lastModifiedBy; + // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // source to Matter + user.creationSource = DlAssetSource::kMatterIM; + user.createdBy = userInDb.createdBy; + user.modificationSource = DlAssetSource::kMatterIM; + user.lastModifiedBy = userInDb.lastModifiedBy; ChipLogDetail(Zcl, "Found occupied user " @@ -151,8 +155,12 @@ bool LockEndpoint::GetCredential(uint16_t credentialIndex, DlCredentialType cred } credential.credentialType = credentialInStorage.credentialType; credential.credentialData = chip::ByteSpan(credentialInStorage.credentialData, credentialInStorage.credentialDataSize); - credential.createdBy = credentialInStorage.createdBy; - credential.lastModifiedBy = credentialInStorage.modifiedBy; + // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // source to Matter + credential.creationSource = DlAssetSource::kMatterIM; + credential.createdBy = credentialInStorage.createdBy; + credential.modificationSource = DlAssetSource::kMatterIM; + credential.lastModifiedBy = credentialInStorage.modifiedBy; ChipLogDetail(Zcl, "Found occupied credential [endpoint=%d,index=%u,type=%u,dataSize=%u,createdBy=%u,modifiedBy=%u]", mEndpointId, credentialIndex, to_underlying(credential.credentialType), diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index d0927ba2941f95..78e8b582751ddb 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -382,9 +382,17 @@ void DoorLockServer::GetUserCommandHandler(chip::app::CommandHandler * commandOb } SuccessOrExit(err = writer->EndContainer(credentialsContainer)); } - SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kCreatorFabricIndex)), user.createdBy)); - SuccessOrExit( - err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kLastModifiedFabricIndex)), user.lastModifiedBy)); + // Append fabric IDs only if the user was created/modified by matter + if (user.creationSource == DlAssetSource::kMatterIM) + { + SuccessOrExit(err = + writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kCreatorFabricIndex)), user.createdBy)); + } + if (user.modificationSource == DlAssetSource::kMatterIM) + { + SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kLastModifiedFabricIndex)), + user.lastModifiedBy)); + } } else { @@ -694,54 +702,34 @@ void DoorLockServer::GetCredentialStatusCommandHandler( } } - uint16_t nextCredentialIndex = 0; - - CHIP_ERROR err = CHIP_NO_ERROR; - using ResponseFields = Commands::GetCredentialStatusResponse::Fields; - app::ConcreteCommandPath path = { emberAfCurrentEndpoint(), ::Id, Commands::GetCredentialStatusResponse::Id }; - TLV::TLVWriter * writer = nullptr; - SuccessOrExit(err = commandObj->PrepareCommand(path)); - VerifyOrExit((writer = commandObj->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kCredentialExists)), credentialExists)); + Commands::GetCredentialStatusResponse::Type response { .credentialExists = credentialExists }; if (credentialExists) { if (0 != userIndexWithCredential) { - SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kUserIndex)), userIndexWithCredential)); + response.userIndex = Nullable(userIndexWithCredential); } - if (kUndefinedFabricIndex != credentialInfo.createdBy) + if (credentialInfo.creationSource == DlAssetSource::kMatterIM) { - SuccessOrExit( - err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kCreatorFabricIndex)), credentialInfo.createdBy)); + response.creatorFabricIndex = Nullable(credentialInfo.createdBy); } - if (kUndefinedFabricIndex != credentialInfo.lastModifiedBy) + if (credentialInfo.modificationSource == DlAssetSource::kMatterIM) { - SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kLastModifiedFabricIndex)), - credentialInfo.lastModifiedBy)); + response.lastModifiedFabricIndex = Nullable(credentialInfo.lastModifiedBy); } } + uint16_t nextCredentialIndex = 0; if (findUnoccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast(credentialIndex + 1), nextCredentialIndex)) { - SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kNextCredentialIndex)), nextCredentialIndex)); + response.nextCredentialIndex = Nullable(nextCredentialIndex); } - SuccessOrExit(err = commandObj->FinishCommand()); + commandObj->AddResponse(commandPath, response); emberAfDoorLockClusterPrintln("[GetCredentialStatus] Prepared credential status " "[endpointId=%d,credentialType=%u,credentialIndex=%d,userIndex=%d,nextCredentialIndex=%d]", commandPath.mEndpointId, to_underlying(credentialType), credentialIndex, userIndexWithCredential, nextCredentialIndex); - -exit: - if (CHIP_NO_ERROR != err) - { - ChipLogError(Zcl, - "[GetCredentialStatus] Error occurred when preparing response: %s " - "[endpointId=%d,credentialType=%u,credentialIndex=%d,userIndex=%d,nextCredentialIndex=%d]", - err.AsString(), commandPath.mEndpointId, to_underlying(credentialType), credentialIndex, - userIndexWithCredential, nextCredentialIndex); - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); - } } void DoorLockServer::ClearCredentialCommandHandler( 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 4184e6d2f3816d..03fc2ad6a5b667 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -427,6 +427,12 @@ enum class DlCredentialStatus : uint8_t kOccupied = 0x01, /**< Indicates if credential slot is already occupied. */ }; +enum class DlAssetSource : uint8_t +{ + kUnspecified = 0x00, + kMatterIM = 0x01, +}; + /** * @brief Structure that holds the credential information. */ @@ -435,7 +441,11 @@ struct EmberAfPluginDoorLockCredentialInfo DlCredentialStatus status; /**< Indicates if credential slot is occupied or not. */ DlCredentialType credentialType; /**< Specifies the type of the credential (PIN, RFID, etc.). */ chip::ByteSpan credentialData; /**< Credential data bytes. */ + + DlAssetSource creationSource; chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ + + DlAssetSource modificationSource; chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ }; @@ -450,7 +460,11 @@ struct EmberAfPluginDoorLockUserInfo DlUserStatus userStatus; /**< Status of the user slot (available/occupied). */ DlUserType userType; /**< Type of the user. */ DlCredentialRule credentialRule; /**< Number of supported credentials. */ + + DlAssetSource creationSource; chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ + + DlAssetSource modificationSource; chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ }; From e6ae3ab765b96bab43053cbbabdb553689d90812 Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Wed, 25 May 2022 19:36:10 +0300 Subject: [PATCH 4/9] [#14919] Return the next occupied slot for GetUser/GetCredentialStatus commands --- .../door-lock-server/door-lock-server.cpp | 72 ++++++++++++++++-- .../door-lock-server/door-lock-server.h | 16 ++-- .../tests/suites/DL_UsersAndCredentials.yaml | 76 +++++++++---------- 3 files changed, 115 insertions(+), 49 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 78e8b582751ddb..53fd59b707b762 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -399,9 +399,9 @@ void DoorLockServer::GetUserCommandHandler(chip::app::CommandHandler * commandOb emberAfDoorLockClusterPrintln("[GetUser] User not found [userIndex=%d]", userIndex); } - // appclusters, 5.2.4.36.1: We need to add next available user after userIndex if any. + // appclusters, 5.2.4.36.1: We need to add next occupied user after userIndex if any. uint16_t nextAvailableUserIndex = 0; - if (findUnoccupiedUserSlot(commandPath.mEndpointId, static_cast(userIndex + 1), nextAvailableUserIndex)) + if (findOccupiedUserSlot(commandPath.mEndpointId, static_cast(userIndex + 1), nextAvailableUserIndex)) { SuccessOrExit(err = writer->Put(TLV::ContextTag(to_underlying(ResponseFields::kNextUserIndex)), nextAvailableUserIndex)); @@ -702,7 +702,7 @@ void DoorLockServer::GetCredentialStatusCommandHandler( } } - Commands::GetCredentialStatusResponse::Type response { .credentialExists = credentialExists }; + Commands::GetCredentialStatusResponse::Type response{ .credentialExists = credentialExists }; if (credentialExists) { if (0 != userIndexWithCredential) @@ -719,8 +719,8 @@ void DoorLockServer::GetCredentialStatusCommandHandler( } } uint16_t nextCredentialIndex = 0; - if (findUnoccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast(credentialIndex + 1), - nextCredentialIndex)) + if (findOccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast(credentialIndex + 1), + nextCredentialIndex)) { response.nextCredentialIndex = Nullable(nextCredentialIndex); } @@ -1404,6 +1404,32 @@ bool DoorLockServer::getMaxNumberOfCredentials(chip::EndpointId endpointId, DlCr return status; } +bool DoorLockServer::findOccupiedUserSlot(chip::EndpointId endpointId, uint16_t startIndex, uint16_t & userIndex) +{ + uint16_t maxNumberOfUsers; + VerifyOrReturnError(GetAttribute(endpointId, Attributes::NumberOfTotalUsersSupported::Id, + Attributes::NumberOfTotalUsersSupported::Get, maxNumberOfUsers), + false); + + userIndex = 0; + for (uint16_t i = startIndex; i <= maxNumberOfUsers; ++i) + { + EmberAfPluginDoorLockUserInfo user; + if (!emberAfPluginDoorLockGetUser(endpointId, i, user)) + { + ChipLogError(Zcl, "Unable to get user to check if slot is occupied: app error [userIndex=%d]", i); + return false; + } + + if (DlUserStatus::kAvailable != user.userStatus) + { + userIndex = i; + return true; + } + } + return false; +} + bool DoorLockServer::findUnoccupiedUserSlot(chip::EndpointId endpointId, uint16_t & userIndex) { return findUnoccupiedUserSlot(endpointId, 1, userIndex); @@ -1435,6 +1461,42 @@ bool DoorLockServer::findUnoccupiedUserSlot(chip::EndpointId endpointId, uint16_ return false; } +bool DoorLockServer::findOccupiedCredentialSlot(chip::EndpointId endpointId, DlCredentialType credentialType, uint16_t startIndex, + uint16_t & credentialIndex) +{ + uint16_t maxNumberOfCredentials = 0; + if (!getMaxNumberOfCredentials(endpointId, credentialType, maxNumberOfCredentials)) + { + return false; + } + + // Programming PIN index starts with 0, and it is assumed that it is unique. Therefor different bounds checking for that + // credential type + if (DlCredentialType::kProgrammingPIN == credentialType) + { + maxNumberOfCredentials--; + } + + for (uint16_t i = startIndex; i <= maxNumberOfCredentials; ++i) + { + EmberAfPluginDoorLockCredentialInfo info; + if (!emberAfPluginDoorLockGetCredential(endpointId, i, credentialType, info)) + { + ChipLogError(Zcl, "Unable to get credential: app error [endpointId=%d,credentialType=%u,credentialIndex=%d]", + endpointId, to_underlying(credentialType), i); + return false; + } + + if (DlCredentialStatus::kAvailable != info.status) + { + credentialIndex = i; + return true; + } + } + + return false; +} + bool DoorLockServer::findUnoccupiedCredentialSlot(chip::EndpointId endpointId, DlCredentialType credentialType, uint16_t startIndex, uint16_t & credentialIndex) { 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 03fc2ad6a5b667..05deb1a2bbd5f6 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -191,9 +191,13 @@ class DoorLockServer bool getCredentialRange(chip::EndpointId endpointId, DlCredentialType type, size_t & minSize, size_t & maxSize); bool getMaxNumberOfCredentials(chip::EndpointId endpointId, DlCredentialType credentialType, uint16_t & maxNumberOfCredentials); + bool findOccupiedUserSlot(chip::EndpointId endpointId, uint16_t startIndex, uint16_t & userIndex); + bool findUnoccupiedUserSlot(chip::EndpointId endpointId, uint16_t & userIndex); bool findUnoccupiedUserSlot(chip::EndpointId endpointId, uint16_t startIndex, uint16_t & userIndex); + bool findOccupiedCredentialSlot(chip::EndpointId endpointId, DlCredentialType credentialType, uint16_t startIndex, + uint16_t & credentialIndex); bool findUnoccupiedCredentialSlot(chip::EndpointId endpointId, DlCredentialType credentialType, uint16_t startIndex, uint16_t & credentialIndex); @@ -438,12 +442,12 @@ enum class DlAssetSource : uint8_t */ struct EmberAfPluginDoorLockCredentialInfo { - DlCredentialStatus status; /**< Indicates if credential slot is occupied or not. */ - DlCredentialType credentialType; /**< Specifies the type of the credential (PIN, RFID, etc.). */ - chip::ByteSpan credentialData; /**< Credential data bytes. */ + DlCredentialStatus status; /**< Indicates if credential slot is occupied or not. */ + DlCredentialType credentialType; /**< Specifies the type of the credential (PIN, RFID, etc.). */ + chip::ByteSpan credentialData; /**< Credential data bytes. */ DlAssetSource creationSource; - chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ + chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ DlAssetSource modificationSource; chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ @@ -462,10 +466,10 @@ struct EmberAfPluginDoorLockUserInfo DlCredentialRule credentialRule; /**< Number of supported credentials. */ DlAssetSource creationSource; - chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ + chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ DlAssetSource modificationSource; - chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ + chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ }; /** diff --git a/src/app/tests/suites/DL_UsersAndCredentials.yaml b/src/app/tests/suites/DL_UsersAndCredentials.yaml index d71a0ee70ee4fa..34f28bfd95cf28 100644 --- a/src/app/tests/suites/DL_UsersAndCredentials.yaml +++ b/src/app/tests/suites/DL_UsersAndCredentials.yaml @@ -55,7 +55,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 2 + value: null - label: "Get number of supported users and verify default value" command: "readAttribute" @@ -130,7 +130,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Set user at the occupied index fails with appropriate response" command: "SetUser" @@ -202,7 +202,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Modify userUniqueId for existing user" command: "SetUser" @@ -251,7 +251,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Modify userStatus for existing user" command: "SetUser" @@ -300,7 +300,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Modify userType for existing user" command: "SetUser" @@ -349,7 +349,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Modify credentialRule for existing user" command: "SetUser" @@ -398,7 +398,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Modify all fields for existing user" command: "SetUser" @@ -447,7 +447,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Add another user with non-default fields" command: "SetUser" @@ -496,7 +496,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 3 + value: null - label: "Create user in the last slot" command: "SetUser" @@ -626,7 +626,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 3 # Slot 2 is still occupied + value: 2 # Slot 2 is still occupied - label: "Create new user in the cleared slot" command: "SetUser" @@ -676,7 +676,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 3 # Slot 2 is still occupied + value: 2 # Slot 2 is still occupied - label: "Clear user with index 0 fails" command: "ClearUser" @@ -733,7 +733,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 3 + value: null - label: "Read last cleared user and verify it is available" command: "GetUser" @@ -792,7 +792,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 2 + value: null - label: "Reading PIN credential with index 0 fails" command: "GetCredentialStatus" @@ -869,7 +869,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Verify created PIN credential" command: "GetCredentialStatus" @@ -888,7 +888,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextCredentialIndex" - value: 2 + value: null - label: "Create new PIN credential and user with index 0 fails" command: "SetCredential" @@ -992,7 +992,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 3 + value: null - label: "Create new RFID credential and add it to existing user" command: "SetCredential" @@ -1051,7 +1051,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Verify created credential" command: "GetCredentialStatus" @@ -1070,7 +1070,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextCredentialIndex" - value: 3 + value: null - label: "Create new RFID credential and user with index 0 fails" command: "SetCredential" @@ -1510,7 +1510,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 3 + value: 2 - label: "Create new RFID credential and add it to existing user" command: "SetCredential" @@ -1571,7 +1571,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 3 + value: 2 - label: "Clear first PIN credential" command: "ClearCredential" @@ -1598,7 +1598,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 6 + value: 2 - label: "Read the user back and make sure PIN credential is deleted" command: "GetUser" @@ -1632,7 +1632,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 3 + value: 2 - label: "Clear the second PIN credential" command: "ClearCredential" @@ -1659,7 +1659,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 6 + value: 4 - label: "Read the user back and make sure related user is deleted" command: "GetUser" @@ -1688,7 +1688,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 3 + value: null - label: "Create new RFID credential with user" command: "SetCredential" @@ -1741,7 +1741,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 2 + value: 5 - label: "Read back the second RFID credential and make sure it is deleted" command: "GetCredentialStatus" @@ -1760,7 +1760,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 3 + value: 5 - label: "Read back the third RFID credential and make sure it is deleted" command: "GetCredentialStatus" @@ -1779,7 +1779,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 6 + value: 5 - label: "Read the user related with first RFID back and make sure it has only @@ -1810,7 +1810,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Read the user related with second RFID back and make sure it is @@ -1841,7 +1841,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 3 + value: null - label: "Create new PIN credential with user" command: "SetCredential" @@ -1948,7 +1948,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 2 + value: null - label: "Read back the first RFID credential and make sure it is deleted" command: "GetCredentialStatus" @@ -1967,7 +1967,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 3 + value: null - label: "Read back the second PIN credential and make sure it is deleted" command: "GetCredentialStatus" @@ -1986,7 +1986,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextCredentialIndex" - value: 7 + value: null - label: "Read the user related with first PIN back and make sure it is deleted" @@ -2016,7 +2016,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 2 + value: null - label: "Read the user related with first RFID back and make sure it is @@ -2047,7 +2047,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 3 + value: null - label: "Read the user related with second PIN back and make sure it is @@ -2078,7 +2078,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 4 + value: null - label: "Read the user related with last RFID back and make sure it is deleted" @@ -2108,7 +2108,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 5 + value: null - label: "Create new Programming PIN credential with invalid index" command: "SetCredential" @@ -2189,7 +2189,7 @@ tests: - name: "lastModifiedFabricIndex" value: 1 - name: "nextUserIndex" - value: 2 + value: null - label: "Verify created programming PIN credential" command: "GetCredentialStatus" @@ -2340,7 +2340,7 @@ tests: - name: "lastModifiedFabricIndex" value: null - name: "nextUserIndex" - value: 2 + value: null - label: "Make sure programming PIN credential is deleted" command: "GetCredentialStatus" From 05b4ddd262800767ba40eae4b358a5f5ed55a230 Mon Sep 17 00:00:00 2001 From: Evgeniy Morozov Date: Thu, 26 May 2022 13:03:24 +0300 Subject: [PATCH 5/9] Apply suggestions from code review Fix typos Co-authored-by: Boris Zbarsky --- examples/lock-app/efr32/src/LockManager.cpp | 4 ++-- src/app/clusters/door-lock-server/door-lock-server.cpp | 2 +- src/app/clusters/door-lock-server/door-lock-server.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/lock-app/efr32/src/LockManager.cpp b/examples/lock-app/efr32/src/LockManager.cpp index 3d9754b55563f2..5bde9b78e93897 100644 --- a/examples/lock-app/efr32/src/LockManager.cpp +++ b/examples/lock-app/efr32/src/LockManager.cpp @@ -230,7 +230,7 @@ bool LockManager::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & us user.userUniqueId = userInDb.userUniqueId; user.userType = userInDb.userType; user.credentialRule = userInDb.credentialRule; - // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification // source to Matter user.creationSource = DlAssetSource::kMatterIM; user.createdBy = userInDb.createdBy; @@ -322,7 +322,7 @@ bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credential } credential.credentialType = credentialInStorage.credentialType; credential.credentialData = credentialInStorage.credentialData; - // So far there's no way to actually create the credential outside the matter, so here we always set the creation/modification + // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification // source to Matter credential.creationSource = DlAssetSource::kMatterIM; credential.modificationSource = DlAssetSource::kMatterIM; diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 53fd59b707b762..ce05bdf7624980 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -1470,7 +1470,7 @@ bool DoorLockServer::findOccupiedCredentialSlot(chip::EndpointId endpointId, DlC return false; } - // Programming PIN index starts with 0, and it is assumed that it is unique. Therefor different bounds checking for that + // Programming PIN index starts with 0, and it is assumed that it is unique. Therefore different bounds checking for that // credential type if (DlCredentialType::kProgrammingPIN == credentialType) { 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 05deb1a2bbd5f6..82f4fba925331b 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -447,7 +447,7 @@ struct EmberAfPluginDoorLockCredentialInfo chip::ByteSpan credentialData; /**< Credential data bytes. */ DlAssetSource creationSource; - chip::FabricIndex createdBy; /**< ID of the fabric that created the user. */ + chip::FabricIndex createdBy; /**< Index of the fabric that created the user. */ DlAssetSource modificationSource; chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ From 2c82663a4c3b66a4df7e4714f912ac1aaa5c696f Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Thu, 26 May 2022 13:26:27 +0300 Subject: [PATCH 6/9] Fix code review notes --- .../door-lock-server/door-lock-server.cpp | 50 +++++++++++++------ .../door-lock-server/door-lock-server.h | 4 +- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index ce05bdf7624980..999aaa145bad13 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -707,22 +707,22 @@ void DoorLockServer::GetCredentialStatusCommandHandler( { if (0 != userIndexWithCredential) { - response.userIndex = Nullable(userIndexWithCredential); + response.userIndex.SetNonNull(userIndexWithCredential); } if (credentialInfo.creationSource == DlAssetSource::kMatterIM) { - response.creatorFabricIndex = Nullable(credentialInfo.createdBy); + response.creatorFabricIndex.SetNonNull(credentialInfo.createdBy); } if (credentialInfo.modificationSource == DlAssetSource::kMatterIM) { - response.lastModifiedFabricIndex = Nullable(credentialInfo.lastModifiedBy); + response.lastModifiedFabricIndex.SetNonNull(credentialInfo.lastModifiedBy); } } uint16_t nextCredentialIndex = 0; if (findOccupiedCredentialSlot(commandPath.mEndpointId, credentialType, static_cast(credentialIndex + 1), nextCredentialIndex)) { - response.nextCredentialIndex = Nullable(nextCredentialIndex); + response.nextCredentialIndex.SetNonNull(nextCredentialIndex); } commandObj->AddResponse(commandPath, response); @@ -1238,7 +1238,7 @@ bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIn fabricIndex); // Iterate over all the users and clean up the deleted fabric - if (!cleanFabricFromUsers(endpointId, fabricIndex)) + if (!clearFabricFromUsers(endpointId, fabricIndex)) { ChipLogError(Zcl, "[OnFabricRemoved] Unable to cleanup fabric from users - internal error [endpointId=%d,fabricIndex=%d]", endpointId, fabricIndex); @@ -1827,7 +1827,7 @@ EmberAfStatus DoorLockServer::clearUser(chip::EndpointId endpointId, chip::Fabri return EMBER_ZCL_STATUS_SUCCESS; } -bool DoorLockServer::cleanFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) +bool DoorLockServer::clearFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex) { uint16_t maxNumberOfUsers; VerifyOrReturnError(GetAttribute(endpointId, Attributes::NumberOfTotalUsersSupported::Id, @@ -1851,7 +1851,17 @@ bool DoorLockServer::cleanFabricFromUsers(chip::EndpointId endpointId, chip::Fab continue; } - if (!emberAfPluginDoorLockSetUser(endpointId, userIndex, kUndefinedFabricIndex, kUndefinedFabricIndex, user.userName, + if (user.createdBy == fabricIndex) + { + user.createdBy = kUndefinedFabricIndex; + } + + if (user.lastModifiedBy == fabricIndex) + { + user.lastModifiedBy = kUndefinedFabricIndex; + } + + if (!emberAfPluginDoorLockSetUser(endpointId, userIndex, user.createdBy, user.lastModifiedBy, user.userName, user.userUniqueId, user.userStatus, user.userType, user.credentialRule, user.credentials.data(), user.credentials.size())) { @@ -2287,7 +2297,7 @@ bool DoorLockServer::credentialTypeSupported(chip::EndpointId endpointId, DlCred case DlCredentialType::kPin: return SupportsPIN(endpointId); case DlCredentialType::kRfid: - return SupportsPFID(endpointId); + return SupportsRFID(endpointId); default: return false; } @@ -2714,7 +2724,7 @@ EmberAfStatus DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip emberAfDoorLockClusterPrintln("[clearCredentials] All PIN credentials were cleared [endpointId=%d]", endpointId); } - if (SupportsPFID(endpointId)) + if (SupportsRFID(endpointId)) { auto status = clearCredentials(endpointId, modifier, sourceNodeId, DlCredentialType::kRfid); if (EMBER_ZCL_STATUS_SUCCESS != status) @@ -2829,7 +2839,17 @@ bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, DlC continue; } - if (!emberAfPluginDoorLockSetCredential(endpointId, credentialIndex, kUndefinedFabricIndex, kUndefinedFabricIndex, + if (credential.createdBy == fabricToRemove) + { + credential.createdBy = kUndefinedFabricIndex; + } + + if (credential.lastModifiedBy == fabricToRemove) + { + credential.lastModifiedBy = kUndefinedFabricIndex; + } + + if (!emberAfPluginDoorLockSetCredential(endpointId, credentialIndex, credential.createdBy, credential.lastModifiedBy, credential.status, credential.credentialType, credential.credentialData)) { ChipLogError(Zcl, @@ -2845,7 +2865,7 @@ bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, DlC bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, chip::FabricIndex fabricToRemove) { - if (SupportsPFID(endpointId)) + if (SupportsRFID(endpointId)) { clearFabricFromCredentials(endpointId, DlCredentialType::kRfid, fabricToRemove); } @@ -2881,13 +2901,13 @@ bool DoorLockServer::sendRemoteLockUserChange(chip::EndpointId endpointId, DlLoc event.operationSource = DlOperationSource::kRemote; if (0 != userIndex) { - event.userIndex = Nullable(userIndex); + event.userIndex.SetNonNull(userIndex); } - event.fabricIndex = Nullable(fabricIndex); - event.sourceNode = Nullable(nodeId); + event.fabricIndex.SetNonNull(fabricIndex); + event.sourceNode.SetNonNull(nodeId); if (0 != dataIndex) { - event.dataIndex = Nullable(dataIndex); + event.dataIndex.SetNonNull(dataIndex); } EventNumber eventNumber; 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 82f4fba925331b..25ccf346a953b2 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -160,7 +160,7 @@ class DoorLockServer inline bool SupportsPIN(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kPINCredentials); } - inline bool SupportsPFID(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kRFIDCredentials); } + inline bool SupportsRFID(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kRFIDCredentials); } inline bool SupportsFingers(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kFingerCredentials); } @@ -221,7 +221,7 @@ class DoorLockServer EmberAfStatus clearUser(chip::EndpointId endpointId, chip::FabricIndex modifierFabricId, chip::NodeId sourceNodeId, uint16_t userIndex, const EmberAfPluginDoorLockUserInfo & user, bool sendUserChangeEvent); - bool cleanFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex); + bool clearFabricFromUsers(chip::EndpointId endpointId, chip::FabricIndex fabricIndex); DlStatus createNewCredentialAndUser(chip::EndpointId endpointId, chip::FabricIndex creatorFabricIdx, chip::NodeId sourceNodeId, const Nullable & userStatus, const Nullable & userType, From 2efeb3391f75950b3e436776262409aed4a702da Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Thu, 2 Jun 2022 11:06:10 +0300 Subject: [PATCH 7/9] Update efr32 lock app and address code review feedback --- examples/lock-app/efr32/include/LockManager.h | 4 ++-- examples/lock-app/efr32/src/LockManager.cpp | 13 +++++++++---- examples/lock-app/efr32/src/ZclCallbacks.cpp | 6 ++++-- .../door-lock-server/door-lock-server.cpp | 18 ++++++++++++++---- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/examples/lock-app/efr32/include/LockManager.h b/examples/lock-app/efr32/include/LockManager.h index ba2deb7007ce04..e8c2d8d0f9f117 100644 --- a/examples/lock-app/efr32/include/LockManager.h +++ b/examples/lock-app/efr32/include/LockManager.h @@ -75,8 +75,8 @@ class LockManager bool GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, EmberAfPluginDoorLockCredentialInfo & credential) const; - bool SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialStatus credentialStatus, - DlCredentialType credentialType, const chip::ByteSpan & credentialData); + bool SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData); bool setLockState(chip::EndpointId endpointId, DlLockState lockState, const Optional & pin, DlOperationError & err); diff --git a/examples/lock-app/efr32/src/LockManager.cpp b/examples/lock-app/efr32/src/LockManager.cpp index 5bde9b78e93897..c74107594ef041 100644 --- a/examples/lock-app/efr32/src/LockManager.cpp +++ b/examples/lock-app/efr32/src/LockManager.cpp @@ -322,6 +322,8 @@ bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credential } credential.credentialType = credentialInStorage.credentialType; credential.credentialData = credentialInStorage.credentialData; + credential.createdBy = credentialInStorage.createdBy; + credential.lastModifiedBy = credentialInStorage.lastModifiedBy; // So far there's no way to actually create the credential outside Matter, so here we always set the creation/modification // source to Matter credential.creationSource = DlAssetSource::kMatterIM; @@ -333,13 +335,14 @@ bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credential return true; } -bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialStatus credentialStatus, - DlCredentialType credentialType, const chip::ByteSpan & credentialData) +bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, + chip::FabricIndex modifier, DlCredentialStatus credentialStatus, DlCredentialType credentialType, + const chip::ByteSpan & credentialData) { ChipLogProgress(Zcl, "Door Lock App: LockManager::SetCredential " - "[credentialStatus=%u,credentialType=%u,credentialDataSize=%u]", - to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size()); + "[credentialStatus=%u,credentialType=%u,credentialDataSize=%u,creator=%d,modifier=%d]", + to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size(), creator, modifier); auto & credentialInStorage = mLockCredentials; if (credentialData.size() > DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE) @@ -352,6 +355,8 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential } credentialInStorage.status = credentialStatus; credentialInStorage.credentialType = credentialType; + credentialInStorage.createdBy = creator; + credentialInStorage.lastModifiedBy = modifier; memcpy(mCredentialData, credentialData.data(), credentialData.size()); mCredentialData[credentialData.size()] = 0; diff --git a/examples/lock-app/efr32/src/ZclCallbacks.cpp b/examples/lock-app/efr32/src/ZclCallbacks.cpp index daf244afb477bf..f48098aa5053a1 100644 --- a/examples/lock-app/efr32/src/ZclCallbacks.cpp +++ b/examples/lock-app/efr32/src/ZclCallbacks.cpp @@ -90,10 +90,12 @@ bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t cr return LockMgr().GetCredential(endpointId, credentialIndex, credentialType, credential); } -bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialStatus credentialStatus, +bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, chip::FabricIndex creator, + chip::FabricIndex modifier, DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData) { - return LockMgr().SetCredential(endpointId, credentialIndex, credentialStatus, credentialType, credentialData); + return LockMgr().SetCredential(endpointId, credentialIndex, creator, modifier, credentialStatus, credentialType, + credentialData); } bool emberAfPluginDoorLockGetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 999aaa145bad13..1fb048f055562d 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -53,7 +53,7 @@ static constexpr uint32_t DOOR_LOCK_MAX_LOCK_TIMEOUT_SEC = MAX_INT32U_VALUE / (2 DoorLockServer DoorLockServer::instance; -class DoorLockCLusterFabricDelegate : public chip::FabricTable::Delegate +class DoorLockClusterFabricDelegate : public chip::FabricTable::Delegate { void OnFabricDeletedFromStorage(FabricTable & fabricTable, FabricIndex fabricIndex) override { @@ -74,7 +74,7 @@ class DoorLockCLusterFabricDelegate : public chip::FabricTable::Delegate // Intentionally left blank void OnFabricPersistedToStorage(FabricTable & fabricTable, FabricIndex fabricIndex) override {} }; -static DoorLockCLusterFabricDelegate gFabricDelegate; +static DoorLockClusterFabricDelegate gFabricDelegate; void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId); @@ -1242,6 +1242,7 @@ bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIn { ChipLogError(Zcl, "[OnFabricRemoved] Unable to cleanup fabric from users - internal error [endpointId=%d,fabricIndex=%d]", endpointId, fabricIndex); + return false; } // Iterate over all the credentials and clean up the fabrics @@ -1250,6 +1251,7 @@ bool DoorLockServer::OnFabricRemoved(chip::EndpointId endpointId, chip::FabricIn ChipLogError(Zcl, "[OnFabricRemoved] Unable to cleanup fabric from credentials - internal error [endpointId=%d,fabricIndex=%d]", endpointId, fabricIndex); + return false; } return true; @@ -2818,7 +2820,15 @@ bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, DlC return false; } - for (uint16_t credentialIndex = 1; credentialIndex < maxNumberOfCredentials; ++credentialIndex) + uint16_t startIndex = 1; + // Programming PIN is a special case -- it is unique and its index assumed to be 0. + if (DlCredentialType::kProgrammingPIN == credentialType) + { + startIndex = 0; + maxNumberOfCredentials--; + } + + for (uint16_t credentialIndex = startIndex; credentialIndex <= maxNumberOfCredentials; ++credentialIndex) { EmberAfPluginDoorLockCredentialInfo credential; if (!emberAfPluginDoorLockGetCredential(endpointId, credentialIndex, credentialType, credential)) @@ -2856,7 +2866,7 @@ bool DoorLockServer::clearFabricFromCredentials(chip::EndpointId endpointId, DlC "[clearFabricFromCredentials] Unable to clear fabric from credential - internal error " "[endpointId=%d,credentialType=%u,credentialIndex=%d,fabricIdToRemove=%d]", endpointId, to_underlying(credentialType), credentialIndex, fabricToRemove); - continue; + return false; } } From 44bd05cc94682e1366a934ebb033896edd9e2f60 Mon Sep 17 00:00:00 2001 From: Morozov-5F Date: Thu, 2 Jun 2022 11:11:47 +0300 Subject: [PATCH 8/9] Update auto-generated files --- .../chip-tool/zap-generated/test/Commands.h | 104 +++++++----------- .../zap-generated/test/Commands.h | 104 +++++++----------- 2 files changed, 76 insertions(+), 132 deletions(-) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index d8b83514c0d0a3..32c2d676e9a665 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -56169,8 +56169,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 2: @@ -56221,8 +56220,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 7: @@ -56260,8 +56258,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 10: @@ -56297,8 +56294,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 12: @@ -56334,8 +56330,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 14: @@ -56371,8 +56366,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 16: @@ -56408,8 +56402,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 18: @@ -56445,8 +56438,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 20: @@ -56482,8 +56474,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 22: @@ -56554,7 +56545,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); } break; case 28: @@ -56590,7 +56581,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); } break; case 30: @@ -56625,8 +56616,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 34: @@ -56678,8 +56668,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 37: @@ -56738,8 +56727,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 41: @@ -56758,8 +56746,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 42: @@ -56816,8 +56803,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 48: @@ -56872,8 +56858,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 50: @@ -56892,8 +56877,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 51: @@ -57134,7 +57118,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); } break; case 67: @@ -57196,7 +57180,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); } break; case 69: @@ -57216,7 +57200,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); } break; case 71: @@ -57262,7 +57246,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); } break; case 72: @@ -57282,7 +57266,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); } break; case 74: @@ -57308,8 +57292,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 75: @@ -57343,7 +57326,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); } break; case 78: @@ -57360,7 +57343,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); } break; case 79: @@ -57377,7 +57360,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); } break; case 80: @@ -57416,8 +57399,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 81: @@ -57443,8 +57425,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 82: @@ -57505,8 +57486,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 87: @@ -57522,8 +57502,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 88: @@ -57539,8 +57518,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 7U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); } break; case 89: @@ -57566,8 +57544,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 90: @@ -57593,8 +57570,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 91: @@ -57620,8 +57596,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 4U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 92: @@ -57647,8 +57622,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 5U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 93: @@ -57712,8 +57686,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 96: @@ -57791,8 +57764,7 @@ class DL_UsersAndCredentialsSuite : public TestCommand VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); } break; case 106: 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 a869ffdb549dc6..73b1dd2e2276af 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -94674,8 +94674,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -94842,8 +94841,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -94970,8 +94968,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95074,8 +95071,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95178,8 +95174,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95282,8 +95277,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95386,8 +95380,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95490,8 +95483,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95594,8 +95586,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -95838,7 +95829,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); } NextTest(); @@ -95941,7 +95932,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); } NextTest(); @@ -96069,8 +96060,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -96216,8 +96206,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -96391,8 +96380,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -96444,8 +96432,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -96658,8 +96645,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -96789,8 +96775,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -96842,8 +96827,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -97610,7 +97594,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); } NextTest(); @@ -97750,7 +97734,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); } NextTest(); @@ -97823,7 +97807,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 2U)); } NextTest(); @@ -97914,7 +97898,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); } NextTest(); @@ -97987,7 +97971,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 4U)); } NextTest(); @@ -98057,8 +98041,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -98177,7 +98160,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 2U)); + VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 5U)); } NextTest(); @@ -98227,7 +98210,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 3U)); + VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 5U)); } NextTest(); @@ -98277,7 +98260,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 6U)); + VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 5U)); } NextTest(); @@ -98358,8 +98341,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -98429,8 +98411,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -98637,8 +98618,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -98687,8 +98667,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -98737,8 +98716,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("nextCredentialIndex", actualValue, 7U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", actualValue)); } NextTest(); @@ -98808,8 +98786,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -98879,8 +98856,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 3U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -98950,8 +98926,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 4U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -99021,8 +98996,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 5U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -99192,8 +99166,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); @@ -99513,8 +99486,7 @@ class DL_UsersAndCredentials : public TestCommandBridge { { id actualValue = values.nextUserIndex; - VerifyOrReturn(CheckValueNonNull("nextUserIndex", actualValue)); - VerifyOrReturn(CheckValue("nextUserIndex", actualValue, 2U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", actualValue)); } NextTest(); From c061c53c0f813bbed266096c5655dabbd0912f0a Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 2 Jun 2022 08:43:54 +0000 Subject: [PATCH 9/9] Restyled by clang-format --- examples/lock-app/efr32/src/ZclCallbacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lock-app/efr32/src/ZclCallbacks.cpp b/examples/lock-app/efr32/src/ZclCallbacks.cpp index f48098aa5053a1..c271f2dc65fd5a 100644 --- a/examples/lock-app/efr32/src/ZclCallbacks.cpp +++ b/examples/lock-app/efr32/src/ZclCallbacks.cpp @@ -94,7 +94,7 @@ bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t cr chip::FabricIndex modifier, DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData) { - return LockMgr().SetCredential(endpointId, credentialIndex, creator, modifier, credentialStatus, credentialType, + return LockMgr().SetCredential(endpointId, credentialIndex, creator, modifier, credentialStatus, credentialType, credentialData); }