From 3043217837a3e84cb5156e0dafb761a051a9d4fe Mon Sep 17 00:00:00 2001 From: Evgeniy Morozov Date: Sat, 29 Jan 2022 00:50:04 +0300 Subject: [PATCH] Feature/implement schedules (#13863) * Add method definitions for weekday schedule * Use correct types for door lock schedule attributes * Implement SetWeekDay schedule command and add argument tests for it * Implement GetWeekDay schedule command and add argument tests for it * Use optional instead of presentIf in door-lock-cluster.xml * Add ability to externally get number of supported users and schedules for door lock * Support multiple endpoints on the door lock example app * Implement storage for week day schedules in the door lock example app * Implement command to clear the week day door lock schedules - Also support feature checks - Fix compiler warnings * Enable year-day schedule stuff in the zap configs * Add placeholder implementation of Year Days schedules * Implement year day schedules in the cluster * Add Doxygen comments for door lock cluster * Fix code review notes * Update auto-generated files --- .../all-clusters-app.matter | 6 +- examples/chip-tool/templates/tests.js | 1 + .../door-lock-common/door-lock-app.matter | 64 + .../door-lock-common/door-lock-app.zap | 74 +- examples/door-lock-app/linux/BUILD.gn | 1 + .../linux/include/LockEndpoint.h | 112 + .../door-lock-app/linux/include/LockManager.h | 55 +- examples/door-lock-app/linux/main.cpp | 35 +- .../door-lock-app/linux/src/LockEndpoint.cpp | 348 ++ .../door-lock-app/linux/src/LockManager.cpp | 293 +- .../tv-casting-common/tv-casting-app.matter | 6 +- .../door-lock-server/door-lock-server.cpp | 783 +++- .../door-lock-server/door-lock-server.h | 194 +- src/app/tests/suites/DL_Schedules.yaml | 1472 +++++++ .../zcl/data-model/chip/door-lock-cluster.xml | 46 +- .../data_model/controller-clusters.matter | 70 + .../data_model/controller-clusters.zap | 458 ++- .../java/zap-generated/CHIPCallbackTypes.h | 8 + .../java/zap-generated/CHIPClusters-JNI.cpp | 472 +++ .../zap-generated/CHIPInvokeCallbacks.cpp | 232 ++ .../java/zap-generated/CHIPInvokeCallbacks.h | 30 + .../chip/devicecontroller/ChipClusters.java | 252 ++ .../devicecontroller/ClusterInfoMapping.java | 309 ++ .../devicecontroller/ClusterReadMapping.java | 30 + .../python/chip/clusters/CHIPClusters.py | 75 + .../python/chip/clusters/Objects.py | 40 +- .../CHIPAttributeTLVValueDecoder.mm | 22 + .../CHIP/zap-generated/CHIPCallbackBridge.mm | 81 + .../CHIPCallbackBridge_internal.h | 30 + .../CHIP/zap-generated/CHIPClustersObjc.h | 34 + .../CHIP/zap-generated/CHIPClustersObjc.mm | 204 + .../zap-generated/CHIPCommandPayloadsObjc.h | 20 +- .../zap-generated/CHIPCommandPayloadsObjc.mm | 20 +- .../CHIP/zap-generated/CHIPTestClustersObjc.h | 4 + .../zap-generated/CHIPTestClustersObjc.mm | 38 + .../Framework/CHIPTests/CHIPClustersTests.m | 52 + .../zap-generated/endpoint_config.h | 12 +- .../zap-generated/attributes/Accessors.cpp | 30 +- .../zap-generated/attributes/Accessors.h | 12 +- .../zap-generated/cluster-objects.h | 96 +- .../zap-generated/cluster/Commands.h | 261 +- .../cluster/logging/DataModelLogger.cpp | 47 + .../cluster/logging/DataModelLogger.h | 4 + .../chip-tool/zap-generated/test/Commands.h | 3540 +++++++++++++++++ .../zap-generated/CHIPClientCallbacks.cpp | 42 + .../zap-generated/CHIPClientCallbacks.h | 5 + .../zap-generated/CHIPClusters.cpp | 317 ++ .../zap-generated/CHIPClusters.h | 15 + .../zap-generated/IMClusterCommandHandler.cpp | 163 + .../zap-generated/IMClusterCommandHandler.cpp | 54 + .../zap-generated/endpoint_config.h | 16 +- .../zap-generated/endpoint_config.h | 12 +- 52 files changed, 10152 insertions(+), 445 deletions(-) create mode 100644 examples/door-lock-app/linux/include/LockEndpoint.h create mode 100644 examples/door-lock-app/linux/src/LockEndpoint.cpp create mode 100644 src/app/tests/suites/DL_Schedules.yaml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 00f32124749bc8..88c5abfd4e77cc 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -1159,9 +1159,9 @@ server cluster DoorLock = 257 { readonly attribute int16u numberOfTotalUsersSupported = 17; readonly attribute int16u numberOfPINUsersSupported = 18; readonly attribute int16u numberOfRFIDUsersSupported = 19; - readonly attribute int16u numberOfWeekDaySchedulesSupportedPerUser = 20; - readonly attribute int16u numberOfYearDaySchedulesSupportedPerUser = 21; - readonly attribute int16u numberOfHolidaySchedulesSupported = 22; + readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; + readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; + readonly attribute int8u numberOfHolidaySchedulesSupported = 22; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 04d822951b7242..e1328555c68527 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -249,6 +249,7 @@ function getTests() const DoorLock = [ 'DL_UsersAndCredentials', 'DL_LockUnlock', + 'DL_Schedules', ]; const Groups = [ diff --git a/examples/door-lock-app/door-lock-common/door-lock-app.matter b/examples/door-lock-app/door-lock-common/door-lock-app.matter index 57ba1b95b7dd3f..1449bebe3483da 100644 --- a/examples/door-lock-app/door-lock-common/door-lock-app.matter +++ b/examples/door-lock-app/door-lock-common/door-lock-app.matter @@ -502,6 +502,8 @@ server cluster DoorLock = 257 { readonly attribute int16u numberOfTotalUsersSupported = 17; readonly attribute int16u numberOfPINUsersSupported = 18; readonly attribute int16u numberOfRFIDUsersSupported = 19; + readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; + readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; @@ -527,6 +529,16 @@ server cluster DoorLock = 257 { INT16U userIndex = 0; } + request struct ClearWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct ClearYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + request struct GetCredentialStatusRequest { DlCredential credential = 0; } @@ -535,6 +547,16 @@ server cluster DoorLock = 257 { INT16U userIndex = 0; } + request struct GetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct GetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + request struct LockDoorRequest { optional OCTET_STRING pinCode = 0; } @@ -558,6 +580,23 @@ server cluster DoorLock = 257 { nullable DlCredentialRule credentialRule = 6; } + request struct SetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlDaysMaskMap daysMask = 2; + INT8U startHour = 3; + INT8U startMinute = 4; + INT8U endHour = 5; + INT8U endMinute = 6; + } + + request struct SetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + epoch_s localStartTime = 2; + epoch_s localEndTime = 3; + } + request struct UnlockDoorRequest { optional OCTET_STRING pinCode = 0; } @@ -581,6 +620,25 @@ server cluster DoorLock = 257 { nullable INT16U nextUserIndex = 9; } + response struct GetWeekDayScheduleResponse { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional DlDaysMaskMap daysMask = 3; + optional INT8U startHour = 4; + optional INT8U startMinute = 5; + optional INT8U endHour = 6; + optional INT8U endMinute = 7; + } + + response struct GetYearDayScheduleResponse { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional epoch_s localStartTime = 3; + optional epoch_s localEndTime = 4; + } + response struct SetCredentialResponse { DlStatus status = 0; nullable INT16U userIndex = 1; @@ -589,11 +647,17 @@ server cluster DoorLock = 257 { command ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; command ClearUser(ClearUserRequest): DefaultSuccess = 29; + command ClearWeekDaySchedule(ClearWeekDayScheduleRequest): DefaultSuccess = 13; + command ClearYearDaySchedule(ClearYearDayScheduleRequest): DefaultSuccess = 16; command GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; command GetUser(GetUserRequest): GetUserResponse = 27; + command GetWeekDaySchedule(GetWeekDayScheduleRequest): GetWeekDayScheduleResponse = 12; + command GetYearDaySchedule(GetYearDayScheduleRequest): GetYearDayScheduleResponse = 15; command LockDoor(LockDoorRequest): DefaultSuccess = 0; command SetCredential(SetCredentialRequest): SetCredentialResponse = 34; command SetUser(SetUserRequest): DefaultSuccess = 26; + command SetWeekDaySchedule(SetWeekDayScheduleRequest): DefaultSuccess = 11; + command SetYearDaySchedule(SetYearDayScheduleRequest): DefaultSuccess = 14; command UnlockDoor(UnlockDoorRequest): DefaultSuccess = 1; } diff --git a/examples/door-lock-app/door-lock-common/door-lock-app.zap b/examples/door-lock-app/door-lock-common/door-lock-app.zap index e4214b2ea5416d..3b563ebfc4d2f3 100644 --- a/examples/door-lock-app/door-lock-common/door-lock-app.zap +++ b/examples/door-lock-app/door-lock-common/door-lock-app.zap @@ -6076,6 +6076,54 @@ "incoming": 1, "outgoing": 1 }, + { + "name": "SetWeekDaySchedule", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetWeekDaySchedule", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearWeekDaySchedule", + "code": 13, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "SetYearDaySchedule", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GetYearDaySchedule", + "code": 15, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ClearYearDaySchedule", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, { "name": "SetUser", "code": 26, @@ -6151,6 +6199,22 @@ "side": "server", "enabled": 1, "commands": [ + { + "name": "GetWeekDayScheduleResponse", + "code": 12, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "GetYearDayScheduleResponse", + "code": 15, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + }, { "name": "GetUserResponse", "code": 28, @@ -6347,11 +6411,11 @@ "code": 20, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6362,11 +6426,11 @@ "code": 21, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6876,7 +6940,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x103", + "defaultValue": "0x113", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/door-lock-app/linux/BUILD.gn b/examples/door-lock-app/linux/BUILD.gn index 6123de3db30afd..ff0f13d217d852 100644 --- a/examples/door-lock-app/linux/BUILD.gn +++ b/examples/door-lock-app/linux/BUILD.gn @@ -18,6 +18,7 @@ import("//build_overrides/chip.gni") executable("chip-door-lock-app") { sources = [ "main.cpp", + "src/LockEndpoint.cpp", "src/LockManager.cpp", ] diff --git a/examples/door-lock-app/linux/include/LockEndpoint.h b/examples/door-lock-app/linux/include/LockEndpoint.h new file mode 100644 index 00000000000000..7fc2f55923fdbb --- /dev/null +++ b/examples/door-lock-app/linux/include/LockEndpoint.h @@ -0,0 +1,112 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +struct LockUserInfo; +struct LockCredentialInfo; +struct WeekDaysScheduleInfo; +struct YearDayScheduleInfo; + +static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE = 20; + +class LockEndpoint +{ +public: + LockEndpoint(chip::EndpointId endpointId, uint16_t numberOfLockUsersSupported, uint16_t numberOfCredentialsSupported, + uint8_t weekDaySchedulesPerUser, uint8_t yearDaySchedulesPerUser) : + mEndpointId(endpointId), + mLockState(DlLockState::kLocked), mLockUsers(numberOfLockUsersSupported), + mLockCredentials(numberOfCredentialsSupported + 1), + mWeekDaySchedules(numberOfLockUsersSupported, std::vector(weekDaySchedulesPerUser)), + mYearDaySchedules(numberOfLockUsersSupported, std::vector(numberOfLockUsersSupported)) + {} + + inline chip::EndpointId GetEndpointId() { return mEndpointId; } + + bool Lock(const Optional & pin); + bool Unlock(const Optional & pin); + + bool GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) const; + bool SetUser(uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, const chip::CharSpan & userName, + uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, DlCredentialRule credentialRule, + const DlCredential * credentials, size_t totalCredentials); + + bool GetCredential(uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential) const; + + bool SetCredential(uint16_t credentialIndex, DlCredentialStatus credentialStatus, DlCredentialType credentialType, + const chip::ByteSpan & credentialData); + + DlStatus GetSchedule(uint8_t weekDayIndex, uint16_t userIndex, EmberAfPluginDoorLockWeekDaySchedule & schedule); + DlStatus GetSchedule(uint8_t yearDayIndex, uint16_t userIndex, EmberAfPluginDoorLockYearDaySchedule & schedule); + DlStatus SetSchedule(uint8_t weekDayIndex, uint16_t userIndex, DlScheduleStatus status, DlDaysMaskMap daysMask, + uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute); + DlStatus SetSchedule(uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, uint32_t localStartTime, + uint32_t localEndTime); + +private: + bool setLockState(DlLockState lockState, const Optional & pin); + const char * lockStateToString(DlLockState lockState) const; + + chip::EndpointId mEndpointId; + DlLockState mLockState; + + // This is very naive implementation of users/credentials/schedules database and by no means the best practice. Proper storage + // of those items is out of scope of this example. + std::vector mLockUsers; + std::vector mLockCredentials; + std::vector> mWeekDaySchedules; + std::vector> mYearDaySchedules; +}; + +struct LockUserInfo +{ + char userName[DOOR_LOCK_USER_NAME_BUFFER_SIZE]; + DlCredential credentials[DOOR_LOCK_MAX_CREDENTIALS_PER_USER]; + size_t totalCredentials; + uint32_t userUniqueId; + DlUserStatus userStatus; + DlUserType userType; + DlCredentialRule credentialRule; + chip::FabricIndex createdBy; + chip::FabricIndex lastModifiedBy; +}; + +struct LockCredentialInfo +{ + DlCredentialStatus status; + DlCredentialType credentialType; + uint8_t credentialData[DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE]; + size_t credentialDataSize; +}; + +struct WeekDaysScheduleInfo +{ + DlScheduleStatus status; + EmberAfPluginDoorLockWeekDaySchedule schedule; +}; + +struct YearDayScheduleInfo +{ + DlScheduleStatus status; + EmberAfPluginDoorLockYearDaySchedule schedule; +}; diff --git a/examples/door-lock-app/linux/include/LockManager.h b/examples/door-lock-app/linux/include/LockManager.h index 80119fd6991c4c..956a82708cfbe2 100644 --- a/examples/door-lock-app/linux/include/LockManager.h +++ b/examples/door-lock-app/linux/include/LockManager.h @@ -18,44 +18,21 @@ #pragma once +#include #include -#include -#include - -#include +#include #include -struct LockUserInfo -{ - char userName[DOOR_LOCK_USER_NAME_BUFFER_SIZE]; - DlCredential credentials[DOOR_LOCK_MAX_CREDENTIALS_PER_USER]; - size_t totalCredentials; - uint32_t userUniqueId; - DlUserStatus userStatus; - DlUserType userType; - DlCredentialRule credentialRule; - chip::FabricIndex createdBy; - chip::FabricIndex lastModifiedBy; -}; - -static constexpr size_t DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE = 20; - -struct LockCredentialInfo -{ - DlCredentialStatus status; - DlCredentialType credentialType; - uint8_t credentialData[DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE]; - size_t credentialDataSize; -}; - class LockManager { public: - LockManager() : mLocked(DlLockState::kLocked) {} + LockManager() {} - bool Lock(chip::Optional pin); - bool Unlock(chip::Optional pin); + bool InitEndpoint(chip::EndpointId endpointId); + + bool Lock(chip::EndpointId endpointId, const Optional & pin); + bool Unlock(chip::EndpointId endpointId, const Optional & pin); bool GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user); bool SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, @@ -68,17 +45,21 @@ class LockManager bool SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData); + DlStatus GetSchedule(chip::EndpointId endpointId, uint8_t weekDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule); + DlStatus GetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule); + DlStatus SetSchedule(chip::EndpointId endpointId, uint8_t weekDayIndex, uint16_t userIndex, DlScheduleStatus status, + DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute); + DlStatus SetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime); + static LockManager & Instance(); private: - bool setLockState(DlLockState lockState, chip::Optional & pin); - const char * lockStateToString(DlLockState lockState); + LockEndpoint * getEndpoint(chip::EndpointId endpointId); - DlLockState mLocked; + std::vector mEndpoints; - // TODO: Support multiple endpoints in the app. - std::array mLockUsers; - // Also include programming User PIN as a zero index - std::array mLockCredentials; static LockManager instance; }; diff --git a/examples/door-lock-app/linux/main.cpp b/examples/door-lock-app/linux/main.cpp index 779a55058370fa..635337c232f3ae 100644 --- a/examples/door-lock-app/linux/main.cpp +++ b/examples/door-lock-app/linux/main.cpp @@ -31,14 +31,14 @@ using namespace chip::app::Clusters::DoorLock; // should wait for door to be locked on lock command and return success) but // door lock server should check pin before even calling the lock-door // callback. -bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode) { - return LockManager::Instance().Lock(pinCode); + return LockManager::Instance().Lock(endpointId, pinCode); } -bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode) { - return LockManager::Instance().Unlock(pinCode); + return LockManager::Instance().Unlock(endpointId, pinCode); } bool emberAfPluginDoorLockGetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) @@ -68,6 +68,32 @@ bool emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t cr return LockManager::Instance().SetCredential(endpointId, credentialIndex, credentialStatus, credentialType, credentialData); } +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + return LockManager::Instance().GetSchedule(endpointId, weekdayIndex, userIndex, schedule); +} + +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + DlScheduleStatus status, DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, + uint8_t endHour, uint8_t endMinute) +{ + return LockManager::Instance().SetSchedule(endpointId, weekdayIndex, userIndex, status, daysMask, startHour, startMinute, + endHour, endMinute); +} + +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime) +{ + return LockManager::Instance().SetSchedule(endpointId, yearDayIndex, userIndex, status, localStartTime, localEndTime); +} + +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + return LockManager::Instance().GetSchedule(endpointId, yearDayIndex, userIndex, schedule); +} + void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, uint16_t size, uint8_t * value) { @@ -81,6 +107,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & void emberAfDoorLockClusterInitCallback(EndpointId endpoint) { DoorLockServer::Instance().InitServer(endpoint); + LockManager::Instance().InitEndpoint(endpoint); } void ApplicationInit() {} diff --git a/examples/door-lock-app/linux/src/LockEndpoint.cpp b/examples/door-lock-app/linux/src/LockEndpoint.cpp new file mode 100644 index 00000000000000..2d5822baf44966 --- /dev/null +++ b/examples/door-lock-app/linux/src/LockEndpoint.cpp @@ -0,0 +1,348 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "LockEndpoint.h" +#include + +using chip::to_underlying; + +bool LockEndpoint::Lock(const Optional & pin) +{ + return setLockState(DlLockState::kLocked, pin); +} + +bool LockEndpoint::Unlock(const Optional & pin) +{ + return setLockState(DlLockState::kUnlocked, pin); +} + +bool LockEndpoint::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) const +{ + ChipLogProgress(Zcl, "Door Lock App: LockEndpoint::GetUser [endpoint=%d,userIndex=%hu]", mEndpointId, userIndex); + + uint16_t adjustedUserIndex = static_cast(userIndex - 1); + if (adjustedUserIndex > mLockUsers.size()) + { + ChipLogError(Zcl, "Cannot get user - index out of range [endpoint=%d,index=%hu,adjustedIndex=%d]", mEndpointId, userIndex, + adjustedUserIndex); + return false; + } + + const auto & userInDb = mLockUsers[adjustedUserIndex]; + user.userStatus = userInDb.userStatus; + if (DlUserStatus::kAvailable == user.userStatus) + { + ChipLogDetail(Zcl, "Found unoccupied user [endpoint=%d,adjustedIndex=%hu]", mEndpointId, adjustedUserIndex); + return true; + } + + user.userName = chip::CharSpan(userInDb.userName, strlen(userInDb.userName)); + user.credentials = chip::Span(userInDb.credentials, userInDb.totalCredentials); + user.userUniqueId = userInDb.userUniqueId; + user.userType = userInDb.userType; + user.credentialRule = userInDb.credentialRule; + user.createdBy = userInDb.createdBy; + user.lastModifiedBy = userInDb.lastModifiedBy; + + ChipLogDetail( + Zcl, + "Found occupied user " + "[endpoint=%d,adjustedIndex=%hu,name=\"%*.s\",credentialsCount=%zu,uniqueId=%x,type=%" PRIu8 ",credentialRule=%" PRIu8 "," + "createdBy=%d,lastModifiedBy=%d]", + mEndpointId, adjustedUserIndex, static_cast(user.userName.size()), user.userName.data(), user.credentials.size(), + user.userUniqueId, to_underlying(user.userType), to_underlying(user.credentialRule), user.createdBy, user.lastModifiedBy); + + return true; +} + +bool LockEndpoint::SetUser(uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + const chip::CharSpan & userName, uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, + DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials) +{ + ChipLogProgress(Zcl, + "Door Lock App: LockEndpoint::SetUser " + "[endpoint=%d,userIndex=%" PRIu16 ",creator=%d,modifier=%d,userName=\"%*.s\",uniqueId=%" PRIx32 + ",userStatus=%" PRIu8 ",userType=%" PRIu8 "," + "credentialRule=%" PRIu8 ",credentials=%p,totalCredentials=%zu]", + mEndpointId, userIndex, creator, modifier, static_cast(userName.size()), userName.data(), uniqueId, + to_underlying(userStatus), to_underlying(usertype), to_underlying(credentialRule), credentials, + totalCredentials); + + uint16_t adjustedUserIndex = static_cast(userIndex - 1); + if (adjustedUserIndex > mLockUsers.size()) + { + ChipLogError(Zcl, "Cannot set user - index out of range [endpoint=%d,index=%d,adjustedUserIndex=%" PRIu16 "]", mEndpointId, + userIndex, adjustedUserIndex); + return false; + } + + auto & userInStorage = mLockUsers[adjustedUserIndex]; + + if (userName.size() > DOOR_LOCK_MAX_USER_NAME_SIZE) + { + ChipLogError(Zcl, "Cannot set user - user name is too long [endpoint=%d,index=%d,adjustedUserIndex=%" PRIu16 "]", + mEndpointId, userIndex, adjustedUserIndex); + return false; + } + + if (totalCredentials > sizeof(DOOR_LOCK_MAX_CREDENTIALS_PER_USER)) + { + ChipLogError(Zcl, + "Cannot set user - total number of credentials is too big [endpoint=%d,index=%d,adjustedUserIndex=%" PRIu16 + ",totalCredentials=%zu]", + mEndpointId, userIndex, adjustedUserIndex, totalCredentials); + return false; + } + + chip::Platform::CopyString(userInStorage.userName, userName); + userInStorage.userName[userName.size()] = 0; + userInStorage.userUniqueId = uniqueId; + userInStorage.userStatus = userStatus; + userInStorage.userType = usertype; + userInStorage.credentialRule = credentialRule; + userInStorage.lastModifiedBy = modifier; + userInStorage.createdBy = creator; + + userInStorage.totalCredentials = totalCredentials; + for (size_t i = 0; i < totalCredentials; ++i) + { + userInStorage.credentials[i] = credentials[i]; + } + + ChipLogProgress(Zcl, "Successfully set the user [mEndpointId=%d,index=%d,adjustedIndex=%d]", mEndpointId, userIndex, + adjustedUserIndex); + + return true; +} + +bool LockEndpoint::GetCredential(uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential) const +{ + ChipLogProgress( + Zcl, "Door Lock App: LockEndpoint::GetCredential [endpoint=%d,credentialIndex=%" PRIu16 ",credentialType=%" PRIu8 "]", + mEndpointId, credentialIndex, to_underlying(credentialType)); + + if (credentialIndex >= mLockCredentials.size() || (0 == credentialIndex && DlCredentialType::kProgrammingPIN != credentialType)) + { + ChipLogError(Zcl, "Cannot get the credential - index out of range [endpoint=%d,index=%d]", mEndpointId, credentialIndex); + return false; + } + + const auto & credentialInStorage = mLockCredentials[credentialIndex]; + + credential.status = credentialInStorage.status; + if (DlCredentialStatus::kAvailable == credential.status) + { + ChipLogDetail(Zcl, "Found unoccupied credential [endpoint=%d,index=%" PRIu16 "]", mEndpointId, credentialIndex); + return true; + } + credential.credentialType = credentialInStorage.credentialType; + credential.credentialData = chip::ByteSpan(credentialInStorage.credentialData, credentialInStorage.credentialDataSize); + + ChipLogDetail(Zcl, "Found occupied credential [endpoint=%d,index=%" PRIu16 ",type=%" PRIu8 ",dataSize=%zu]", mEndpointId, + credentialIndex, to_underlying(credential.credentialType), credential.credentialData.size()); + + return true; +} + +bool LockEndpoint::SetCredential(uint16_t credentialIndex, DlCredentialStatus credentialStatus, DlCredentialType credentialType, + const chip::ByteSpan & credentialData) +{ + ChipLogProgress( + Zcl, + "Door Lock App: LockEndpoint::SetCredential " + "[endpoint=%d,credentialIndex=%" PRIu16 ",credentialStatus=%" PRIu8 ",credentialType=%" PRIu8 ",credentialDataSize=%zu]", + mEndpointId, credentialIndex, to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size()); + + if (credentialIndex >= mLockCredentials.size() || (0 == credentialIndex && DlCredentialType::kProgrammingPIN != credentialType)) + { + ChipLogError(Zcl, "Cannot set the credential - index out of range [endpoint=%d,index=%d]", mEndpointId, credentialIndex); + return false; + } + + auto & credentialInStorage = mLockCredentials[credentialIndex]; + if (credentialData.size() > DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE) + { + ChipLogError(Zcl, + "Cannot get the credential - data size exceeds limit " + "[endpoint=%d,index=%d,dataSize=%zu,maxDataSize=%zu]", + mEndpointId, credentialIndex, credentialData.size(), DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE); + return false; + } + credentialInStorage.status = credentialStatus; + credentialInStorage.credentialType = credentialType; + std::memcpy(credentialInStorage.credentialData, credentialData.data(), credentialData.size()); + credentialInStorage.credentialDataSize = credentialData.size(); + + ChipLogProgress(Zcl, "Successfully set the credential [mEndpointId=%d,index=%d,credentialType=%" PRIu8 "]", mEndpointId, + credentialIndex, to_underlying(credentialType)); + + return true; +} + +DlStatus LockEndpoint::GetSchedule(uint8_t weekDayIndex, uint16_t userIndex, EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + if (0 == userIndex || userIndex > mWeekDaySchedules.size()) + { + return DlStatus::kFailure; + } + + if (0 == weekDayIndex || weekDayIndex > mWeekDaySchedules.at(userIndex - 1).size()) + { + return DlStatus::kFailure; + } + + const auto & scheduleInStorage = mWeekDaySchedules.at(userIndex - 1).at(weekDayIndex - 1); + if (DlScheduleStatus::kAvailable == scheduleInStorage.status) + { + return DlStatus::kNotFound; + } + + schedule = scheduleInStorage.schedule; + + return DlStatus::kSuccess; +} + +DlStatus LockEndpoint::SetSchedule(uint8_t weekDayIndex, uint16_t userIndex, DlScheduleStatus status, DlDaysMaskMap daysMask, + uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute) +{ + if (0 == userIndex || userIndex > mWeekDaySchedules.size()) + { + return DlStatus::kFailure; + } + + if (0 == weekDayIndex || weekDayIndex > mWeekDaySchedules.at(userIndex - 1).size()) + { + return DlStatus::kFailure; + } + + auto & scheduleInStorage = mWeekDaySchedules.at(userIndex - 1).at(weekDayIndex - 1); + + scheduleInStorage.schedule.daysMask = daysMask; + scheduleInStorage.schedule.startHour = startHour; + scheduleInStorage.schedule.startMinute = startMinute; + scheduleInStorage.schedule.endHour = endHour; + scheduleInStorage.schedule.endMinute = endMinute; + scheduleInStorage.status = status; + + return DlStatus::kSuccess; +} + +DlStatus LockEndpoint::GetSchedule(uint8_t yearDayIndex, uint16_t userIndex, EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + if (0 == userIndex || userIndex > mYearDaySchedules.size()) + { + return DlStatus::kFailure; + } + + if (0 == yearDayIndex || yearDayIndex > mYearDaySchedules.at(userIndex - 1).size()) + { + return DlStatus::kFailure; + } + + const auto & scheduleInStorage = mYearDaySchedules.at(userIndex - 1).at(yearDayIndex - 1); + if (DlScheduleStatus::kAvailable == scheduleInStorage.status) + { + return DlStatus::kNotFound; + } + + schedule = scheduleInStorage.schedule; + + return DlStatus::kSuccess; +} + +DlStatus LockEndpoint::SetSchedule(uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, uint32_t localStartTime, + uint32_t localEndTime) +{ + if (0 == userIndex || userIndex > mYearDaySchedules.size()) + { + return DlStatus::kFailure; + } + + if (0 == yearDayIndex || yearDayIndex > mYearDaySchedules.at(userIndex - 1).size()) + { + return DlStatus::kFailure; + } + + auto & scheduleInStorage = mYearDaySchedules.at(userIndex - 1).at(yearDayIndex - 1); + scheduleInStorage.schedule.localStartTime = localStartTime; + scheduleInStorage.schedule.localEndTime = localEndTime; + scheduleInStorage.status = status; + + return DlStatus::kSuccess; +} + +bool LockEndpoint::setLockState(DlLockState lockState, const Optional & pin) +{ + if (mLockState == lockState) + { + ChipLogDetail(Zcl, "Door Lock App: door is already locked, ignoring command to set lock state to \"%s\" [endpointId=%d]", + lockStateToString(lockState), mEndpointId); + return true; + } + + if (!pin.HasValue()) + { + ChipLogDetail(Zcl, "Door Lock App: PIN code is not specified, setting door lock state to \"%s\" [endpointId=%d]", + lockStateToString(lockState), mEndpointId); + mLockState = lockState; + return true; + } + + // Check the PIN code + for (const auto & pinCredential : mLockCredentials) + { + if (pinCredential.credentialType != DlCredentialType::kPin || pinCredential.status == DlCredentialStatus::kAvailable) + { + continue; + } + + chip::ByteSpan credentialData(pinCredential.credentialData, pinCredential.credentialDataSize); + if (credentialData.data_equal(pin.Value())) + { + ChipLogDetail( + Zcl, + "Door Lock App: specified PIN code was found in the database, setting door lock state to \"%s\" [endpointId=%d]", + lockStateToString(lockState), mEndpointId); + + mLockState = lockState; + return true; + } + } + + ChipLogDetail(Zcl, + "Door Lock App: specified PIN code was not found in the database, ignoring command to set lock state to \"%s\" " + "[endpointId=%d]", + lockStateToString(lockState), mEndpointId); + + return false; +} + +const char * LockEndpoint::lockStateToString(DlLockState lockState) const +{ + switch (lockState) + { + case DlLockState::kNotFullyLocked: + return "Not Fully Locked"; + case DlLockState::kLocked: + return "Locked"; + case DlLockState::kUnlocked: + return "Unlocked"; + } + + return "Unknown"; +} diff --git a/examples/door-lock-app/linux/src/LockManager.cpp b/examples/door-lock-app/linux/src/LockManager.cpp index 71c821de4b7533..41b9200e14cd9b 100644 --- a/examples/door-lock-app/linux/src/LockManager.cpp +++ b/examples/door-lock-app/linux/src/LockManager.cpp @@ -31,225 +31,198 @@ LockManager & LockManager::Instance() return instance; } -bool LockManager::Lock(chip::Optional pin) +bool LockManager::InitEndpoint(chip::EndpointId endpointId) { - return setLockState(DlLockState::kLocked, pin); -} - -bool LockManager::Unlock(chip::Optional pin) -{ - return setLockState(DlLockState::kUnlocked, pin); -} + uint16_t numberOfSupportedUsers = 0; + if (!DoorLockServer::Instance().GetNumberOfUserSupported(endpointId, numberOfSupportedUsers)) + { + ChipLogError(Zcl, + "Unable to get number of supported users when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfSupportedUsers = 10; + } -bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) -{ - ChipLogProgress(Zcl, "Door Lock App: LockManager::GetUser [endpoint=%d,userIndex=%hu]", endpointId, userIndex); + uint16_t numberOfSupportedCredentials = 0; + // We're planning to use shared storage for PIN and RFID users so we will have the maximum of both sizes her to simplify logic + uint16_t numberOfPINCredentialsSupported = 0; + uint16_t numberOfRFIDCredentialsSupported = 0; + if (!DoorLockServer::Instance().GetNumberOfPINCredentialsSupported(endpointId, numberOfPINCredentialsSupported) || + !DoorLockServer::Instance().GetNumberOfRFIDCredentialsSupported(endpointId, numberOfRFIDCredentialsSupported)) + { + ChipLogError( + Zcl, "Unable to get number of supported credentials when initializing lock endpoint, defaulting to 10 [endpointId=%d]", + endpointId); + numberOfSupportedCredentials = 10; + } + else + { + numberOfSupportedCredentials = std::max(numberOfPINCredentialsSupported, numberOfRFIDCredentialsSupported); + } - uint16_t adjustedUserIndex = static_cast(userIndex - 1); - if (adjustedUserIndex > mLockUsers.size()) + uint8_t numberOfWeekDaySchedulesPerUser = 0; + if (!DoorLockServer::Instance().GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, numberOfWeekDaySchedulesPerUser)) { - ChipLogError(Zcl, "Cannot get user - index out of range [endpoint=%d,index=%hu,adjustedIndex=%d]", endpointId, userIndex, - adjustedUserIndex); - return false; + ChipLogError(Zcl, + "Unable to get number of supported week day schedules per user when initializing lock endpoint, defaulting to " + "10 [endpointId=%d]", + endpointId); + numberOfWeekDaySchedulesPerUser = 10; } - const auto & userInDb = mLockUsers[adjustedUserIndex]; - user.userStatus = userInDb.userStatus; - if (DlUserStatus::kAvailable == user.userStatus) + uint8_t numberOfYearDaySchedulesPerUser = 0; + if (!DoorLockServer::Instance().GetNumberOfYearDaySchedulesPerUserSupported(endpointId, numberOfYearDaySchedulesPerUser)) { - ChipLogDetail(Zcl, "Found unoccupied user [endpoint=%d,adjustedIndex=%hu]", endpointId, adjustedUserIndex); - return true; + ChipLogError(Zcl, + "Unable to get number of supported year day schedules per user when initializing lock endpoint, defaulting to " + "10 [endpointId=%d]", + endpointId); + numberOfYearDaySchedulesPerUser = 10; } - user.userName = chip::CharSpan(userInDb.userName, strlen(userInDb.userName)); - user.credentials = chip::Span(userInDb.credentials, userInDb.totalCredentials); - user.userUniqueId = userInDb.userUniqueId; - user.userType = userInDb.userType; - user.credentialRule = userInDb.credentialRule; - user.createdBy = userInDb.createdBy; - user.lastModifiedBy = userInDb.lastModifiedBy; + mEndpoints.push_back(LockEndpoint(endpointId, numberOfSupportedUsers, numberOfSupportedCredentials, + numberOfWeekDaySchedulesPerUser, numberOfYearDaySchedulesPerUser)); - ChipLogDetail( + ChipLogProgress( Zcl, - "Found occupied user " - "[endpoint=%d,adjustedIndex=%hu,name=\"%*.s\",credentialsCount=%zu,uniqueId=%x,type=%" PRIu8 ",credentialRule=%" PRIu8 "," - "createdBy=%d,lastModifiedBy=%d]", - endpointId, adjustedUserIndex, static_cast(user.userName.size()), user.userName.data(), user.credentials.size(), - user.userUniqueId, to_underlying(user.userType), to_underlying(user.credentialRule), user.createdBy, user.lastModifiedBy); + "Initialized new lock door endpoint [id=%d,users=%d,credentials=%d,weekDaySchedulesPerUser=%d,yearDaySchedulesPerUser=%d]", + endpointId, numberOfSupportedUsers, numberOfSupportedCredentials, numberOfWeekDaySchedulesPerUser, + numberOfYearDaySchedulesPerUser); return true; } -bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, - const chip::CharSpan & userName, uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, - DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials) +bool LockManager::Lock(chip::EndpointId endpointId, const Optional & pin) { - ChipLogProgress(Zcl, - "Door Lock App: LockManager::SetUser " - "[endpoint=%d,userIndex=%" PRIu16 ",creator=%d,modifier=%d,userName=\"%*.s\",uniqueId=%" PRIx32 - ",userStatus=%" PRIu8 ",userType=%" PRIu8 "," - "credentialRule=%" PRIu8 ",credentials=%p,totalCredentials=%zu]", - endpointId, userIndex, creator, modifier, static_cast(userName.size()), userName.data(), uniqueId, - to_underlying(userStatus), to_underlying(usertype), to_underlying(credentialRule), credentials, - totalCredentials); - - uint16_t adjustedUserIndex = static_cast(userIndex - 1); - if (adjustedUserIndex > mLockUsers.size()) - { - ChipLogError(Zcl, "Cannot set user - index out of range [endpoint=%d,index=%d,adjustedUserIndex=%" PRIu16 "]", endpointId, - userIndex, adjustedUserIndex); + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) + { + ChipLogError(Zcl, "Unable to lock the door - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; } + return lockEndpoint->Lock(pin); +} - auto & userInStorage = mLockUsers[adjustedUserIndex]; - - if (userName.size() > DOOR_LOCK_MAX_USER_NAME_SIZE) +bool LockManager::Unlock(chip::EndpointId endpointId, const Optional & pin) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogError(Zcl, "Cannot set user - user name is too long [endpoint=%d,index=%d,adjustedUserIndex=%" PRIu16 "]", - endpointId, userIndex, adjustedUserIndex); + ChipLogError(Zcl, "Unable to unlock the door - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; } + return lockEndpoint->Unlock(pin); +} - strncpy(userInStorage.userName, userName.data(), userName.size()); - userInStorage.userName[userName.size()] = 0; - userInStorage.userUniqueId = uniqueId; - userInStorage.userStatus = userStatus; - userInStorage.userType = usertype; - userInStorage.credentialRule = credentialRule; - userInStorage.lastModifiedBy = modifier; - userInStorage.createdBy = creator; - - userInStorage.totalCredentials = totalCredentials; - for (size_t i = 0; i < totalCredentials; ++i) +bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - userInStorage.credentials[i] = credentials[i]; + ChipLogError(Zcl, "Unable to get the user - endpoint does not exist or not initialized [endpointId=%d]", endpointId); + return false; } - - ChipLogProgress(Zcl, "Successfully set the user [endpointId=%d,index=%d,adjustedIndex=%d]", endpointId, userIndex, - adjustedUserIndex); - - return true; + return lockEndpoint->GetUser(userIndex, user); } -bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, - EmberAfPluginDoorLockCredentialInfo & credential) +bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, + const chip::CharSpan & userName, uint32_t uniqueId, DlUserStatus userStatus, DlUserType usertype, + DlCredentialRule credentialRule, const DlCredential * credentials, size_t totalCredentials) { - ChipLogProgress(Zcl, - "Door Lock App: LockManager::GetCredential [endpoint=%d,credentialIndex=%" PRIu16 ",credentialType=%" PRIu8 "]", - endpointId, credentialIndex, to_underlying(credentialType)); - - if (credentialIndex >= mLockCredentials.size() || (0 == credentialIndex && DlCredentialType::kProgrammingPIN != credentialType)) + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogError(Zcl, "Cannot get the credential - index out of range [endpoint=%d,index=%d]", endpointId, credentialIndex); + ChipLogError(Zcl, "Unable to set the user - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; } + return lockEndpoint->SetUser(userIndex, creator, modifier, userName, uniqueId, userStatus, usertype, credentialRule, + credentials, totalCredentials); +} - const auto & credentialInStorage = mLockCredentials[credentialIndex]; - - credential.status = credentialInStorage.status; - if (DlCredentialStatus::kAvailable == credential.status) +bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialType credentialType, + EmberAfPluginDoorLockCredentialInfo & credential) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogDetail(Zcl, "Found unoccupied credential [endpoint=%d,index=%" PRIu16 "]", endpointId, credentialIndex); - return true; + ChipLogError(Zcl, "Unable to get the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId); + return false; } - credential.credentialType = credentialInStorage.credentialType; - credential.credentialData = chip::ByteSpan(credentialInStorage.credentialData, credentialInStorage.credentialDataSize); - - ChipLogDetail(Zcl, "Found occupied credential [endpoint=%d,index=%" PRIu16 ",type=%" PRIu8 ",dataSize=%zu]", endpointId, - credentialIndex, to_underlying(credential.credentialType), credential.credentialData.size()); - - return true; + return lockEndpoint->GetCredential(credentialIndex, credentialType, credential); } bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, DlCredentialStatus credentialStatus, DlCredentialType credentialType, const chip::ByteSpan & credentialData) { - ChipLogProgress( - Zcl, - "Door Lock App: LockManager::SetCredential " - "[endpoint=%d,credentialIndex=%" PRIu16 ",credentialStatus=%" PRIu8 ",credentialType=%" PRIu8 ",credentialDataSize=%zu]", - endpointId, credentialIndex, to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size()); - - if (credentialIndex >= mLockCredentials.size() || (0 == credentialIndex && DlCredentialType::kProgrammingPIN != credentialType)) + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogError(Zcl, "Cannot set the credential - index out of range [endpoint=%d,index=%d]", endpointId, credentialIndex); + ChipLogError(Zcl, "Unable to set the credential - endpoint does not exist or not initialized [endpointId=%d]", endpointId); return false; } + return lockEndpoint->SetCredential(credentialIndex, credentialStatus, credentialType, credentialData); +} - auto & credentialInStorage = mLockCredentials[credentialIndex]; - if (credentialData.size() > DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE) +DlStatus LockManager::GetSchedule(chip::EndpointId endpointId, uint8_t weekDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogError(Zcl, - "Cannot get the credential - data size exceeds limit " - "[endpoint=%d,index=%d,dataSize=%zu,maxDataSize=%zu]", - endpointId, credentialIndex, credentialData.size(), DOOR_LOCK_CREDENTIAL_INFO_MAX_DATA_SIZE); - return false; + ChipLogError(Zcl, "Unable to get the week day schedule - endpoint does not exist or not initialized [endpointId=%d]", + endpointId); + return DlStatus::kFailure; } - credentialInStorage.status = credentialStatus; - credentialInStorage.credentialType = credentialType; - std::memcpy(credentialInStorage.credentialData, credentialData.data(), credentialData.size()); - credentialInStorage.credentialDataSize = credentialData.size(); - - ChipLogProgress(Zcl, "Successfully set the credential [endpointId=%d,index=%d,credentialType=%" PRIu8 "]", endpointId, - credentialIndex, to_underlying(credentialType)); - - return true; + return lockEndpoint->GetSchedule(weekDayIndex, userIndex, schedule); } -bool LockManager::setLockState(DlLockState lockState, chip::Optional & pin) +DlStatus LockManager::SetSchedule(chip::EndpointId endpointId, uint8_t weekDayIndex, uint16_t userIndex, DlScheduleStatus status, + DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, + uint8_t endMinute) { - if (mLocked == lockState) + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogDetail(Zcl, "Door Lock App: door is already locked, ignoring command to set lock state to \"%s\"", - lockStateToString(lockState)); - return true; + ChipLogError(Zcl, "Unable to set the week day schedule - endpoint does not exist or not initialized [endpointId=%d]", + endpointId); + return DlStatus::kFailure; } + return lockEndpoint->SetSchedule(weekDayIndex, userIndex, status, daysMask, startHour, startMinute, endHour, endMinute); +} - if (!pin.HasValue()) +DlStatus LockManager::GetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - ChipLogDetail(Zcl, "Door Lock App: PIN code is not specified, setting door lock state to \"%s\"", - lockStateToString(lockState)); - mLocked = lockState; - return true; + ChipLogError(Zcl, "Unable to get the year day schedule - endpoint does not exist or not initialized [endpointId=%d]", + endpointId); + return DlStatus::kFailure; } + return lockEndpoint->GetSchedule(yearDayIndex, userIndex, schedule); +} - // Check the PIN code - for (const auto & pinCredential : mLockCredentials) +DlStatus LockManager::SetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime) +{ + auto lockEndpoint = getEndpoint(endpointId); + if (nullptr == lockEndpoint) { - if (pinCredential.credentialType != DlCredentialType::kPin || pinCredential.status == DlCredentialStatus::kAvailable) - { - continue; - } - - chip::ByteSpan credentialData(pinCredential.credentialData, pinCredential.credentialDataSize); - if (credentialData.data_equal(pin.Value())) - { - ChipLogDetail(Zcl, "Door Lock App: specified PIN code was found in the database, setting door lock state to \"%s\"", - lockStateToString(lockState)); - - mLocked = lockState; - return true; - } + ChipLogError(Zcl, "Unable to set the year day schedule - endpoint does not exist or not initialized [endpointId=%d]", + endpointId); + return DlStatus::kFailure; } - - ChipLogDetail(Zcl, - "Door Lock App: specified PIN code was not found in the database, ignoring command to set lock state to \"%s\"", - lockStateToString(lockState)); - - return false; + return lockEndpoint->SetSchedule(yearDayIndex, userIndex, status, localStartTime, localEndTime); } -const char * LockManager::lockStateToString(DlLockState lockState) +LockEndpoint * LockManager::getEndpoint(chip::EndpointId endpointId) { - switch (lockState) + for (auto it = mEndpoints.begin(); it != mEndpoints.end(); ++it) { - case DlLockState::kNotFullyLocked: - return "Not Fully Locked"; - case DlLockState::kLocked: - return "Locked"; - case DlLockState::kUnlocked: - return "Unlocked"; + if (it->GetEndpointId() == endpointId) + { + return &(*it); + } } - - return "Unknown"; + return nullptr; } diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index c10ef178e7d2ee..86098b34a90ab7 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1061,9 +1061,9 @@ server cluster DoorLock = 257 { attribute int16u openPeriod = 6; readonly attribute int16u numberOfTotalUsersSupported = 17; readonly attribute int16u numberOfPINUsersSupported = 18; - readonly attribute int16u numberOfWeekDaySchedulesSupportedPerUser = 20; - readonly attribute int16u numberOfYearDaySchedulesSupportedPerUser = 21; - readonly attribute int16u numberOfHolidaySchedulesSupported = 22; + readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; + readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; + readonly attribute int8u numberOfHolidaySchedulesSupported = 22; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; readonly attribute bitmap8 credentialRulesSupport = 27; 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 af8f98f157b36a..3e9a8db4bfcb28 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -38,6 +38,9 @@ using namespace chip; using namespace chip::app::DataModel; using namespace chip::app::Clusters::DoorLock; +static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_HOUR = 23; +static constexpr uint8_t DOOR_LOCK_SCHEDULE_MAX_MINUTE = 59; + EmberEventControl emberAfPluginDoorLockServerLockoutEventControl; EmberEventControl emberAfPluginDoorLockServerRelockEventControl; @@ -179,6 +182,63 @@ bool DoorLockServer::SetPrivacyModeButton(chip::EndpointId endpointId, bool isEn return (EMBER_ZCL_STATUS_SUCCESS == status); } +bool DoorLockServer::GetNumberOfUserSupported(chip::EndpointId endpointId, uint16_t & numberOfUsersSupported) +{ + EmberAfStatus status = Attributes::NumberOfTotalUsersSupported::Get(endpointId, &numberOfUsersSupported); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + ChipLogError(Zcl, "Unable to read attribute 'NumberOfTotalUsersSupported' [status=%d]", status); + return false; + } + return true; +} + +bool DoorLockServer::GetNumberOfPINCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfPINCredentials) +{ + EmberAfStatus status = Attributes::NumberOfPINUsersSupported::Get(endpointId, &numberOfPINCredentials); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + ChipLogError(Zcl, "Unable to read attribute 'NumberOfPINUsersSupported' [status=%d]", status); + return false; + } + return true; +} + +bool DoorLockServer::GetNumberOfRFIDCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfRFIDCredentials) +{ + EmberAfStatus status = Attributes::NumberOfRFIDUsersSupported::Get(endpointId, &numberOfRFIDCredentials); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + ChipLogError(Zcl, "Unable to read attribute 'NumberOfRFIDUsersSupported' [status=%d]", status); + return false; + } + return true; +} + +bool DoorLockServer::GetNumberOfWeekDaySchedulesPerUserSupported(chip::EndpointId endpointId, + uint8_t & numberOfWeekDaySchedulesPerUser) +{ + EmberAfStatus status = Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Get(endpointId, &numberOfWeekDaySchedulesPerUser); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + ChipLogError(Zcl, "Unable to read attribute 'NumberOfWeekDaySchedulesSupportedPerUser' [status=%d]", status); + return false; + } + return true; +} + +bool DoorLockServer::GetNumberOfYearDaySchedulesPerUserSupported(chip::EndpointId endpointId, + uint8_t & numberOfYearDaySchedulesPerUser) +{ + EmberAfStatus status = Attributes::NumberOfYearDaySchedulesSupportedPerUser::Get(endpointId, &numberOfYearDaySchedulesPerUser); + if (EMBER_ZCL_STATUS_SUCCESS != status) + { + ChipLogError(Zcl, "Unable to read attribute 'NumberOfYearDaySchedulesSupportedPerUser' [status=%d]", status); + return false; + } + return true; +} + void DoorLockServer::SetUserCommandHandler(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::SetUser::DecodableType & commandData) @@ -792,6 +852,456 @@ void DoorLockServer::LockUnlockDoorCommandHandler(chip::app::CommandHandler * co emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); } +void DoorLockServer::SetWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + + auto fabricIdx = getFabricIndex(commandObj); + if (kUndefinedFabricIndex == fabricIdx) + { + ChipLogError(Zcl, "[SetWeekDaySchedule] Unable to get the fabric IDX [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto sourceNodeId = getNodeId(commandObj); + if (chip::kUndefinedNodeId == sourceNodeId) + { + ChipLogError(Zcl, "[SetWeekDaySchedule] Unable to get the source node index [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto weekDayIndex = commandData.weekDayIndex; + auto userIndex = commandData.userIndex; + const auto & daysMask = commandData.daysMask; + auto startHour = commandData.startHour; + auto startMinute = commandData.startMinute; + auto endHour = commandData.endHour; + auto endMinute = commandData.endMinute; + + if (!weekDayIndexValid(endpointId, weekDayIndex) || !userIndexValid(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln( + "[SetWeekDaySchedule] Unable to add schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - user does not exist " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND); + return; + } + + // appclusters, 5.2.4.14 - spec does not allow setting the schedule for multiple days in the bitmask + int setBitsInDaysMask = 0; + uint8_t rawDaysMask = daysMask.Raw(); + for (size_t i = 0; i < sizeof(rawDaysMask) * 8; ++i) + { + setBitsInDaysMask += rawDaysMask & 0x1; + rawDaysMask = static_cast(rawDaysMask >> 1); + } + + if (setBitsInDaysMask == 0 || setBitsInDaysMask > 1) + { + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - daysMask is out of range " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%x]", + endpointId, weekDayIndex, userIndex, daysMask.Raw()); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + if (startHour > DOOR_LOCK_SCHEDULE_MAX_HOUR || startMinute > DOOR_LOCK_SCHEDULE_MAX_MINUTE || + endHour > DOOR_LOCK_SCHEDULE_MAX_HOUR || endMinute > DOOR_LOCK_SCHEDULE_MAX_MINUTE) + { + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - start time out of range " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + if (startHour > endHour || (startHour == endHour && startMinute >= endMinute)) + { + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Unable to add schedule - invalid time " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, startHour, startMinute, endHour, endMinute); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + auto status = emberAfPluginDoorLockSetSchedule(endpointId, weekDayIndex, userIndex, DlScheduleStatus::kOccupied, daysMask, + startHour, startMinute, endHour, endMinute); + if (DlStatus::kSuccess != status) + { + ChipLogError(Zcl, + "[SetWeekDaySchedule] Unable to add schedule - internal error " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, weekDayIndex, userIndex, to_underlying(status)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + emberAfDoorLockClusterPrintln("[SetWeekDaySchedule] Successfully created new schedule " + "[endpointId=%d,weekDayIndex=%d,userIndex=%d,daysMask=%d,startTime=\"%d:%d\",endTime=\"%d:%d\"]", + endpointId, weekDayIndex, userIndex, daysMask.Raw(), startHour, startMinute, endHour, endMinute); + + sendRemoteLockUserChange(endpointId, DlLockDataType::kWeekDaySchedule, DlDataOperationType::kAdd, sourceNodeId, fabricIdx, + userIndex, static_cast(weekDayIndex)); + + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); +} + +void DoorLockServer::GetWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + + auto weekDayIndex = commandData.weekDayIndex; + auto userIndex = commandData.userIndex; + + if (!weekDayIndexValid(endpointId, weekDayIndex) || !userIndexValid(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln( + "[GetWeekDaySchedule] Unable to get schedule - index out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); + sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kInvalidField); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); + sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kNotFound); + return; + } + + EmberAfPluginDoorLockWeekDaySchedule scheduleInfo; + auto status = emberAfPluginDoorLockGetSchedule(endpointId, weekDayIndex, userIndex, scheduleInfo); + if (DlStatus::kSuccess != status) + { + sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, status); + return; + } + + sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kSuccess, scheduleInfo.daysMask, + scheduleInfo.startHour, scheduleInfo.startMinute, scheduleInfo.endHour, scheduleInfo.endMinute); +} + +void DoorLockServer::ClearWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] Incoming command [endpointId=%d]", endpointId); + + auto fabricIdx = getFabricIndex(commandObj); + if (kUndefinedFabricIndex == fabricIdx) + { + ChipLogError(Zcl, "[ClearWeekDaySchedule] Unable to get the fabric IDX [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto sourceNodeId = getNodeId(commandObj); + if (chip::kUndefinedNodeId == sourceNodeId) + { + ChipLogError(Zcl, "[ClearWeekDaySchedule] Unable to get the source node index [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto weekDayIndex = commandData.weekDayIndex; + auto userIndex = commandData.userIndex; + + if (!userIndexValid(endpointId, userIndex) || (!weekDayIndexValid(endpointId, weekDayIndex) && 0xFE != weekDayIndex)) + { + emberAfDoorLockClusterPrintln( + "[ClearWeekDaySchedule] User or WeekDay index is out of range [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, + weekDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[ClearWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", + endpointId, weekDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND); + return; + } + + DlStatus clearStatus = DlStatus::kSuccess; + if (0xFE == weekDayIndex) + { + emberAfDoorLockClusterPrintln( + "[ClearWeekDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", endpointId, userIndex); + clearStatus = clearWeekDaySchedules(endpointId, userIndex); + } + else + { + emberAfDoorLockClusterPrintln( + "[ClearWeekDaySchedule] Clearing a single schedule [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, + weekDayIndex, userIndex); + clearStatus = clearWeekDaySchedule(endpointId, userIndex, weekDayIndex); + } + + if (DlStatus::kSuccess != clearStatus) + { + emberAfDoorLockClusterPrintln( + "[ClearWeekDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, to_underlying(clearStatus)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + sendRemoteLockUserChange(endpointId, DlLockDataType::kWeekDaySchedule, DlDataOperationType::kClear, sourceNodeId, fabricIdx, + userIndex, static_cast(weekDayIndex)); + + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); +} + +void DoorLockServer::SetYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + emberAfDoorLockClusterPrintln("[SetYearDaySchedule] incoming command [endpointId=%d]", endpointId); + + auto fabricIdx = getFabricIndex(commandObj); + if (kUndefinedFabricIndex == fabricIdx) + { + ChipLogError(Zcl, "[SetYearDaySchedule] Unable to get the fabric IDX [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto sourceNodeId = getNodeId(commandObj); + if (chip::kUndefinedNodeId == sourceNodeId) + { + ChipLogError(Zcl, "[SetYearDaySchedule] Unable to get the source node index [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto yearDayIndex = commandData.yearDayIndex; + auto userIndex = commandData.userIndex; + auto localStarTime = commandData.localStartTime; + auto localEndTime = commandData.localEndTime; + + if (!yearDayIndexValid(endpointId, yearDayIndex) || !userIndexValid(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln( + "[SetYearDaySchedule] Unable to add schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Unable to add schedule - user does not exist " + "[endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND); + return; + } + + if (localEndTime <= localStarTime) + { + emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Unable to add schedule - schedule ends earlier than starts" + "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStarTime=%" PRIu32 ",localEndTime=%" PRIu32 + "]", + endpointId, yearDayIndex, userIndex, localStarTime, localEndTime); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_FIELD); + return; + } + + auto status = emberAfPluginDoorLockSetSchedule(endpointId, yearDayIndex, userIndex, DlScheduleStatus::kOccupied, localStarTime, + localEndTime); + if (DlStatus::kSuccess != status) + { + ChipLogError(Zcl, + "[SetYearDaySchedule] Unable to add schedule - internal error " + "[endpointId=%d,yearDayIndex=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, yearDayIndex, userIndex, to_underlying(status)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + emberAfDoorLockClusterPrintln("[SetYearDaySchedule] Successfully created new schedule " + "[endpointId=%d,yearDayIndex=%d,userIndex=%d,localStartTime=%" PRIu32 ",endTime=%" PRIu32 "]", + endpointId, yearDayIndex, userIndex, localStarTime, localEndTime); + + sendRemoteLockUserChange(endpointId, DlLockDataType::kYearDaySchedule, DlDataOperationType::kAdd, sourceNodeId, fabricIdx, + userIndex, static_cast(yearDayIndex)); + + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); +} + +void DoorLockServer::GetYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[GetYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + emberAfDoorLockClusterPrintln("[GetYearDaySchedule] incoming command [endpointId=%d]", endpointId); + + auto yearDayIndex = commandData.yearDayIndex; + auto userIndex = commandData.userIndex; + + if (!yearDayIndexValid(endpointId, yearDayIndex) || !userIndexValid(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln( + "[GetYearDaySchedule] Unable to get schedule - index out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); + sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kInvalidField); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); + sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kNotFound); + return; + } + + EmberAfPluginDoorLockYearDaySchedule scheduleInfo; + auto status = emberAfPluginDoorLockGetSchedule(endpointId, yearDayIndex, userIndex, scheduleInfo); + if (DlStatus::kSuccess != status) + { + sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, status); + return; + } + + sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kSuccess, + scheduleInfo.localStartTime, scheduleInfo.localEndTime); +} + +void DoorLockServer::ClearYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::DecodableType & commandData) +{ + auto endpointId = commandPath.mEndpointId; + if (!SupportsSchedules(endpointId)) + { + emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] Ignore command (not supported) [endpointId=%d]", endpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] incoming command [endpointId=%d]", endpointId); + + auto fabricIdx = getFabricIndex(commandObj); + if (kUndefinedFabricIndex == fabricIdx) + { + ChipLogError(Zcl, "[ClearYearDaySchedule] Unable to get the fabric IDX [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto sourceNodeId = getNodeId(commandObj); + if (chip::kUndefinedNodeId == sourceNodeId) + { + ChipLogError(Zcl, "[ClearYearDaySchedule] Unable to get the source node index [endpointId=%d]", commandPath.mEndpointId); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + auto yearDayIndex = commandData.yearDayIndex; + auto userIndex = commandData.userIndex; + + if (!userIndexValid(endpointId, userIndex) || (!yearDayIndexValid(endpointId, yearDayIndex) && 0xFE != yearDayIndex)) + { + emberAfDoorLockClusterPrintln( + "[ClearYearDaySchedule] User or YearDay index is out of range [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, + yearDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_COMMAND); + return; + } + + if (!userExists(endpointId, userIndex)) + { + emberAfDoorLockClusterPrintln("[ClearYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", + endpointId, yearDayIndex, userIndex); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_NOT_FOUND); + return; + } + + DlStatus clearStatus = DlStatus::kSuccess; + if (0xFE == yearDayIndex) + { + emberAfDoorLockClusterPrintln( + "[ClearYearDaySchedule] Clearing all schedules for a single user [endpointId=%d,userIndex=%d]", endpointId, userIndex); + clearStatus = clearYearDaySchedules(endpointId, userIndex); + } + else + { + emberAfDoorLockClusterPrintln( + "[ClearYearDaySchedule] Clearing a single schedule [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, + yearDayIndex, userIndex); + clearStatus = clearYearDaySchedule(endpointId, userIndex, yearDayIndex); + } + + if (DlStatus::kSuccess != clearStatus) + { + emberAfDoorLockClusterPrintln( + "[ClearYearDaySchedule] Unable to clear the user schedules - app error [endpointId=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, to_underlying(clearStatus)); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_FAILURE); + return; + } + + sendRemoteLockUserChange(endpointId, DlLockDataType::kYearDaySchedule, DlDataOperationType::kClear, sourceNodeId, fabricIdx, + userIndex, static_cast(yearDayIndex)); + + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); +} + bool DoorLockServer::HasFeature(chip::EndpointId endpointId, DoorLockFeature feature) { uint32_t featureMap = 0; @@ -841,10 +1351,8 @@ bool DoorLockServer::userIndexValid(chip::EndpointId endpointId, uint16_t userIn bool DoorLockServer::userIndexValid(chip::EndpointId endpointId, uint16_t userIndex, uint16_t & maxNumberOfUser) { - EmberAfStatus status = Attributes::NumberOfTotalUsersSupported::Get(endpointId, &maxNumberOfUser); - if (EMBER_ZCL_STATUS_SUCCESS != status) + if (!GetNumberOfUserSupported(endpointId, maxNumberOfUser)) { - ChipLogError(Zcl, "Unable to read attribute 'NumberOfTotalUsersSupported' [status:%d]", status); return false; } @@ -856,6 +1364,19 @@ bool DoorLockServer::userIndexValid(chip::EndpointId endpointId, uint16_t userIn return true; } +bool DoorLockServer::userExists(chip::EndpointId endpointId, uint16_t userIndex) +{ + // Check if user actually exist + EmberAfPluginDoorLockUserInfo user; + if (!emberAfPluginDoorLockGetUser(endpointId, userIndex, user)) + { + ChipLogError(Zcl, "[UserExists] Unable to get the user - internal error [endpointId=%d,userIndex=%d]", endpointId, + userIndex); + return false; + } + return DlUserStatus::kAvailable != user.userStatus; +} + bool DoorLockServer::credentialIndexValid(chip::EndpointId endpointId, DlCredentialType type, uint16_t credentialIndex) { uint16_t maxCredentials = 0; @@ -921,32 +1442,23 @@ bool DoorLockServer::getMaxNumberOfCredentials(chip::EndpointId endpointId, DlCr uint16_t & maxNumberOfCredentials) { maxNumberOfCredentials = 0; - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + bool status = false; switch (credentialType) { case DlCredentialType::kProgrammingPIN: maxNumberOfCredentials = 1; return true; case DlCredentialType::kPin: - status = Attributes::NumberOfPINUsersSupported::Get(endpointId, &maxNumberOfCredentials); + status = GetNumberOfPINCredentialsSupported(endpointId, maxNumberOfCredentials); break; case DlCredentialType::kRfid: - status = Attributes::NumberOfRFIDUsersSupported::Get(endpointId, &maxNumberOfCredentials); + status = GetNumberOfRFIDCredentialsSupported(endpointId, maxNumberOfCredentials); break; default: return false; } - if (EMBER_ZCL_STATUS_SUCCESS != status) - { - ChipLogError(Zcl, - "Unable to read an attribute to get the max number of credentials [endpointId=%d,credentialType=%" PRIu8 - ",status=%d]", - endpointId, to_underlying(credentialType), status); - return false; - } - - return true; + return status; } bool DoorLockServer::findUnoccupiedUserSlot(chip::EndpointId endpointId, uint16_t & userIndex) @@ -1292,7 +1804,13 @@ EmberAfStatus DoorLockServer::clearUser(chip::EndpointId endpointId, chip::Fabri } } - // TODO: Remove all the user schedules + // Clear all the user schedules + auto status = clearSchedules(endpointId, userIndex); + if (DlStatus::kSuccess != status) + { + ChipLogError(Zcl, "[ClearUser] Unable to delete schedules - internal error [endpointId=%d,userIndex=%d]", endpointId, + userIndex); + } // Remove the user entry if (!emberAfPluginDoorLockSetUser(endpointId, userIndex, kUndefinedFabricIndex, kUndefinedFabricIndex, chip::CharSpan(""), 0, @@ -1714,6 +2232,175 @@ bool DoorLockServer::credentialTypeSupported(chip::EndpointId endpointId, DlCred return false; } +bool DoorLockServer::weekDayIndexValid(chip::EndpointId endpointId, uint8_t weekDayIndex) +{ + uint8_t weekDaysSupported; + if (!GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, weekDaysSupported)) + { + return false; + } + + // appclusters, 5.2.4.14-17: weekday index changes from 1 to maxNumberOfUsers + if (0 == weekDayIndex || weekDayIndex > weekDaysSupported) + { + return false; + } + return true; +} + +DlStatus DoorLockServer::clearWeekDaySchedule(chip::EndpointId endpointId, uint16_t userIndex, uint8_t weekDayIndex) +{ + auto status = emberAfPluginDoorLockSetSchedule(endpointId, weekDayIndex, userIndex, DlScheduleStatus::kAvailable, + DlDaysMaskMap(0), 0, 0, 0, 0); + if (DlStatus::kSuccess != status && DlStatus::kNotFound != status) + { + ChipLogError(Zcl, + "[ClearWeekDaySchedule] Unable to clear the schedule - internal error " + "[endpointId=%d,userIndex=%d,scheduleIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, weekDayIndex, to_underlying(status)); + return status; + } + return DlStatus::kSuccess; +} + +DlStatus DoorLockServer::clearWeekDaySchedules(chip::EndpointId endpointId, uint16_t userIndex) +{ + uint8_t weekDaySchedulesPerUser = 0; + if (!GetNumberOfWeekDaySchedulesPerUserSupported(endpointId, weekDaySchedulesPerUser)) + { + return DlStatus::kFailure; + } + + for (uint8_t i = 1; i <= weekDaySchedulesPerUser; ++i) + { + auto status = clearWeekDaySchedule(endpointId, userIndex, i); + if (DlStatus::kSuccess != status) + { + return status; + } + } + return DlStatus::kSuccess; +} + +DlStatus DoorLockServer::clearSchedules(chip::EndpointId endpointId, uint16_t userIndex) +{ + auto status = clearWeekDaySchedules(endpointId, userIndex); + if (DlStatus::kSuccess != status) + { + ChipLogError(Zcl, + "[CleaAllSchedules] Unable to clear week day schedules for user - internal error " + "[endpointId=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, to_underlying(status)); + return status; + } + + status = clearYearDaySchedules(endpointId, userIndex); + if (DlStatus::kSuccess != status) + { + ChipLogError(Zcl, + "[CleaAllSchedules] Unable to clear year day schedules for user - internal error " + "[endpointId=%d,userIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, to_underlying(status)); + return status; + } + + // TODO: Clear holiday schedules when they're implemented + return DlStatus::kSuccess; +} + +CHIP_ERROR DoorLockServer::sendGetWeekDayScheduleResponse(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, uint8_t weekdayIndex, + uint16_t userIndex, DlStatus status, DlDaysMaskMap daysMask, + uint8_t startHour, uint8_t startMinute, uint8_t endHour, + uint8_t endMinute) +{ + VerifyOrDie(nullptr != commandObj); + + Commands::GetWeekDayScheduleResponse::Type response; + response.weekDayIndex = weekdayIndex; + response.userIndex = userIndex; + response.status = status; + if (DlStatus::kSuccess == status) + { + response.daysMask = Optional>(daysMask); + response.startHour = Optional(startHour); + response.startMinute = Optional(startMinute); + response.endHour = Optional(endHour); + response.endMinute = Optional(endMinute); + } + + return commandObj->AddResponseData(commandPath, response); +} + +bool DoorLockServer::yearDayIndexValid(chip::EndpointId endpointId, uint8_t yearDayIndex) +{ + uint8_t yearDaysSupported; + if (!GetNumberOfYearDaySchedulesPerUserSupported(endpointId, yearDaysSupported)) + { + return false; + } + + // appclusters, 5.2.4.18-21: year day index changes from 1 to maxNumberOfUsers + if (0 == yearDayIndex || yearDayIndex > yearDaysSupported) + { + return false; + } + return true; +} + +DlStatus DoorLockServer::clearYearDaySchedule(chip::EndpointId endpointId, uint16_t userIndex, uint8_t yearDayIndex) +{ + auto status = emberAfPluginDoorLockSetSchedule(endpointId, yearDayIndex, userIndex, DlScheduleStatus::kAvailable, 0, 0); + if (DlStatus::kSuccess != status && DlStatus::kNotFound != status) + { + ChipLogError(Zcl, + "[ClearYearDaySchedule] Unable to clear the schedule - internal error " + "[endpointId=%d,userIndex=%d,scheduleIndex=%d,status=%" PRIu8 "]", + endpointId, userIndex, yearDayIndex, to_underlying(status)); + return status; + } + return DlStatus::kSuccess; +} + +DlStatus DoorLockServer::clearYearDaySchedules(chip::EndpointId endpointId, uint16_t userIndex) +{ + uint8_t weekDaySchedulesPerUser = 0; + if (!GetNumberOfYearDaySchedulesPerUserSupported(endpointId, weekDaySchedulesPerUser)) + { + return DlStatus::kFailure; + } + + for (uint8_t i = 1; i <= weekDaySchedulesPerUser; ++i) + { + auto status = clearYearDaySchedule(endpointId, userIndex, i); + if (DlStatus::kSuccess != status) + { + return status; + } + } + return DlStatus::kSuccess; +} + +CHIP_ERROR DoorLockServer::sendGetYearDayScheduleResponse(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, uint8_t yearDayIndex, + uint16_t userIndex, DlStatus status, uint32_t localStartTime, + uint32_t localEndTime) +{ + VerifyOrDie(nullptr != commandObj); + + Commands::GetYearDayScheduleResponse::Type response; + response.yearDayIndex = yearDayIndex; + response.userIndex = userIndex; + response.status = status; + if (DlStatus::kSuccess == status) + { + response.localStartTime = Optional(localStartTime); + response.localEndTime = Optional(localEndTime); + } + + return commandObj->AddResponseData(commandPath, response); +} + EmberAfStatus DoorLockServer::clearCredential(chip::EndpointId endpointId, chip::FabricIndex modifier, chip::NodeId sourceNodeId, DlCredentialType credentialType, uint16_t credentialIndex, bool sendUserChangeEvent) { @@ -2098,10 +2785,7 @@ bool emberAfDoorLockClusterSetWeekDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("SetWeekDaySchedule: command not implemented"); - - // TODO: Implement setting weekday schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().SetWeekDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2109,10 +2793,7 @@ bool emberAfDoorLockClusterGetWeekDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("GetWeekDaySchedule: command not implemented"); - - // TODO: Implement getting weekday schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().GetWeekDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2120,10 +2801,7 @@ bool emberAfDoorLockClusterClearWeekDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("ClearWeekDaySchedule: command not implemented"); - - // TODO: Implement clearing weekday schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().ClearWeekDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2131,10 +2809,7 @@ bool emberAfDoorLockClusterSetYearDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("SetYearDaySchedule: command not implemented"); - - // TODO: Implement setting year day schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().SetYearDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2142,10 +2817,7 @@ bool emberAfDoorLockClusterGetYearDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("GetYearDaySchedule: command not implemented"); - - // TODO: Implement getting year day schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().GetYearDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2153,10 +2825,7 @@ bool emberAfDoorLockClusterClearYearDayScheduleCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::DecodableType & commandData) { - emberAfDoorLockClusterPrintln("ClearYearDaySchedule: command not implemented"); - - // TODO: Implement clearing year day schedule - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); + DoorLockServer::Instance().ClearYearDayScheduleCommandHandler(commandObj, commandPath, commandData); return true; } @@ -2316,14 +2985,12 @@ void MatterDoorLockPluginServerInitCallback() void MatterDoorLockClusterServerAttributeChangedCallback(const app::ConcreteAttributePath & attributePath) {} -bool __attribute__((weak)) -emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +bool __attribute__((weak)) emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode) { return false; } -bool __attribute__((weak)) -emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, chip::Optional pinCode) +bool __attribute__((weak)) emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode) { return false; } @@ -2418,3 +3085,29 @@ emberAfPluginDoorLockSetCredential(chip::EndpointId endpointId, uint16_t credent { return false; } + +DlStatus __attribute__((weak)) emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, + uint16_t userIndex, EmberAfPluginDoorLockWeekDaySchedule & schedule) +{ + return DlStatus::kFailure; +} + +DlStatus __attribute__((weak)) emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, + uint16_t userIndex, EmberAfPluginDoorLockYearDaySchedule & schedule) +{ + return DlStatus::kFailure; +} + +DlStatus __attribute__((weak)) +emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, DlScheduleStatus status, + DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, uint8_t endHour, uint8_t endMinute) +{ + return DlStatus::kFailure; +} + +DlStatus __attribute__((weak)) +emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, DlScheduleStatus status, + uint32_t localStartTime, uint32_t localEndTime) +{ + return DlStatus::kFailure; +} 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 269c2c8ec22ec5..2a20fa5fa8dfe3 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.h +++ b/src/app/clusters/door-lock-server/door-lock-server.h @@ -33,6 +33,7 @@ using chip::Optional; using chip::app::Clusters::DoorLock::DlCredentialRule; using chip::app::Clusters::DoorLock::DlCredentialType; using chip::app::Clusters::DoorLock::DlDataOperationType; +using chip::app::Clusters::DoorLock::DlDaysMaskMap; using chip::app::Clusters::DoorLock::DlDoorState; using chip::app::Clusters::DoorLock::DlLockDataType; using chip::app::Clusters::DoorLock::DlLockOperationType; @@ -78,6 +79,12 @@ class DoorLockServer bool SetOneTouchLocking(chip::EndpointId endpointId, bool isEnabled); bool SetPrivacyModeButton(chip::EndpointId endpointId, bool isEnabled); + bool GetNumberOfUserSupported(chip::EndpointId endpointId, uint16_t & numberOfUsersSupported); + bool GetNumberOfPINCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfPINCredentials); + bool GetNumberOfRFIDCredentialsSupported(chip::EndpointId endpointId, uint16_t & numberOfRFIDCredentials); + bool GetNumberOfWeekDaySchedulesPerUserSupported(chip::EndpointId endpointId, uint8_t & numberOfWeekDaySchedulesPerUser); + bool GetNumberOfYearDaySchedulesPerUserSupported(chip::EndpointId endpointId, uint8_t & numberOfYearDaySchedulesPerUser); + void SetUserCommandHandler(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DoorLock::Commands::SetUser::DecodableType & commandData); @@ -100,6 +107,26 @@ class DoorLockServer void LockUnlockDoorCommandHandler(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, DlLockOperationType operationType, const chip::Optional & pinCode); + void SetWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::DecodableType & commandData); + void GetWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::DecodableType & commandData); + void ClearWeekDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::DecodableType & commandData); + + void SetYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::DecodableType & commandData); + void GetYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::DecodableType & commandData); + void ClearYearDayScheduleCommandHandler( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::DecodableType & commandData); + bool HasFeature(chip::EndpointId endpointId, DoorLockFeature feature); inline bool SupportsPIN(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kPINCredentials); } @@ -110,6 +137,8 @@ class DoorLockServer inline bool SupportsFace(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kFaceCredentials); } + inline bool SupportsSchedules(chip::EndpointId endpointId) { return HasFeature(endpointId, DoorLockFeature::kAccessSchedules); } + inline bool SupportsUSR(chip::EndpointId endpointId) { // appclusters, 5.2.2: USR feature has conformance [PIN | RID | FGP | FACE] @@ -123,6 +152,7 @@ class DoorLockServer bool userIndexValid(chip::EndpointId endpointId, uint16_t userIndex); bool userIndexValid(chip::EndpointId endpointId, uint16_t userIndex, uint16_t & maxNumberOfUser); + bool userExists(chip::EndpointId endpointId, uint16_t userIndex); bool credentialIndexValid(chip::EndpointId endpointId, DlCredentialType type, uint16_t credentialIndex); bool credentialIndexValid(chip::EndpointId endpointId, DlCredentialType type, uint16_t credentialIndex, @@ -194,6 +224,28 @@ class DoorLockServer // TODO: Maybe use CHIP_APPLICATION_ERROR instead of boolean in class methods? bool credentialTypeSupported(chip::EndpointId endpointId, DlCredentialType type); + bool weekDayIndexValid(chip::EndpointId endpointId, uint8_t weekDayIndex); + + DlStatus clearWeekDaySchedule(chip::EndpointId endpointId, uint16_t userIndex, uint8_t weekDayIndex); + DlStatus clearWeekDaySchedules(chip::EndpointId endpointId, uint16_t userIndex); + DlStatus clearSchedules(chip::EndpointId endpointId, uint16_t userIndex); + + CHIP_ERROR sendGetWeekDayScheduleResponse(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, uint8_t weekdayIndex, + uint16_t userIndex, DlStatus status, DlDaysMaskMap daysMask = DlDaysMaskMap(0), + uint8_t startHour = 0, uint8_t startMinute = 0, uint8_t endHour = 0, + uint8_t endMinute = 0); + + bool yearDayIndexValid(chip::EndpointId endpointId, uint8_t yearDayIndex); + + DlStatus clearYearDaySchedule(chip::EndpointId endpointId, uint16_t userIndex, uint8_t weekDayIndex); + DlStatus clearYearDaySchedules(chip::EndpointId endpointId, uint16_t userIndex); + + CHIP_ERROR sendGetYearDayScheduleResponse(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, uint8_t yearDayIndex, + uint16_t userIndex, DlStatus status, uint32_t localStartTime = 0, + uint32_t localEndTime = 0); + bool sendRemoteLockUserChange(chip::EndpointId endpointId, DlLockDataType dataType, DlDataOperationType operation, chip::NodeId nodeId, chip::FabricIndex fabricIndex, uint16_t userIndex = 0, uint16_t dataIndex = 0); @@ -237,11 +289,145 @@ struct EmberAfPluginDoorLockUserInfo chip::FabricIndex lastModifiedBy; /**< ID of the fabric that modified the user. */ }; -typedef bool (*EmberAfDoorLockLockUnlockCommand)(chip::EndpointId endpointId, chip::Optional pinCode); +/** + * @brief Status of the schedule slot in the schedule database. + */ +enum class DlScheduleStatus : uint8_t +{ + kAvailable = 0x00, /**< Indicates if schedule slot is available. */ + kOccupied = 0x01, /**< Indicates if schedule slot is already occupied. */ +}; + +/** + * @brief Structure that holds week day schedule information. + */ +struct EmberAfPluginDoorLockWeekDaySchedule +{ + DlDaysMaskMap daysMask; /** Indicates the days of the week the Week Day schedule applies for. */ + uint8_t startHour; /** Starting hour for the Week Day schedule. */ + uint8_t startMinute; /** Starting minute for the Week Day schedule. */ + uint8_t endHour; /** Ending hour for the Week Day schedule. */ + uint8_t endMinute; /** Ending minute for the Week Day schedule. */ +}; + +/** + * @brief Structure that holds year day schedule information. + */ +struct EmberAfPluginDoorLockYearDaySchedule +{ + uint32_t localStartTime; /** The starting time for the Year Day schedule in Epoch Time in Seconds with local time offset based + on the local timezone and DST offset on the day represented by the value. */ + uint32_t localEndTime; /** The ending time for the Year Day schedule in Epoch Time in Seconds with local time offset based on + * the local timezone and DST offset on the day represented by the value. */ +}; + +/** + * @brief This callback is called when Door Lock cluster needs to access the Week Day schedule in the schedules database. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param weekdayIndex Index of the week day schedule to access. It is guaranteed to be within limits declared in the spec for + * week day schedule (from 1 up to NumberOfWeekDaySchedulesSupportedPerUser). + * @param userIndex Index of the user to get week day schedule. It is guaranteed to be within limits declared in the spec (from 1 up + * to the value of NumberOfUsersSupported attribute). + * @param[out] schedule Resulting week day schedule. + * + * @retval DlStatus::kSuccess if schedule was retrieved successfully + * @retval DlStatus::kNotFound if the schedule or user does not exist + * @retval DlStatus::kFailure in case of any other failure + */ +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + EmberAfPluginDoorLockWeekDaySchedule & schedule); +/** + * @brief This callback is called when Door Lock cluster needs to access the Year Day schedule in the schedules database. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param yearDayIndex Index of the year day schedule to access. It is guaranteed to be within limits declared in the spec for + * year day schedule (from 1 up to NumberOfYearDaySchedulesSupportedPerUser) + * @param userIndex Index of the user to get year day schedule. It is guaranteed to be within limits declared in the spec (from 1 up + * to the value of NumberOfUsersSupported attribute). + * @param[out] schedule Resulting year day schedule. + * + * @retval DlStatus::kSuccess if schedule was retrieved successfully + * @retval DlStatus::kNotFound if the schedule or user does not exist + * @retval DlStatus::kFailure in case of any other failure + */ +DlStatus emberAfPluginDoorLockGetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + EmberAfPluginDoorLockYearDaySchedule & schedule); + +/** + * @brief This callback is called when Door Lock cluster needs to create, modify or clear the week day schedule in schedules + * database. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param weekdayIndex Index of the week day schedule to access. It is guaranteed to be within limits declared in the spec for + * week day schedule (from 1 up to NumberOfWeekDaySchedulesSupportedPerUser). + * @param userIndex Index of the user to get year day schedule. It is guaranteed to be within limits declared in the spec (from 1 up + * to the value of NumberOfUsersSupported attribute). + * @param status New status of the schedule slot (occupied/available). DlScheduleStatus::kAvailable means that the + * schedules must be deleted. + * @param daysMask Indicates the days of the week the Week Day schedule applies for. + * @param startHour Starting hour for the Week Day schedule. + * @param startMinute Starting minute for the Week Day schedule + * @param endHour Ending hour for the Week Day schedule. Guaranteed to be greater or equal to \p startHour. + * @param endMinute Ending minute for the Week Day schedule. If \p endHour is equal to \p startHour then EndMinute + * is guaranteed to be greater than \p startMinute. + * + * @retval DlStatus::kSuccess if schedule was successfully modified + * @retval DlStatus::kNotFound if the schedule or user does not exist + * @retval DlStatus::kFailure in case of any other failure + */ +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t weekdayIndex, uint16_t userIndex, + DlScheduleStatus status, DlDaysMaskMap daysMask, uint8_t startHour, uint8_t startMinute, + uint8_t endHour, uint8_t endMinute); +/** + * @brief This callback is called when Door Lock cluster needs to create, modify or clear the year day schedule in schedules + * database. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param yearDayIndex Index of the year day schedule to access. It is guaranteed to be within limits declared in the spec for + * year day schedule (from 1 up to NumberOfYearDaySchedulesSupportedPerUser). + * @param userIndex Index of the user to get year day schedule. It is guaranteed to be within limits declared in the spec (from 1 up + * to the value of NumberOfUsersSupported attribute). + * @param status New status of the schedule slot (occupied/available). DlScheduleStatus::kAvailable means that the + * schedules must be deleted. + * @param localStartTime The starting time for the Year Day schedule in Epoch Time in Seconds with local time offset based on the + * local timezone and DST offset on the day represented by the value. + * @param localEndTime The ending time for the Year Day schedule in Epoch Time in Seconds with local time offset based on the local + * timezone and DST offset on the day represented by the value. \p localEndTime is guaranteed to be greater than + * \p localStartTime. + * + * @retval DlStatus::kSuccess if schedule was successfully modified + * @retval DlStatus::kNotFound if the schedule or user does not exist + * @retval DlStatus::kFailure in case of any other failure + */ +DlStatus emberAfPluginDoorLockSetSchedule(chip::EndpointId endpointId, uint8_t yearDayIndex, uint16_t userIndex, + DlScheduleStatus status, uint32_t localStartTime, uint32_t localEndTime); + +typedef bool (*EmberAfDoorLockLockUnlockCommand)(chip::EndpointId endpointId, const chip::Optional & pinCode); + +/** + * @brief This callback is called when Door Lock cluster needs to issue command to lock the door. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param[in] pinCode PIN code that is used to lock the door. Could be absent if attribute RequirePINforRemoteOperation is not set + * or set to false. + * + * @return true if the door was locked, false in case of any failure. + */ +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode); + +/** + * @brief This callback is called when Door Lock cluster needs to issue command to unlock the door. + * + * @param endpointId ID of the endpoint which contains the lock. + * @param[in[ pinCode PIN code that is used to unlock the door. Could be absent if attribute RequirePINforRemoteOperation is not set + * or set to false. + * + * @return true if the door was unlocked, false in case of any failure. + */ +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode); -bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, chip::Optional pinCode); -bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, chip::Optional pinCode); -bool emberAfPluginDoorLockOnDoorUnlockWithTimeoutCommand(chip::EndpointId endpointId, chip::Optional pinCode, +bool emberAfPluginDoorLockOnDoorUnlockWithTimeoutCommand(chip::EndpointId endpointId, const Optional & pinCode, uint16_t timeout); // ============================================================================= diff --git a/src/app/tests/suites/DL_Schedules.yaml b/src/app/tests/suites/DL_Schedules.yaml new file mode 100644 index 00000000000000..9c5030f1eb50dd --- /dev/null +++ b/src/app/tests/suites/DL_Schedules.yaml @@ -0,0 +1,1472 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Door Lock Cluster Schedules tests + +config: + cluster: "Door Lock" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Create new PIN credential and schedule user" + command: "SetCredential" + arguments: + values: + - name: "operationType" + value: 0 + - name: "credential" + value: { CredentialType: 1, CredentialIndex: 1 } + - name: "credentialData" + value: "123456" + - name: "userIndex" + value: null + - name: "userStatus" + value: null + - name: "userType" + value: null + response: + values: + - name: "status" + value: 0x00 + - name: "userIndex" + value: 1 + - name: "nextCredentialIndex" + value: 2 + + - label: "Get number of supported users" + command: "readAttribute" + attribute: "NumberOfTotalUsersSupported" + response: + saveAs: NumberOfTotalUsersSupported + value: 10 + + - label: + "Get Max number of Week Day schedules for user and verify default + value" + command: "readAttribute" + attribute: "NumberOfWeekDaySchedulesSupportedPerUser" + response: + saveAs: NumberOfWeekDaySchedulesSupportedPerUser + value: 10 + + - label: + "Get Max number of Year Day schedules for user and verify default + value" + command: "readAttribute" + attribute: "NumberOfYearDaySchedulesSupportedPerUser" + response: + saveAs: NumberOfYearDaySchedulesSupportedPerUser + value: 10 + + # + # Excercise SetWeekDay schedules with invalid parameters + # + - label: "Create Week Day schedule with 0 index" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 0 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with out-of-bounds index" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: + static_cast(NumberOfWeekDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with 0 user index" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 0 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with out-of-bounds user index" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule for non-existing user" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 2 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: NOT_FOUND + + - label: "Create Week Day schedule with 0 days mask" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule for Sunday and Monday" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x3 # (Sunday and Monday) + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule for Sunday Wednesday and Saturday" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x49 # (Sunday, Wednesday and Saturday) + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with invalid start hour" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 24 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with invalid start minute" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 60 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with invalid end hour" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 24 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with invalid end minute" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 60 + response: + error: INVALID_FIELD + + - label: "Create Week Day schedule with start hour later that end hour" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 19 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + response: + error: INVALID_FIELD + + - label: + "Create Week Day schedule with start minute later that end minute when + hours are equal" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 1 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 50 + - name: "endHour" + value: 15 + - name: "endMinute" + value: 49 + response: + error: INVALID_FIELD + + - label: "Make sure that previous operations did not create a schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + # + # Excercise GetWeekDay schedules with invalid parameters + # + - label: "Get Week Day schedule with 0 index" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 0 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 0 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x85 + + - label: "Get Week Day schedule with out-of-bounds index" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: + static_cast(NumberOfWeekDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: + static_cast(NumberOfWeekDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + - name: "status" + value: 0x85 + + - label: "Get Week Day schedule with 0 user index" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 0 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 0 + - name: "status" + value: 0x85 + + - label: "Get Week Day schedule with out-of-bounds user index" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + - name: "status" + value: 0x85 + + - label: "Get Week Day schedule with non-existing user index" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 2 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 2 + - name: "status" + value: 0x8B + + # + # Excercise SetYearDay schedules with invalid parameters + # + - label: "Create Year Day schedule with 0 index" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 0 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + response: + error: INVALID_FIELD + + - label: "Create Year Day schedule with out-of-bounds index" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: + static_cast(NumberOfYearDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + response: + error: INVALID_FIELD + + - label: "Create Year Day schedule with 0 user index" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 0 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + response: + error: INVALID_FIELD + + - label: "Create Year Day schedule with out-of-bounds user index" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + response: + error: INVALID_FIELD + + - label: "Create Year Day schedule for non-existing user" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + response: + error: NOT_FOUND + + - label: "Create Year Day schedule with start hour later that end hour" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 12345689 + - name: "localEndTime" + value: 12345688 + response: + error: INVALID_FIELD + + - label: "Make sure that previous operations did not create a schedule" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + # + # Excercise GetWeekDay schedules with invalid parameters + # + - label: "Get Year Day schedule with 0 index" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 0 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 0 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x85 + + - label: "Get Year Day schedule with out-of-bounds index" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: + static_cast(NumberOfYearDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: + static_cast(NumberOfYearDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + - name: "status" + value: 0x85 + + - label: "Get Year Day schedule with 0 user index" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 0 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 0 + - name: "status" + value: 0x85 + + - label: "Get Year Day schedule with out-of-bounds user index" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + - name: "status" + value: 0x85 + + - label: "Get Year Day schedule with non-existing user index" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + - name: "status" + value: 0x8B + + - label: "Create Week Day schedule with valid parameters" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + + - label: "Verify created schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + + - label: "Create Year Day schedule with valid parameters" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + + - label: "Verify created schedule" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + + # + # Excercise ClearWeekDay schedules with invalid parameters + # + - label: "Clear Week Day schedule with 0 index" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 0 + - name: "userIndex" + value: 1 + response: + error: INVALID_FIELD + + - label: "Clear Week Day schedule with out-of-bounds index" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: + static_cast(NumberOfWeekDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + response: + error: INVALID_FIELD + + - label: "Clear Week Day schedule with 0 user index" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 0 + response: + error: INVALID_FIELD + + - label: "Clear Week Day schedule with out-of-bounds user index" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + response: + error: INVALID_FIELD + + - label: "Clear Week Day schedule with non-existing user" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 2 + response: + error: NOT_FOUND + + # + # Excercise ClearYearDay schedules with invalid parameters + # + - label: "Clear Year Day schedule with 0 index" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 0 + - name: "userIndex" + value: 1 + response: + error: INVALID_FIELD + + - label: "Clear Year Day schedule with out-of-bounds index" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: + static_cast(NumberOfYearDaySchedulesSupportedPerUser + + 1) + - name: "userIndex" + value: 1 + response: + error: INVALID_FIELD + + - label: "Clear Year Day schedule with 0 user index" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 0 + response: + error: INVALID_FIELD + + - label: "Clear Year Day schedule with out-of-bounds user index" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: static_cast(NumberOfTotalUsersSupported + 1) + response: + error: INVALID_FIELD + + - label: "Clear Year Day schedule with non-existing user" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + response: + error: NOT_FOUND + + - label: "Make sure that week day schedule was not deleted" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 15 + - name: "startMinute" + value: 16 + - name: "endHour" + value: 18 + - name: "endMinute" + value: 00 + + - label: "Make sure that year day schedule was not deleted" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + + - label: "Create another Week Day schedule with valid parameters" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x02 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Verify created week day schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 2 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x02 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Create another Year Day schedule with valid parameters" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 9000 + - name: "localEndTime" + value: 888888888 + + - label: "Verify created year day schedule" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 9000 + - name: "localEndTime" + value: 888888888 + + - label: "Clear a single week day schedule for the first user" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + + - label: "Verify cleared week day schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Clear all remaining week day schedules for the first user" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 0xFE + - name: "userIndex" + value: 1 + + - label: "Verify cleared week schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 2 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Make sure that first year day schedule was not deleted" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 12345 + - name: "localEndTime" + value: 12345689 + + - label: "Make sure that second year day schedule was not deleted" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 9000 + - name: "localEndTime" + value: 888888888 + + # We create it to test that clearing year day schedules does not delete week day schedules + - label: "Create another Week Day schedule with valid parameters" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x02 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Clear a single year day schedule for the first user" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + + - label: "Verify cleared year day schedule" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Clear all remaining year schedules for the first user" + command: "ClearYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 0xFE + - name: "userIndex" + value: 1 + + - label: "Verify that second year day schedule was cleared" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 2 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Verify created week day schedule" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x02 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Clear all remaining week day schedules for the first user" + command: "ClearWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 0xFE + - name: "userIndex" + value: 1 + + - label: + "Create new user without credential so we can add more schedules to it" + command: "SetUser" + arguments: + values: + - name: "operationType" + value: 0 + - name: "userIndex" + value: 2 + - name: "userName" + value: null + - name: "userUniqueId" + value: null + - name: "userStatus" + value: null + - name: "userType" + value: null + - name: "credentialRule" + value: null + + - label: "Create Week Day schedule with valid parameters for first user" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Verify created week day schedule for first user" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x01 + - name: "startHour" + value: 0 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Create Year Day schedule for first user" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 4 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 9000 + - name: "localEndTime" + value: 888888888 + + - label: "Verify created year day schedule for first" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 4 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 4 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 9000 + - name: "localEndTime" + value: 888888888 + + - label: "Create Week Day schedule with valid parameters for second user" + command: "SetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 4 + - name: "userIndex" + value: 2 + - name: "daysMask" + value: 0x40 + - name: "startHour" + value: 23 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Verify created week day schedule for first user" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 4 + - name: "userIndex" + value: 2 + response: + values: + - name: "weekDayIndex" + value: 4 + - name: "userIndex" + value: 2 + - name: "status" + value: 0x0 + - name: "daysMask" + value: 0x40 + - name: "startHour" + value: 23 + - name: "startMinute" + value: 0 + - name: "endHour" + value: 23 + - name: "endMinute" + value: 59 + + - label: "Create Year Day schedule for second user" + command: "SetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "localStartTime" + value: 55555 + - name: "localEndTime" + value: 7777777 + + - label: "Verify created year day schedule for first" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x0 + - name: "localStartTime" + value: 55555 + - name: "localEndTime" + value: 7777777 + + - label: "Cleanup" + command: "ClearUser" + arguments: + values: + - name: "userIndex" + value: 0xFFFE + + - label: "Make sure clearing first user also cleared week day schedules" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + response: + values: + - name: "weekDayIndex" + value: 1 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Make sure clearing first user also cleared year day schedules" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 4 + - name: "userIndex" + value: 1 + response: + values: + - name: "yearDayIndex" + value: 4 + - name: "userIndex" + value: 1 + - name: "status" + value: 0x8B + + - label: "Make sure clearing second user also cleared week day schedules" + command: "GetWeekDaySchedule" + arguments: + values: + - name: "weekDayIndex" + value: 4 + - name: "userIndex" + value: 2 + response: + values: + - name: "weekDayIndex" + value: 4 + - name: "userIndex" + value: 2 + - name: "status" + value: 0x8B + + - label: "Make sure clearing second user also cleared year day schedules" + command: "GetYearDaySchedule" + arguments: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + response: + values: + - name: "yearDayIndex" + value: 1 + - name: "userIndex" + value: 2 + - name: "status" + value: 0x8B diff --git a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml index 84f62ddabce84a..ccc3168e955eca 100644 --- a/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml @@ -95,11 +95,11 @@ limitations under the License. NumberOfRFIDUsersSupported - NumberOfWeekDaySchedulesSupportedPerUser + NumberOfWeekDaySchedulesSupportedPerUser - NumberOfYearDaySchedulesSupportedPerUser + NumberOfYearDaySchedulesSupportedPerUser - NumberOfHolidaySchedulesSupported + NumberOfHolidaySchedulesSupported MaxPINCodeLength @@ -365,11 +365,11 @@ limitations under the License. - - - - - + + + + + @@ -401,8 +401,8 @@ limitations under the License. - - + + @@ -432,9 +432,9 @@ limitations under the License. - - - + + + @@ -952,15 +952,15 @@ limitations under the License. - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 986c61a9e6e9ec..d8ad9258da0efd 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -1358,6 +1358,8 @@ client cluster DoorLock = 257 { readonly attribute int16u numberOfTotalUsersSupported = 17; readonly attribute int16u numberOfPINUsersSupported = 18; readonly attribute int16u numberOfRFIDUsersSupported = 19; + readonly attribute int8u numberOfWeekDaySchedulesSupportedPerUser = 20; + readonly attribute int8u numberOfYearDaySchedulesSupportedPerUser = 21; readonly attribute int8u maxPINCodeLength = 23; readonly attribute int8u minPINCodeLength = 24; readonly attribute int8u maxRFIDCodeLength = 25; @@ -1381,6 +1383,16 @@ client cluster DoorLock = 257 { INT16U userIndex = 0; } + request struct ClearWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct ClearYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + request struct GetCredentialStatusRequest { DlCredential credential = 0; } @@ -1389,6 +1401,16 @@ client cluster DoorLock = 257 { INT16U userIndex = 0; } + request struct GetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + } + + request struct GetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + } + request struct LockDoorRequest { optional OCTET_STRING pinCode = 0; } @@ -1412,10 +1434,32 @@ client cluster DoorLock = 257 { nullable DlCredentialRule credentialRule = 6; } + request struct SetWeekDayScheduleRequest { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlDaysMaskMap daysMask = 2; + INT8U startHour = 3; + INT8U startMinute = 4; + INT8U endHour = 5; + INT8U endMinute = 6; + } + + request struct SetYearDayScheduleRequest { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + epoch_s localStartTime = 2; + epoch_s localEndTime = 3; + } + request struct UnlockDoorRequest { optional OCTET_STRING pinCode = 0; } + request struct UnlockWithTimeoutRequest { + INT16U timeout = 0; + optional OCTET_STRING pinCode = 1; + } + response struct GetCredentialStatusResponse { boolean credentialExists = 0; nullable INT16U userIndex = 1; @@ -1435,6 +1479,25 @@ client cluster DoorLock = 257 { nullable INT16U nextUserIndex = 9; } + response struct GetWeekDayScheduleResponse { + INT8U weekDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional DlDaysMaskMap daysMask = 3; + optional INT8U startHour = 4; + optional INT8U startMinute = 5; + optional INT8U endHour = 6; + optional INT8U endMinute = 7; + } + + response struct GetYearDayScheduleResponse { + INT8U yearDayIndex = 0; + INT16U userIndex = 1; + DlStatus status = 2; + optional epoch_s localStartTime = 3; + optional epoch_s localEndTime = 4; + } + response struct SetCredentialResponse { DlStatus status = 0; nullable INT16U userIndex = 1; @@ -1443,12 +1506,19 @@ client cluster DoorLock = 257 { command ClearCredential(ClearCredentialRequest): DefaultSuccess = 38; command ClearUser(ClearUserRequest): DefaultSuccess = 29; + command ClearWeekDaySchedule(ClearWeekDayScheduleRequest): DefaultSuccess = 13; + command ClearYearDaySchedule(ClearYearDayScheduleRequest): DefaultSuccess = 16; command GetCredentialStatus(GetCredentialStatusRequest): GetCredentialStatusResponse = 36; command GetUser(GetUserRequest): GetUserResponse = 27; + command GetWeekDaySchedule(GetWeekDayScheduleRequest): GetWeekDayScheduleResponse = 12; + command GetYearDaySchedule(GetYearDayScheduleRequest): GetYearDayScheduleResponse = 15; command LockDoor(LockDoorRequest): DefaultSuccess = 0; command SetCredential(SetCredentialRequest): SetCredentialResponse = 34; command SetUser(SetUserRequest): DefaultSuccess = 26; + command SetWeekDaySchedule(SetWeekDayScheduleRequest): DefaultSuccess = 11; + command SetYearDaySchedule(SetYearDayScheduleRequest): DefaultSuccess = 14; command UnlockDoor(UnlockDoorRequest): DefaultSuccess = 1; + command UnlockWithTimeout(UnlockWithTimeoutRequest): DefaultSuccess = 3; } client cluster ElectricalMeasurement = 2820 { diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index d936694a09353e..714731f7ca5e5f 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -7026,6 +7026,70 @@ "incoming": 1, "outgoing": 1 }, + { + "name": "UnlockWithTimeout", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "SetWeekDaySchedule", + "code": 11, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetWeekDaySchedule", + "code": 12, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearWeekDaySchedule", + "code": 13, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "SetYearDaySchedule", + "code": 14, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "GetYearDaySchedule", + "code": 15, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "ClearYearDaySchedule", + "code": 16, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 1 + }, + { + "name": "SetHolidaySchedule", + "code": 17, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 0 + }, { "name": "SetUser", "code": 26, @@ -7076,6 +7140,21 @@ } ], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -7130,7 +7209,7 @@ "code": 12, "mfgCode": null, "source": "server", - "incoming": 0, + "incoming": 1, "outgoing": 1 }, { @@ -7138,7 +7217,7 @@ "code": 15, "mfgCode": null, "source": "server", - "incoming": 0, + "incoming": 1, "outgoing": 1 }, { @@ -7251,6 +7330,51 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "DoorOpenEvents", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "DoorClosedEvents", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OpenPeriod", + "code": 6, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "NumberOfLogRecordsSupported", "code": 16, @@ -7311,6 +7435,51 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "NumberOfWeekDaySchedulesSupportedPerUser", + "code": 20, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfYearDaySchedulesSupportedPerUser", + "code": 21, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfHolidaySchedulesSupported", + "code": 22, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "MaxPINCodeLength", "code": 23, @@ -7371,6 +7540,36 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "CredentialRulesSupport", + "code": 27, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnableLogging", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "Language", "code": 33, @@ -7386,6 +7585,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "LEDSettings", + "code": 34, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AutoRelockTime", "code": 35, @@ -7446,6 +7660,36 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "DefaultConfigurationRegister", + "code": 39, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EnableLocalProgramming", + "code": 40, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "EnableOneTouchLocking", "code": 41, @@ -7461,6 +7705,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "EnableInsideStatusLED", + "code": 42, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "EnablePrivacyModeButton", "code": 43, @@ -7476,6 +7735,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "LocalProgrammingFeatures", + "code": 44, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "WrongCodeEntryLimit", "code": 48, @@ -7506,6 +7780,171 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "SendPINOverTheAir", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RequirePINforRemoteOperation", + "code": 51, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ExpiringUserTimeout", + "code": 53, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AlarmMask", + "code": 64, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "KeypadOperationEventMask", + "code": 65, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemoteOperationEventMask", + "code": 66, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ManualOperationEventMask", + "code": 67, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RFIDOperationEventMask", + "code": 68, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "KeypadProgrammingEventMask", + "code": 69, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RemoteProgrammingEventMask", + "code": 70, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RFIDProgrammingEventMask", + "code": 71, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -7521,6 +7960,21 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index a5292c1bee8010..7d021d408b0919 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -334,6 +334,10 @@ typedef void (*CHIPDoorLockClusterGetCredentialStatusResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetUserResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetYearDayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType &); typedef void (*CHIPDoorLockClusterSetCredentialResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType &); @@ -351,6 +355,10 @@ typedef void (*CHIPDoorLockClusterNumberOfPINUsersSupportedAttributeCallbackType void *, chip::app::Clusters::DoorLock::Attributes::NumberOfPINUsersSupported::TypeInfo::DecodableArgType); typedef void (*CHIPDoorLockClusterNumberOfRFIDUsersSupportedAttributeCallbackType)( void *, chip::app::Clusters::DoorLock::Attributes::NumberOfRFIDUsersSupported::TypeInfo::DecodableArgType); +typedef void (*CHIPDoorLockClusterNumberOfWeekDaySchedulesSupportedPerUserAttributeCallbackType)( + void *, chip::app::Clusters::DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo::DecodableArgType); +typedef void (*CHIPDoorLockClusterNumberOfYearDaySchedulesSupportedPerUserAttributeCallbackType)( + void *, chip::app::Clusters::DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo::DecodableArgType); typedef void (*CHIPDoorLockClusterMaxPINCodeLengthAttributeCallbackType)( void *, chip::app::Clusters::DoorLock::Attributes::MaxPINCodeLength::TypeInfo::DecodableArgType); typedef void (*CHIPDoorLockClusterMinPINCodeLengthAttributeCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index e6aa4d967e48bb..94f0805cdc3a57 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -8784,6 +8784,112 @@ JNI_METHOD(void, DoorLockCluster, clearUser) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, clearWeekDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject weekDayIndex, jobject userIndex, + jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.weekDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(weekDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DoorLockCluster, clearYearDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject yearDayIndex, jobject userIndex, + jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.yearDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(yearDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, DoorLockCluster, getCredentialStatus) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject credential, jobject timedInvokeTimeoutMs) { @@ -8896,6 +9002,118 @@ JNI_METHOD(void, DoorLockCluster, getUser) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, getWeekDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject weekDayIndex, jobject userIndex, + jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.weekDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(weekDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DoorLockCluster, getYearDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject yearDayIndex, jobject userIndex, + jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.yearDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(yearDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + + std::unique_ptr + onSuccess(Platform::New(callback), + Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, DoorLockCluster, lockDoor) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject pinCode, jobject timedInvokeTimeoutMs) { @@ -9150,6 +9368,126 @@ JNI_METHOD(void, DoorLockCluster, setUser) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, setWeekDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject weekDayIndex, jobject userIndex, jobject daysMask, + jobject startHour, jobject startMinute, jobject endHour, jobject endMinute, jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.weekDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(weekDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + request.daysMask = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(daysMask)); + request.startHour = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(startHour)); + request.startMinute = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(startMinute)); + request.endHour = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(endHour)); + request.endMinute = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(endMinute)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DoorLockCluster, setYearDaySchedule) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject yearDayIndex, jobject userIndex, jobject localStartTime, + jobject localEndTime, jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.yearDayIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(yearDayIndex)); + request.userIndex = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(userIndex)); + request.localStartTime = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(localStartTime)); + request.localEndTime = static_cast>( + chip::JniReferences::GetInstance().LongToPrimitive(localEndTime)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, DoorLockCluster, unlockDoor) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject pinCode, jobject timedInvokeTimeoutMs) { @@ -9206,6 +9544,64 @@ JNI_METHOD(void, DoorLockCluster, unlockDoor) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, unlockWithTimeout) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject timeout, jobject pinCode, jobject timedInvokeTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster; + + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type request; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + request.timeout = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(timeout)); + if (pinCode != nullptr) + { + jobject optionalValue_0; + chip::JniReferences::GetInstance().GetOptionalValue(pinCode, optionalValue_0); + auto & definedValue_0 = request.pinCode.Emplace(); + cleanupByteArrays.push_back(chip::Platform::MakeUnique(env, static_cast(optionalValue_0))); + definedValue_0 = cleanupByteArrays.back()->byteSpan(); + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + VerifyOrReturn(onFailure.get() != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native callback", CHIP_ERROR_NO_MEMORY)); + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error getting native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedInvokeTimeoutMs == nullptr) + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->InvokeCommand(request, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedInvokeTimeoutMs)); + } + VerifyOrReturn(err == CHIP_NO_ERROR, + AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error invoking command", + CHIP_ERROR_INCORRECT_STATE)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, DoorLockCluster, subscribeLockStateAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -9467,6 +9863,82 @@ JNI_METHOD(void, DoorLockCluster, subscribeNumberOfRFIDUsersSupportedAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, subscribeNumberOfWeekDaySchedulesSupportedPerUserAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, DoorLockCluster, subscribeNumberOfYearDaySchedulesSupportedPerUserAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = + chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPInt8uAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, DoorLockCluster, subscribeMaxPINCodeLengthAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index c64cfa54169775..961897f52a175a 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -678,6 +678,238 @@ void CHIPDoorLockClusterGetUserResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, userIndex, userName, userUniqueId, userStatus, userType, credentialRule, credentials, creatorFabricIndex, lastModifiedFabricIndex, nextUserIndex); } +CHIPDoorLockClusterGetWeekDayScheduleResponseCallback::CHIPDoorLockClusterGetWeekDayScheduleResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDoorLockClusterGetWeekDayScheduleResponseCallback::~CHIPDoorLockClusterGetWeekDayScheduleResponseCallback() +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +}; + +void CHIPDoorLockClusterGetWeekDayScheduleResponseCallback::CallbackFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & dataResponse) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + jmethodID javaMethod; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv")); + + std::unique_ptr + cppCallback(reinterpret_cast(context), + chip::Platform::Delete); + VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback")); + + javaCallbackRef = cppCallback->javaCallbackRef; + // Java callback is allowed to be null, exit early if this is the case. + VerifyOrReturn(javaCallbackRef != nullptr); + + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); + + jobject weekDayIndex; + std::string weekDayIndexClassName = "java/lang/Integer"; + std::string weekDayIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(weekDayIndexClassName.c_str(), weekDayIndexCtorSignature.c_str(), + dataResponse.weekDayIndex, weekDayIndex); + jobject userIndex; + std::string userIndexClassName = "java/lang/Integer"; + std::string userIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), + dataResponse.userIndex, userIndex); + jobject status; + std::string statusClassName = "java/lang/Integer"; + std::string statusCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); + jobject daysMask; + if (!dataResponse.daysMask.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, daysMask); + } + else + { + std::string daysMaskClassName = "java/lang/Integer"; + std::string daysMaskCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(daysMaskClassName.c_str(), daysMaskCtorSignature.c_str(), + dataResponse.daysMask.Value().Raw(), daysMask); + } + jobject startHour; + if (!dataResponse.startHour.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, startHour); + } + else + { + std::string startHourClassName = "java/lang/Integer"; + std::string startHourCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(startHourClassName.c_str(), startHourCtorSignature.c_str(), + dataResponse.startHour.Value(), startHour); + } + jobject startMinute; + if (!dataResponse.startMinute.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, startMinute); + } + else + { + std::string startMinuteClassName = "java/lang/Integer"; + std::string startMinuteCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + startMinuteClassName.c_str(), startMinuteCtorSignature.c_str(), dataResponse.startMinute.Value(), startMinute); + } + jobject endHour; + if (!dataResponse.endHour.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, endHour); + } + else + { + std::string endHourClassName = "java/lang/Integer"; + std::string endHourCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(endHourClassName.c_str(), endHourCtorSignature.c_str(), + dataResponse.endHour.Value(), endHour); + } + jobject endMinute; + if (!dataResponse.endMinute.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, endMinute); + } + else + { + std::string endMinuteClassName = "java/lang/Integer"; + std::string endMinuteCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(endMinuteClassName.c_str(), endMinuteCtorSignature.c_str(), + dataResponse.endMinute.Value(), endMinute); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, weekDayIndex, userIndex, status, daysMask, startHour, startMinute, endHour, + endMinute); +} +CHIPDoorLockClusterGetYearDayScheduleResponseCallback::CHIPDoorLockClusterGetYearDayScheduleResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDoorLockClusterGetYearDayScheduleResponseCallback::~CHIPDoorLockClusterGetYearDayScheduleResponseCallback() +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +}; + +void CHIPDoorLockClusterGetYearDayScheduleResponseCallback::CallbackFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & dataResponse) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + jmethodID javaMethod; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Error invoking Java callback: no JNIEnv")); + + std::unique_ptr + cppCallback(reinterpret_cast(context), + chip::Platform::Delete); + VerifyOrReturn(cppCallback != nullptr, ChipLogError(Zcl, "Error invoking Java callback: failed to cast native callback")); + + javaCallbackRef = cppCallback->javaCallbackRef; + // Java callback is allowed to be null, exit early if this is the case. + VerifyOrReturn(javaCallbackRef != nullptr); + + err = JniReferences::GetInstance().FindMethod( + env, javaCallbackRef, "onSuccess", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); + + jobject yearDayIndex; + std::string yearDayIndexClassName = "java/lang/Integer"; + std::string yearDayIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(yearDayIndexClassName.c_str(), yearDayIndexCtorSignature.c_str(), + dataResponse.yearDayIndex, yearDayIndex); + jobject userIndex; + std::string userIndexClassName = "java/lang/Integer"; + std::string userIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(userIndexClassName.c_str(), userIndexCtorSignature.c_str(), + dataResponse.userIndex, userIndex); + jobject status; + std::string statusClassName = "java/lang/Integer"; + std::string statusCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(statusClassName.c_str(), statusCtorSignature.c_str(), + static_cast(dataResponse.status), status); + jobject localStartTime; + if (!dataResponse.localStartTime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, localStartTime); + } + else + { + std::string localStartTimeClassName = "java/lang/Long"; + std::string localStartTimeCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(localStartTimeClassName.c_str(), + localStartTimeCtorSignature.c_str(), + dataResponse.localStartTime.Value(), localStartTime); + } + jobject localEndTime; + if (!dataResponse.localEndTime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, localEndTime); + } + else + { + std::string localEndTimeClassName = "java/lang/Long"; + std::string localEndTimeCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + localEndTimeClassName.c_str(), localEndTimeCtorSignature.c_str(), dataResponse.localEndTime.Value(), localEndTime); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, yearDayIndex, userIndex, status, localStartTime, localEndTime); +} CHIPDoorLockClusterSetCredentialResponseCallback::CHIPDoorLockClusterSetCredentialResponseCallback(jobject javaCallback) : Callback::Callback(CallbackFn, this) { diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h index e1d774071d391a..2fdbb539bee740 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h @@ -127,6 +127,36 @@ class CHIPDoorLockClusterGetUserResponseCallback : public Callback::Callback +{ +public: + CHIPDoorLockClusterGetWeekDayScheduleResponseCallback(jobject javaCallback); + + ~CHIPDoorLockClusterGetWeekDayScheduleResponseCallback(); + + static void CallbackFn(void * context, + const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & data); + +private: + jobject javaCallbackRef; +}; + +class CHIPDoorLockClusterGetYearDayScheduleResponseCallback + : public Callback::Callback +{ +public: + CHIPDoorLockClusterGetYearDayScheduleResponseCallback(jobject javaCallback); + + ~CHIPDoorLockClusterGetYearDayScheduleResponseCallback(); + + static void CallbackFn(void * context, + const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & data); + +private: + jobject javaCallbackRef; +}; + class CHIPDoorLockClusterSetCredentialResponseCallback : public Callback::Callback { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 1221e030a49b92..4b35c5b906cc12 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -4720,6 +4720,32 @@ public void clearUser( clearUser(chipClusterPtr, callback, userIndex, timedInvokeTimeoutMs); } + public void clearWeekDaySchedule( + DefaultClusterCallback callback, Integer weekDayIndex, Integer userIndex) { + clearWeekDaySchedule(chipClusterPtr, callback, weekDayIndex, userIndex, null); + } + + public void clearWeekDaySchedule( + DefaultClusterCallback callback, + Integer weekDayIndex, + Integer userIndex, + int timedInvokeTimeoutMs) { + clearWeekDaySchedule(chipClusterPtr, callback, weekDayIndex, userIndex, timedInvokeTimeoutMs); + } + + public void clearYearDaySchedule( + DefaultClusterCallback callback, Integer yearDayIndex, Integer userIndex) { + clearYearDaySchedule(chipClusterPtr, callback, yearDayIndex, userIndex, null); + } + + public void clearYearDaySchedule( + DefaultClusterCallback callback, + Integer yearDayIndex, + Integer userIndex, + int timedInvokeTimeoutMs) { + clearYearDaySchedule(chipClusterPtr, callback, yearDayIndex, userIndex, timedInvokeTimeoutMs); + } + public void getCredentialStatus( GetCredentialStatusResponseCallback callback, ChipStructs.DoorLockClusterDlCredential credential) { @@ -4742,6 +4768,32 @@ public void getUser( getUser(chipClusterPtr, callback, userIndex, timedInvokeTimeoutMs); } + public void getWeekDaySchedule( + GetWeekDayScheduleResponseCallback callback, Integer weekDayIndex, Integer userIndex) { + getWeekDaySchedule(chipClusterPtr, callback, weekDayIndex, userIndex, null); + } + + public void getWeekDaySchedule( + GetWeekDayScheduleResponseCallback callback, + Integer weekDayIndex, + Integer userIndex, + int timedInvokeTimeoutMs) { + getWeekDaySchedule(chipClusterPtr, callback, weekDayIndex, userIndex, timedInvokeTimeoutMs); + } + + public void getYearDaySchedule( + GetYearDayScheduleResponseCallback callback, Integer yearDayIndex, Integer userIndex) { + getYearDaySchedule(chipClusterPtr, callback, yearDayIndex, userIndex, null); + } + + public void getYearDaySchedule( + GetYearDayScheduleResponseCallback callback, + Integer yearDayIndex, + Integer userIndex, + int timedInvokeTimeoutMs) { + getYearDaySchedule(chipClusterPtr, callback, yearDayIndex, userIndex, timedInvokeTimeoutMs); + } + public void lockDoor(DefaultClusterCallback callback, Optional pinCode) { lockDoor(chipClusterPtr, callback, pinCode, null); } @@ -4837,6 +4889,78 @@ public void setUser( timedInvokeTimeoutMs); } + public void setWeekDaySchedule( + DefaultClusterCallback callback, + Integer weekDayIndex, + Integer userIndex, + Integer daysMask, + Integer startHour, + Integer startMinute, + Integer endHour, + Integer endMinute) { + setWeekDaySchedule( + chipClusterPtr, + callback, + weekDayIndex, + userIndex, + daysMask, + startHour, + startMinute, + endHour, + endMinute, + null); + } + + public void setWeekDaySchedule( + DefaultClusterCallback callback, + Integer weekDayIndex, + Integer userIndex, + Integer daysMask, + Integer startHour, + Integer startMinute, + Integer endHour, + Integer endMinute, + int timedInvokeTimeoutMs) { + setWeekDaySchedule( + chipClusterPtr, + callback, + weekDayIndex, + userIndex, + daysMask, + startHour, + startMinute, + endHour, + endMinute, + timedInvokeTimeoutMs); + } + + public void setYearDaySchedule( + DefaultClusterCallback callback, + Integer yearDayIndex, + Integer userIndex, + Long localStartTime, + Long localEndTime) { + setYearDaySchedule( + chipClusterPtr, callback, yearDayIndex, userIndex, localStartTime, localEndTime, null); + } + + public void setYearDaySchedule( + DefaultClusterCallback callback, + Integer yearDayIndex, + Integer userIndex, + Long localStartTime, + Long localEndTime, + int timedInvokeTimeoutMs) { + setYearDaySchedule( + chipClusterPtr, + callback, + yearDayIndex, + userIndex, + localStartTime, + localEndTime, + timedInvokeTimeoutMs); + } + public void unlockDoor(DefaultClusterCallback callback, Optional pinCode) { unlockDoor(chipClusterPtr, callback, pinCode, null); } @@ -4846,6 +4970,19 @@ public void unlockDoor( unlockDoor(chipClusterPtr, callback, pinCode, timedInvokeTimeoutMs); } + public void unlockWithTimeout( + DefaultClusterCallback callback, Integer timeout, Optional pinCode) { + unlockWithTimeout(chipClusterPtr, callback, timeout, pinCode, null); + } + + public void unlockWithTimeout( + DefaultClusterCallback callback, + Integer timeout, + Optional pinCode, + int timedInvokeTimeoutMs) { + unlockWithTimeout(chipClusterPtr, callback, timeout, pinCode, timedInvokeTimeoutMs); + } + private native void clearCredential( long chipClusterPtr, DefaultClusterCallback Callback, @@ -4858,6 +4995,20 @@ private native void clearUser( Integer userIndex, @Nullable Integer timedInvokeTimeoutMs); + private native void clearWeekDaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer weekDayIndex, + Integer userIndex, + @Nullable Integer timedInvokeTimeoutMs); + + private native void clearYearDaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer yearDayIndex, + Integer userIndex, + @Nullable Integer timedInvokeTimeoutMs); + private native void getCredentialStatus( long chipClusterPtr, GetCredentialStatusResponseCallback Callback, @@ -4870,6 +5021,20 @@ private native void getUser( Integer userIndex, @Nullable Integer timedInvokeTimeoutMs); + private native void getWeekDaySchedule( + long chipClusterPtr, + GetWeekDayScheduleResponseCallback Callback, + Integer weekDayIndex, + Integer userIndex, + @Nullable Integer timedInvokeTimeoutMs); + + private native void getYearDaySchedule( + long chipClusterPtr, + GetYearDayScheduleResponseCallback Callback, + Integer yearDayIndex, + Integer userIndex, + @Nullable Integer timedInvokeTimeoutMs); + private native void lockDoor( long chipClusterPtr, DefaultClusterCallback Callback, @@ -4899,12 +5064,40 @@ private native void setUser( @Nullable Integer credentialRule, @Nullable Integer timedInvokeTimeoutMs); + private native void setWeekDaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer weekDayIndex, + Integer userIndex, + Integer daysMask, + Integer startHour, + Integer startMinute, + Integer endHour, + Integer endMinute, + @Nullable Integer timedInvokeTimeoutMs); + + private native void setYearDaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer yearDayIndex, + Integer userIndex, + Long localStartTime, + Long localEndTime, + @Nullable Integer timedInvokeTimeoutMs); + private native void unlockDoor( long chipClusterPtr, DefaultClusterCallback Callback, Optional pinCode, @Nullable Integer timedInvokeTimeoutMs); + private native void unlockWithTimeout( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer timeout, + Optional pinCode, + @Nullable Integer timedInvokeTimeoutMs); + public interface GetCredentialStatusResponseCallback { void onSuccess( Boolean credentialExists, @@ -4930,6 +5123,31 @@ void onSuccess( void onError(Exception error); } + public interface GetWeekDayScheduleResponseCallback { + void onSuccess( + Integer weekDayIndex, + Integer userIndex, + Integer status, + Optional daysMask, + Optional startHour, + Optional startMinute, + Optional endHour, + Optional endMinute); + + void onError(Exception error); + } + + public interface GetYearDayScheduleResponseCallback { + void onSuccess( + Integer yearDayIndex, + Integer userIndex, + Integer status, + Optional localStartTime, + Optional localEndTime); + + void onError(Exception error); + } + public interface SetCredentialResponseCallback { void onSuccess( Integer status, @Nullable Integer userIndex, @Nullable Integer nextCredentialIndex); @@ -5027,6 +5245,28 @@ public void subscribeNumberOfRFIDUsersSupportedAttribute( chipClusterPtr, callback, minInterval, maxInterval); } + public void readNumberOfWeekDaySchedulesSupportedPerUserAttribute( + IntegerAttributeCallback callback) { + readNumberOfWeekDaySchedulesSupportedPerUserAttribute(chipClusterPtr, callback); + } + + public void subscribeNumberOfWeekDaySchedulesSupportedPerUserAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeNumberOfWeekDaySchedulesSupportedPerUserAttribute( + chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readNumberOfYearDaySchedulesSupportedPerUserAttribute( + IntegerAttributeCallback callback) { + readNumberOfYearDaySchedulesSupportedPerUserAttribute(chipClusterPtr, callback); + } + + public void subscribeNumberOfYearDaySchedulesSupportedPerUserAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + subscribeNumberOfYearDaySchedulesSupportedPerUserAttribute( + chipClusterPtr, callback, minInterval, maxInterval); + } + public void readMaxPINCodeLengthAttribute(IntegerAttributeCallback callback) { readMaxPINCodeLengthAttribute(chipClusterPtr, callback); } @@ -5260,6 +5500,18 @@ private native void readNumberOfRFIDUsersSupportedAttribute( private native void subscribeNumberOfRFIDUsersSupportedAttribute( long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + private native void readNumberOfWeekDaySchedulesSupportedPerUserAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeNumberOfWeekDaySchedulesSupportedPerUserAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + + private native void readNumberOfYearDaySchedulesSupportedPerUserAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeNumberOfYearDaySchedulesSupportedPerUserAttribute( + long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + private native void readMaxPINCodeLengthAttribute( long chipClusterPtr, IntegerAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 559ebd8349b03a..0ed3b48d67d04c 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -1203,6 +1203,98 @@ public void onError(Exception error) { } } + public static class DelegatedGetWeekDayScheduleResponseCallback + implements ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + Integer weekDayIndex, + Integer userIndex, + Integer status, + Optional daysMask, + Optional startHour, + Optional startMinute, + Optional endHour, + Optional endMinute) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo weekDayIndexResponseValue = + new CommandResponseInfo("weekDayIndex", "Integer"); + responseValues.put(weekDayIndexResponseValue, weekDayIndex); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo daysMaskResponseValue = + new CommandResponseInfo("daysMask", "Optional"); + responseValues.put(daysMaskResponseValue, daysMask); + CommandResponseInfo startHourResponseValue = + new CommandResponseInfo("startHour", "Optional"); + responseValues.put(startHourResponseValue, startHour); + CommandResponseInfo startMinuteResponseValue = + new CommandResponseInfo("startMinute", "Optional"); + responseValues.put(startMinuteResponseValue, startMinute); + CommandResponseInfo endHourResponseValue = + new CommandResponseInfo("endHour", "Optional"); + responseValues.put(endHourResponseValue, endHour); + CommandResponseInfo endMinuteResponseValue = + new CommandResponseInfo("endMinute", "Optional"); + responseValues.put(endMinuteResponseValue, endMinute); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedGetYearDayScheduleResponseCallback + implements ChipClusters.DoorLockCluster.GetYearDayScheduleResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + Integer yearDayIndex, + Integer userIndex, + Integer status, + Optional localStartTime, + Optional localEndTime) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo yearDayIndexResponseValue = + new CommandResponseInfo("yearDayIndex", "Integer"); + responseValues.put(yearDayIndexResponseValue, yearDayIndex); + CommandResponseInfo userIndexResponseValue = new CommandResponseInfo("userIndex", "Integer"); + responseValues.put(userIndexResponseValue, userIndex); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo localStartTimeResponseValue = + new CommandResponseInfo("localStartTime", "Optional"); + responseValues.put(localStartTimeResponseValue, localStartTime); + CommandResponseInfo localEndTimeResponseValue = + new CommandResponseInfo("localEndTime", "Optional"); + responseValues.put(localEndTimeResponseValue, localEndTime); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedSetCredentialResponseCallback implements ChipClusters.DoorLockCluster.SetCredentialResponseCallback, DelegatedClusterCallback { @@ -6232,6 +6324,56 @@ public Map> getCommandMap() { () -> new DelegatedDefaultClusterCallback(), doorLockclearUserCommandParams); doorLockClusterInteractionInfoMap.put("clearUser", doorLockclearUserInteractionInfo); + Map doorLockclearWeekDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockclearWeekDayScheduleweekDayIndexCommandParameterInfo = + new CommandParameterInfo("weekDayIndex", Integer.class); + doorLockclearWeekDayScheduleCommandParams.put( + "weekDayIndex", doorLockclearWeekDayScheduleweekDayIndexCommandParameterInfo); + + CommandParameterInfo doorLockclearWeekDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLockclearWeekDayScheduleCommandParams.put( + "userIndex", doorLockclearWeekDayScheduleuserIndexCommandParameterInfo); + + InteractionInfo doorLockclearWeekDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .clearWeekDaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("weekDayIndex"), + (Integer) commandArguments.get("userIndex")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLockclearWeekDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "clearWeekDaySchedule", doorLockclearWeekDayScheduleInteractionInfo); + Map doorLockclearYearDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockclearYearDayScheduleyearDayIndexCommandParameterInfo = + new CommandParameterInfo("yearDayIndex", Integer.class); + doorLockclearYearDayScheduleCommandParams.put( + "yearDayIndex", doorLockclearYearDayScheduleyearDayIndexCommandParameterInfo); + + CommandParameterInfo doorLockclearYearDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLockclearYearDayScheduleCommandParams.put( + "userIndex", doorLockclearYearDayScheduleuserIndexCommandParameterInfo); + + InteractionInfo doorLockclearYearDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .clearYearDaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("yearDayIndex"), + (Integer) commandArguments.get("userIndex")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLockclearYearDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "clearYearDaySchedule", doorLockclearYearDayScheduleInteractionInfo); Map doorLockgetCredentialStatusCommandParams = new LinkedHashMap(); InteractionInfo doorLockgetCredentialStatusInteractionInfo = @@ -6263,6 +6405,56 @@ public Map> getCommandMap() { () -> new DelegatedGetUserResponseCallback(), doorLockgetUserCommandParams); doorLockClusterInteractionInfoMap.put("getUser", doorLockgetUserInteractionInfo); + Map doorLockgetWeekDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockgetWeekDayScheduleweekDayIndexCommandParameterInfo = + new CommandParameterInfo("weekDayIndex", Integer.class); + doorLockgetWeekDayScheduleCommandParams.put( + "weekDayIndex", doorLockgetWeekDayScheduleweekDayIndexCommandParameterInfo); + + CommandParameterInfo doorLockgetWeekDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLockgetWeekDayScheduleCommandParams.put( + "userIndex", doorLockgetWeekDayScheduleuserIndexCommandParameterInfo); + + InteractionInfo doorLockgetWeekDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .getWeekDaySchedule( + (ChipClusters.DoorLockCluster.GetWeekDayScheduleResponseCallback) callback, + (Integer) commandArguments.get("weekDayIndex"), + (Integer) commandArguments.get("userIndex")); + }, + () -> new DelegatedGetWeekDayScheduleResponseCallback(), + doorLockgetWeekDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "getWeekDaySchedule", doorLockgetWeekDayScheduleInteractionInfo); + Map doorLockgetYearDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockgetYearDayScheduleyearDayIndexCommandParameterInfo = + new CommandParameterInfo("yearDayIndex", Integer.class); + doorLockgetYearDayScheduleCommandParams.put( + "yearDayIndex", doorLockgetYearDayScheduleyearDayIndexCommandParameterInfo); + + CommandParameterInfo doorLockgetYearDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLockgetYearDayScheduleCommandParams.put( + "userIndex", doorLockgetYearDayScheduleuserIndexCommandParameterInfo); + + InteractionInfo doorLockgetYearDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .getYearDaySchedule( + (ChipClusters.DoorLockCluster.GetYearDayScheduleResponseCallback) callback, + (Integer) commandArguments.get("yearDayIndex"), + (Integer) commandArguments.get("userIndex")); + }, + () -> new DelegatedGetYearDayScheduleResponseCallback(), + doorLockgetYearDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "getYearDaySchedule", doorLockgetYearDayScheduleInteractionInfo); Map doorLocklockDoorCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocklockDoorpinCodeCommandParameterInfo = @@ -6373,6 +6565,98 @@ public Map> getCommandMap() { () -> new DelegatedDefaultClusterCallback(), doorLocksetUserCommandParams); doorLockClusterInteractionInfoMap.put("setUser", doorLocksetUserInteractionInfo); + Map doorLocksetWeekDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLocksetWeekDayScheduleweekDayIndexCommandParameterInfo = + new CommandParameterInfo("weekDayIndex", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "weekDayIndex", doorLocksetWeekDayScheduleweekDayIndexCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "userIndex", doorLocksetWeekDayScheduleuserIndexCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDayScheduledaysMaskCommandParameterInfo = + new CommandParameterInfo("daysMask", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "daysMask", doorLocksetWeekDayScheduledaysMaskCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDaySchedulestartHourCommandParameterInfo = + new CommandParameterInfo("startHour", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "startHour", doorLocksetWeekDaySchedulestartHourCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDaySchedulestartMinuteCommandParameterInfo = + new CommandParameterInfo("startMinute", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "startMinute", doorLocksetWeekDaySchedulestartMinuteCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDayScheduleendHourCommandParameterInfo = + new CommandParameterInfo("endHour", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "endHour", doorLocksetWeekDayScheduleendHourCommandParameterInfo); + + CommandParameterInfo doorLocksetWeekDayScheduleendMinuteCommandParameterInfo = + new CommandParameterInfo("endMinute", Integer.class); + doorLocksetWeekDayScheduleCommandParams.put( + "endMinute", doorLocksetWeekDayScheduleendMinuteCommandParameterInfo); + + InteractionInfo doorLocksetWeekDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .setWeekDaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("weekDayIndex"), + (Integer) commandArguments.get("userIndex"), + (Integer) commandArguments.get("daysMask"), + (Integer) commandArguments.get("startHour"), + (Integer) commandArguments.get("startMinute"), + (Integer) commandArguments.get("endHour"), + (Integer) commandArguments.get("endMinute")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLocksetWeekDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "setWeekDaySchedule", doorLocksetWeekDayScheduleInteractionInfo); + Map doorLocksetYearDayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLocksetYearDayScheduleyearDayIndexCommandParameterInfo = + new CommandParameterInfo("yearDayIndex", Integer.class); + doorLocksetYearDayScheduleCommandParams.put( + "yearDayIndex", doorLocksetYearDayScheduleyearDayIndexCommandParameterInfo); + + CommandParameterInfo doorLocksetYearDayScheduleuserIndexCommandParameterInfo = + new CommandParameterInfo("userIndex", Integer.class); + doorLocksetYearDayScheduleCommandParams.put( + "userIndex", doorLocksetYearDayScheduleuserIndexCommandParameterInfo); + + CommandParameterInfo doorLocksetYearDaySchedulelocalStartTimeCommandParameterInfo = + new CommandParameterInfo("localStartTime", Long.class); + doorLocksetYearDayScheduleCommandParams.put( + "localStartTime", doorLocksetYearDaySchedulelocalStartTimeCommandParameterInfo); + + CommandParameterInfo doorLocksetYearDaySchedulelocalEndTimeCommandParameterInfo = + new CommandParameterInfo("localEndTime", Long.class); + doorLocksetYearDayScheduleCommandParams.put( + "localEndTime", doorLocksetYearDaySchedulelocalEndTimeCommandParameterInfo); + + InteractionInfo doorLocksetYearDayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .setYearDaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("yearDayIndex"), + (Integer) commandArguments.get("userIndex"), + (Long) commandArguments.get("localStartTime"), + (Long) commandArguments.get("localEndTime")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLocksetYearDayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "setYearDaySchedule", doorLocksetYearDayScheduleInteractionInfo); Map doorLockunlockDoorCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockunlockDoorpinCodeCommandParameterInfo = @@ -6390,6 +6674,31 @@ public Map> getCommandMap() { () -> new DelegatedDefaultClusterCallback(), doorLockunlockDoorCommandParams); doorLockClusterInteractionInfoMap.put("unlockDoor", doorLockunlockDoorInteractionInfo); + Map doorLockunlockWithTimeoutCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockunlockWithTimeouttimeoutCommandParameterInfo = + new CommandParameterInfo("timeout", Integer.class); + doorLockunlockWithTimeoutCommandParams.put( + "timeout", doorLockunlockWithTimeouttimeoutCommandParameterInfo); + + CommandParameterInfo doorLockunlockWithTimeoutpinCodeCommandParameterInfo = + new CommandParameterInfo("pinCode", Optional.class); + doorLockunlockWithTimeoutCommandParams.put( + "pinCode", doorLockunlockWithTimeoutpinCodeCommandParameterInfo); + + InteractionInfo doorLockunlockWithTimeoutInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .unlockWithTimeout( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("timeout"), + (Optional) commandArguments.get("pinCode")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLockunlockWithTimeoutCommandParams); + doorLockClusterInteractionInfoMap.put( + "unlockWithTimeout", doorLockunlockWithTimeoutInteractionInfo); commandMap.put("doorLock", doorLockClusterInteractionInfoMap); Map electricalMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 7a6fce9528fe69..2dc210109c6a96 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -1980,6 +1980,36 @@ public Map> getReadAttributeMap() { readDoorLockInteractionInfo.put( "readNumberOfRFIDUsersSupportedAttribute", readDoorLockNumberOfRFIDUsersSupportedAttributeInteractionInfo); + Map + readDoorLockNumberOfWeekDaySchedulesSupportedPerUserCommandParams = + new LinkedHashMap(); + InteractionInfo readDoorLockNumberOfWeekDaySchedulesSupportedPerUserAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .readNumberOfWeekDaySchedulesSupportedPerUserAttribute( + (ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDoorLockNumberOfWeekDaySchedulesSupportedPerUserCommandParams); + readDoorLockInteractionInfo.put( + "readNumberOfWeekDaySchedulesSupportedPerUserAttribute", + readDoorLockNumberOfWeekDaySchedulesSupportedPerUserAttributeInteractionInfo); + Map + readDoorLockNumberOfYearDaySchedulesSupportedPerUserCommandParams = + new LinkedHashMap(); + InteractionInfo readDoorLockNumberOfYearDaySchedulesSupportedPerUserAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .readNumberOfYearDaySchedulesSupportedPerUserAttribute( + (ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDoorLockNumberOfYearDaySchedulesSupportedPerUserCommandParams); + readDoorLockInteractionInfo.put( + "readNumberOfYearDaySchedulesSupportedPerUserAttribute", + readDoorLockNumberOfYearDaySchedulesSupportedPerUserAttributeInteractionInfo); Map readDoorLockMaxPINCodeLengthCommandParams = new LinkedHashMap(); InteractionInfo readDoorLockMaxPINCodeLengthAttributeInteractionInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 1a5862e25362a7..61c2025a5bdb63 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -1533,6 +1533,22 @@ class ChipClusters: "userIndex": "int", }, }, + 0x0000000D: { + "commandId": 0x0000000D, + "commandName": "ClearWeekDaySchedule", + "args": { + "weekDayIndex": "int", + "userIndex": "int", + }, + }, + 0x00000010: { + "commandId": 0x00000010, + "commandName": "ClearYearDaySchedule", + "args": { + "yearDayIndex": "int", + "userIndex": "int", + }, + }, 0x00000024: { "commandId": 0x00000024, "commandName": "GetCredentialStatus", @@ -1548,6 +1564,22 @@ class ChipClusters: "userIndex": "int", }, }, + 0x0000000C: { + "commandId": 0x0000000C, + "commandName": "GetWeekDaySchedule", + "args": { + "weekDayIndex": "int", + "userIndex": "int", + }, + }, + 0x0000000F: { + "commandId": 0x0000000F, + "commandName": "GetYearDaySchedule", + "args": { + "yearDayIndex": "int", + "userIndex": "int", + }, + }, 0x00000000: { "commandId": 0x00000000, "commandName": "LockDoor", @@ -1581,6 +1613,29 @@ class ChipClusters: "credentialRule": "int", }, }, + 0x0000000B: { + "commandId": 0x0000000B, + "commandName": "SetWeekDaySchedule", + "args": { + "weekDayIndex": "int", + "userIndex": "int", + "daysMask": "int", + "startHour": "int", + "startMinute": "int", + "endHour": "int", + "endMinute": "int", + }, + }, + 0x0000000E: { + "commandId": 0x0000000E, + "commandName": "SetYearDaySchedule", + "args": { + "yearDayIndex": "int", + "userIndex": "int", + "localStartTime": "int", + "localEndTime": "int", + }, + }, 0x00000001: { "commandId": 0x00000001, "commandName": "UnlockDoor", @@ -1588,6 +1643,14 @@ class ChipClusters: "pinCode": "bytes", }, }, + 0x00000003: { + "commandId": 0x00000003, + "commandName": "UnlockWithTimeout", + "args": { + "timeout": "int", + "pinCode": "bytes", + }, + }, }, "attributes": { 0x00000000: { @@ -1632,6 +1695,18 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000014: { + "attributeName": "NumberOfWeekDaySchedulesSupportedPerUser", + "attributeId": 0x00000014, + "type": "int", + "reportable": True, + }, + 0x00000015: { + "attributeName": "NumberOfYearDaySchedulesSupportedPerUser", + "attributeId": 0x00000015, + "type": "int", + "reportable": True, + }, 0x00000017: { "attributeName": "MaxPINCodeLength", "attributeId": 0x00000017, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index a2d82704f303bc..ab599f2c5884b3 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -14812,21 +14812,21 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="weekDayIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="userIndex", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="status", Tag=2, Type=DoorLock.Enums.DlStatus), - ClusterObjectFieldDescriptor(Label="daysMask", Tag=3, Type=uint), - ClusterObjectFieldDescriptor(Label="startHour", Tag=4, Type=uint), - ClusterObjectFieldDescriptor(Label="startMinute", Tag=5, Type=uint), - ClusterObjectFieldDescriptor(Label="endHour", Tag=6, Type=uint), - ClusterObjectFieldDescriptor(Label="endMinute", Tag=7, Type=uint), + ClusterObjectFieldDescriptor(Label="daysMask", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="startHour", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="startMinute", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endHour", Tag=6, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endMinute", Tag=7, Type=typing.Optional[uint]), ]) weekDayIndex: 'uint' = 0 userIndex: 'uint' = 0 status: 'DoorLock.Enums.DlStatus' = 0 - daysMask: 'uint' = 0 - startHour: 'uint' = 0 - startMinute: 'uint' = 0 - endHour: 'uint' = 0 - endMinute: 'uint' = 0 + daysMask: 'typing.Optional[uint]' = None + startHour: 'typing.Optional[uint]' = None + startMinute: 'typing.Optional[uint]' = None + endHour: 'typing.Optional[uint]' = None + endMinute: 'typing.Optional[uint]' = None @dataclass class ClearWeekDaySchedule(ClusterCommand): @@ -14896,15 +14896,15 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="yearDayIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="userIndex", Tag=1, Type=uint), ClusterObjectFieldDescriptor(Label="status", Tag=2, Type=DoorLock.Enums.DlStatus), - ClusterObjectFieldDescriptor(Label="localStartTime", Tag=3, Type=uint), - ClusterObjectFieldDescriptor(Label="localEndTime", Tag=4, Type=uint), + ClusterObjectFieldDescriptor(Label="localStartTime", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="localEndTime", Tag=4, Type=typing.Optional[uint]), ]) yearDayIndex: 'uint' = 0 userIndex: 'uint' = 0 status: 'DoorLock.Enums.DlStatus' = 0 - localStartTime: 'uint' = 0 - localEndTime: 'uint' = 0 + localStartTime: 'typing.Optional[uint]' = None + localEndTime: 'typing.Optional[uint]' = None @dataclass class ClearYearDaySchedule(ClusterCommand): @@ -14971,16 +14971,16 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields = [ ClusterObjectFieldDescriptor(Label="holidayIndex", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="status", Tag=1, Type=DoorLock.Enums.DlStatus), - ClusterObjectFieldDescriptor(Label="localStartTime", Tag=2, Type=uint), - ClusterObjectFieldDescriptor(Label="localEndTime", Tag=3, Type=uint), - ClusterObjectFieldDescriptor(Label="operatingMode", Tag=4, Type=DoorLock.Enums.DlOperatingMode), + ClusterObjectFieldDescriptor(Label="localStartTime", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="localEndTime", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="operatingMode", Tag=4, Type=typing.Optional[DoorLock.Enums.DlOperatingMode]), ]) holidayIndex: 'uint' = 0 status: 'DoorLock.Enums.DlStatus' = 0 - localStartTime: 'uint' = 0 - localEndTime: 'uint' = 0 - operatingMode: 'DoorLock.Enums.DlOperatingMode' = 0 + localStartTime: 'typing.Optional[uint]' = None + localEndTime: 'typing.Optional[uint]' = None + operatingMode: 'typing.Optional[DoorLock.Enums.DlOperatingMode]' = None @dataclass class ClearHolidaySchedule(ClusterCommand): diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index a5ba2318c55f20..a5b3f6e322f9ef 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -2400,6 +2400,28 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader value = [NSNumber numberWithUnsignedShort:cppValue]; return value; } + case Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id: { + using TypeInfo = Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id: { + using TypeInfo = Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } case Attributes::MaxPINCodeLength::Id: { using TypeInfo = Attributes::MaxPINCodeLength::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 8542fe88acbcf3..1220b239ef0322 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -5377,6 +5377,87 @@ DispatchSuccess(context, response); }; +void CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & data) +{ + auto * response = [CHIPDoorLockClusterGetWeekDayScheduleResponseParams new]; + { + response.weekDayIndex = [NSNumber numberWithUnsignedChar:data.weekDayIndex]; + } + { + response.userIndex = [NSNumber numberWithUnsignedShort:data.userIndex]; + } + { + response.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(data.status)]; + } + { + if (data.daysMask.HasValue()) { + response.daysMask = [NSNumber numberWithUnsignedChar:data.daysMask.Value().Raw()]; + } else { + response.daysMask = nil; + } + } + { + if (data.startHour.HasValue()) { + response.startHour = [NSNumber numberWithUnsignedChar:data.startHour.Value()]; + } else { + response.startHour = nil; + } + } + { + if (data.startMinute.HasValue()) { + response.startMinute = [NSNumber numberWithUnsignedChar:data.startMinute.Value()]; + } else { + response.startMinute = nil; + } + } + { + if (data.endHour.HasValue()) { + response.endHour = [NSNumber numberWithUnsignedChar:data.endHour.Value()]; + } else { + response.endHour = nil; + } + } + { + if (data.endMinute.HasValue()) { + response.endMinute = [NSNumber numberWithUnsignedChar:data.endMinute.Value()]; + } else { + response.endMinute = nil; + } + } + DispatchSuccess(context, response); +}; + +void CHIPDoorLockClusterGetYearDayScheduleResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & data) +{ + auto * response = [CHIPDoorLockClusterGetYearDayScheduleResponseParams new]; + { + response.yearDayIndex = [NSNumber numberWithUnsignedChar:data.yearDayIndex]; + } + { + response.userIndex = [NSNumber numberWithUnsignedShort:data.userIndex]; + } + { + response.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(data.status)]; + } + { + if (data.localStartTime.HasValue()) { + response.localStartTime = [NSNumber numberWithUnsignedInt:data.localStartTime.Value()]; + } else { + response.localStartTime = nil; + } + } + { + if (data.localEndTime.HasValue()) { + response.localEndTime = [NSNumber numberWithUnsignedInt:data.localEndTime.Value()]; + } else { + response.localEndTime = nil; + } + } + DispatchSuccess(context, response); +}; + void CHIPDoorLockClusterSetCredentialResponseCallbackBridge::OnSuccessFn( void * context, const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType & data) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 4e74c046e04f65..89f00f28330742 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -44,6 +44,10 @@ typedef void (*CHIPDoorLockClusterGetCredentialStatusResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetUserResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetYearDayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType &); typedef void (*CHIPDoorLockClusterSetCredentialResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType &); typedef void (*CHIPGeneralCommissioningClusterArmFailSafeResponseCallbackType)( @@ -4302,6 +4306,32 @@ class CHIPDoorLockClusterGetUserResponseCallbackBridge : public CHIPCallbackBrid static void OnSuccessFn(void * context, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType & data); }; +class CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & data); +}; + +class CHIPDoorLockClusterGetYearDayScheduleResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterGetYearDayScheduleResponseCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & data); +}; + class CHIPDoorLockClusterSetCredentialResponseCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index c6cf36794f9c3e..604a3a49889b3c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1409,20 +1409,36 @@ NS_ASSUME_NONNULL_BEGIN - (void)clearCredentialWithParams:(CHIPDoorLockClusterClearCredentialParams *)params completionHandler:(StatusCompletion)completionHandler; - (void)clearUserWithParams:(CHIPDoorLockClusterClearUserParams *)params completionHandler:(StatusCompletion)completionHandler; +- (void)clearWeekDayScheduleWithParams:(CHIPDoorLockClusterClearWeekDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; +- (void)clearYearDayScheduleWithParams:(CHIPDoorLockClusterClearYearDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)getCredentialStatusWithParams:(CHIPDoorLockClusterGetCredentialStatusParams *)params completionHandler:(void (^)(CHIPDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; - (void)getUserWithParams:(CHIPDoorLockClusterGetUserParams *)params completionHandler: (void (^)(CHIPDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; +- (void)getWeekDayScheduleWithParams:(CHIPDoorLockClusterGetWeekDayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; +- (void)getYearDayScheduleWithParams:(CHIPDoorLockClusterGetYearDayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; - (void)lockDoorWithParams:(CHIPDoorLockClusterLockDoorParams * _Nullable)params completionHandler:(StatusCompletion)completionHandler; - (void)setCredentialWithParams:(CHIPDoorLockClusterSetCredentialParams *)params completionHandler:(void (^)(CHIPDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; - (void)setUserWithParams:(CHIPDoorLockClusterSetUserParams *)params completionHandler:(StatusCompletion)completionHandler; +- (void)setWeekDayScheduleWithParams:(CHIPDoorLockClusterSetWeekDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; +- (void)setYearDayScheduleWithParams:(CHIPDoorLockClusterSetYearDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)unlockDoorWithParams:(CHIPDoorLockClusterUnlockDoorParams * _Nullable)params completionHandler:(StatusCompletion)completionHandler; +- (void)unlockWithTimeoutWithParams:(CHIPDoorLockClusterUnlockWithTimeoutParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)readAttributeLockStateWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; @@ -1480,6 +1496,24 @@ NS_ASSUME_NONNULL_BEGIN reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; +- (void)readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable) + subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler; + +- (void)readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable) + subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler; + - (void)readAttributeMaxPINCodeLengthWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)subscribeAttributeMaxPINCodeLengthWithMinInterval:(uint16_t)minInterval diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 6efb84794292ce..9ee29928a4e4d5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -5990,6 +5990,46 @@ new CHIPCommandSuccessCallbackBridge( }); } +- (void)clearWeekDayScheduleWithParams:(CHIPDoorLockClusterClearWeekDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::ClearWeekDaySchedule::Type request; + request.weekDayIndex = params.weekDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)clearYearDayScheduleWithParams:(CHIPDoorLockClusterClearYearDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::ClearYearDaySchedule::Type request; + request.yearDayIndex = params.yearDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)getCredentialStatusWithParams:(CHIPDoorLockClusterGetCredentialStatusParams *)params completionHandler:(void (^)(CHIPDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completionHandler @@ -6024,6 +6064,40 @@ new CHIPDoorLockClusterGetUserResponseCallbackBridge( }); } +- (void)getWeekDayScheduleWithParams:(CHIPDoorLockClusterGetWeekDayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::GetWeekDaySchedule::Type request; + request.weekDayIndex = params.weekDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + + new CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)getYearDayScheduleWithParams:(CHIPDoorLockClusterGetYearDayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::GetYearDaySchedule::Type request; + request.yearDayIndex = params.yearDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + + new CHIPDoorLockClusterGetYearDayScheduleResponseCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)lockDoorWithParams:(CHIPDoorLockClusterLockDoorParams * _Nullable)params completionHandler:(StatusCompletion)completionHandler { @@ -6137,6 +6211,53 @@ new CHIPCommandSuccessCallbackBridge( }); } +- (void)setWeekDayScheduleWithParams:(CHIPDoorLockClusterSetWeekDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::SetWeekDaySchedule::Type request; + request.weekDayIndex = params.weekDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + request.daysMask = static_cast>(params.daysMask.unsignedCharValue); + request.startHour = params.startHour.unsignedCharValue; + request.startMinute = params.startMinute.unsignedCharValue; + request.endHour = params.endHour.unsignedCharValue; + request.endMinute = params.endMinute.unsignedCharValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)setYearDayScheduleWithParams:(CHIPDoorLockClusterSetYearDayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::SetYearDaySchedule::Type request; + request.yearDayIndex = params.yearDayIndex.unsignedCharValue; + request.userIndex = params.userIndex.unsignedShortValue; + request.localStartTime = params.localStartTime.unsignedIntValue; + request.localEndTime = params.localEndTime.unsignedIntValue; + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)unlockDoorWithParams:(CHIPDoorLockClusterUnlockDoorParams * _Nullable)params completionHandler:(StatusCompletion)completionHandler { @@ -6161,6 +6282,29 @@ new CHIPCommandSuccessCallbackBridge( }); } +- (void)unlockWithTimeoutWithParams:(CHIPDoorLockClusterUnlockWithTimeoutParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::UnlockWithTimeout::Type request; + request.timeout = params.timeout.unsignedShortValue; + if (params.pinCode != nil) { + auto & definedValue_0 = request.pinCode.Emplace(); + definedValue_0 = [self asByteSpan:params.pinCode]; + } + + new CHIPCommandSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable value, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.InvokeCommand(request, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)readAttributeLockStateWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { @@ -6370,6 +6514,66 @@ new CHIPInt16uAttributeCallbackSubscriptionBridge( subscriptionEstablishedHandler); } +- (void)readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable) + subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler +{ + new CHIPInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + minInterval, maxInterval, CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + }, + subscriptionEstablishedHandler); +} + +- (void)readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable) + subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))reportHandler +{ + new CHIPInt8uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + minInterval, maxInterval, CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + }, + subscriptionEstablishedHandler); +} + - (void)readAttributeMaxPINCodeLengthWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h index 9dc0cbb1d4c30f..38b3d0d834deda 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.h @@ -957,11 +957,11 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic) NSNumber * _Nonnull weekDayIndex; @property (strong, nonatomic) NSNumber * _Nonnull userIndex; @property (strong, nonatomic) NSNumber * _Nonnull status; -@property (strong, nonatomic) NSNumber * _Nonnull daysMask; -@property (strong, nonatomic) NSNumber * _Nonnull startHour; -@property (strong, nonatomic) NSNumber * _Nonnull startMinute; -@property (strong, nonatomic) NSNumber * _Nonnull endHour; -@property (strong, nonatomic) NSNumber * _Nonnull endMinute; +@property (strong, nonatomic) NSNumber * _Nullable daysMask; +@property (strong, nonatomic) NSNumber * _Nullable startHour; +@property (strong, nonatomic) NSNumber * _Nullable startMinute; +@property (strong, nonatomic) NSNumber * _Nullable endHour; +@property (strong, nonatomic) NSNumber * _Nullable endMinute; - (instancetype)init; @end @@ -989,8 +989,8 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic) NSNumber * _Nonnull yearDayIndex; @property (strong, nonatomic) NSNumber * _Nonnull userIndex; @property (strong, nonatomic) NSNumber * _Nonnull status; -@property (strong, nonatomic) NSNumber * _Nonnull localStartTime; -@property (strong, nonatomic) NSNumber * _Nonnull localEndTime; +@property (strong, nonatomic) NSNumber * _Nullable localStartTime; +@property (strong, nonatomic) NSNumber * _Nullable localEndTime; - (instancetype)init; @end @@ -1016,9 +1016,9 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPDoorLockClusterGetHolidayScheduleResponseParams : NSObject @property (strong, nonatomic) NSNumber * _Nonnull holidayIndex; @property (strong, nonatomic) NSNumber * _Nonnull status; -@property (strong, nonatomic) NSNumber * _Nonnull localStartTime; -@property (strong, nonatomic) NSNumber * _Nonnull localEndTime; -@property (strong, nonatomic) NSNumber * _Nonnull operatingMode; +@property (strong, nonatomic) NSNumber * _Nullable localStartTime; +@property (strong, nonatomic) NSNumber * _Nullable localEndTime; +@property (strong, nonatomic) NSNumber * _Nullable operatingMode; - (instancetype)init; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm index 685f2c4c7c0eb7..d5c745df59d1a0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCommandPayloadsObjc.mm @@ -2030,15 +2030,15 @@ - (instancetype)init _status = @(0); - _daysMask = @(0); + _daysMask = nil; - _startHour = @(0); + _startHour = nil; - _startMinute = @(0); + _startMinute = nil; - _endHour = @(0); + _endHour = nil; - _endMinute = @(0); + _endMinute = nil; } return self; } @@ -2098,9 +2098,9 @@ - (instancetype)init _status = @(0); - _localStartTime = @(0); + _localStartTime = nil; - _localEndTime = @(0); + _localEndTime = nil; } return self; } @@ -2156,11 +2156,11 @@ - (instancetype)init _status = @(0); - _localStartTime = @(0); + _localStartTime = nil; - _localEndTime = @(0); + _localEndTime = nil; - _operatingMode = @(0); + _operatingMode = nil; } return self; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index 276db9c6925a3c..1e835c6cbe7354 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -328,6 +328,10 @@ NS_ASSUME_NONNULL_BEGIN completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeNumberOfRFIDUsersSupportedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeNumberOfYearDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeMaxPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeMinPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeMaxRFIDCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index a36a98bf31664f..448ca1e164b413 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -3202,6 +3202,44 @@ new CHIPDefaultSuccessCallbackBridge( }); } +- (void)writeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeNumberOfYearDaySchedulesSupportedPerUserWithValue:(NSNumber * _Nonnull)value + completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedCharValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)writeAttributeMaxPINCodeLengthWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 7b8b1f6884dd10..eec43511a56bdf 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -45744,6 +45744,58 @@ - (void)testSendClusterDoorLockReadAttributeNumberOfRFIDUsersSupportedWithComple [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterDoorLockReadAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = + [self expectationWithDescription:@"DoorLockReadAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletionHandler"]; + + [cluster readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletionHandler:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DoorLock NumberOfWeekDaySchedulesSupportedPerUser Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterDoorLockReadAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = + [self expectationWithDescription:@"DoorLockReadAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletionHandler"]; + + [cluster readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletionHandler:^( + NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DoorLock NumberOfYearDaySchedulesSupportedPerUser Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterDoorLockReadAttributeMaxPINCodeLengthWithCompletionHandler { dispatch_queue_t queue = dispatch_get_main_queue(); diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 89ad4c07811645..49f42cdce4b983 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1935,9 +1935,9 @@ { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfTotalUsersSupported */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfPINUsersSupported */ \ { 0x00000013, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfRFIDUsersSupported */ \ - { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfWeekDaySchedulesSupportedPerUser */ \ - { 0x00000015, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfYearDaySchedulesSupportedPerUser */ \ - { 0x00000016, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfHolidaySchedulesSupported */ \ + { 0x00000014, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfWeekDaySchedulesSupportedPerUser */ \ + { 0x00000015, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfYearDaySchedulesSupportedPerUser */ \ + { 0x00000016, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfHolidaySchedulesSupported */ \ { 0x00000017, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(6) }, /* MaxPINCodeLength */ \ { 0x00000018, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(6) }, /* MinPINCodeLength */ \ { 0x00000019, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(20) }, /* MaxRFIDCodeLength */ \ @@ -2665,7 +2665,7 @@ { 0x00000101, \ ZAP_ATTRIBUTE_INDEX(288), \ 32, \ - 57, \ + 54, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -2801,7 +2801,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 26, 1120 }, { ZAP_CLUSTER_INDEX(26), 46, 6202 }, { ZAP_CLUSTER_INDEX(72), 4, 21 }, \ + { ZAP_CLUSTER_INDEX(0), 26, 1120 }, { ZAP_CLUSTER_INDEX(26), 46, 6199 }, { ZAP_CLUSTER_INDEX(72), 4, 21 }, \ } // Largest attribute size is needed for various buffers @@ -2811,7 +2811,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (41) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (7343) +#define ATTRIBUTE_MAX_SIZE (7340) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 83acffd2e80b8a..b5f5cfc51e5caf 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -13808,9 +13808,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace NumberOfWeekDaySchedulesSupportedPerUser { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -13822,9 +13822,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -13832,16 +13832,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } } // namespace NumberOfWeekDaySchedulesSupportedPerUser namespace NumberOfYearDaySchedulesSupportedPerUser { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -13853,9 +13853,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -13863,16 +13863,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } } // namespace NumberOfYearDaySchedulesSupportedPerUser namespace NumberOfHolidaySchedulesSupported { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::DoorLock::Id, Id, readable, sizeof(temp)); @@ -13884,9 +13884,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -13894,7 +13894,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); + return emberAfWriteServerAttribute(endpoint, Clusters::DoorLock::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } } // namespace NumberOfHolidaySchedulesSupported diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 25d5bda66e6407..20081c37dd2f9c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2493,18 +2493,18 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace NumberOfRFIDUsersSupported namespace NumberOfWeekDaySchedulesSupportedPerUser { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace NumberOfWeekDaySchedulesSupportedPerUser namespace NumberOfYearDaySchedulesSupportedPerUser { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace NumberOfYearDaySchedulesSupportedPerUser namespace NumberOfHolidaySchedulesSupported { -EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace NumberOfHolidaySchedulesSupported namespace MaxPINCodeLength { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 28c99ae95fff53..7f7f493a9d07a0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -17892,14 +17892,14 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetWeekDayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t weekDayIndex = static_cast(0); - uint16_t userIndex = static_cast(0); - DlStatus status = static_cast(0); - chip::BitFlags daysMask = static_cast>(0); - uint8_t startHour = static_cast(0); - uint8_t startMinute = static_cast(0); - uint8_t endHour = static_cast(0); - uint8_t endMinute = static_cast(0); + uint8_t weekDayIndex = static_cast(0); + uint16_t userIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional> daysMask; + Optional startHour; + Optional startMinute; + Optional endHour; + Optional endMinute; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -17914,14 +17914,14 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetWeekDayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t weekDayIndex = static_cast(0); - uint16_t userIndex = static_cast(0); - DlStatus status = static_cast(0); - chip::BitFlags daysMask = static_cast>(0); - uint8_t startHour = static_cast(0); - uint8_t startMinute = static_cast(0); - uint8_t endHour = static_cast(0); - uint8_t endMinute = static_cast(0); + uint8_t weekDayIndex = static_cast(0); + uint16_t userIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional> daysMask; + Optional startHour; + Optional startMinute; + Optional endHour; + Optional endMinute; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetWeekDayScheduleResponse @@ -18053,11 +18053,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetYearDayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t yearDayIndex = static_cast(0); - uint16_t userIndex = static_cast(0); - DlStatus status = static_cast(0); - uint32_t localStartTime = static_cast(0); - uint32_t localEndTime = static_cast(0); + uint8_t yearDayIndex = static_cast(0); + uint16_t userIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional localStartTime; + Optional localEndTime; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -18072,11 +18072,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetYearDayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t yearDayIndex = static_cast(0); - uint16_t userIndex = static_cast(0); - DlStatus status = static_cast(0); - uint32_t localStartTime = static_cast(0); - uint32_t localEndTime = static_cast(0); + uint8_t yearDayIndex = static_cast(0); + uint16_t userIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional localStartTime; + Optional localEndTime; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetYearDayScheduleResponse @@ -18205,11 +18205,11 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::GetHolidayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t holidayIndex = static_cast(0); - DlStatus status = static_cast(0); - uint32_t localStartTime = static_cast(0); - uint32_t localEndTime = static_cast(0); - DlOperatingMode operatingMode = static_cast(0); + uint8_t holidayIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional localStartTime; + Optional localEndTime; + Optional operatingMode; CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; @@ -18224,11 +18224,11 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::GetHolidayScheduleResponse::Id; } static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } - uint8_t holidayIndex = static_cast(0); - DlStatus status = static_cast(0); - uint32_t localStartTime = static_cast(0); - uint32_t localEndTime = static_cast(0); - DlOperatingMode operatingMode = static_cast(0); + uint8_t holidayIndex = static_cast(0); + DlStatus status = static_cast(0); + Optional localStartTime; + Optional localEndTime; + Optional operatingMode; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace GetHolidayScheduleResponse @@ -19139,9 +19139,9 @@ struct TypeInfo namespace NumberOfWeekDaySchedulesSupportedPerUser { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id; } @@ -19151,9 +19151,9 @@ struct TypeInfo namespace NumberOfYearDaySchedulesSupportedPerUser { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id; } @@ -19163,9 +19163,9 @@ struct TypeInfo namespace NumberOfHolidaySchedulesSupported { struct TypeInfo { - using Type = uint16_t; - using DecodableType = uint16_t; - using DecodableArgType = uint16_t; + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; static constexpr ClusterId GetClusterId() { return Clusters::DoorLock::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfHolidaySchedulesSupported::Id; } @@ -19602,11 +19602,11 @@ struct TypeInfo Attributes::NumberOfPINUsersSupported::TypeInfo::DecodableType numberOfPINUsersSupported = static_cast(0); Attributes::NumberOfRFIDUsersSupported::TypeInfo::DecodableType numberOfRFIDUsersSupported = static_cast(0); Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo::DecodableType numberOfWeekDaySchedulesSupportedPerUser = - static_cast(0); + static_cast(0); Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo::DecodableType numberOfYearDaySchedulesSupportedPerUser = - static_cast(0); + static_cast(0); Attributes::NumberOfHolidaySchedulesSupported::TypeInfo::DecodableType numberOfHolidaySchedulesSupported = - static_cast(0); + static_cast(0); Attributes::MaxPINCodeLength::TypeInfo::DecodableType maxPINCodeLength = static_cast(0); Attributes::MinPINCodeLength::TypeInfo::DecodableType minPINCodeLength = static_cast(0); Attributes::MaxRFIDCodeLength::TypeInfo::DecodableType maxRFIDCodeLength = static_cast(0); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 670e486a94a747..af96551efcb27b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2233,12 +2233,19 @@ class DiagnosticLogsRetrieveLogsRequest : public ClusterCommand | Commands: | | | * ClearCredential | 0x26 | | * ClearUser | 0x1D | +| * ClearWeekDaySchedule | 0x0D | +| * ClearYearDaySchedule | 0x10 | | * GetCredentialStatus | 0x24 | | * GetUser | 0x1B | +| * GetWeekDaySchedule | 0x0C | +| * GetYearDaySchedule | 0x0F | | * LockDoor | 0x00 | | * SetCredential | 0x22 | | * SetUser | 0x1A | +| * SetWeekDaySchedule | 0x0B | +| * SetYearDaySchedule | 0x0E | | * UnlockDoor | 0x01 | +| * UnlockWithTimeout | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * LockState | 0x0000 | @@ -2248,6 +2255,8 @@ class DiagnosticLogsRetrieveLogsRequest : public ClusterCommand | * NumberOfTotalUsersSupported | 0x0011 | | * NumberOfPINUsersSupported | 0x0012 | | * NumberOfRFIDUsersSupported | 0x0013 | +| * NumberOfWeekDaySchedulesSupportedPerUser | 0x0014 | +| * NumberOfYearDaySchedulesSupportedPerUser | 0x0015 | | * MaxPINCodeLength | 0x0017 | | * MinPINCodeLength | 0x0018 | | * MaxRFIDCodeLength | 0x0019 | @@ -2319,6 +2328,54 @@ class DoorLockClearUser : public ClusterCommand chip::app::Clusters::DoorLock::Commands::ClearUser::Type mRequest; }; +/* + * Command ClearWeekDaySchedule + */ +class DoorLockClearWeekDaySchedule : public ClusterCommand +{ +public: + DoorLockClearWeekDaySchedule() : ClusterCommand("clear-week-day-schedule") + { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000D) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x0000000D, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type mRequest; +}; + +/* + * Command ClearYearDaySchedule + */ +class DoorLockClearYearDaySchedule : public ClusterCommand +{ +public: + DoorLockClearYearDaySchedule() : ClusterCommand("clear-year-day-schedule") + { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000010) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x00000010, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type mRequest; +}; + /* * Command GetCredentialStatus */ @@ -2366,6 +2423,54 @@ class DoorLockGetUser : public ClusterCommand chip::app::Clusters::DoorLock::Commands::GetUser::Type mRequest; }; +/* + * Command GetWeekDaySchedule + */ +class DoorLockGetWeekDaySchedule : public ClusterCommand +{ +public: + DoorLockGetWeekDaySchedule() : ClusterCommand("get-week-day-schedule") + { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000C) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x0000000C, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type mRequest; +}; + +/* + * Command GetYearDaySchedule + */ +class DoorLockGetYearDaySchedule : public ClusterCommand +{ +public: + DoorLockGetYearDaySchedule() : ClusterCommand("get-year-day-schedule") + { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000F) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x0000000F, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type mRequest; +}; + /* * Command LockDoor */ @@ -2447,6 +2552,61 @@ class DoorLockSetUser : public ClusterCommand chip::app::Clusters::DoorLock::Commands::SetUser::Type mRequest; }; +/* + * Command SetWeekDaySchedule + */ +class DoorLockSetWeekDaySchedule : public ClusterCommand +{ +public: + DoorLockSetWeekDaySchedule() : ClusterCommand("set-week-day-schedule") + { + AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("DaysMask", 0, UINT8_MAX, &mRequest.daysMask); + AddArgument("StartHour", 0, UINT8_MAX, &mRequest.startHour); + AddArgument("StartMinute", 0, UINT8_MAX, &mRequest.startMinute); + AddArgument("EndHour", 0, UINT8_MAX, &mRequest.endHour); + AddArgument("EndMinute", 0, UINT8_MAX, &mRequest.endMinute); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000B) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x0000000B, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type mRequest; +}; + +/* + * Command SetYearDaySchedule + */ +class DoorLockSetYearDaySchedule : public ClusterCommand +{ +public: + DoorLockSetYearDaySchedule() : ClusterCommand("set-year-day-schedule") + { + AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); + AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); + AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); + AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x0000000E) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x0000000E, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type mRequest; +}; + /* * Command UnlockDoor */ @@ -2470,6 +2630,30 @@ class DoorLockUnlockDoor : public ClusterCommand chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type mRequest; }; +/* + * Command UnlockWithTimeout + */ +class DoorLockUnlockWithTimeout : public ClusterCommand +{ +public: + DoorLockUnlockWithTimeout() : ClusterCommand("unlock-with-timeout") + { + AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); + AddArgument("PinCode", &mRequest.pinCode); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000003) on endpoint %" PRIu16, endpointId); + + return ClusterCommand::SendCommand(device, endpointId, 0x00000101, 0x00000003, mRequest); + } + +private: + chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type mRequest; +}; + class WriteDoorLockLanguage : public WriteAttribute { public: @@ -9415,26 +9599,37 @@ void registerClusterDoorLock(Commands & commands) // // Commands // - make_unique(Id), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // + make_unique(Id), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // // // Attributes // - make_unique(Id), // - make_unique(Id, "lock-state", Attributes::LockState::Id), // - make_unique(Id, "lock-type", Attributes::LockType::Id), // - make_unique(Id, "actuator-enabled", Attributes::ActuatorEnabled::Id), // - make_unique(Id, "door-state", Attributes::DoorState::Id), // - make_unique(Id, "number-of-total-users-supported", Attributes::NumberOfTotalUsersSupported::Id), // - make_unique(Id, "number-of-pinusers-supported", Attributes::NumberOfPINUsersSupported::Id), // - make_unique(Id, "number-of-rfidusers-supported", Attributes::NumberOfRFIDUsersSupported::Id), // + make_unique(Id), // + make_unique(Id, "lock-state", Attributes::LockState::Id), // + make_unique(Id, "lock-type", Attributes::LockType::Id), // + make_unique(Id, "actuator-enabled", Attributes::ActuatorEnabled::Id), // + make_unique(Id, "door-state", Attributes::DoorState::Id), // + make_unique(Id, "number-of-total-users-supported", Attributes::NumberOfTotalUsersSupported::Id), // + make_unique(Id, "number-of-pinusers-supported", Attributes::NumberOfPINUsersSupported::Id), // + make_unique(Id, "number-of-rfidusers-supported", Attributes::NumberOfRFIDUsersSupported::Id), // + make_unique(Id, "number-of-week-day-schedules-supported-per-user", + Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id), // + make_unique(Id, "number-of-year-day-schedules-supported-per-user", + Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id), // make_unique(Id, "max-pincode-length", Attributes::MaxPINCodeLength::Id), // make_unique(Id, "min-pincode-length", Attributes::MinPINCodeLength::Id), // make_unique(Id, "max-rfidcode-length", Attributes::MaxRFIDCodeLength::Id), // @@ -9465,20 +9660,24 @@ void registerClusterDoorLock(Commands & commands) make_unique(Id, "number-of-total-users-supported", Attributes::NumberOfTotalUsersSupported::Id), // make_unique(Id, "number-of-pinusers-supported", Attributes::NumberOfPINUsersSupported::Id), // make_unique(Id, "number-of-rfidusers-supported", Attributes::NumberOfRFIDUsersSupported::Id), // - make_unique(Id, "max-pincode-length", Attributes::MaxPINCodeLength::Id), // - make_unique(Id, "min-pincode-length", Attributes::MinPINCodeLength::Id), // - make_unique(Id, "max-rfidcode-length", Attributes::MaxRFIDCodeLength::Id), // - make_unique(Id, "min-rfidcode-length", Attributes::MinRFIDCodeLength::Id), // - make_unique(Id, "language", Attributes::Language::Id), // - make_unique(Id, "auto-relock-time", Attributes::AutoRelockTime::Id), // - make_unique(Id, "sound-volume", Attributes::SoundVolume::Id), // - make_unique(Id, "operating-mode", Attributes::OperatingMode::Id), // - make_unique(Id, "supported-operating-modes", Attributes::SupportedOperatingModes::Id), // - make_unique(Id, "enable-one-touch-locking", Attributes::EnableOneTouchLocking::Id), // - make_unique(Id, "enable-privacy-mode-button", Attributes::EnablePrivacyModeButton::Id), // - make_unique(Id, "wrong-code-entry-limit", Attributes::WrongCodeEntryLimit::Id), // - make_unique(Id, "attribute-list", Attributes::AttributeList::Id), // - make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id), // + make_unique(Id, "number-of-week-day-schedules-supported-per-user", + Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id), // + make_unique(Id, "number-of-year-day-schedules-supported-per-user", + Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id), // + make_unique(Id, "max-pincode-length", Attributes::MaxPINCodeLength::Id), // + make_unique(Id, "min-pincode-length", Attributes::MinPINCodeLength::Id), // + make_unique(Id, "max-rfidcode-length", Attributes::MaxRFIDCodeLength::Id), // + make_unique(Id, "min-rfidcode-length", Attributes::MinRFIDCodeLength::Id), // + make_unique(Id, "language", Attributes::Language::Id), // + make_unique(Id, "auto-relock-time", Attributes::AutoRelockTime::Id), // + make_unique(Id, "sound-volume", Attributes::SoundVolume::Id), // + make_unique(Id, "operating-mode", Attributes::OperatingMode::Id), // + make_unique(Id, "supported-operating-modes", Attributes::SupportedOperatingModes::Id), // + make_unique(Id, "enable-one-touch-locking", Attributes::EnableOneTouchLocking::Id), // + make_unique(Id, "enable-privacy-mode-button", Attributes::EnablePrivacyModeButton::Id), // + make_unique(Id, "wrong-code-entry-limit", Attributes::WrongCodeEntryLimit::Id), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id), // // // Events // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index b099c826ee2a0e..046bef729fa4ab 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3448,6 +3448,33 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, DataModelLogger::LogString(indent, "}"); return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("weekDayIndex", indent + 1, value.weekDayIndex)); + ReturnErrorOnFailure(DataModelLogger::LogValue("userIndex", indent + 1, value.userIndex)); + ReturnErrorOnFailure(DataModelLogger::LogValue("status", indent + 1, value.status)); + ReturnErrorOnFailure(DataModelLogger::LogValue("daysMask", indent + 1, value.daysMask)); + ReturnErrorOnFailure(DataModelLogger::LogValue("startHour", indent + 1, value.startHour)); + ReturnErrorOnFailure(DataModelLogger::LogValue("startMinute", indent + 1, value.startMinute)); + ReturnErrorOnFailure(DataModelLogger::LogValue("endHour", indent + 1, value.endHour)); + ReturnErrorOnFailure(DataModelLogger::LogValue("endMinute", indent + 1, value.endMinute)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + ReturnErrorOnFailure(DataModelLogger::LogValue("yearDayIndex", indent + 1, value.yearDayIndex)); + ReturnErrorOnFailure(DataModelLogger::LogValue("userIndex", indent + 1, value.userIndex)); + ReturnErrorOnFailure(DataModelLogger::LogValue("status", indent + 1, value.status)); + ReturnErrorOnFailure(DataModelLogger::LogValue("localStartTime", indent + 1, value.localStartTime)); + ReturnErrorOnFailure(DataModelLogger::LogValue("localEndTime", indent + 1, value.localEndTime)); + DataModelLogger::LogString(indent, "}"); + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const DoorLock::Commands::SetCredentialResponse::DecodableType & value) { @@ -4656,6 +4683,16 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("NumberOfRFIDUsersSupported", 1, value); } + case DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfWeekDaySchedulesSupportedPerUser", 1, value); + } + case DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfYearDaySchedulesSupportedPerUser", 1, value); + } case DoorLock::Attributes::MaxPINCodeLength::Id: { uint8_t value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -7349,6 +7386,16 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("GetUserResponse", 1, value); } + case DoorLock::Commands::GetWeekDayScheduleResponse::Id: { + DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GetWeekDayScheduleResponse", 1, value); + } + case DoorLock::Commands::GetYearDayScheduleResponse::Id: { + DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GetYearDayScheduleResponse", 1, value); + } case DoorLock::Commands::SetCredentialResponse::Id: { DoorLock::Commands::SetCredentialResponse::DecodableType value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index ccdda46736af1a..70de48733c85ff 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -266,6 +266,10 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 4751070ecff04a..d0a926564b9164 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -176,6 +176,7 @@ class TestList : public Command printf("TestSubscribe_OnOff\n"); printf("DL_UsersAndCredentials\n"); printf("DL_LockUnlock\n"); + printf("DL_Schedules\n"); printf("TestGroupMessaging\n"); printf("TestGroupsCluster\n"); printf("TestGroupDemoCommand\n"); @@ -79492,6 +79493,3544 @@ class DL_LockUnlock : public TestCommand void OnSuccessResponse_10() { NextTest(); } }; +class DL_Schedules : public TestCommand +{ +public: + DL_Schedules() : TestCommand("DL_Schedules"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~DL_Schedules() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: DL_Schedules\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: DL_Schedules\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 : Create new PIN credential and schedule user\n"); + err = TestCreateNewPinCredentialAndScheduleUser_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Get number of supported users\n"); + err = TestGetNumberOfSupportedUsers_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Get Max number of Week Day schedules for user and verify default value\n"); + err = TestGetMaxNumberOfWeekDaySchedulesForUserAndVerifyDefaultValue_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : Get Max number of Year Day schedules for user and verify default value\n"); + err = TestGetMaxNumberOfYearDaySchedulesForUserAndVerifyDefaultValue_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Create Week Day schedule with 0 index\n"); + err = TestCreateWeekDayScheduleWith0Index_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Create Week Day schedule with out-of-bounds index\n"); + err = TestCreateWeekDayScheduleWithOutOfBoundsIndex_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Create Week Day schedule with 0 user index\n"); + err = TestCreateWeekDayScheduleWith0UserIndex_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Create Week Day schedule with out-of-bounds user index\n"); + err = TestCreateWeekDayScheduleWithOutOfBoundsUserIndex_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Create Week Day schedule for non-existing user\n"); + err = TestCreateWeekDayScheduleForNonExistingUser_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Create Week Day schedule with 0 days mask\n"); + err = TestCreateWeekDayScheduleWith0DaysMask_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Create Week Day schedule for Sunday and Monday\n"); + err = TestCreateWeekDayScheduleForSundayAndMonday_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Create Week Day schedule for Sunday Wednesday and Saturday\n"); + err = TestCreateWeekDayScheduleForSundayWednesdayAndSaturday_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Create Week Day schedule with invalid start hour\n"); + err = TestCreateWeekDayScheduleWithInvalidStartHour_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Create Week Day schedule with invalid start minute\n"); + err = TestCreateWeekDayScheduleWithInvalidStartMinute_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Create Week Day schedule with invalid end hour\n"); + err = TestCreateWeekDayScheduleWithInvalidEndHour_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Create Week Day schedule with invalid end minute\n"); + err = TestCreateWeekDayScheduleWithInvalidEndMinute_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Create Week Day schedule with start hour later that end hour\n"); + err = TestCreateWeekDayScheduleWithStartHourLaterThatEndHour_17(); + break; + case 18: + ChipLogProgress( + chipTool, + " ***** Test Step 18 : Create Week Day schedule with start minute later that end minute when hours are equal\n"); + err = TestCreateWeekDayScheduleWithStartMinuteLaterThatEndMinuteWhenHoursAreEqual_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Make sure that previous operations did not create a schedule\n"); + err = TestMakeSureThatPreviousOperationsDidNotCreateASchedule_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Get Week Day schedule with 0 index\n"); + err = TestGetWeekDayScheduleWith0Index_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Get Week Day schedule with out-of-bounds index\n"); + err = TestGetWeekDayScheduleWithOutOfBoundsIndex_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Get Week Day schedule with 0 user index\n"); + err = TestGetWeekDayScheduleWith0UserIndex_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Get Week Day schedule with out-of-bounds user index\n"); + err = TestGetWeekDayScheduleWithOutOfBoundsUserIndex_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Get Week Day schedule with non-existing user index\n"); + err = TestGetWeekDayScheduleWithNonExistingUserIndex_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Create Year Day schedule with 0 index\n"); + err = TestCreateYearDayScheduleWith0Index_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Create Year Day schedule with out-of-bounds index\n"); + err = TestCreateYearDayScheduleWithOutOfBoundsIndex_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Create Year Day schedule with 0 user index\n"); + err = TestCreateYearDayScheduleWith0UserIndex_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Create Year Day schedule with out-of-bounds user index\n"); + err = TestCreateYearDayScheduleWithOutOfBoundsUserIndex_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Create Year Day schedule for non-existing user\n"); + err = TestCreateYearDayScheduleForNonExistingUser_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Create Year Day schedule with start hour later that end hour\n"); + err = TestCreateYearDayScheduleWithStartHourLaterThatEndHour_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Make sure that previous operations did not create a schedule\n"); + err = TestMakeSureThatPreviousOperationsDidNotCreateASchedule_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Get Year Day schedule with 0 index\n"); + err = TestGetYearDayScheduleWith0Index_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Get Year Day schedule with out-of-bounds index\n"); + err = TestGetYearDayScheduleWithOutOfBoundsIndex_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Get Year Day schedule with 0 user index\n"); + err = TestGetYearDayScheduleWith0UserIndex_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Get Year Day schedule with out-of-bounds user index\n"); + err = TestGetYearDayScheduleWithOutOfBoundsUserIndex_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Get Year Day schedule with non-existing user index\n"); + err = TestGetYearDayScheduleWithNonExistingUserIndex_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Create Week Day schedule with valid parameters\n"); + err = TestCreateWeekDayScheduleWithValidParameters_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Verify created schedule\n"); + err = TestVerifyCreatedSchedule_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : Create Year Day schedule with valid parameters\n"); + err = TestCreateYearDayScheduleWithValidParameters_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Verify created schedule\n"); + err = TestVerifyCreatedSchedule_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Clear Week Day schedule with 0 index\n"); + err = TestClearWeekDayScheduleWith0Index_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Clear Week Day schedule with out-of-bounds index\n"); + err = TestClearWeekDayScheduleWithOutOfBoundsIndex_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Clear Week Day schedule with 0 user index\n"); + err = TestClearWeekDayScheduleWith0UserIndex_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Clear Week Day schedule with out-of-bounds user index\n"); + err = TestClearWeekDayScheduleWithOutOfBoundsUserIndex_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Clear Week Day schedule with non-existing user\n"); + err = TestClearWeekDayScheduleWithNonExistingUser_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : Clear Year Day schedule with 0 index\n"); + err = TestClearYearDayScheduleWith0Index_46(); + break; + case 47: + ChipLogProgress(chipTool, " ***** Test Step 47 : Clear Year Day schedule with out-of-bounds index\n"); + err = TestClearYearDayScheduleWithOutOfBoundsIndex_47(); + break; + case 48: + ChipLogProgress(chipTool, " ***** Test Step 48 : Clear Year Day schedule with 0 user index\n"); + err = TestClearYearDayScheduleWith0UserIndex_48(); + break; + case 49: + ChipLogProgress(chipTool, " ***** Test Step 49 : Clear Year Day schedule with out-of-bounds user index\n"); + err = TestClearYearDayScheduleWithOutOfBoundsUserIndex_49(); + break; + case 50: + ChipLogProgress(chipTool, " ***** Test Step 50 : Clear Year Day schedule with non-existing user\n"); + err = TestClearYearDayScheduleWithNonExistingUser_50(); + break; + case 51: + ChipLogProgress(chipTool, " ***** Test Step 51 : Make sure that week day schedule was not deleted\n"); + err = TestMakeSureThatWeekDayScheduleWasNotDeleted_51(); + break; + case 52: + ChipLogProgress(chipTool, " ***** Test Step 52 : Make sure that year day schedule was not deleted\n"); + err = TestMakeSureThatYearDayScheduleWasNotDeleted_52(); + break; + case 53: + ChipLogProgress(chipTool, " ***** Test Step 53 : Create another Week Day schedule with valid parameters\n"); + err = TestCreateAnotherWeekDayScheduleWithValidParameters_53(); + break; + case 54: + ChipLogProgress(chipTool, " ***** Test Step 54 : Verify created week day schedule\n"); + err = TestVerifyCreatedWeekDaySchedule_54(); + break; + case 55: + ChipLogProgress(chipTool, " ***** Test Step 55 : Create another Year Day schedule with valid parameters\n"); + err = TestCreateAnotherYearDayScheduleWithValidParameters_55(); + break; + case 56: + ChipLogProgress(chipTool, " ***** Test Step 56 : Verify created year day schedule\n"); + err = TestVerifyCreatedYearDaySchedule_56(); + break; + case 57: + ChipLogProgress(chipTool, " ***** Test Step 57 : Clear a single week day schedule for the first user\n"); + err = TestClearASingleWeekDayScheduleForTheFirstUser_57(); + break; + case 58: + ChipLogProgress(chipTool, " ***** Test Step 58 : Verify cleared week day schedule\n"); + err = TestVerifyClearedWeekDaySchedule_58(); + break; + case 59: + ChipLogProgress(chipTool, " ***** Test Step 59 : Clear all remaining week day schedules for the first user\n"); + err = TestClearAllRemainingWeekDaySchedulesForTheFirstUser_59(); + break; + case 60: + ChipLogProgress(chipTool, " ***** Test Step 60 : Verify cleared week schedule\n"); + err = TestVerifyClearedWeekSchedule_60(); + break; + case 61: + ChipLogProgress(chipTool, " ***** Test Step 61 : Make sure that first year day schedule was not deleted\n"); + err = TestMakeSureThatFirstYearDayScheduleWasNotDeleted_61(); + break; + case 62: + ChipLogProgress(chipTool, " ***** Test Step 62 : Make sure that second year day schedule was not deleted\n"); + err = TestMakeSureThatSecondYearDayScheduleWasNotDeleted_62(); + break; + case 63: + ChipLogProgress(chipTool, " ***** Test Step 63 : Create another Week Day schedule with valid parameters\n"); + err = TestCreateAnotherWeekDayScheduleWithValidParameters_63(); + break; + case 64: + ChipLogProgress(chipTool, " ***** Test Step 64 : Clear a single year day schedule for the first user\n"); + err = TestClearASingleYearDayScheduleForTheFirstUser_64(); + break; + case 65: + ChipLogProgress(chipTool, " ***** Test Step 65 : Verify cleared year day schedule\n"); + err = TestVerifyClearedYearDaySchedule_65(); + break; + case 66: + ChipLogProgress(chipTool, " ***** Test Step 66 : Clear all remaining year schedules for the first user\n"); + err = TestClearAllRemainingYearSchedulesForTheFirstUser_66(); + break; + case 67: + ChipLogProgress(chipTool, " ***** Test Step 67 : Verify that second year day schedule was cleared\n"); + err = TestVerifyThatSecondYearDayScheduleWasCleared_67(); + break; + case 68: + ChipLogProgress(chipTool, " ***** Test Step 68 : Verify created week day schedule\n"); + err = TestVerifyCreatedWeekDaySchedule_68(); + break; + case 69: + ChipLogProgress(chipTool, " ***** Test Step 69 : Clear all remaining week day schedules for the first user\n"); + err = TestClearAllRemainingWeekDaySchedulesForTheFirstUser_69(); + break; + case 70: + ChipLogProgress(chipTool, + " ***** Test Step 70 : Create new user without credential so we can add more schedules to it\n"); + err = TestCreateNewUserWithoutCredentialSoWeCanAddMoreSchedulesToIt_70(); + break; + case 71: + ChipLogProgress(chipTool, " ***** Test Step 71 : Create Week Day schedule with valid parameters for first user\n"); + err = TestCreateWeekDayScheduleWithValidParametersForFirstUser_71(); + break; + case 72: + ChipLogProgress(chipTool, " ***** Test Step 72 : Verify created week day schedule for first user\n"); + err = TestVerifyCreatedWeekDayScheduleForFirstUser_72(); + break; + case 73: + ChipLogProgress(chipTool, " ***** Test Step 73 : Create Year Day schedule for first user\n"); + err = TestCreateYearDayScheduleForFirstUser_73(); + break; + case 74: + ChipLogProgress(chipTool, " ***** Test Step 74 : Verify created year day schedule for first\n"); + err = TestVerifyCreatedYearDayScheduleForFirst_74(); + break; + case 75: + ChipLogProgress(chipTool, " ***** Test Step 75 : Create Week Day schedule with valid parameters for second user\n"); + err = TestCreateWeekDayScheduleWithValidParametersForSecondUser_75(); + break; + case 76: + ChipLogProgress(chipTool, " ***** Test Step 76 : Verify created week day schedule for first user\n"); + err = TestVerifyCreatedWeekDayScheduleForFirstUser_76(); + break; + case 77: + ChipLogProgress(chipTool, " ***** Test Step 77 : Create Year Day schedule for second user\n"); + err = TestCreateYearDayScheduleForSecondUser_77(); + break; + case 78: + ChipLogProgress(chipTool, " ***** Test Step 78 : Verify created year day schedule for first\n"); + err = TestVerifyCreatedYearDayScheduleForFirst_78(); + break; + case 79: + ChipLogProgress(chipTool, " ***** Test Step 79 : Cleanup\n"); + err = TestCleanup_79(); + break; + case 80: + ChipLogProgress(chipTool, " ***** Test Step 80 : Make sure clearing first user also cleared week day schedules\n"); + err = TestMakeSureClearingFirstUserAlsoClearedWeekDaySchedules_80(); + break; + case 81: + ChipLogProgress(chipTool, " ***** Test Step 81 : Make sure clearing first user also cleared year day schedules\n"); + err = TestMakeSureClearingFirstUserAlsoClearedYearDaySchedules_81(); + break; + case 82: + ChipLogProgress(chipTool, " ***** Test Step 82 : Make sure clearing second user also cleared week day schedules\n"); + err = TestMakeSureClearingSecondUserAlsoClearedWeekDaySchedules_82(); + break; + case 83: + ChipLogProgress(chipTool, " ***** Test Step 83 : Make sure clearing second user also cleared year day schedules\n"); + err = TestMakeSureClearingSecondUserAlsoClearedYearDaySchedules_83(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 84; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + uint16_t NumberOfTotalUsersSupported; + uint8_t NumberOfWeekDaySchedulesSupportedPerUser; + uint8_t NumberOfYearDaySchedulesSupportedPerUser; + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, uint16_t numberOfTotalUsersSupported) + { + (static_cast(context))->OnSuccessResponse_2(numberOfTotalUsersSupported); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, uint8_t numberOfWeekDaySchedulesSupportedPerUser) + { + (static_cast(context))->OnSuccessResponse_3(numberOfWeekDaySchedulesSupportedPerUser); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, uint8_t numberOfYearDaySchedulesSupportedPerUser) + { + (static_cast(context))->OnSuccessResponse_4(numberOfYearDaySchedulesSupportedPerUser); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestCreateNewPinCredentialAndScheduleUser_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; + + RequestType request; + request.operationType = static_cast(0); + + request.credential.credentialType = static_cast(1); + request.credential.credentialIndex = 1U; + + request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + request.userIndex.SetNull(); + request.userStatus.SetNull(); + request.userType.SetNull(); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(data.status, data.userIndex, data.nextCredentialIndex); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_1(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(chip::app::Clusters::DoorLock::DlStatus status, + const chip::app::DataModel::Nullable & userIndex, + const chip::app::DataModel::Nullable & nextCredentialIndex) + { + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); + + NextTest(); + } + + CHIP_ERROR TestGetNumberOfSupportedUsers_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::DoorLockClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(uint16_t numberOfTotalUsersSupported) + { + VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", numberOfTotalUsersSupported, 10U)); + + NumberOfTotalUsersSupported = numberOfTotalUsersSupported; + NextTest(); + } + + CHIP_ERROR TestGetMaxNumberOfWeekDaySchedulesForUserAndVerifyDefaultValue_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::DoorLockClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(uint8_t numberOfWeekDaySchedulesSupportedPerUser) + { + VerifyOrReturn(CheckValue("numberOfWeekDaySchedulesSupportedPerUser", numberOfWeekDaySchedulesSupportedPerUser, 10)); + + NumberOfWeekDaySchedulesSupportedPerUser = numberOfWeekDaySchedulesSupportedPerUser; + NextTest(); + } + + CHIP_ERROR TestGetMaxNumberOfYearDaySchedulesForUserAndVerifyDefaultValue_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::DoorLockClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(uint8_t numberOfYearDaySchedulesSupportedPerUser) + { + VerifyOrReturn(CheckValue("numberOfYearDaySchedulesSupportedPerUser", numberOfYearDaySchedulesSupportedPerUser, 10)); + + NumberOfYearDaySchedulesSupportedPerUser = numberOfYearDaySchedulesSupportedPerUser; + NextTest(); + } + + CHIP_ERROR TestCreateWeekDayScheduleWith0Index_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 0; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_5(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_5() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithOutOfBoundsIndex_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_6(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_6() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWith0UserIndex_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 0U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_7(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_7() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithOutOfBoundsUserIndex_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_8(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_8() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleForNonExistingUser_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 2U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_9(error); }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + NextTest(); + } + + void OnSuccessResponse_9() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWith0DaysMask_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(0); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_10(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_10() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleForSundayAndMonday_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(3); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_11(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_11() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleForSundayWednesdayAndSaturday_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(73); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_12(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_12(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_12() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithInvalidStartHour_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 24; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_13(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_13() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithInvalidStartMinute_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 60; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_14(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_14(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_14() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithInvalidEndHour_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 24; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_15(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_15(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_15() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithInvalidEndMinute_16() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 60; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_16(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_16(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_16(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_16() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithStartHourLaterThatEndHour_17() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 19; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_17(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_17(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_17(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_17() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithStartMinuteLaterThatEndMinuteWhenHoursAreEqual_18() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 50; + request.endHour = 15; + request.endMinute = 49; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_18(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_18(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_18() { ThrowSuccessResponse(); } + + CHIP_ERROR TestMakeSureThatPreviousOperationsDidNotCreateASchedule_19() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_19(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_19(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_19(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_19(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestGetWeekDayScheduleWith0Index_20() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 0; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_20(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_20(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_20(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_20(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 0)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetWeekDayScheduleWithOutOfBoundsIndex_21() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_21(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_21(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_21(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_21(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn( + CheckValue("weekDayIndex", weekDayIndex, static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1))); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetWeekDayScheduleWith0UserIndex_22() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 0U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_22(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_22(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_22(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_22(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 0U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetWeekDayScheduleWithOutOfBoundsUserIndex_23() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_23(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_23(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_23(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_23(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, static_cast(NumberOfTotalUsersSupported + 1))); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetWeekDayScheduleWithNonExistingUserIndex_24() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_24(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_24(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_24(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_24(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestCreateYearDayScheduleWith0Index_25() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 0; + request.userIndex = 1U; + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_25(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_25(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_25(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_25() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateYearDayScheduleWithOutOfBoundsIndex_26() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_26(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_26(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_26(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_26() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateYearDayScheduleWith0UserIndex_27() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 0U; + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_27(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_27(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_27(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_27() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateYearDayScheduleWithOutOfBoundsUserIndex_28() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_28(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_28(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_28(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_28() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateYearDayScheduleForNonExistingUser_29() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 2U; + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_29(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_29(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_29(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + NextTest(); + } + + void OnSuccessResponse_29() { ThrowSuccessResponse(); } + + CHIP_ERROR TestCreateYearDayScheduleWithStartHourLaterThatEndHour_30() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + request.localStartTime = 12345689UL; + request.localEndTime = 12345688UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_30(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_30(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_30(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_30() { ThrowSuccessResponse(); } + + CHIP_ERROR TestMakeSureThatPreviousOperationsDidNotCreateASchedule_31() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_31(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_31(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_31(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_31(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestGetYearDayScheduleWith0Index_32() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 0; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_32(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_32(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_32(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_32(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 0)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetYearDayScheduleWithOutOfBoundsIndex_33() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_33(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_33(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_33(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_33(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn( + CheckValue("yearDayIndex", yearDayIndex, static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1))); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetYearDayScheduleWith0UserIndex_34() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 0U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_34(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_34(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_34(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_34(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 0U)); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetYearDayScheduleWithOutOfBoundsUserIndex_35() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_35(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_35(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_35(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_35(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, static_cast(NumberOfTotalUsersSupported + 1))); + + VerifyOrReturn(CheckValue("status", status, 133)); + + NextTest(); + } + + CHIP_ERROR TestGetYearDayScheduleWithNonExistingUserIndex_36() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_36(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_36(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_36(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_36(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestCreateWeekDayScheduleWithValidParameters_37() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 15; + request.startMinute = 16; + request.endHour = 18; + request.endMinute = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_37(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_37(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_37(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_37() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedSchedule_38() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_38(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_38(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_38(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_38(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 15)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 16)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 18)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 0)); + + NextTest(); + } + + CHIP_ERROR TestCreateYearDayScheduleWithValidParameters_39() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + request.localStartTime = 12345UL; + request.localEndTime = 12345689UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_39(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_39(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_39(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_39() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedSchedule_40() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_40(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_40(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_40(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_40(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); + + NextTest(); + } + + CHIP_ERROR TestClearWeekDayScheduleWith0Index_41() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 0; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_41(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_41(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_41(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_41() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearWeekDayScheduleWithOutOfBoundsIndex_42() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_42(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_42(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_42(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_42() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearWeekDayScheduleWith0UserIndex_43() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 0U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_43(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_43(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_43(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_43() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearWeekDayScheduleWithOutOfBoundsUserIndex_44() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_44(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_44(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_44(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_44() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearWeekDayScheduleWithNonExistingUser_45() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_45(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_45(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_45(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + NextTest(); + } + + void OnSuccessResponse_45() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearYearDayScheduleWith0Index_46() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 0; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_46(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_46(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_46(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_46() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearYearDayScheduleWithOutOfBoundsIndex_47() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_47(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_47(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_47(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_47() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearYearDayScheduleWith0UserIndex_48() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 0U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_48(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_48(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_48(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_48() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearYearDayScheduleWithOutOfBoundsUserIndex_49() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_49(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_49(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_49(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + NextTest(); + } + + void OnSuccessResponse_49() { ThrowSuccessResponse(); } + + CHIP_ERROR TestClearYearDayScheduleWithNonExistingUser_50() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_50(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_50(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_50(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + NextTest(); + } + + void OnSuccessResponse_50() { ThrowSuccessResponse(); } + + CHIP_ERROR TestMakeSureThatWeekDayScheduleWasNotDeleted_51() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_51(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_51(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_51(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_51(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 15)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 16)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 18)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 0)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureThatYearDayScheduleWasNotDeleted_52() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_52(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_52(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_52(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_52(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); + + NextTest(); + } + + CHIP_ERROR TestCreateAnotherWeekDayScheduleWithValidParameters_53() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 2; + request.userIndex = 1U; + request.daysMask = static_cast>(2); + request.startHour = 0; + request.startMinute = 0; + request.endHour = 23; + request.endMinute = 59; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_53(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_53(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_53(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_53() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedWeekDaySchedule_54() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 2; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_54(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_54(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_54(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_54(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 2)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + + NextTest(); + } + + CHIP_ERROR TestCreateAnotherYearDayScheduleWithValidParameters_55() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 2; + request.userIndex = 1U; + request.localStartTime = 9000UL; + request.localEndTime = 888888888UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_55(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_55(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_55(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_55() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedYearDaySchedule_56() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 2; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_56(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_56(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_56(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_56(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); + + NextTest(); + } + + CHIP_ERROR TestClearASingleWeekDayScheduleForTheFirstUser_57() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_57(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_57(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_57(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_57() { NextTest(); } + + CHIP_ERROR TestVerifyClearedWeekDaySchedule_58() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_58(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_58(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_58(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_58(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestClearAllRemainingWeekDaySchedulesForTheFirstUser_59() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 254; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_59(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_59(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_59(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_59() { NextTest(); } + + CHIP_ERROR TestVerifyClearedWeekSchedule_60() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 2; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_60(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_60(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_60(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_60(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureThatFirstYearDayScheduleWasNotDeleted_61() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_61(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_61(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_61(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_61(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureThatSecondYearDayScheduleWasNotDeleted_62() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 2; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_62(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_62(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_62(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_62(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); + + NextTest(); + } + + CHIP_ERROR TestCreateAnotherWeekDayScheduleWithValidParameters_63() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(2); + request.startHour = 0; + request.startMinute = 0; + request.endHour = 23; + request.endMinute = 59; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_63(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_63(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_63(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_63() { NextTest(); } + + CHIP_ERROR TestClearASingleYearDayScheduleForTheFirstUser_64() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_64(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_64(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_64(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_64() { NextTest(); } + + CHIP_ERROR TestVerifyClearedYearDaySchedule_65() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_65(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_65(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_65(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_65(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestClearAllRemainingYearSchedulesForTheFirstUser_66() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 254; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_66(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_66(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_66(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_66() { NextTest(); } + + CHIP_ERROR TestVerifyThatSecondYearDayScheduleWasCleared_67() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 2; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_67(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_67(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_67(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_67(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestVerifyCreatedWeekDaySchedule_68() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_68(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_68(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_68(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_68(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 2)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + + NextTest(); + } + + CHIP_ERROR TestClearAllRemainingWeekDaySchedulesForTheFirstUser_69() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 254; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_69(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_69(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_69(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_69() { NextTest(); } + + CHIP_ERROR TestCreateNewUserWithoutCredentialSoWeCanAddMoreSchedulesToIt_70() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; + + RequestType request; + request.operationType = static_cast(0); + request.userIndex = 2U; + request.userName.SetNull(); + request.userUniqueId.SetNull(); + request.userStatus.SetNull(); + request.userType.SetNull(); + request.credentialRule.SetNull(); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_70(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_70(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_70(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_70() { NextTest(); } + + CHIP_ERROR TestCreateWeekDayScheduleWithValidParametersForFirstUser_71() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + request.daysMask = static_cast>(1); + request.startHour = 0; + request.startMinute = 0; + request.endHour = 23; + request.endMinute = 59; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_71(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_71(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_71(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_71() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedWeekDayScheduleForFirstUser_72() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_72(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_72(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_72(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_72(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + + NextTest(); + } + + CHIP_ERROR TestCreateYearDayScheduleForFirstUser_73() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 4; + request.userIndex = 1U; + request.localStartTime = 9000UL; + request.localEndTime = 888888888UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_73(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_73(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_73(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_73() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedYearDayScheduleForFirst_74() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 4; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_74(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_74(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_74(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_74(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 4)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); + + NextTest(); + } + + CHIP_ERROR TestCreateWeekDayScheduleWithValidParametersForSecondUser_75() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 4; + request.userIndex = 2U; + request.daysMask = static_cast>(64); + request.startHour = 23; + request.startMinute = 0; + request.endHour = 23; + request.endMinute = 59; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_75(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_75(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_75(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_75() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedWeekDayScheduleForFirstUser_76() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 4; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_76(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_76(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_76(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_76(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 4)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 64)); + + VerifyOrReturn(CheckValuePresent("startHour", startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("endHour", endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + + NextTest(); + } + + CHIP_ERROR TestCreateYearDayScheduleForSecondUser_77() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + request.localStartTime = 55555UL; + request.localEndTime = 7777777UL; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_77(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_77(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_77(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_77() { NextTest(); } + + CHIP_ERROR TestVerifyCreatedYearDayScheduleForFirst_78() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_78(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_78(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_78(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_78(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 55555UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 7777777UL)); + + NextTest(); + } + + CHIP_ERROR TestCleanup_79() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; + + RequestType request; + request.userIndex = 65534U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_79(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_79(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_79(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_79() { NextTest(); } + + CHIP_ERROR TestMakeSureClearingFirstUserAlsoClearedWeekDaySchedules_80() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 1; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_80(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_80(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_80(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_80(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureClearingFirstUserAlsoClearedYearDaySchedules_81() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 4; + request.userIndex = 1U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_81(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_81(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_81(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_81(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 4)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureClearingSecondUserAlsoClearedWeekDaySchedules_82() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + + RequestType request; + request.weekDayIndex = 4; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_82(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, + data.startMinute, data.endHour, data.endMinute); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_82(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_82(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_82(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional> & daysMask, + const chip::Optional & startHour, const chip::Optional & startMinute, + const chip::Optional & endHour, const chip::Optional & endMinute) + { + VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 4)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } + + CHIP_ERROR TestMakeSureClearingSecondUserAlsoClearedYearDaySchedules_83() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + + RequestType request; + request.yearDayIndex = 1; + request.userIndex = 2U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context)) + ->OnSuccessResponse_83(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_83(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_83(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_83(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, + const chip::Optional & localStartTime, const chip::Optional & localEndTime) + { + VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", status, 139)); + + NextTest(); + } +}; + class TestGroupMessaging : public TestCommand { public: @@ -81588,6 +85127,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index 699a62a8a5729e..ef18eabfa875a3 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -2455,6 +2455,48 @@ bool emberAfDoorLockClusterGetUserResponseCallback(EndpointId endpoint, app::Com return true; } +bool emberAfDoorLockClusterGetWeekDayScheduleResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, + uint8_t weekDayIndex, uint16_t userIndex, uint8_t status, + uint8_t daysMask, uint8_t startHour, uint8_t startMinute, + uint8_t endHour, uint8_t endMinute) +{ + ChipLogProgress(Zcl, "GetWeekDayScheduleResponse:"); + ChipLogProgress(Zcl, " weekDayIndex: %" PRIu8 "", weekDayIndex); + ChipLogProgress(Zcl, " userIndex: %" PRIu16 "", userIndex); + ChipLogProgress(Zcl, " status: %" PRIu8 "", status); + ChipLogProgress(Zcl, " daysMask: %" PRIu8 "", daysMask); + ChipLogProgress(Zcl, " startHour: %" PRIu8 "", startHour); + ChipLogProgress(Zcl, " startMinute: %" PRIu8 "", startMinute); + ChipLogProgress(Zcl, " endHour: %" PRIu8 "", endHour); + ChipLogProgress(Zcl, " endMinute: %" PRIu8 "", endMinute); + + GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetWeekDayScheduleResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, weekDayIndex, userIndex, status, daysMask, startHour, startMinute, endHour, endMinute); + return true; +} + +bool emberAfDoorLockClusterGetYearDayScheduleResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, + uint8_t yearDayIndex, uint16_t userIndex, uint8_t status, + uint32_t localStartTime, uint32_t localEndTime) +{ + ChipLogProgress(Zcl, "GetYearDayScheduleResponse:"); + ChipLogProgress(Zcl, " yearDayIndex: %" PRIu8 "", yearDayIndex); + ChipLogProgress(Zcl, " userIndex: %" PRIu16 "", userIndex); + ChipLogProgress(Zcl, " status: %" PRIu8 "", status); + ChipLogProgress(Zcl, " localStartTime: %" PRIu32 "", localStartTime); + ChipLogProgress(Zcl, " localEndTime: %" PRIu32 "", localEndTime); + + GET_CLUSTER_RESPONSE_CALLBACKS("DoorLockClusterGetYearDayScheduleResponseCallback"); + + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext, yearDayIndex, userIndex, status, localStartTime, localEndTime); + return true; +} + bool emberAfDoorLockClusterSetCredentialResponseCallback(EndpointId endpoint, app::CommandSender * commandObj, uint8_t status, uint16_t userIndex, uint16_t nextCredentialIndex) { diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index 91077a6cf176e8..20f0ebdabf723d 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -49,6 +49,11 @@ typedef void (*DoorLockClusterGetUserResponseCallback)(void * context, uint16_t /* TYPE WARNING: array array defaults to */ uint8_t * credentials, chip::FabricIndex creatorFabricIndex, chip::FabricIndex lastModifiedFabricIndex, uint16_t nextUserIndex); +typedef void (*DoorLockClusterGetWeekDayScheduleResponseCallback)(void * context, uint8_t weekDayIndex, uint16_t userIndex, + uint8_t status, uint8_t daysMask, uint8_t startHour, + uint8_t startMinute, uint8_t endHour, uint8_t endMinute); +typedef void (*DoorLockClusterGetYearDayScheduleResponseCallback)(void * context, uint8_t yearDayIndex, uint16_t userIndex, + uint8_t status, uint32_t localStartTime, uint32_t localEndTime); typedef void (*DoorLockClusterSetCredentialResponseCallback)(void * context, uint8_t status, uint16_t userIndex, uint16_t nextCredentialIndex); typedef void (*GeneralCommissioningClusterArmFailSafeResponseCallback)(void * context, uint8_t errorCode, chip::CharSpan debugText); diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index c5aefdb5d05581..c041827eb64555 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -2542,6 +2542,92 @@ CHIP_ERROR DoorLockCluster::ClearUser(Callback::Cancelable * onSuccessCallback, return err; } +CHIP_ERROR DoorLockCluster::ClearWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::ClearWeekDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // weekDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), weekDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR DoorLockCluster::ClearYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::ClearYearDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // yearDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), yearDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + CHIP_ERROR DoorLockCluster::GetCredentialStatus(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t credentialType, uint16_t credentialIndex) { @@ -2626,6 +2712,92 @@ CHIP_ERROR DoorLockCluster::GetUser(Callback::Cancelable * onSuccessCallback, Ca return err; } +CHIP_ERROR DoorLockCluster::GetWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::GetWeekDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // weekDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), weekDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR DoorLockCluster::GetYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::GetYearDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // yearDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), yearDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + CHIP_ERROR DoorLockCluster::LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pinCode) { @@ -2775,6 +2947,108 @@ CHIP_ERROR DoorLockCluster::SetUser(Callback::Cancelable * onSuccessCallback, Ca return err; } +CHIP_ERROR DoorLockCluster::SetWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex, uint8_t daysMask, uint8_t startHour, + uint8_t startMinute, uint8_t endHour, uint8_t endMinute) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::SetWeekDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // weekDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), weekDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + // daysMask: dlDaysMaskMap + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), daysMask)); + // startHour: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), startHour)); + // startMinute: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), startMinute)); + // endHour: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), endHour)); + // endMinute: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), endMinute)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + +CHIP_ERROR DoorLockCluster::SetYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex, uint32_t localStartTime, + uint32_t localEndTime) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::SetYearDaySchedule::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // yearDayIndex: int8u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), yearDayIndex)); + // userIndex: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), userIndex)); + // localStartTime: epochS + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), localStartTime)); + // localEndTime: epochS + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), localEndTime)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + CHIP_ERROR DoorLockCluster::UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pinCode) { @@ -2816,6 +3090,49 @@ CHIP_ERROR DoorLockCluster::UnlockDoor(Callback::Cancelable * onSuccessCallback, return err; } +CHIP_ERROR DoorLockCluster::UnlockWithTimeout(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t timeout, chip::ByteSpan pinCode) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVWriter * writer = nullptr; + uint8_t argSeqNumber = 0; + + // Used when encoding non-empty command. Suppress error message when encoding empty commands. + (void) writer; + (void) argSeqNumber; + + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, DoorLock::Commands::UnlockWithTimeout::Id, + (app::CommandPathFlags::kEndpointIdValid) }; + + CommandSenderHandle sender( + Platform::New(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); + + VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); + + SuccessOrExit(err = sender->PrepareCommand(cmdParams)); + + VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + // timeout: int16u + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), timeout)); + // pinCode: octetString + SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), pinCode)); + + SuccessOrExit(err = sender->FinishCommand()); + + // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. + mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); + + SuccessOrExit(err = mDevice->SendCommands(sender.get(), mTimeout)); + + // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object + // now. + sender.release(); +exit: + return err; +} + // ElectricalMeasurement Cluster Commands // EthernetNetworkDiagnostics Cluster Commands diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 43db038e095240..accde31fb79fe9 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -297,9 +297,17 @@ class DLL_EXPORT DoorLockCluster : public ClusterBase CHIP_ERROR ClearCredential(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t credentialType, uint16_t credentialIndex); CHIP_ERROR ClearUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userIndex); + CHIP_ERROR ClearWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex); + CHIP_ERROR ClearYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex); CHIP_ERROR GetCredentialStatus(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t credentialType, uint16_t credentialIndex); CHIP_ERROR GetUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userIndex); + CHIP_ERROR GetWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex); + CHIP_ERROR GetYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex); CHIP_ERROR LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pinCode); CHIP_ERROR SetCredential(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t operationType, uint8_t credentialType, uint16_t credentialIndex, chip::ByteSpan credentialData, @@ -307,8 +315,15 @@ class DLL_EXPORT DoorLockCluster : public ClusterBase CHIP_ERROR SetUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t operationType, uint16_t userIndex, chip::CharSpan userName, uint32_t userUniqueId, uint8_t userStatus, uint8_t userType, uint8_t credentialRule); + CHIP_ERROR SetWeekDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t weekDayIndex, uint16_t userIndex, uint8_t daysMask, uint8_t startHour, + uint8_t startMinute, uint8_t endHour, uint8_t endMinute); + CHIP_ERROR SetYearDaySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint8_t yearDayIndex, uint16_t userIndex, uint32_t localStartTime, uint32_t localEndTime); CHIP_ERROR UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pinCode); + CHIP_ERROR UnlockWithTimeout(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t timeout, chip::ByteSpan pinCode); }; class DLL_EXPORT ElectricalMeasurementCluster : public ClusterBase diff --git a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp index 41561218171774..413c7604c68b63 100644 --- a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp @@ -732,6 +732,169 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa } break; } + case Commands::GetWeekDayScheduleResponse::Id: { + expectArgumentCount = 8; + uint8_t weekDayIndex; + uint16_t userIndex; + uint8_t status; + uint8_t daysMask; + uint8_t startHour; + uint8_t startMinute; + uint8_t endHour; + uint8_t endMinute; + bool argExists[8]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 8) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + TLVUnpackError = aDataTlv.Get(weekDayIndex); + break; + case 1: + TLVUnpackError = aDataTlv.Get(userIndex); + break; + case 2: + TLVUnpackError = aDataTlv.Get(status); + break; + case 3: + TLVUnpackError = aDataTlv.Get(daysMask); + break; + case 4: + TLVUnpackError = aDataTlv.Get(startHour); + break; + case 5: + TLVUnpackError = aDataTlv.Get(startMinute); + break; + case 6: + TLVUnpackError = aDataTlv.Get(endHour); + break; + case 7: + TLVUnpackError = aDataTlv.Get(endMinute); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 8 == validArgumentCount) + { + wasHandled = emberAfDoorLockClusterGetWeekDayScheduleResponseCallback(aCommandPath.mEndpointId, apCommandObj, + weekDayIndex, userIndex, status, daysMask, + startHour, startMinute, endHour, endMinute); + } + break; + } + case Commands::GetYearDayScheduleResponse::Id: { + expectArgumentCount = 5; + uint8_t yearDayIndex; + uint16_t userIndex; + uint8_t status; + uint32_t localStartTime; + uint32_t localEndTime; + bool argExists[5]; + + memset(argExists, 0, sizeof argExists); + + while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR) + { + // Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element. + // Skip this element if it is not a ContextTag, not consider it as an error if other values are valid. + if (!TLV::IsContextTag(aDataTlv.GetTag())) + { + continue; + } + currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag()); + if (currentDecodeTagId < 5) + { + if (argExists[currentDecodeTagId]) + { + ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag())); + TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT; + break; + } + else + { + argExists[currentDecodeTagId] = true; + validArgumentCount++; + } + } + switch (currentDecodeTagId) + { + case 0: + TLVUnpackError = aDataTlv.Get(yearDayIndex); + break; + case 1: + TLVUnpackError = aDataTlv.Get(userIndex); + break; + case 2: + TLVUnpackError = aDataTlv.Get(status); + break; + case 3: + TLVUnpackError = aDataTlv.Get(localStartTime); + break; + case 4: + TLVUnpackError = aDataTlv.Get(localEndTime); + break; + default: + // Unsupported tag, ignore it. + ChipLogProgress(Zcl, "Unknown TLV tag during processing."); + break; + } + if (CHIP_NO_ERROR != TLVUnpackError) + { + break; + } + } + + if (CHIP_END_OF_TLV == TLVError) + { + // CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error. + TLVError = CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount) + { + wasHandled = emberAfDoorLockClusterGetYearDayScheduleResponseCallback( + aCommandPath.mEndpointId, apCommandObj, yearDayIndex, userIndex, status, localStartTime, localEndTime); + } + break; + } case Commands::SetCredentialResponse::Id: { expectArgumentCount = 3; uint8_t status; diff --git a/zzz_generated/door-lock-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/door-lock-app/zap-generated/IMClusterCommandHandler.cpp index b462f579d6ad17..fa73792c9ed6f7 100644 --- a/zzz_generated/door-lock-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/door-lock-app/zap-generated/IMClusterCommandHandler.cpp @@ -175,6 +175,24 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::ClearWeekDaySchedule::Id: { + Commands::ClearWeekDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterClearWeekDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::ClearYearDaySchedule::Id: { + Commands::ClearYearDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterClearYearDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } case Commands::GetCredentialStatus::Id: { Commands::GetCredentialStatus::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); @@ -193,6 +211,24 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::GetWeekDaySchedule::Id: { + Commands::GetWeekDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterGetWeekDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GetYearDaySchedule::Id: { + Commands::GetYearDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterGetYearDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } case Commands::LockDoor::Id: { Commands::LockDoor::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); @@ -220,6 +256,24 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::SetWeekDaySchedule::Id: { + Commands::SetWeekDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterSetWeekDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::SetYearDaySchedule::Id: { + Commands::SetYearDaySchedule::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfDoorLockClusterSetYearDayScheduleCallback(apCommandObj, aCommandPath, commandData); + } + break; + } case Commands::UnlockDoor::Id: { Commands::UnlockDoor::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); diff --git a/zzz_generated/door-lock-app/zap-generated/endpoint_config.h b/zzz_generated/door-lock-app/zap-generated/endpoint_config.h index aa8a4f77838610..f91030ee5d0ec9 100644 --- a/zzz_generated/door-lock-app/zap-generated/endpoint_config.h +++ b/zzz_generated/door-lock-app/zap-generated/endpoint_config.h @@ -300,7 +300,7 @@ 0x00, 0x00, 0x00, 0x60, \ \ /* 648 - FeatureMap, */ \ - 0x00, 0x00, 0x01, 0x03, \ + 0x00, 0x00, 0x01, 0x13, \ } #else // !BIGENDIAN_CPU @@ -580,7 +580,7 @@ 0x60, 0x00, 0x00, 0x00, \ \ /* 648 - FeatureMap, */ \ - 0x03, 0x01, 0x00, 0x00, \ + 0x13, 0x01, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU @@ -624,7 +624,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 214 +#define GENERATED_ATTRIBUTE_COUNT 216 #define GENERATED_ATTRIBUTES \ { \ \ @@ -897,6 +897,8 @@ { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfTotalUsersSupported */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfPINUsersSupported */ \ { 0x00000013, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfRFIDUsersSupported */ \ + { 0x00000014, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfWeekDaySchedulesSupportedPerUser */ \ + { 0x00000015, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfYearDaySchedulesSupportedPerUser */ \ { 0x00000017, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(8) }, /* MaxPINCodeLength */ \ { 0x00000018, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(6) }, /* MinPINCodeLength */ \ { 0x00000019, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(20) }, /* MaxRFIDCodeLength */ \ @@ -1017,8 +1019,8 @@ }, /* Endpoint: 1, Cluster: Power Source (server) */ \ { 0x00000101, \ ZAP_ATTRIBUTE_INDEX(191), \ - 23, \ - 37, \ + 25, \ + 39, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -1029,7 +1031,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 18, 905 }, { ZAP_CLUSTER_INDEX(18), 3, 170 }, \ + { ZAP_CLUSTER_INDEX(0), 18, 905 }, { ZAP_CLUSTER_INDEX(18), 3, 172 }, \ } // Largest attribute size is needed for various buffers @@ -1039,7 +1041,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (39) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (1075) +#define ATTRIBUTE_MAX_SIZE (1077) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 4b391bae798687..47597009559921 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -1249,9 +1249,9 @@ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* OpenPeriod */ \ { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfTotalUsersSupported */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfPINUsersSupported */ \ - { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfWeekDaySchedulesSupportedPerUser */ \ - { 0x00000015, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfYearDaySchedulesSupportedPerUser */ \ - { 0x00000016, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfHolidaySchedulesSupported */ \ + { 0x00000014, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfWeekDaySchedulesSupportedPerUser */ \ + { 0x00000015, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfYearDaySchedulesSupportedPerUser */ \ + { 0x00000016, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* NumberOfHolidaySchedulesSupported */ \ { 0x00000017, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(6) }, /* MaxPINCodeLength */ \ { 0x00000018, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(6) }, /* MinPINCodeLength */ \ { 0x0000001B, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* CredentialRulesSupport */ \ @@ -1687,7 +1687,7 @@ { 0x00000101, \ ZAP_ATTRIBUTE_INDEX(243), \ 28, \ - 49, \ + 46, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -1786,7 +1786,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 1359 }, { ZAP_CLUSTER_INDEX(21), 33, 2480 }, { ZAP_CLUSTER_INDEX(54), 3, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 1359 }, { ZAP_CLUSTER_INDEX(21), 33, 2477 }, { ZAP_CLUSTER_INDEX(54), 3, 8 }, \ } // Largest attribute size is needed for various buffers @@ -1796,7 +1796,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (75) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3847) +#define ATTRIBUTE_MAX_SIZE (3844) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3)