From 316279307f41fbcf5a24d4bd2806587970926b18 Mon Sep 17 00:00:00 2001 From: Bharat Raju Date: Fri, 31 Mar 2023 12:44:02 -0400 Subject: [PATCH] Deprecating Stateful Helpers (#25883) * Replacing chip_client_clusters, chip_cluster_commands, chip_cluster_responses and chip_cluster_command_arguments with all_user_clusters, zcl_commands, zcl_command_responses and zcl_command_arguments respectively in templates - Updating minimum zap vesion - Github: ZAP#971 * Using all_user_cluster_generated_commands instead of zcl_commands Github: ZAP#971 * updating minimum version of zap Github: ZAP#971 --- .../docker/images/chip-cert-bins/Dockerfile | 2 +- scripts/setup/zap.json | 2 +- scripts/tools/zap/zap_execution.py | 2 +- .../CHIPAttributeTLVValueDecoder-src.zapt | 4 +- .../java/templates/CHIPClustersWrite-JNI.zapt | 4 +- .../CHIPEventTLVValueDecoder-src.zapt | 4 +- .../java/templates/CHIPReadCallbacks-src.zapt | 4 +- .../java/templates/ChipClusters-java.zapt | 40 ++++++++----- .../java/templates/ChipEventStructs-java.zapt | 4 +- .../java/templates/ChipIdLookup-java.zapt | 12 ++-- .../java/templates/ChipStructs-java.zapt | 4 +- .../java/templates/ClusterInfo-java.zapt | 60 +++++++++++-------- .../devicecontroller/ClusterInfoMapping.java | 10 ++-- .../templates/python-CHIPClusters-py.zapt | 38 +++++++----- 14 files changed, 110 insertions(+), 80 deletions(-) diff --git a/integrations/docker/images/chip-cert-bins/Dockerfile b/integrations/docker/images/chip-cert-bins/Dockerfile index 94a650d139ae0b..cc3090b4c71547 100644 --- a/integrations/docker/images/chip-cert-bins/Dockerfile +++ b/integrations/docker/images/chip-cert-bins/Dockerfile @@ -7,7 +7,7 @@ ARG COMMITHASH=7b99e6399c6069037c613782d78132c69b9dcabb # ZAP Development install, so that it runs on both x64 and arm64 # Generally this should match with the ZAP version that is used for codegen within the # specified SHA -ARG ZAP_VERSION=v2023.03.27-nightly +ARG ZAP_VERSION=v2023.03.30-nightly # Ensure TARGETPLATFORM is set RUN case ${TARGETPLATFORM} in \ diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index c27c39a1674dae..a9a13342a3b79b 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,7 +8,7 @@ "mac-arm64", "windows-amd64" ], - "tags": ["version:2@v2023.03.27-nightly.1"] + "tags": ["version:2@v2023.03.30-nightly.1"] } ] } diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 6e5fbab32fe7e2..4beb061e32fc3f 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2023.3.27' +MIN_ZAP_VERSION = '2023.3.30' class ZapTool: diff --git a/src/controller/java/templates/CHIPAttributeTLVValueDecoder-src.zapt b/src/controller/java/templates/CHIPAttributeTLVValueDecoder-src.zapt index ce559b045f635e..ce42d5d1140680 100644 --- a/src/controller/java/templates/CHIPAttributeTLVValueDecoder-src.zapt +++ b/src/controller/java/templates/CHIPAttributeTLVValueDecoder-src.zapt @@ -37,7 +37,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR switch (aPath.mClusterId) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} case app::Clusters::{{asUpperCamelCase name}}::Id: { using namespace app::Clusters::{{asUpperCamelCase name}}; switch (aPath.mAttributeId) @@ -61,7 +61,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } - {{/chip_client_clusters}} + {{/all_user_clusters}} default: *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; break; diff --git a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt index 8a149383d50801..242f8c1b19fdba 100644 --- a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt +++ b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt @@ -29,7 +29,7 @@ using namespace chip; using namespace chip::Controller; -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} {{#zcl_attributes_server removeKeys='isOptional'}} {{#if_unsupported_attribute_callback type isArray ../id}} {{else}} @@ -77,7 +77,7 @@ JNI_METHOD(void, {{asUpperCamelCase ../name}}Cluster, write{{asUpperCamelCase na {{/if}} {{/if_unsupported_attribute_callback}} {{/zcl_attributes_server}} -{{/chip_client_clusters}} +{{/all_user_clusters}} {{/if}} #pragma clang diagnostic pop diff --git a/src/controller/java/templates/CHIPEventTLVValueDecoder-src.zapt b/src/controller/java/templates/CHIPEventTLVValueDecoder-src.zapt index 7f4936670cdb1d..58554412612858 100644 --- a/src/controller/java/templates/CHIPEventTLVValueDecoder-src.zapt +++ b/src/controller/java/templates/CHIPEventTLVValueDecoder-src.zapt @@ -37,7 +37,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & switch (aPath.mClusterId) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} case app::Clusters::{{asUpperCamelCase name}}::Id: { using namespace app::Clusters::{{asUpperCamelCase name}}; switch (aPath.mEventId) @@ -82,7 +82,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } - {{/chip_client_clusters}} + {{/all_user_clusters}} default: *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; diff --git a/src/controller/java/templates/CHIPReadCallbacks-src.zapt b/src/controller/java/templates/CHIPReadCallbacks-src.zapt index 2d1b9deb520827..a1fa202bf96e54 100644 --- a/src/controller/java/templates/CHIPReadCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPReadCallbacks-src.zapt @@ -85,7 +85,7 @@ void CHIP{{chipCallback.name}}AttributeCallback::CallbackFn(void * context, {{ch {{/unless}} {{/chip_server_global_responses}} -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} {{#zcl_attributes_server removeKeys='isOptional'}} {{! TODO: Add support for struct-typed attributes }} {{#if_unsupported_attribute_callback type isArray ../id}} @@ -173,6 +173,6 @@ void CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallb {{/if}} {{/if_unsupported_attribute_callback}} {{/zcl_attributes_server}} -{{/chip_client_clusters}} +{{/all_user_clusters}} {{/if}} diff --git a/src/controller/java/templates/ChipClusters-java.zapt b/src/controller/java/templates/ChipClusters-java.zapt index 6737840347b615..655b547864a4af 100644 --- a/src/controller/java/templates/ChipClusters-java.zapt +++ b/src/controller/java/templates/ChipClusters-java.zapt @@ -102,7 +102,7 @@ public class ChipClusters { } } - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} public static class {{asUpperCamelCase name}}Cluster extends BaseChipCluster { public static final long CLUSTER_ID = {{code}}L; @@ -112,34 +112,46 @@ public class ChipClusters { @Override public native long initWithDevice(long devicePtr, int endpointId); - {{#chip_cluster_commands}} + {{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'client')}} {{#unless mustUseTimedInvoke}} public void {{asLowerCamelCase name}}({{#if hasSpecificResponse}}{{asUpperCamelCase responseName}}Callback{{else}}DefaultClusterCallback{{/if}} callback - {{#chip_cluster_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true}} {{asLowerCamelCase label}}{{/chip_cluster_command_arguments}}) { - {{asLowerCamelCase name}}(chipClusterPtr, callback{{#chip_cluster_command_arguments}}, {{asLowerCamelCase label}}{{/chip_cluster_command_arguments}}, null); + {{#zcl_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}}) { + {{asLowerCamelCase name}}(chipClusterPtr, callback{{#zcl_command_arguments}}, {{asLowerCamelCase label}}{{/zcl_command_arguments}}, null); } {{/unless}} public void {{asLowerCamelCase name}}({{#if hasSpecificResponse}}{{asUpperCamelCase responseName}}Callback{{else}}DefaultClusterCallback{{/if}} callback - {{#chip_cluster_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true}} {{asLowerCamelCase label}}{{/chip_cluster_command_arguments}} + {{#zcl_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}} , int timedInvokeTimeoutMs) { - {{asLowerCamelCase name}}(chipClusterPtr, callback{{#chip_cluster_command_arguments}}, {{asLowerCamelCase label}}{{/chip_cluster_command_arguments}}, timedInvokeTimeoutMs); + {{asLowerCamelCase name}}(chipClusterPtr, callback{{#zcl_command_arguments}}, {{asLowerCamelCase label}}{{/zcl_command_arguments}}, timedInvokeTimeoutMs); } - {{/chip_cluster_commands}} - {{#chip_cluster_commands}} + {{/if}} + {{/if_compare}} + {{/all_user_cluster_generated_commands}} + {{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'client')}} private native void {{asLowerCamelCase name}}(long chipClusterPtr, {{#if hasSpecificResponse}}{{asUpperCamelCase responseName}}Callback{{else}}DefaultClusterCallback{{/if}} Callback - {{#chip_cluster_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true}} {{asLowerCamelCase label}}{{/chip_cluster_command_arguments}} + {{#zcl_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}} , @Nullable Integer timedInvokeTimeoutMs); - {{/chip_cluster_commands}} - {{#chip_cluster_responses}} + {{/if}} + {{/if_compare}} + {{/all_user_cluster_generated_commands}} + {{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'server')}} public interface {{asUpperCamelCase name}}Callback { - void onSuccess({{#chip_cluster_response_arguments}}{{#not_first}}, {{/not_first}}{{asJavaType type chipType parent.parent.name includeAnnotations=true}} {{asLowerCamelCase label}}{{/chip_cluster_response_arguments}}); + void onSuccess({{#zcl_command_arguments}}{{#not_first}}, {{/not_first}}{{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}}); void onError(Exception error); } - {{/chip_cluster_responses}} + {{/if}} + {{/if_compare}} + {{/all_user_cluster_generated_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} {{#if_unsupported_attribute_callback type isArray ../id}} @@ -233,6 +245,6 @@ public class ChipClusters { {{#not_last}} {{/not_last}} - {{/chip_client_clusters}} + {{/all_user_clusters}} } {{/if}} diff --git a/src/controller/java/templates/ChipEventStructs-java.zapt b/src/controller/java/templates/ChipEventStructs-java.zapt index 90b82b818a3ce1..4737bd19b2648b 100644 --- a/src/controller/java/templates/ChipEventStructs-java.zapt +++ b/src/controller/java/templates/ChipEventStructs-java.zapt @@ -11,7 +11,7 @@ import java.util.Optional; {{! TODO: Use AutoValue for inner classes. }} public class ChipEventStructs { {{#if (chip_has_client_clusters)}} -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} {{#zcl_events}} public static class {{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event { {{#zcl_event_fields}} @@ -54,6 +54,6 @@ public {{asJavaType type null parent.parent.name includeAnnotations=true}} {{asL } {{/zcl_events}} -{{/chip_client_clusters}} +{{/all_user_clusters}} {{/if}} } \ No newline at end of file diff --git a/src/controller/java/templates/ChipIdLookup-java.zapt b/src/controller/java/templates/ChipIdLookup-java.zapt index bfcb2c84c7c342..18bea3b747cb37 100644 --- a/src/controller/java/templates/ChipIdLookup-java.zapt +++ b/src/controller/java/templates/ChipIdLookup-java.zapt @@ -9,11 +9,11 @@ public final class ChipIdLookup { * ID is found, returns an empty string. */ public static String clusterIdToName(long clusterId) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} if (clusterId == {{code}}L) { return "{{asUpperCamelCase name}}"; } - {{/chip_client_clusters}} + {{/all_user_clusters}} return ""; } @@ -22,7 +22,7 @@ public final class ChipIdLookup { * If no matching IDs are found, returns an empty string. */ public static String attributeIdToName(long clusterId, long attributeId) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} if (clusterId == {{code}}L) { {{#zcl_attributes_server}} if (attributeId == {{code}}L) { @@ -31,7 +31,7 @@ public final class ChipIdLookup { {{/zcl_attributes_server}} return ""; } - {{/chip_client_clusters}} + {{/all_user_clusters}} return ""; } @@ -40,7 +40,7 @@ public final class ChipIdLookup { * If no matching IDs are found, returns an empty string. */ public static String eventIdToName(long clusterId, long eventId) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} if (clusterId == {{code}}L) { {{#chip_server_cluster_events}} if (eventId == {{code}}L) { @@ -49,7 +49,7 @@ public final class ChipIdLookup { {{/chip_server_cluster_events}} return ""; } - {{/chip_client_clusters}} + {{/all_user_clusters}} return ""; } } diff --git a/src/controller/java/templates/ChipStructs-java.zapt b/src/controller/java/templates/ChipStructs-java.zapt index 12ce7baf3a3a72..19771c7bdd2bad 100644 --- a/src/controller/java/templates/ChipStructs-java.zapt +++ b/src/controller/java/templates/ChipStructs-java.zapt @@ -11,7 +11,7 @@ import java.util.Optional; {{! TODO: Use AutoValue for inner classes. }} public class ChipStructs { {{#if (chip_has_client_clusters)}} -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} {{#zcl_structs}} {{#if itemCnt}} public static class {{asUpperCamelCase parent.name}}Cluster{{asUnderlyingType name}} { @@ -52,6 +52,6 @@ public {{asJavaType type null parent.parent.name includeAnnotations=true}} {{asL {{/if}} {{/zcl_structs}} -{{/chip_client_clusters}} +{{/all_user_clusters}} {{/if}} } \ No newline at end of file diff --git a/src/controller/java/templates/ClusterInfo-java.zapt b/src/controller/java/templates/ClusterInfo-java.zapt index 1c18a3923438ca..63cf5cbfba106e 100644 --- a/src/controller/java/templates/ClusterInfo-java.zapt +++ b/src/controller/java/templates/ClusterInfo-java.zapt @@ -199,8 +199,10 @@ public class ClusterInfoMapping { callback.onFailure(e); } } - {{#chip_client_clusters}} - {{#chip_cluster_responses}} + {{#all_user_clusters side='client'}} + {{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'server')}} public static class Delegated{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Callback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}Callback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -209,9 +211,9 @@ public class ClusterInfoMapping { } @Override - public void onSuccess({{#chip_cluster_response_arguments}}{{#not_first}}, {{/not_first}}{{asJavaType type chipType parent.parent.name includeAnnotations=true}} {{asSymbol label}}{{/chip_cluster_response_arguments}}) { + public void onSuccess({{#zcl_command_arguments}}{{#not_first}}, {{/not_first}}{{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asSymbol label}}{{/zcl_command_arguments}}) { Map responseValues = new LinkedHashMap<>(); - {{#chip_cluster_response_arguments}} + {{#zcl_command_arguments}} {{#if isArray}} // {{asSymbol label}}: {{asUnderlyingZclType type}} // Conversion from this type to Java is not properly implemented yet @@ -220,11 +222,11 @@ public class ClusterInfoMapping { // {{asSymbol label}}: Struct {{type}} // Conversion from this type to Java is not properly implemented yet {{else}} - CommandResponseInfo {{asSymbol label}}ResponseValue = new CommandResponseInfo("{{asSymbol label}}", "{{asJavaType type null parent.parent.name}}"); + CommandResponseInfo {{asSymbol label}}ResponseValue = new CommandResponseInfo("{{asSymbol label}}", "{{asJavaType type null parent.parent.name clusterId=parent.parent.id}}"); responseValues.put({{asSymbol label}}ResponseValue, {{asSymbol label}}); {{/if_is_struct}} {{/if}} - {{/chip_cluster_response_arguments}} + {{/zcl_command_arguments}} callback.onSuccess(responseValues); } @@ -234,7 +236,9 @@ public class ClusterInfoMapping { } } - {{/chip_cluster_responses}} + {{/if}} + {{/if_compare}} + {{/all_user_cluster_generated_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} {{#if_unsupported_attribute_callback type isArray ../id}} {{else}} @@ -275,7 +279,7 @@ public class ClusterInfoMapping { {{/if_unsupported_attribute_callback}} {{/zcl_attributes_server}} - {{/chip_client_clusters}} + {{/all_user_clusters}} public Map getClusterMap() { Map clusterMap = initializeClusterMap(); @@ -290,37 +294,39 @@ public class ClusterInfoMapping { public Map initializeClusterMap() { Map clusterMap = new HashMap<>(); - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} ClusterInfo {{asLowerCamelCase name}}ClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.{{asUpperCamelCase name}}Cluster(ptr, endpointId), new HashMap<>()); clusterMap.put("{{asLowerCamelCase name}}", {{asLowerCamelCase name}}ClusterInfo); - {{/chip_client_clusters}} + {{/all_user_clusters}} return clusterMap; } public void combineCommand(Map destination, Map> source) { - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} destination.get("{{asLowerCamelCase name}}").combineCommands(source.get("{{asLowerCamelCase name}}")); - {{/chip_client_clusters}} + {{/all_user_clusters}} } @SuppressWarnings("unchecked") public Map> getCommandMap() { Map> commandMap = new HashMap<>(); - {{#chip_client_clusters}} + {{#all_user_clusters side='client'}} Map {{asLowerCamelCase name}}ClusterInteractionInfoMap = new LinkedHashMap<>(); - {{#chip_cluster_commands}} + {{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'client')}} Map {{asLowerCamelCase ../name}}{{asLowerCamelCase name}}CommandParams = new LinkedHashMap(); {{! TODO: fill out parameter types }} - {{#if (zcl_command_arguments_count this.id)}} - {{#chip_cluster_command_arguments}} + {{#if hasArguments}} + {{#zcl_command_arguments}} {{#if_is_struct type}} {{else}} - CommandParameterInfo {{asLowerCamelCase ../../name}}{{asLowerCamelCase ../name}}{{asLowerCamelCase label}}CommandParameterInfo = new CommandParameterInfo("{{asLowerCamelCase label}}", {{asJavaType type null parent.parent.name removeGenericType=true}}.class, {{asJavaType type null parent.parent.name underlyingType=true}}.class); + CommandParameterInfo {{asLowerCamelCase ../../name}}{{asLowerCamelCase ../name}}{{asLowerCamelCase label}}CommandParameterInfo = new CommandParameterInfo("{{asLowerCamelCase label}}", {{asJavaType type null parent.parent.name removeGenericType=true clusterId=parent.parent.id}}.class, {{asJavaType type null parent.parent.name underlyingType=true clusterId=parent.parent.id}}.class); {{asLowerCamelCase ../../name}}{{asLowerCamelCase ../name}}CommandParams.put("{{asLowerCamelCase label}}",{{asLowerCamelCase ../../name}}{{asLowerCamelCase ../name}}{{asLowerCamelCase label}}CommandParameterInfo); {{#not_last}} {{/not_last}} {{/if_is_struct}} - {{/chip_cluster_command_arguments}} + {{/zcl_command_arguments}} {{else}} {{/if}} {{#if hasSpecificResponse}} @@ -328,10 +334,10 @@ public class ClusterInfoMapping { (cluster, callback, commandArguments) -> { ((ChipClusters.{{asUpperCamelCase ../name}}Cluster) cluster) .{{asLowerCamelCase name}}((ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase responseName}}Callback) callback - {{#chip_cluster_command_arguments}} - , ({{asJavaType type chipType parent.parent.name}}) + {{#zcl_command_arguments}} + , ({{asJavaType type chipType parent.parent.name clusterId=parent.parent.id}}) commandArguments.get("{{asLowerCamelCase label}}") - {{/chip_cluster_command_arguments}} + {{/zcl_command_arguments}} {{! TODO: Allow timeout to be passed from client for this and timed write. }} {{#if mustUseTimedInvoke}}, 10000{{/if}} ); @@ -344,10 +350,10 @@ public class ClusterInfoMapping { (cluster, callback, commandArguments) -> { ((ChipClusters.{{asUpperCamelCase ../name}}Cluster) cluster) .{{asLowerCamelCase name}}((DefaultClusterCallback) callback - {{#chip_cluster_command_arguments}} - , ({{asJavaType type chipType parent.parent.name}}) + {{#zcl_command_arguments}} + , ({{asJavaType type chipType parent.parent.name clusterId=parent.parent.id}}) commandArguments.get("{{asLowerCamelCase label}}") - {{/chip_cluster_command_arguments}} + {{/zcl_command_arguments}} {{! TODO: Allow timeout to be passed from client for this and timed write. }} {{#if mustUseTimedInvoke}}, 10000{{/if}} ); @@ -357,9 +363,11 @@ public class ClusterInfoMapping { ); {{/if}} {{asLowerCamelCase ../name}}ClusterInteractionInfoMap.put("{{asLowerCamelCase name}}", {{asLowerCamelCase ../name}}{{asLowerCamelCase name}}InteractionInfo); - {{/chip_cluster_commands}} + {{/if}} + {{/if_compare}} + {{/all_user_cluster_generated_commands}} commandMap.put("{{asLowerCamelCase name}}", {{asLowerCamelCase name}}ClusterInteractionInfoMap); - {{/chip_client_clusters}} + {{/all_user_clusters}} return commandMap; } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index e532a920d45eaa..68c919e25bb999 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -13780,7 +13780,7 @@ public Map> getCommandMap() { Map groupsgetGroupMembershipCommandParams = new LinkedHashMap(); CommandParameterInfo groupsgetGroupMembershipgroupListCommandParameterInfo = - new CommandParameterInfo("groupList", ArrayList.class, Object.class); + new CommandParameterInfo("groupList", ArrayList.class, Integer.class); groupsgetGroupMembershipCommandParams.put( "groupList", groupsgetGroupMembershipgroupListCommandParameterInfo); @@ -14746,7 +14746,7 @@ public Map> getCommandMap() { "softwareVersion", otaSoftwareUpdateProviderqueryImagesoftwareVersionCommandParameterInfo); CommandParameterInfo otaSoftwareUpdateProviderqueryImageprotocolsSupportedCommandParameterInfo = - new CommandParameterInfo("protocolsSupported", ArrayList.class, Object.class); + new CommandParameterInfo("protocolsSupported", ArrayList.class, Integer.class); otaSoftwareUpdateProviderqueryImageCommandParams.put( "protocolsSupported", otaSoftwareUpdateProviderqueryImageprotocolsSupportedCommandParameterInfo); @@ -15653,7 +15653,7 @@ public Map> getCommandMap() { Map groupKeyManagementkeySetReadAllIndicesCommandParams = new LinkedHashMap(); CommandParameterInfo groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo = - new CommandParameterInfo("groupKeySetIDs", ArrayList.class, Object.class); + new CommandParameterInfo("groupKeySetIDs", ArrayList.class, Integer.class); groupKeyManagementkeySetReadAllIndicesCommandParams.put( "groupKeySetIDs", groupKeyManagementkeySetReadAllIndicesgroupKeySetIDsCommandParameterInfo); @@ -17993,7 +17993,7 @@ public Map> getCommandMap() { Map unitTestingtestListInt8UArgumentRequestCommandParams = new LinkedHashMap(); CommandParameterInfo unitTestingtestListInt8UArgumentRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", ArrayList.class, Object.class); + new CommandParameterInfo("arg1", ArrayList.class, Integer.class); unitTestingtestListInt8UArgumentRequestCommandParams.put( "arg1", unitTestingtestListInt8UArgumentRequestarg1CommandParameterInfo); @@ -18045,7 +18045,7 @@ public Map> getCommandMap() { Map unitTestingtestListInt8UReverseRequestCommandParams = new LinkedHashMap(); CommandParameterInfo unitTestingtestListInt8UReverseRequestarg1CommandParameterInfo = - new CommandParameterInfo("arg1", ArrayList.class, Object.class); + new CommandParameterInfo("arg1", ArrayList.class, Integer.class); unitTestingtestListInt8UReverseRequestCommandParams.put( "arg1", unitTestingtestListInt8UReverseRequestarg1CommandParameterInfo); diff --git a/src/controller/python/templates/python-CHIPClusters-py.zapt b/src/controller/python/templates/python-CHIPClusters-py.zapt index d7bc40131654cb..4b1443e7211de4 100644 --- a/src/controller/python/templates/python-CHIPClusters-py.zapt +++ b/src/controller/python/templates/python-CHIPClusters-py.zapt @@ -13,22 +13,32 @@ class ChipClusters: SUCCESS_DELEGATE = ctypes.CFUNCTYPE(None) FAILURE_DELEGATE = ctypes.CFUNCTYPE(None, ctypes.c_uint8) -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} _{{asDelimitedMacro name}}_CLUSTER_INFO = { "clusterName": "{{asUpperCamelCase name}}", "clusterId": {{asHex code 8}}, "commands": { -{{#chip_cluster_commands}} - {{asHex code 8}}: { - "commandId": {{asHex code 8}}, - "commandName": "{{asUpperCamelCase name}}", +{{#all_user_cluster_generated_commands}} + {{#if_compare clusterId ../id operator='=='}} + {{#if (is_str_equal commandSource 'client')}} + {{asHex commandCode 8}}: { + "commandId": {{asHex commandCode 8}}, + "commandName": "{{asUpperCamelCase commandName}}", "args": { -{{#chip_cluster_command_arguments_with_structs_expanded}} - "{{asLowerCamelCase label}}": "{{#if (isCharString type)}}str{{else}}{{asPythonType chipType}}{{/if}}", -{{/chip_cluster_command_arguments_with_structs_expanded}} +{{#zcl_command_arguments}} + {{#if_is_struct type}} + {{#zcl_struct_items_by_struct_name type}} + "{{asLowerCamelCase label}}": "{{#if (isCharString type)}}str{{else}}{{as_underlying_python_zcl_type type ../../id}}{{/if}}", + {{/zcl_struct_items_by_struct_name}} + {{else}} + "{{asLowerCamelCase label}}": "{{#if (isCharString type)}}str{{else}}{{as_underlying_python_zcl_type type ../id}}{{/if}}", + {{/if_is_struct}} +{{/zcl_command_arguments}} }, }, -{{/chip_cluster_commands}} + {{/if}} + {{/if_compare}} +{{/all_user_cluster_generated_commands}} }, "attributes": { {{#zcl_attributes_server removeKeys='isOptional'}} @@ -46,18 +56,18 @@ class ChipClusters: {{/zcl_attributes_server}} }, } -{{/chip_client_clusters}} +{{/all_user_clusters}} _CLUSTER_ID_DICT = { -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} {{asHex code 8}}: _{{asDelimitedMacro name}}_CLUSTER_INFO, -{{/chip_client_clusters}} +{{/all_user_clusters}} } _CLUSTER_NAME_DICT = { -{{#chip_client_clusters}} +{{#all_user_clusters side='client'}} "{{asUpperCamelCase name}}": _{{asDelimitedMacro name}}_CLUSTER_INFO, -{{/chip_client_clusters}} +{{/all_user_clusters}} } def __init__(self, chipstack):