Skip to content

Commit

Permalink
Use zcl cluster for chip client callbacks (#26952)
Browse files Browse the repository at this point in the history
* Use zcl_clusters instead of all_user_clusters

* zap regen all

* Move CHIPClientCallbacks.zapt into src/controller/java/templates

* Remove one more instance from CHIPClientCallbacks.h

* Remove more referencese to CHIPClientCallbacks.h

* Move file to the right location and regen-all

* update a LOT of paths to the new java-generated path

* Test regen

* Restyled by clang-format

---------

Co-authored-by: Andrei Litvin <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Aug 8, 2023
1 parent a04d23e commit 1077202
Show file tree
Hide file tree
Showing 33 changed files with 1,215 additions and 112 deletions.
2 changes: 0 additions & 2 deletions build/chip/chip_codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ endfunction()
# GENERATOR "app-templates"
# OUTPUTS
# "zap-generated/access.h",
# "zap-generated/CHIPClientCallbacks.h",
# "zap-generated/CHIPClusters.h"
# "zap-generated/endpoint_config.h",
# "zap-generated/gen_config.h",
Expand Down Expand Up @@ -164,7 +163,6 @@ function(chip_zapgen TARGET_NAME)
"${CHIP_ROOT}/src/app/zap-templates/partials/header.zapt"
"${CHIP_ROOT}/src/app/zap-templates/partials/im_command_handler_cluster_commands.zapt"
"${CHIP_ROOT}/src/app/zap-templates/templates/app/access.zapt"
"${CHIP_ROOT}/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt"
"${CHIP_ROOT}/src/app/zap-templates/templates/app/CHIPClusters.zapt"
"${CHIP_ROOT}/src/app/zap-templates/templates/app/endpoint_config.zapt"
"${CHIP_ROOT}/src/app/zap-templates/templates/app/gen_config.zapt"
Expand Down
1 change: 0 additions & 1 deletion build/chip/chip_codegen.gni
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ template("_chip_build_time_zapgen") {

# Application templates, actually generating files
"${_template_dir}/access.zapt",
"${_template_dir}/CHIPClientCallbacks.zapt",
"${_template_dir}/CHIPClusters.zapt",
"${_template_dir}/endpoint_config.zapt",
"${_template_dir}/gen_config.zapt",
Expand Down
1 change: 0 additions & 1 deletion build/chip/esp32/esp32_codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ macro(chip_app_component_zapgen ZAP_NAME)
GENERATOR "app-templates"
OUTPUTS
"zap-generated/access.h"
"zap-generated/CHIPClientCallbacks.h"
"zap-generated/CHIPClusters.h"
"zap-generated/endpoint_config.h"
"zap-generated/gen_config.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

{% for type in globalTypes -%}
class CHIP{{type.name}}AttributeCallback : public chip::Callback::Callback<{{type.name}}AttributeCallback>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

class CHIPBooleanAttributeCallback : public chip::Callback::Callback<BooleanAttributeCallback>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

class CHIPBooleanAttributeCallback : public chip::Callback::Callback<BooleanAttributeCallback>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

class CHIPBooleanAttributeCallback : public chip::Callback::Callback<BooleanAttributeCallback>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

class CHIPBooleanAttributeCallback : public chip::Callback::Callback<BooleanAttributeCallback>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <jni.h>
#include <lib/support/ErrorStr.h>
#include <lib/support/JniReferences.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

class CHIPBooleanAttributeCallback : public chip::Callback::Callback<BooleanAttributeCallback>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <controller/java/zap-generated/CHIPInvokeCallbacks.h>

#include <app-common/zap-generated/cluster-objects.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
#include <controller/java/CHIPDefaultCallbacks.h>
Expand Down
2 changes: 0 additions & 2 deletions scripts/tools/zap/tests/available_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ inputs/all-clusters-app.zap:
CHIPClusters.h: outputs/all-clusters-app/app-templates/CHIPClusters.h
endpoint_config.h: outputs/all-clusters-app/app-templates/endpoint_config.h
gen_config.h: outputs/all-clusters-app/app-templates/gen_config.h
CHIPClientCallbacks.h: outputs/all-clusters-app/app-templates/CHIPClientCallbacks.h
access.h: outputs/all-clusters-app/app-templates/access.h
IMClusterCommandHandler.cpp: outputs/all-clusters-app/app-templates/IMClusterCommandHandler.cpp

Expand All @@ -24,6 +23,5 @@ inputs/lighting-app.zap:
CHIPClusters.h: outputs/lighting-app/app-templates/CHIPClusters.h
endpoint_config.h: outputs/lighting-app/app-templates/endpoint_config.h
gen_config.h: outputs/lighting-app/app-templates/gen_config.h
CHIPClientCallbacks.h: outputs/lighting-app/app-templates/CHIPClientCallbacks.h
access.h: outputs/lighting-app/app-templates/access.h
IMClusterCommandHandler.cpp: outputs/lighting-app/app-templates/IMClusterCommandHandler.cpp

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ function(chip_configure_data_model APP_TARGET)
GENERATOR "app-templates"
OUTPUTS
"zap-generated/access.h"
"zap-generated/CHIPClientCallbacks.h"
"zap-generated/CHIPClusters.h"
"zap-generated/endpoint_config.h"
"zap-generated/gen_config.h"
Expand Down
1 change: 0 additions & 1 deletion src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ template("chip_data_model") {
"zap-generated/access.h",
"zap-generated/gen_config.h",
"zap-generated/endpoint_config.h",
"zap-generated/CHIPClientCallbacks.h",
]

if (chip_code_pre_generated_directory == "") {
Expand Down
5 changes: 0 additions & 5 deletions src/app/zap-templates/app-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
"name": "ZCL gen_config header",
"output": "gen_config.h"
},
{
"path": "templates/app/CHIPClientCallbacks.zapt",
"name": "CHIP Client Callbacks header",
"output": "CHIPClientCallbacks.h"
},
{
"path": "templates/app/im-cluster-command-handler.zapt",
"name": "CHIP Client Callbacks for Interaction Model",
Expand Down
2 changes: 1 addition & 1 deletion src/controller/java/CHIPDefaultCallbacks.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <jni.h>

#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <lib/core/CHIPError.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <jni/CHIPCallbackTypes.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include <lib/support/Span.h>

// List specific responses
{{#all_user_clusters side='client'}}
{{#zcl_clusters}}
{{#zcl_attributes_server removeKeys='isOptional'}}
{{#if isArray}}
typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}ListAttributeCallback)(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} data);
{{/if}}
{{/zcl_attributes_server}}
{{/all_user_clusters}}
{{/zcl_clusters}}

2 changes: 1 addition & 1 deletion src/controller/java/templates/CHIPClustersWrite-JNI.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "CHIPInvokeCallbacks.h"

#include <app-common/zap-generated/cluster-objects.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>
#include <zap-generated/CHIPClusters.h>
#include <zap-generated/CHIPClientCallbacks.h>

#include <controller/java/AndroidCallbacks.h>
#include <controller/java/AndroidClusterExceptions.h>
Expand Down
2 changes: 1 addition & 1 deletion src/controller/java/templates/CHIPInvokeCallbacks.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <app-common/zap-generated/cluster-objects.h>
#include <jni.h>
#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

namespace chip {

Expand Down
2 changes: 1 addition & 1 deletion src/controller/java/templates/CHIPReadCallbacks-src.zapt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{> header}}
#include <jni/CHIPReadCallbacks.h>

#include <zap-generated/CHIPClientCallbacks.h>
#include <controller/java/zap-generated/CHIPClientCallbacks.h>

#include <jni.h>
#include <lib/support/JniReferences.h>
Expand Down
5 changes: 5 additions & 0 deletions src/controller/java/templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"name": "CHIP cluster invoke callbacks for Java (native code)",
"output": "src/controller/java/zap-generated/CHIPInvokeCallbacks.h"
},
{
"path": "CHIPClientCallbacks.zapt",
"name": "CHIP Client Callbacks header",
"output": "src/controller/java/zap-generated/CHIPClientCallbacks.h"
},
{
"path": "CHIPInvokeCallbacks-src.zapt",
"name": "CHIP cluster invoke callbacks for Java (native code)",
Expand Down
Loading

0 comments on commit 1077202

Please sign in to comment.