diff --git a/scripts/idl/generators/cpp/application/PluginApplicationCallbacksHeader.jinja b/scripts/idl/generators/cpp/application/PluginApplicationCallbacksHeader.jinja index 83e3dbf4c15a8a..2e31426b3d05fc 100644 --- a/scripts/idl/generators/cpp/application/PluginApplicationCallbacksHeader.jinja +++ b/scripts/idl/generators/cpp/application/PluginApplicationCallbacksHeader.jinja @@ -1,9 +1,13 @@ #pragma once -#include +{%- 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 %} diff --git a/scripts/idl/generators/cpp/application/__init__.py b/scripts/idl/generators/cpp/application/__init__.py index 40a4bb26b0b34b..efb264dd0f9324 100644 --- a/scripts/idl/generators/cpp/application/__init__.py +++ b/scripts/idl/generators/cpp/application/__init__.py @@ -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): @@ -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): """ diff --git a/scripts/idl/tests/outputs/several_clusters/cpp-app/PluginApplicationCallbacks.h b/scripts/idl/tests/outputs/several_clusters/cpp-app/PluginApplicationCallbacks.h index 00041de30d3ea9..620b4159b1350c 100644 --- a/scripts/idl/tests/outputs/several_clusters/cpp-app/PluginApplicationCallbacks.h +++ b/scripts/idl/tests/outputs/several_clusters/cpp-app/PluginApplicationCallbacks.h @@ -1,10 +1,6 @@ #pragma once - -#include +void MatterThirdPluginServerInitCallback(); #define MATTER_PLUGINS_INIT \ - MatterFirstPluginClientInitCallback(); \ - MatterSecondPluginClientInitCallback(); \ - MatterThirdPluginClientInitCallback(); \ MatterThirdPluginServerInitCallback(); diff --git a/src/app/common/templates/templates.json b/src/app/common/templates/templates.json index 23838583aea61b..ea4ae8f0a22417 100644 --- a/src/app/common/templates/templates.json +++ b/src/app/common/templates/templates.json @@ -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", diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index a3803a8cfbd58c..6f037518f8d80d 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -27,7 +27,6 @@ #include #include -#include #include using namespace chip; diff --git a/src/app/zap-templates/templates/app/callbacks/PluginCallbacks.zapt b/src/app/zap-templates/templates/app/callbacks/PluginCallbacks.zapt deleted file mode 100644 index 1b425da3b4ea78..00000000000000 --- a/src/app/zap-templates/templates/app/callbacks/PluginCallbacks.zapt +++ /dev/null @@ -1,8 +0,0 @@ -{{> header}} - -#pragma once - -{{#zcl_clusters}} -void __attribute__((weak)) Matter{{asUpperCamelCase label}}PluginClientInitCallback() {} -void Matter{{asUpperCamelCase label}}PluginServerInitCallback(); -{{/zcl_clusters}} diff --git a/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h b/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h deleted file mode 100644 index fbc1968cc73d06..00000000000000 --- a/zzz_generated/app-common/app-common/zap-generated/callbacks/PluginCallbacks.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * - * Copyright (c) 2022 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. - */ - -// THIS FILE IS GENERATED BY ZAP - -#pragma once - -void __attribute__((weak)) MatterIdentifyPluginClientInitCallback() {} -void MatterIdentifyPluginServerInitCallback(); -void __attribute__((weak)) MatterGroupsPluginClientInitCallback() {} -void MatterGroupsPluginServerInitCallback(); -void __attribute__((weak)) MatterScenesPluginClientInitCallback() {} -void MatterScenesPluginServerInitCallback(); -void __attribute__((weak)) MatterOnOffPluginClientInitCallback() {} -void MatterOnOffPluginServerInitCallback(); -void __attribute__((weak)) MatterOnOffSwitchConfigurationPluginClientInitCallback() {} -void MatterOnOffSwitchConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterLevelControlPluginClientInitCallback() {} -void MatterLevelControlPluginServerInitCallback(); -void __attribute__((weak)) MatterBinaryInputBasicPluginClientInitCallback() {} -void MatterBinaryInputBasicPluginServerInitCallback(); -void __attribute__((weak)) MatterPulseWidthModulationPluginClientInitCallback() {} -void MatterPulseWidthModulationPluginServerInitCallback(); -void __attribute__((weak)) MatterDescriptorPluginClientInitCallback() {} -void MatterDescriptorPluginServerInitCallback(); -void __attribute__((weak)) MatterBindingPluginClientInitCallback() {} -void MatterBindingPluginServerInitCallback(); -void __attribute__((weak)) MatterAccessControlPluginClientInitCallback() {} -void MatterAccessControlPluginServerInitCallback(); -void __attribute__((weak)) MatterActionsPluginClientInitCallback() {} -void MatterActionsPluginServerInitCallback(); -void __attribute__((weak)) MatterBasicPluginClientInitCallback() {} -void MatterBasicPluginServerInitCallback(); -void __attribute__((weak)) MatterOtaSoftwareUpdateProviderPluginClientInitCallback() {} -void MatterOtaSoftwareUpdateProviderPluginServerInitCallback(); -void __attribute__((weak)) MatterOtaSoftwareUpdateRequestorPluginClientInitCallback() {} -void MatterOtaSoftwareUpdateRequestorPluginServerInitCallback(); -void __attribute__((weak)) MatterLocalizationConfigurationPluginClientInitCallback() {} -void MatterLocalizationConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterTimeFormatLocalizationPluginClientInitCallback() {} -void MatterTimeFormatLocalizationPluginServerInitCallback(); -void __attribute__((weak)) MatterUnitLocalizationPluginClientInitCallback() {} -void MatterUnitLocalizationPluginServerInitCallback(); -void __attribute__((weak)) MatterPowerSourceConfigurationPluginClientInitCallback() {} -void MatterPowerSourceConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterPowerSourcePluginClientInitCallback() {} -void MatterPowerSourcePluginServerInitCallback(); -void __attribute__((weak)) MatterGeneralCommissioningPluginClientInitCallback() {} -void MatterGeneralCommissioningPluginServerInitCallback(); -void __attribute__((weak)) MatterNetworkCommissioningPluginClientInitCallback() {} -void MatterNetworkCommissioningPluginServerInitCallback(); -void __attribute__((weak)) MatterDiagnosticLogsPluginClientInitCallback() {} -void MatterDiagnosticLogsPluginServerInitCallback(); -void __attribute__((weak)) MatterGeneralDiagnosticsPluginClientInitCallback() {} -void MatterGeneralDiagnosticsPluginServerInitCallback(); -void __attribute__((weak)) MatterSoftwareDiagnosticsPluginClientInitCallback() {} -void MatterSoftwareDiagnosticsPluginServerInitCallback(); -void __attribute__((weak)) MatterThreadNetworkDiagnosticsPluginClientInitCallback() {} -void MatterThreadNetworkDiagnosticsPluginServerInitCallback(); -void __attribute__((weak)) MatterWiFiNetworkDiagnosticsPluginClientInitCallback() {} -void MatterWiFiNetworkDiagnosticsPluginServerInitCallback(); -void __attribute__((weak)) MatterEthernetNetworkDiagnosticsPluginClientInitCallback() {} -void MatterEthernetNetworkDiagnosticsPluginServerInitCallback(); -void __attribute__((weak)) MatterTimeSynchronizationPluginClientInitCallback() {} -void MatterTimeSynchronizationPluginServerInitCallback(); -void __attribute__((weak)) MatterBridgedDeviceBasicPluginClientInitCallback() {} -void MatterBridgedDeviceBasicPluginServerInitCallback(); -void __attribute__((weak)) MatterSwitchPluginClientInitCallback() {} -void MatterSwitchPluginServerInitCallback(); -void __attribute__((weak)) MatterAdministratorCommissioningPluginClientInitCallback() {} -void MatterAdministratorCommissioningPluginServerInitCallback(); -void __attribute__((weak)) MatterOperationalCredentialsPluginClientInitCallback() {} -void MatterOperationalCredentialsPluginServerInitCallback(); -void __attribute__((weak)) MatterGroupKeyManagementPluginClientInitCallback() {} -void MatterGroupKeyManagementPluginServerInitCallback(); -void __attribute__((weak)) MatterFixedLabelPluginClientInitCallback() {} -void MatterFixedLabelPluginServerInitCallback(); -void __attribute__((weak)) MatterUserLabelPluginClientInitCallback() {} -void MatterUserLabelPluginServerInitCallback(); -void __attribute__((weak)) MatterProxyConfigurationPluginClientInitCallback() {} -void MatterProxyConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterProxyDiscoveryPluginClientInitCallback() {} -void MatterProxyDiscoveryPluginServerInitCallback(); -void __attribute__((weak)) MatterProxyValidPluginClientInitCallback() {} -void MatterProxyValidPluginServerInitCallback(); -void __attribute__((weak)) MatterBooleanStatePluginClientInitCallback() {} -void MatterBooleanStatePluginServerInitCallback(); -void __attribute__((weak)) MatterModeSelectPluginClientInitCallback() {} -void MatterModeSelectPluginServerInitCallback(); -void __attribute__((weak)) MatterDoorLockPluginClientInitCallback() {} -void MatterDoorLockPluginServerInitCallback(); -void __attribute__((weak)) MatterWindowCoveringPluginClientInitCallback() {} -void MatterWindowCoveringPluginServerInitCallback(); -void __attribute__((weak)) MatterBarrierControlPluginClientInitCallback() {} -void MatterBarrierControlPluginServerInitCallback(); -void __attribute__((weak)) MatterPumpConfigurationAndControlPluginClientInitCallback() {} -void MatterPumpConfigurationAndControlPluginServerInitCallback(); -void __attribute__((weak)) MatterThermostatPluginClientInitCallback() {} -void MatterThermostatPluginServerInitCallback(); -void __attribute__((weak)) MatterFanControlPluginClientInitCallback() {} -void MatterFanControlPluginServerInitCallback(); -void __attribute__((weak)) MatterThermostatUserInterfaceConfigurationPluginClientInitCallback() {} -void MatterThermostatUserInterfaceConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterColorControlPluginClientInitCallback() {} -void MatterColorControlPluginServerInitCallback(); -void __attribute__((weak)) MatterBallastConfigurationPluginClientInitCallback() {} -void MatterBallastConfigurationPluginServerInitCallback(); -void __attribute__((weak)) MatterIlluminanceMeasurementPluginClientInitCallback() {} -void MatterIlluminanceMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterTemperatureMeasurementPluginClientInitCallback() {} -void MatterTemperatureMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterPressureMeasurementPluginClientInitCallback() {} -void MatterPressureMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterFlowMeasurementPluginClientInitCallback() {} -void MatterFlowMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterRelativeHumidityMeasurementPluginClientInitCallback() {} -void MatterRelativeHumidityMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterOccupancySensingPluginClientInitCallback() {} -void MatterOccupancySensingPluginServerInitCallback(); -void __attribute__((weak)) MatterWakeOnLanPluginClientInitCallback() {} -void MatterWakeOnLanPluginServerInitCallback(); -void __attribute__((weak)) MatterChannelPluginClientInitCallback() {} -void MatterChannelPluginServerInitCallback(); -void __attribute__((weak)) MatterTargetNavigatorPluginClientInitCallback() {} -void MatterTargetNavigatorPluginServerInitCallback(); -void __attribute__((weak)) MatterMediaPlaybackPluginClientInitCallback() {} -void MatterMediaPlaybackPluginServerInitCallback(); -void __attribute__((weak)) MatterMediaInputPluginClientInitCallback() {} -void MatterMediaInputPluginServerInitCallback(); -void __attribute__((weak)) MatterLowPowerPluginClientInitCallback() {} -void MatterLowPowerPluginServerInitCallback(); -void __attribute__((weak)) MatterKeypadInputPluginClientInitCallback() {} -void MatterKeypadInputPluginServerInitCallback(); -void __attribute__((weak)) MatterContentLauncherPluginClientInitCallback() {} -void MatterContentLauncherPluginServerInitCallback(); -void __attribute__((weak)) MatterAudioOutputPluginClientInitCallback() {} -void MatterAudioOutputPluginServerInitCallback(); -void __attribute__((weak)) MatterApplicationLauncherPluginClientInitCallback() {} -void MatterApplicationLauncherPluginServerInitCallback(); -void __attribute__((weak)) MatterApplicationBasicPluginClientInitCallback() {} -void MatterApplicationBasicPluginServerInitCallback(); -void __attribute__((weak)) MatterAccountLoginPluginClientInitCallback() {} -void MatterAccountLoginPluginServerInitCallback(); -void __attribute__((weak)) MatterElectricalMeasurementPluginClientInitCallback() {} -void MatterElectricalMeasurementPluginServerInitCallback(); -void __attribute__((weak)) MatterTestClusterPluginClientInitCallback() {} -void MatterTestClusterPluginServerInitCallback(); -void __attribute__((weak)) MatterFaultInjectionPluginClientInitCallback() {} -void MatterFaultInjectionPluginServerInitCallback();