Skip to content

Commit

Permalink
Remove PluginCallbacks.h header, remove ClientInit callbacks (weak li…
Browse files Browse the repository at this point in the history
…nkage) (#23299)

* Remove `PluginCallbacks` generated file.

This file is not really needed by anything except advance
declaration by PluginApplicationCallbachs.h. We can codegen the
callbacks in that file.

* Remove ClientInitCallback
  • Loading branch information
andy31415 authored Oct 21, 2022
1 parent 131b8c9 commit 3c11013
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 193 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#pragma once

#include <app-common/zap-generated/callbacks/PluginCallbacks.h>
{%- for cluster in clusters | serverClustersOnly | sort(attribute='name') %}
void Matter{{ cluster.name }}PluginServerInitCallback();
{%- endfor %}

#define MATTER_PLUGINS_INIT \
{%- for cluster in clusters | sort(attribute='name') %}
Matter{{ cluster.name }}Plugin{{ cluster.side | clusterSideString }}InitCallback();{{ " \\" if not loop.last else ""}}
{%- for cluster in clusters | serverClustersOnly | sort(attribute='name') %}
Matter{{ cluster.name }}PluginServerInitCallback();{{ " \\" if not loop.last else ""}}
{%- else %}
(void)0; /* No server side clusters */
{%- endfor %}

11 changes: 3 additions & 8 deletions scripts/idl/generators/cpp/application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@
import logging


def clusterSideString(side: ClusterSide):
if side == ClusterSide.CLIENT:
return "Client"
elif side == ClusterSide.SERVER:
return "Server"
else:
raise Exception("Unknown cluster side %r" % (side, ))
def serverClustersOnly(clusters: List[Cluster]) -> List[Cluster]:
return [c for c in clusters if c.side == ClusterSide.SERVER]


class CppApplicationGenerator(CodeGenerator):
Expand All @@ -44,7 +39,7 @@ def __init__(self, storage: GeneratorStorage, idl: Idl):
"""
super().__init__(storage, idl)

self.jinja_env.filters['clusterSideString'] = clusterSideString
self.jinja_env.filters['serverClustersOnly'] = serverClustersOnly

def internal_render_all(self):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once

#include <app-common/zap-generated/callbacks/PluginCallbacks.h>
void MatterThirdPluginServerInitCallback();

#define MATTER_PLUGINS_INIT \
MatterFirstPluginClientInitCallback(); \
MatterSecondPluginClientInitCallback(); \
MatterThirdPluginClientInitCallback(); \
MatterThirdPluginServerInitCallback();

5 changes: 0 additions & 5 deletions src/app/common/templates/templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@
"name": "ZCL print-cluster header",
"output": "print-cluster.h"
},
{
"path": "../../zap-templates/templates/app/callbacks/PluginCallbacks.zapt",
"name": "Matter Callbacks header",
"output": "callbacks/PluginCallbacks.h"
},
{
"path": "../../zap-templates/templates/app/attributes/Accessors.zapt",
"name": "Attributes Accessors header",
Expand Down
1 change: 0 additions & 1 deletion src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/callbacks/PluginCallbacks.h>
#include <app-common/zap-generated/ids/Attributes.h>

using namespace chip;
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 3c11013

Please sign in to comment.