From b48deb65661a71212abf605db8258ea0990c6a60 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Wed, 6 Apr 2022 17:29:05 -0700 Subject: [PATCH] Add missing clusters and attributes controller (#17065) * Add missing controller cluster commands * Generated code --- .../data_model/controller-clusters.matter | 31 +++++ .../data_model/controller-clusters.zap | 22 +++- .../java/zap-generated/CHIPCallbackTypes.h | 2 + .../zap-generated/CHIPInvokeCallbacks.cpp | 112 ++++++++++++++++ .../java/zap-generated/CHIPInvokeCallbacks.h | 15 +++ .../chip/devicecontroller/ChipClusters.java | 86 ++++++++++++ .../devicecontroller/ClusterInfoMapping.java | 116 +++++++++++++++++ .../python/chip/clusters/CHIPClusters.py | 24 ++++ .../CHIP/zap-generated/CHIPCallbackBridge.mm | 34 +++++ .../CHIPCallbackBridge_internal.h | 15 +++ .../CHIP/zap-generated/CHIPClustersObjc.h | 7 + .../CHIP/zap-generated/CHIPClustersObjc.mm | 58 +++++++++ .../zap-generated/cluster/Commands.h | 122 ++++++++++++++++++ 13 files changed, 641 insertions(+), 3 deletions(-) diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index b8093d21824ad9..5cf9a656b611c7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -1513,6 +1513,21 @@ client cluster DoorLock = 257 { INT16U userIndex = 1; } + request struct SetHolidayScheduleRequest { + INT8U holidayIndex = 0; + epoch_s localStartTime = 1; + epoch_s localEndTime = 2; + DlOperatingMode operatingMode = 3; + } + + request struct GetHolidayScheduleRequest { + INT8U holidayIndex = 0; + } + + request struct ClearHolidayScheduleRequest { + INT8U holidayIndex = 0; + } + request struct SetUserRequest { DlDataOperationType operationType = 0; INT16U userIndex = 1; @@ -1567,6 +1582,19 @@ client cluster DoorLock = 257 { optional epoch_s localEndTime = 4; } + response struct GetHolidayScheduleResponse { + INT8U holidayIndex = 0; + DlStatus status = 1; + optional epoch_s localStartTime = 2; + optional epoch_s localEndTime = 3; + optional DlOperatingMode operatingMode = 4; + } + + response struct GetUserTypeResponse { + INT16U userId = 0; + DlUserType userType = 1; + } + response struct GetUserResponse { INT16U userIndex = 0; nullable CHAR_STRING userName = 1; @@ -1601,6 +1629,9 @@ client cluster DoorLock = 257 { command SetYearDaySchedule(SetYearDayScheduleRequest): DefaultSuccess = 14; command GetYearDaySchedule(GetYearDayScheduleRequest): GetYearDayScheduleResponse = 15; command ClearYearDaySchedule(ClearYearDayScheduleRequest): DefaultSuccess = 16; + command SetHolidaySchedule(SetHolidayScheduleRequest): DefaultSuccess = 17; + command GetHolidaySchedule(GetHolidayScheduleRequest): GetHolidayScheduleResponse = 18; + command ClearHolidaySchedule(ClearHolidayScheduleRequest): DefaultSuccess = 19; timed command SetUser(SetUserRequest): DefaultSuccess = 26; command GetUser(GetUserRequest): GetUserResponse = 27; timed command ClearUser(ClearUserRequest): DefaultSuccess = 29; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 09cfba1f5bd5bd..d492103ce1b845 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -8826,7 +8826,23 @@ "mfgCode": null, "source": "client", "incoming": 0, - "outgoing": 0 + "outgoing": 1 + }, + { + "name": "GetHolidaySchedule", + "code": 18, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ClearHolidaySchedule", + "code": 19, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 }, { "name": "SetUser", @@ -8963,7 +8979,7 @@ "code": 18, "mfgCode": null, "source": "server", - "incoming": 0, + "incoming": 1, "outgoing": 1 }, { @@ -8971,7 +8987,7 @@ "code": 21, "mfgCode": null, "source": "server", - "incoming": 0, + "incoming": 1, "outgoing": 1 }, { diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index 57a5454c72536a..29b3589d684e3f 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -442,6 +442,8 @@ typedef void (*CHIPDiagnosticLogsClusterAttributeListAttributeCallbackType)( void *, const chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::TypeInfo::DecodableType &); typedef void (*CHIPDoorLockClusterGetCredentialStatusResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetHolidayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetUserResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp index c7eb45828043aa..61111bd89a91be 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp @@ -459,6 +459,118 @@ void CHIPDoorLockClusterGetCredentialStatusResponseCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, credentialExists, userIndex, nextCredentialIndex); } +CHIPDoorLockClusterGetHolidayScheduleResponseCallback::CHIPDoorLockClusterGetHolidayScheduleResponseCallback(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"); + } +} + +CHIPDoorLockClusterGetHolidayScheduleResponseCallback::~CHIPDoorLockClusterGetHolidayScheduleResponseCallback() +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +}; + +void CHIPDoorLockClusterGetHolidayScheduleResponseCallback::CallbackFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::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/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 holidayIndex; + std::string holidayIndexClassName = "java/lang/Integer"; + std::string holidayIndexCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(holidayIndexClassName.c_str(), holidayIndexCtorSignature.c_str(), + dataResponse.holidayIndex, holidayIndex); + 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 + { + jobject localStartTimeInsideOptional; + std::string localStartTimeInsideOptionalClassName = "java/lang/Long"; + std::string localStartTimeInsideOptionalCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + localStartTimeInsideOptionalClassName.c_str(), localStartTimeInsideOptionalCtorSignature.c_str(), + dataResponse.localStartTime.Value(), localStartTimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(localStartTimeInsideOptional, localStartTime); + } + jobject localEndTime; + if (!dataResponse.localEndTime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, localEndTime); + } + else + { + jobject localEndTimeInsideOptional; + std::string localEndTimeInsideOptionalClassName = "java/lang/Long"; + std::string localEndTimeInsideOptionalCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + localEndTimeInsideOptionalClassName.c_str(), localEndTimeInsideOptionalCtorSignature.c_str(), + dataResponse.localEndTime.Value(), localEndTimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(localEndTimeInsideOptional, localEndTime); + } + jobject operatingMode; + if (!dataResponse.operatingMode.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, operatingMode); + } + else + { + jobject operatingModeInsideOptional; + std::string operatingModeInsideOptionalClassName = "java/lang/Integer"; + std::string operatingModeInsideOptionalCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + operatingModeInsideOptionalClassName.c_str(), operatingModeInsideOptionalCtorSignature.c_str(), + static_cast(dataResponse.operatingMode.Value()), operatingModeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(operatingModeInsideOptional, operatingMode); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, holidayIndex, status, localStartTime, localEndTime, operatingMode); +} CHIPDoorLockClusterGetUserResponseCallback::CHIPDoorLockClusterGetUserResponseCallback(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 c068347c3fa1c1..f52a28f0600407 100644 --- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.h +++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.h @@ -114,6 +114,21 @@ class CHIPDoorLockClusterGetCredentialStatusResponseCallback jobject javaCallbackRef; }; +class CHIPDoorLockClusterGetHolidayScheduleResponseCallback + : public Callback::Callback +{ +public: + CHIPDoorLockClusterGetHolidayScheduleResponseCallback(jobject javaCallback); + + ~CHIPDoorLockClusterGetHolidayScheduleResponseCallback(); + + static void CallbackFn(void * context, + const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType & data); + +private: + jobject javaCallbackRef; +}; + class CHIPDoorLockClusterGetUserResponseCallback : public Callback::Callback { public: diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 9ed965a2a9b3a7..3d6d457e50d73f 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -5866,6 +5866,15 @@ public void clearCredential( clearCredential(chipClusterPtr, callback, credential, timedInvokeTimeoutMs); } + public void clearHolidaySchedule(DefaultClusterCallback callback, Integer holidayIndex) { + clearHolidaySchedule(chipClusterPtr, callback, holidayIndex, null); + } + + public void clearHolidaySchedule( + DefaultClusterCallback callback, Integer holidayIndex, int timedInvokeTimeoutMs) { + clearHolidaySchedule(chipClusterPtr, callback, holidayIndex, timedInvokeTimeoutMs); + } + public void clearUser( DefaultClusterCallback callback, Integer userIndex, int timedInvokeTimeoutMs) { clearUser(chipClusterPtr, callback, userIndex, timedInvokeTimeoutMs); @@ -5910,6 +5919,18 @@ public void getCredentialStatus( getCredentialStatus(chipClusterPtr, callback, credential, timedInvokeTimeoutMs); } + public void getHolidaySchedule( + GetHolidayScheduleResponseCallback callback, Integer holidayIndex) { + getHolidaySchedule(chipClusterPtr, callback, holidayIndex, null); + } + + public void getHolidaySchedule( + GetHolidayScheduleResponseCallback callback, + Integer holidayIndex, + int timedInvokeTimeoutMs) { + getHolidaySchedule(chipClusterPtr, callback, holidayIndex, timedInvokeTimeoutMs); + } + public void getUser(GetUserResponseCallback callback, Integer userIndex) { getUser(chipClusterPtr, callback, userIndex, null); } @@ -5971,6 +5992,39 @@ public void setCredential( timedInvokeTimeoutMs); } + public void setHolidaySchedule( + DefaultClusterCallback callback, + Integer holidayIndex, + Long localStartTime, + Long localEndTime, + Integer operatingMode) { + setHolidaySchedule( + chipClusterPtr, + callback, + holidayIndex, + localStartTime, + localEndTime, + operatingMode, + null); + } + + public void setHolidaySchedule( + DefaultClusterCallback callback, + Integer holidayIndex, + Long localStartTime, + Long localEndTime, + Integer operatingMode, + int timedInvokeTimeoutMs) { + setHolidaySchedule( + chipClusterPtr, + callback, + holidayIndex, + localStartTime, + localEndTime, + operatingMode, + timedInvokeTimeoutMs); + } + public void setUser( DefaultClusterCallback callback, Integer operationType, @@ -6085,6 +6139,12 @@ private native void clearCredential( @Nullable ChipStructs.DoorLockClusterDlCredential credential, @Nullable Integer timedInvokeTimeoutMs); + private native void clearHolidaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer holidayIndex, + @Nullable Integer timedInvokeTimeoutMs); + private native void clearUser( long chipClusterPtr, DefaultClusterCallback Callback, @@ -6111,6 +6171,12 @@ private native void getCredentialStatus( ChipStructs.DoorLockClusterDlCredential credential, @Nullable Integer timedInvokeTimeoutMs); + private native void getHolidaySchedule( + long chipClusterPtr, + GetHolidayScheduleResponseCallback Callback, + Integer holidayIndex, + @Nullable Integer timedInvokeTimeoutMs); + private native void getUser( long chipClusterPtr, GetUserResponseCallback Callback, @@ -6148,6 +6214,15 @@ private native void setCredential( @Nullable Integer userType, @Nullable Integer timedInvokeTimeoutMs); + private native void setHolidaySchedule( + long chipClusterPtr, + DefaultClusterCallback Callback, + Integer holidayIndex, + Long localStartTime, + Long localEndTime, + Integer operatingMode, + @Nullable Integer timedInvokeTimeoutMs); + private native void setUser( long chipClusterPtr, DefaultClusterCallback Callback, @@ -6203,6 +6278,17 @@ void onSuccess( void onError(Exception error); } + public interface GetHolidayScheduleResponseCallback { + void onSuccess( + Integer holidayIndex, + Integer status, + Optional localStartTime, + Optional localEndTime, + Optional operatingMode); + + void onError(Exception error); + } + public interface GetUserResponseCallback { void onSuccess( Integer userIndex, diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index 28cefd47a9621b..94b35eae89f654 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -2037,6 +2037,47 @@ public void onError(Exception error) { } } + public static class DelegatedGetHolidayScheduleResponseCallback + implements ChipClusters.DoorLockCluster.GetHolidayScheduleResponseCallback, + DelegatedClusterCallback { + private ClusterCommandCallback callback; + + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess( + Integer holidayIndex, + Integer status, + Optional localStartTime, + Optional localEndTime, + Optional operatingMode) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo holidayIndexResponseValue = + new CommandResponseInfo("holidayIndex", "Integer"); + responseValues.put(holidayIndexResponseValue, holidayIndex); + 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); + CommandResponseInfo operatingModeResponseValue = + new CommandResponseInfo("operatingMode", "Optional"); + responseValues.put(operatingModeResponseValue, operatingMode); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedGetUserResponseCallback implements ChipClusters.DoorLockCluster.GetUserResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @@ -9120,6 +9161,25 @@ public Map> getCommandMap() { doorLockclearCredentialCommandParams); doorLockClusterInteractionInfoMap.put( "clearCredential", doorLockclearCredentialInteractionInfo); + Map doorLockclearHolidayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockclearHolidayScheduleholidayIndexCommandParameterInfo = + new CommandParameterInfo("holidayIndex", Integer.class); + doorLockclearHolidayScheduleCommandParams.put( + "holidayIndex", doorLockclearHolidayScheduleholidayIndexCommandParameterInfo); + + InteractionInfo doorLockclearHolidayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .clearHolidaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("holidayIndex")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLockclearHolidayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "clearHolidaySchedule", doorLockclearHolidayScheduleInteractionInfo); Map doorLockclearUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockclearUseruserIndexCommandParameterInfo = @@ -9202,6 +9262,25 @@ public Map> getCommandMap() { doorLockgetCredentialStatusCommandParams); doorLockClusterInteractionInfoMap.put( "getCredentialStatus", doorLockgetCredentialStatusInteractionInfo); + Map doorLockgetHolidayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLockgetHolidayScheduleholidayIndexCommandParameterInfo = + new CommandParameterInfo("holidayIndex", Integer.class); + doorLockgetHolidayScheduleCommandParams.put( + "holidayIndex", doorLockgetHolidayScheduleholidayIndexCommandParameterInfo); + + InteractionInfo doorLockgetHolidayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .getHolidaySchedule( + (ChipClusters.DoorLockCluster.GetHolidayScheduleResponseCallback) callback, + (Integer) commandArguments.get("holidayIndex")); + }, + () -> new DelegatedGetHolidayScheduleResponseCallback(), + doorLockgetHolidayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "getHolidaySchedule", doorLockgetHolidayScheduleInteractionInfo); Map doorLockgetUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLockgetUseruserIndexCommandParameterInfo = @@ -9331,6 +9410,43 @@ public Map> getCommandMap() { () -> new DelegatedSetCredentialResponseCallback(), doorLocksetCredentialCommandParams); doorLockClusterInteractionInfoMap.put("setCredential", doorLocksetCredentialInteractionInfo); + Map doorLocksetHolidayScheduleCommandParams = + new LinkedHashMap(); + CommandParameterInfo doorLocksetHolidayScheduleholidayIndexCommandParameterInfo = + new CommandParameterInfo("holidayIndex", Integer.class); + doorLocksetHolidayScheduleCommandParams.put( + "holidayIndex", doorLocksetHolidayScheduleholidayIndexCommandParameterInfo); + + CommandParameterInfo doorLocksetHolidaySchedulelocalStartTimeCommandParameterInfo = + new CommandParameterInfo("localStartTime", Long.class); + doorLocksetHolidayScheduleCommandParams.put( + "localStartTime", doorLocksetHolidaySchedulelocalStartTimeCommandParameterInfo); + + CommandParameterInfo doorLocksetHolidaySchedulelocalEndTimeCommandParameterInfo = + new CommandParameterInfo("localEndTime", Long.class); + doorLocksetHolidayScheduleCommandParams.put( + "localEndTime", doorLocksetHolidaySchedulelocalEndTimeCommandParameterInfo); + + CommandParameterInfo doorLocksetHolidayScheduleoperatingModeCommandParameterInfo = + new CommandParameterInfo("operatingMode", Integer.class); + doorLocksetHolidayScheduleCommandParams.put( + "operatingMode", doorLocksetHolidayScheduleoperatingModeCommandParameterInfo); + + InteractionInfo doorLocksetHolidayScheduleInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .setHolidaySchedule( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("holidayIndex"), + (Long) commandArguments.get("localStartTime"), + (Long) commandArguments.get("localEndTime"), + (Integer) commandArguments.get("operatingMode")); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLocksetHolidayScheduleCommandParams); + doorLockClusterInteractionInfoMap.put( + "setHolidaySchedule", doorLocksetHolidayScheduleInteractionInfo); Map doorLocksetUserCommandParams = new LinkedHashMap(); CommandParameterInfo doorLocksetUseroperationTypeCommandParameterInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 633643426eccce..a91bd719b1b3cb 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -1837,6 +1837,13 @@ class ChipClusters: "credentialIndex": "int", }, }, + 0x00000013: { + "commandId": 0x00000013, + "commandName": "ClearHolidaySchedule", + "args": { + "holidayIndex": "int", + }, + }, 0x0000001D: { "commandId": 0x0000001D, "commandName": "ClearUser", @@ -1868,6 +1875,13 @@ class ChipClusters: "credentialIndex": "int", }, }, + 0x00000012: { + "commandId": 0x00000012, + "commandName": "GetHolidaySchedule", + "args": { + "holidayIndex": "int", + }, + }, 0x0000001B: { "commandId": 0x0000001B, "commandName": "GetUser", @@ -1911,6 +1925,16 @@ class ChipClusters: "userType": "int", }, }, + 0x00000011: { + "commandId": 0x00000011, + "commandName": "SetHolidaySchedule", + "args": { + "holidayIndex": "int", + "localStartTime": "int", + "localEndTime": "int", + "operatingMode": "int", + }, + }, 0x0000001A: { "commandId": 0x0000001A, "commandName": "SetUser", diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index ca70319fd0d690..157859d2e3de60 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -10619,6 +10619,40 @@ DispatchSuccess(context, response); }; +void CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge::OnSuccessFn( + void * context, const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType & data) +{ + auto * response = [CHIPDoorLockClusterGetHolidayScheduleResponseParams new]; + { + response.holidayIndex = [NSNumber numberWithUnsignedChar:data.holidayIndex]; + } + { + 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; + } + } + { + if (data.operatingMode.HasValue()) { + response.operatingMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(data.operatingMode.Value())]; + } else { + response.operatingMode = nil; + } + } + DispatchSuccess(context, response); +}; + void CHIPDoorLockClusterGetUserResponseCallbackBridge::OnSuccessFn( void * context, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::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 e1fddc22e9d279..6a8092966b9e36 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -42,6 +42,8 @@ typedef void (*CHIPDiagnosticLogsClusterRetrieveLogsResponseCallbackType)( void *, const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetCredentialStatusResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType &); +typedef void (*CHIPDoorLockClusterGetHolidayScheduleResponseCallbackType)( + void *, const chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetUserResponseCallbackType)( void *, const chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType &); typedef void (*CHIPDoorLockClusterGetWeekDayScheduleResponseCallbackType)( @@ -8228,6 +8230,19 @@ class CHIPDoorLockClusterGetCredentialStatusResponseCallbackBridge const chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType & data); }; +class CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge(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::GetHolidayScheduleResponse::DecodableType & data); +}; + class CHIPDoorLockClusterGetUserResponseCallbackBridge : public CHIPCallbackBridge { public: diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index c2ba47bfd3c5e2..2e3a15217f9480 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -3795,6 +3795,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)clearCredentialWithParams:(CHIPDoorLockClusterClearCredentialParams *)params completionHandler:(StatusCompletion)completionHandler; +- (void)clearHolidayScheduleWithParams:(CHIPDoorLockClusterClearHolidayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)clearUserWithParams:(CHIPDoorLockClusterClearUserParams *)params completionHandler:(StatusCompletion)completionHandler; - (void)clearWeekDayScheduleWithParams:(CHIPDoorLockClusterClearWeekDayScheduleParams *)params completionHandler:(StatusCompletion)completionHandler; @@ -3803,6 +3805,9 @@ NS_ASSUME_NONNULL_BEGIN - (void)getCredentialStatusWithParams:(CHIPDoorLockClusterGetCredentialStatusParams *)params completionHandler:(void (^)(CHIPDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; +- (void)getHolidayScheduleWithParams:(CHIPDoorLockClusterGetHolidayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler; - (void)getUserWithParams:(CHIPDoorLockClusterGetUserParams *)params completionHandler: (void (^)(CHIPDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; @@ -3817,6 +3822,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)setCredentialWithParams:(CHIPDoorLockClusterSetCredentialParams *)params completionHandler:(void (^)(CHIPDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error))completionHandler; +- (void)setHolidayScheduleWithParams:(CHIPDoorLockClusterSetHolidayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler; - (void)setUserWithParams:(CHIPDoorLockClusterSetUserParams *)params completionHandler:(StatusCompletion)completionHandler; - (void)setWeekDayScheduleWithParams:(CHIPDoorLockClusterSetWeekDayScheduleParams *)params completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 664c3305994e58..5089a36557810b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -14195,6 +14195,25 @@ new CHIPCommandSuccessCallbackBridge( }); } +- (void)clearHolidayScheduleWithParams:(CHIPDoorLockClusterClearHolidayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::ClearHolidaySchedule::Type request; + request.holidayIndex = params.holidayIndex.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)clearUserWithParams:(CHIPDoorLockClusterClearUserParams *)params completionHandler:(StatusCompletion)completionHandler { ListFreer listFreer; @@ -14271,6 +14290,22 @@ new CHIPDoorLockClusterGetCredentialStatusResponseCallbackBridge( }); } +- (void)getHolidayScheduleWithParams:(CHIPDoorLockClusterGetHolidayScheduleParams *)params + completionHandler:(void (^)(CHIPDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, + NSError * _Nullable error))completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::GetHolidaySchedule::Type request; + request.holidayIndex = params.holidayIndex.unsignedCharValue; + + new CHIPDoorLockClusterGetHolidayScheduleResponseCallbackBridge( + 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)getUserWithParams:(CHIPDoorLockClusterGetUserParams *)params completionHandler: (void (^)(CHIPDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completionHandler @@ -14384,6 +14419,29 @@ new CHIPDoorLockClusterSetCredentialResponseCallbackBridge( }); } +- (void)setHolidayScheduleWithParams:(CHIPDoorLockClusterSetHolidayScheduleParams *)params + completionHandler:(StatusCompletion)completionHandler +{ + ListFreer listFreer; + DoorLock::Commands::SetHolidaySchedule::Type request; + request.holidayIndex = params.holidayIndex.unsignedCharValue; + request.localStartTime = params.localStartTime.unsignedIntValue; + request.localEndTime = params.localEndTime.unsignedIntValue; + request.operatingMode + = static_cast>(params.operatingMode.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)setUserWithParams:(CHIPDoorLockClusterSetUserParams *)params completionHandler:(StatusCompletion)completionHandler { ListFreer listFreer; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index b78a0a1f5af13b..d01b9f6d9f75b9 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -19442,6 +19442,41 @@ class DoorLockClearCredential : public ModelCommand { mComplex_Credential; }; +/* + * Command ClearHolidaySchedule + */ +class DoorLockClearHolidaySchedule : public ModelCommand { +public: + DoorLockClearHolidaySchedule() + : ModelCommand("clear-holiday-schedule") + { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mHolidayIndex); + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000013) on endpoint %" PRIu16, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block chipError = CHIP_NO_ERROR; + __auto_type * params = [[CHIPDoorLockClusterClearHolidayScheduleParams alloc] init]; + + params.holidayIndex = [NSNumber numberWithUnsignedChar:mHolidayIndex]; + [cluster clearHolidayScheduleWithParams:params + completionHandler:^(NSError * _Nullable error) { + chipError = [CHIPError errorToCHIPErrorCode:error]; + ChipLogProgress(chipTool, "Error: %s", chip::ErrorStr(chipError)); + SetCommandExitStatus(chipError); + }]; + return chipError; + } + +private: + uint8_t mHolidayIndex; +}; + /* * Command ClearUser */ @@ -19597,6 +19632,43 @@ class DoorLockGetCredentialStatus : public ModelCommand { TypedComplexArgument mComplex_Credential; }; +/* + * Command GetHolidaySchedule + */ +class DoorLockGetHolidaySchedule : public ModelCommand { +public: + DoorLockGetHolidaySchedule() + : ModelCommand("get-holiday-schedule") + { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mHolidayIndex); + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000012) on endpoint %" PRIu16, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block chipError = CHIP_NO_ERROR; + __auto_type * params = [[CHIPDoorLockClusterGetHolidayScheduleParams alloc] init]; + + params.holidayIndex = [NSNumber numberWithUnsignedChar:mHolidayIndex]; + [cluster getHolidayScheduleWithParams:params + completionHandler:^( + CHIPDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, NSError * _Nullable error) { + NSLog(@"Values: %@", values); + chipError = [CHIPError errorToCHIPErrorCode:error]; + ChipLogProgress(chipTool, "Error: %s", chip::ErrorStr(chipError)); + SetCommandExitStatus(chipError); + }]; + return chipError; + } + +private: + uint8_t mHolidayIndex; +}; + /* * Command GetUser */ @@ -19812,6 +19884,53 @@ class DoorLockSetCredential : public ModelCommand { uint8_t mUserType; }; +/* + * Command SetHolidaySchedule + */ +class DoorLockSetHolidaySchedule : public ModelCommand { +public: + DoorLockSetHolidaySchedule() + : ModelCommand("set-holiday-schedule") + { + AddArgument("HolidayIndex", 0, UINT8_MAX, &mHolidayIndex); + AddArgument("LocalStartTime", 0, UINT32_MAX, &mLocalStartTime); + AddArgument("LocalEndTime", 0, UINT32_MAX, &mLocalEndTime); + AddArgument("OperatingMode", 0, UINT8_MAX, &mOperatingMode); + ModelCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000101) command (0x00000011) on endpoint %" PRIu16, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block chipError = CHIP_NO_ERROR; + __auto_type * params = [[CHIPDoorLockClusterSetHolidayScheduleParams alloc] init]; + + params.holidayIndex = [NSNumber numberWithUnsignedChar:mHolidayIndex]; + + params.localStartTime = [NSNumber numberWithUnsignedInt:mLocalStartTime]; + + params.localEndTime = [NSNumber numberWithUnsignedInt:mLocalEndTime]; + + params.operatingMode = [NSNumber numberWithUnsignedChar:mOperatingMode]; + [cluster setHolidayScheduleWithParams:params + completionHandler:^(NSError * _Nullable error) { + chipError = [CHIPError errorToCHIPErrorCode:error]; + ChipLogProgress(chipTool, "Error: %s", chip::ErrorStr(chipError)); + SetCommandExitStatus(chipError); + }]; + return chipError; + } + +private: + uint8_t mHolidayIndex; + uint32_t mLocalStartTime; + uint32_t mLocalEndTime; + uint8_t mOperatingMode; +}; + /* * Command SetUser */ @@ -77163,15 +77282,18 @@ void registerClusterDoorLock(Commands & commands) commands_list clusterCommands = { 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(), // make_unique(), //