From 205333649f259212822808c9ce94034123aa90e4 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 4 Apr 2023 20:46:44 -0400 Subject: [PATCH] Move CHIPReadCallbacks.h in java codegen from zap to jinja (#25865) * Start a first codegen for the read callbacks header * Start fixing includes * Fix unit tests and builds * Fix file naming * Fix an include path to point to compile time codegen * Fix another include path * Remove unused file --------- Co-authored-by: Andrei Litvin --- .../generators/java/CHIPReadCallbacks_h.jinja | 81 + .../generators/java/ChipClustersCpp.jinja | 2 +- .../generators/java/ChipClustersRead.jinja | 2 +- .../matter_idl/generators/java/__init__.py | 232 +- .../matter_idl/tests/available_tests.yaml | 5 + .../jni/CHIPReadReadCallbacks.h | 393 + .../DemoClusterClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/DemoClusterClient-ReadImpl.cpp | 2 +- .../jni/CHIPReadReadCallbacks.h | 393 + .../DemoClusterClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/DemoClusterClient-ReadImpl.cpp | 2 +- .../jni/CHIPReadReadCallbacks.h | 341 + .../MyClusterClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/MyClusterClient-ReadImpl.cpp | 2 +- .../jni/CHIPReadReadCallbacks.h | 397 + .../jni/FirstClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/FirstClient-ReadImpl.cpp | 2 +- .../jni/SecondClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/SecondClient-ReadImpl.cpp | 2 +- .../jni/ThirdClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/ThirdClient-ReadImpl.cpp | 2 +- .../jni/CHIPReadReadCallbacks.h | 341 + .../MyClusterClient-InvokeSubscribeImpl.cpp | 2 +- .../jni/MyClusterClient-ReadImpl.cpp | 2 +- src/controller/data_model/BUILD.gn | 1 + src/controller/java/BUILD.gn | 1 - .../java/templates/CHIPClustersWrite-JNI.zapt | 2 +- .../java/templates/CHIPReadCallbacks-src.zapt | 2 +- .../java/templates/CHIPReadCallbacks.zapt | 72 - src/controller/java/templates/templates.json | 5 - .../zap-generated/CHIPClustersWrite-JNI.cpp | 2 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 2 +- .../java/zap-generated/CHIPReadCallbacks.h | 14978 ---------------- 33 files changed, 2177 insertions(+), 15103 deletions(-) create mode 100644 scripts/py_matter_idl/matter_idl/generators/java/CHIPReadCallbacks_h.jinja create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/CHIPReadReadCallbacks.h create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/CHIPReadReadCallbacks.h create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/CHIPReadReadCallbacks.h create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/CHIPReadReadCallbacks.h create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/CHIPReadReadCallbacks.h delete mode 100644 src/controller/java/templates/CHIPReadCallbacks.zapt delete mode 100644 src/controller/java/zap-generated/CHIPReadCallbacks.h diff --git a/scripts/py_matter_idl/matter_idl/generators/java/CHIPReadCallbacks_h.jinja b/scripts/py_matter_idl/matter_idl/generators/java/CHIPReadCallbacks_h.jinja new file mode 100644 index 00000000000000..272cbcd4329cd3 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/generators/java/CHIPReadCallbacks_h.jinja @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +{% for type in globalTypes -%} +class CHIP{{type.name}}AttributeCallback : public chip::Callback::Callback<{{type.name}}AttributeCallback> +{ +public: + CHIP{{type.name}}AttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIP{{type.name}}AttributeCallback(); + + static void maybeDestroy(CHIP{{type.name}}AttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, {{type.cpp_type}} value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +{% endfor %} + +{% for cluster in clientClusters | sort(attribute='code') %} + {% set typeLookup = idl | createLookupContext(cluster) %} + {%- for attr in cluster.attributes | rejectattr('definition', 'is_using_global_callback', typeLookup) %} +class CHIP{{cluster.name}}{{attr.definition.name | capitalcase}}AttributeCallback : public chip::Callback::Callback +{ +public: + CHIP{{cluster.name}}{{attr.definition.name | capitalcase}}AttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIP{{cluster.name}}{{attr.definition.name | capitalcase}}AttributeCallback(); + + static void maybeDestroy(CHIP{{cluster.name}}{{attr.definition.name | capitalcase}}AttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, {{attr.definition | decodableJniType(typeLookup)}} {%if attr.definition.is_list%}list{%else%}value{%endif%}); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + {% endfor %} +{% endfor %} diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersCpp.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersCpp.jinja index ba84a31a3a5636..9af7eb5712c40f 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersCpp.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersCpp.jinja @@ -85,8 +85,8 @@ {% endmacro -%} #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersRead.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersRead.jinja index 03684f27f83206..e75779cf790624 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersRead.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersRead.jinja @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. #} -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py index 0b21947cc809fc..7bf11f76949574 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import dataclasses import enum import logging import os @@ -26,19 +27,37 @@ from stringcase import capitalcase -def FieldToGlobalName(field: Field, context: TypeLookupContext) -> Union[str, None]: - """Global names are used for generic callbacks shared across - all clusters (e.g. for bool/float/uint32 and similar) - """ - if field.is_list: - return None # lists are always specific per cluster +@dataclasses.dataclass +class GenerateTarget: + template: str + output_name: str - if FieldQuality.NULLABLE & field.qualities: - return None - if FieldQuality.OPTIONAL & field.qualities: - return None +@dataclasses.dataclass +class GlobalType: + name: str # java name + cpp_type: str # underlying type + + +# types that java should see globally +_GLOBAL_TYPES = [ + GlobalType("Boolean", "bool"), + GlobalType("CharString", "const chip::CharSpan"), + GlobalType("Double", "double"), + GlobalType("Float", "float"), + GlobalType("Int8s", "int8_t"), + GlobalType("Int8u", "uint8_t"), + GlobalType("Int16s", "int16_t"), + GlobalType("Int16u", "uint16_t"), + GlobalType("Int32s", "int32_t"), + GlobalType("Int32u", "uint32_t"), + GlobalType("Int64s", "int64_t"), + GlobalType("Int64u", "uint64_t"), + GlobalType("OctetString", "const chip::ByteSpan"), +] + +def _UnderlyingType(field: Field, context: TypeLookupContext) -> Union[str, None]: actual = ParseDataType(field.data_type, context) if type(actual) == IdlEnumType: actual = actual.base_type @@ -68,6 +87,99 @@ def FieldToGlobalName(field: Field, context: TypeLookupContext) -> Union[str, No return None +def FieldToGlobalName(field: Field, context: TypeLookupContext) -> Union[str, None]: + """Global names are used for generic callbacks shared across + all clusters (e.g. for bool/float/uint32 and similar) + """ + if field.is_list: + return None # lists are always specific per cluster + + if FieldQuality.NULLABLE & field.qualities: + return None + + if FieldQuality.OPTIONAL & field.qualities: + return None + + return _UnderlyingType(field, context) + + +# Based on atomicType in ZAP: +# src-electron/generator/matter/app/zap-templates/common/override.js +_KNOWN_DECODABLE_TYPES = { + 'action_id': 'chip::ActionId', + 'attrib_id': 'chip::AttributeId', + 'cluster_id': 'chip::ClusterId', + 'command_id': 'chip::CommandId', + 'data_ver': 'chip::DataVersion', + 'devtype_id': 'chip::DeviceTypeId', + 'endpoint_no': 'chip::EndpointId', + 'eui64': 'chip::NodeId', + 'event_id': 'chip::EventId', + 'event_no': 'chip::EventNumber', + 'fabric_id': 'chip::FabricId', + 'fabric_idx': 'chip::FabricIndex', + 'fabric_idx': 'chip::FabricIndex', + 'field_id': 'chip::FieldId', + 'group_id': 'chip::GroupId', + 'node_id': 'chip::NodeId', + 'percent': 'chip::Percent', + 'percent100ths': 'chip::Percent100ths', + 'transaction_id': 'chip::TransactionId', + 'vendor_id': 'chip::VendorId', + + # non-named enums + 'enum8': 'uint8_t', + 'enum16': 'uint16_t', + 'enum32': 'uint32_t', + 'enum64': 'uint64_t', +} + + +def _CppType(field: Field, context: TypeLookupContext) -> Union[str, None]: + if field.data_type.name.lower() in _KNOWN_DECODABLE_TYPES: + return _KNOWN_DECODABLE_TYPES[field.data_type.name.lower()] + + actual = ParseDataType(field.data_type, context) + if isinstance(actual, BasicString): + if actual.is_binary: + return 'chip::ByteSpan' + else: + return 'chip::CharSpan' + elif isinstance(actual, BasicInteger): + if actual.is_signed: + return "int{}_t".format(actual.power_of_two_bits) + else: + return "uint{}_t".format(actual.power_of_two_bits) + elif isinstance(actual, FundamentalType): + if actual == FundamentalType.BOOL: + return 'bool' + elif actual == FundamentalType.FLOAT: + return 'float' + elif actual == FundamentalType.DOUBLE: + return 'double' + else: + logging.warn('Unknown fundamental type: %r' % actual) + elif isinstance(actual, IdlType): + return f"chip::app::Clusters::{context.cluster.name}::Structs::{field.data_type.name}::DecodableType" + elif isinstance(actual, IdlBitmapType): + return f"chip::BitMask" + + # Handles IdlEnumType + return f"chip::app::Clusters::{context.cluster.name}::{field.data_type.name}" + + +def DecodableJniType(field: Field, context: TypeLookupContext) -> str: + actual = _CppType(field, context) + + if field.is_list: + return f"const chip::app::DataModel::DecodableList<{actual}> &" + + if field.is_nullable: + return f"const chip::app::DataModel::Nullable<{actual}> &" + + return actual + + def GlobalNameToJavaName(name: str) -> str: if name in {'Int8u', 'Int8s', 'Int16u', 'Int16s'}: return 'Integer' @@ -143,6 +255,51 @@ def attributesWithSupportedCallback(attrs, context: TypeLookupContext): yield attr +def _IsUsingGlobalCallback(field: Field, context: TypeLookupContext): + """Test to determine if the data type of a field can use one of + the global callbacks (i.e. it is a basic double/integer/bool etc.) + """ + if field.is_list: + return False + + if field.is_nullable: + return False + + return field.data_type.name in { + "boolean", + "single", + "double", + "int8s", + "int8u", + "int16s", + "int16u", + "int24s", + "int24u", + "int32s", + "int32u", + "int40s", + "int40u", + "int48s", + "int48u", + "int56s", + "int56u", + "int64s", + "int64u", + "enum8", + "enum16", + "enum32", + "enum64", + "bitmap8", + "bitmap16", + "bitmap32", + "bitmap64", + "char_string", + "long_char_string", + "octet_string", + "long_octet_string", + } + + def NamedFilter(choices: List, name: str): for choice in choices: if choice.name == name: @@ -419,8 +576,10 @@ def __init__(self, storage: GeneratorStorage, idl: Idl, **kargs): self.jinja_env.filters['asEncodable'] = EncodableValueFrom self.jinja_env.filters['createLookupContext'] = CreateLookupContext self.jinja_env.filters['canGenerateSubscribe'] = CanGenerateSubscribe + self.jinja_env.filters['decodableJniType'] = DecodableJniType self.jinja_env.tests['is_response_struct'] = IsResponseStruct + self.jinja_env.tests['is_using_global_callback'] = _IsUsingGlobalCallback class JavaJNIGenerator(__JavaCodeGenerator): @@ -434,6 +593,31 @@ def internal_render_all(self): Renders .CPP files required for JNI support. """ + large_targets = [ + GenerateTarget(template="CHIPCallbackTypes.jinja", + output_name="jni/CHIPCallbackTypes.h"), + GenerateTarget(template="CHIPReadCallbacks_h.jinja", + output_name="jni/CHIPReadCallbacks.h") + ] + + for target in large_targets: + self.internal_render_one_output( + template_path=target.template, + output_file_name=target.output_name, + vars={ + 'idl': self.idl, + 'clientClusters': [c for c in self.idl.clusters if c.side == ClusterSide.CLIENT], + 'globalTypes': _GLOBAL_TYPES, + } + ) + + cluster_targets = [ + GenerateTarget(template="ChipClustersRead.jinja", + output_name="jni/{cluster_name}Client-ReadImpl.cpp"), + GenerateTarget(template="ChipClustersCpp.jinja", + output_name="jni/{cluster_name}Client-InvokeSubscribeImpl.cpp"), + ] + self.internal_render_one_output( template_path="CHIPCallbackTypes.jinja", output_file_name="jni/CHIPCallbackTypes.h", @@ -449,23 +633,17 @@ def internal_render_all(self): if cluster.side != ClusterSide.CLIENT: continue - self.internal_render_one_output( - template_path="ChipClustersRead.jinja", - output_file_name="jni/%sClient-ReadImpl.cpp" % cluster.name, - vars={ - 'cluster': cluster, - 'typeLookup': TypeLookupContext(self.idl, cluster), - } - ) - - self.internal_render_one_output( - template_path="ChipClustersCpp.jinja", - output_file_name="jni/%sClient-InvokeSubscribeImpl.cpp" % cluster.name, - vars={ - 'cluster': cluster, - 'typeLookup': TypeLookupContext(self.idl, cluster), - } - ) + for target in cluster_targets: + self.internal_render_one_output( + template_path=target.template, + output_file_name=target.output_name.format( + cluster_name=cluster.name), + vars={ + 'cluster': cluster, + 'typeLookup': TypeLookupContext(self.idl, cluster), + 'globalTypes': _GLOBAL_TYPES, + } + ) class JavaClassGenerator(__JavaCodeGenerator): diff --git a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml index b0ee58585bcc92..659c0ed051203d 100644 --- a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml +++ b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml @@ -15,16 +15,19 @@ java-jni: jni/MyClusterClient-ReadImpl.cpp: outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp jni/MyClusterClient-InvokeSubscribeImpl.cpp: outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp jni/CHIPCallbackTypes.h: outputs/simple_attribute/jni/CHIPCallbackTypes.h + jni/CHIPReadCallbacks.h: outputs/simple_attribute/jni/CHIPReadReadCallbacks.h inputs/global_struct_attribute.matter: jni/DemoClusterClient-ReadImpl.cpp: outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp jni/DemoClusterClient-InvokeSubscribeImpl.cpp: outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp jni/CHIPCallbackTypes.h: outputs/global_struct_attribute/jni/CHIPCallbackTypes.h + jni/CHIPReadCallbacks.h: outputs/global_struct_attribute/jni/CHIPReadReadCallbacks.h inputs/cluster_struct_attribute.matter: jni/DemoClusterClient-ReadImpl.cpp: outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp jni/DemoClusterClient-InvokeSubscribeImpl.cpp: outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp jni/CHIPCallbackTypes.h: outputs/cluster_struct_attribute/jni/CHIPCallbackTypes.h + jni/CHIPReadCallbacks.h: outputs/cluster_struct_attribute/jni/CHIPReadReadCallbacks.h inputs/several_clusters.matter: jni/FirstClient-ReadImpl.cpp: outputs/several_clusters/jni/FirstClient-ReadImpl.cpp @@ -34,11 +37,13 @@ java-jni: jni/SecondClient-InvokeSubscribeImpl.cpp: outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp jni/ThirdClient-InvokeSubscribeImpl.cpp: outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp jni/CHIPCallbackTypes.h: outputs/several_clusters/jni/CHIPCallbackTypes.h + jni/CHIPReadCallbacks.h: outputs/several_clusters/jni/CHIPReadReadCallbacks.h inputs/optional_argument.matter: jni/MyClusterClient-ReadImpl.cpp: outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp jni/MyClusterClient-InvokeSubscribeImpl.cpp: outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp jni/CHIPCallbackTypes.h: outputs/optional_argument/jni/CHIPCallbackTypes.h + jni/CHIPReadCallbacks.h: outputs/optional_argument/jni/CHIPReadReadCallbacks.h java-class: inputs/several_clusters.matter: diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/CHIPReadReadCallbacks.h b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/CHIPReadReadCallbacks.h new file mode 100644 index 00000000000000..f56fb35ca94fc1 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/CHIPReadReadCallbacks.h @@ -0,0 +1,393 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +class CHIPBooleanAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPBooleanAttributeCallback(); + + static void maybeDestroy(CHIPBooleanAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, bool value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPCharStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPCharStringAttributeCallback(); + + static void maybeDestroy(CHIPCharStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::CharSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPDoubleAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoubleAttributeCallback(); + + static void maybeDestroy(CHIPDoubleAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, double value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPFloatAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFloatAttributeCallback(); + + static void maybeDestroy(CHIPFloatAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, float value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8sAttributeCallback(); + + static void maybeDestroy(CHIPInt8sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8uAttributeCallback(); + + static void maybeDestroy(CHIPInt8uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16sAttributeCallback(); + + static void maybeDestroy(CHIPInt16sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16uAttributeCallback(); + + static void maybeDestroy(CHIPInt16uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32sAttributeCallback(); + + static void maybeDestroy(CHIPInt32sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32uAttributeCallback(); + + static void maybeDestroy(CHIPInt32uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64sAttributeCallback(); + + static void maybeDestroy(CHIPInt64sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64uAttributeCallback(); + + static void maybeDestroy(CHIPInt64uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPOctetStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPOctetStringAttributeCallback(); + + static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::ByteSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + + +class CHIPDemoClusterSingleFailSafeAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDemoClusterSingleFailSafeAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDemoClusterSingleFailSafeAttributeCallback(); + + static void maybeDestroy(CHIPDemoClusterSingleFailSafeAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, chip::app::Clusters::DemoCluster::Structs::ArmFailSafeRequest::DecodableType value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + +class CHIPDemoClusterArmFailsafesAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDemoClusterArmFailsafesAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDemoClusterArmFailsafesAttributeCallback(); + + static void maybeDestroy(CHIPDemoClusterArmFailsafesAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp index bd8643b7479144..31bd11a9f16249 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp index a10f4877962d73..3976dcbd9243df 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/cluster_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/CHIPReadReadCallbacks.h b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/CHIPReadReadCallbacks.h new file mode 100644 index 00000000000000..d5fbe2b61bd0c5 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/CHIPReadReadCallbacks.h @@ -0,0 +1,393 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +class CHIPBooleanAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPBooleanAttributeCallback(); + + static void maybeDestroy(CHIPBooleanAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, bool value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPCharStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPCharStringAttributeCallback(); + + static void maybeDestroy(CHIPCharStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::CharSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPDoubleAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoubleAttributeCallback(); + + static void maybeDestroy(CHIPDoubleAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, double value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPFloatAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFloatAttributeCallback(); + + static void maybeDestroy(CHIPFloatAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, float value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8sAttributeCallback(); + + static void maybeDestroy(CHIPInt8sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8uAttributeCallback(); + + static void maybeDestroy(CHIPInt8uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16sAttributeCallback(); + + static void maybeDestroy(CHIPInt16sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16uAttributeCallback(); + + static void maybeDestroy(CHIPInt16uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32sAttributeCallback(); + + static void maybeDestroy(CHIPInt32sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32uAttributeCallback(); + + static void maybeDestroy(CHIPInt32uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64sAttributeCallback(); + + static void maybeDestroy(CHIPInt64sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64uAttributeCallback(); + + static void maybeDestroy(CHIPInt64uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPOctetStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPOctetStringAttributeCallback(); + + static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::ByteSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + + +class CHIPDemoClusterSingleLabelAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDemoClusterSingleLabelAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDemoClusterSingleLabelAttributeCallback(); + + static void maybeDestroy(CHIPDemoClusterSingleLabelAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, chip::app::Clusters::DemoCluster::Structs::LabelStruct::DecodableType value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + +class CHIPDemoClusterSomeLabelsAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDemoClusterSomeLabelsAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDemoClusterSomeLabelsAttributeCallback(); + + static void maybeDestroy(CHIPDemoClusterSomeLabelsAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp index e912528914d41b..c91759c71b12f2 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp index 40ff2ab71cd6d3..1059cd32fe92da 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/global_struct_attribute/jni/DemoClusterClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/CHIPReadReadCallbacks.h b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/CHIPReadReadCallbacks.h new file mode 100644 index 00000000000000..f5cedc144166f0 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/CHIPReadReadCallbacks.h @@ -0,0 +1,341 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +class CHIPBooleanAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPBooleanAttributeCallback(); + + static void maybeDestroy(CHIPBooleanAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, bool value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPCharStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPCharStringAttributeCallback(); + + static void maybeDestroy(CHIPCharStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::CharSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPDoubleAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoubleAttributeCallback(); + + static void maybeDestroy(CHIPDoubleAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, double value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPFloatAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFloatAttributeCallback(); + + static void maybeDestroy(CHIPFloatAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, float value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8sAttributeCallback(); + + static void maybeDestroy(CHIPInt8sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8uAttributeCallback(); + + static void maybeDestroy(CHIPInt8uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16sAttributeCallback(); + + static void maybeDestroy(CHIPInt16sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16uAttributeCallback(); + + static void maybeDestroy(CHIPInt16uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32sAttributeCallback(); + + static void maybeDestroy(CHIPInt32sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32uAttributeCallback(); + + static void maybeDestroy(CHIPInt32uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64sAttributeCallback(); + + static void maybeDestroy(CHIPInt64sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64uAttributeCallback(); + + static void maybeDestroy(CHIPInt64uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPOctetStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPOctetStringAttributeCallback(); + + static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::ByteSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + + + diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp index 1b5e90e300e24e..f55394ec269721 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp index 0317ff5d474d19..57d84d3501b751 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/optional_argument/jni/MyClusterClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/CHIPReadReadCallbacks.h b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/CHIPReadReadCallbacks.h new file mode 100644 index 00000000000000..d819b91891df82 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/CHIPReadReadCallbacks.h @@ -0,0 +1,397 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +class CHIPBooleanAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPBooleanAttributeCallback(); + + static void maybeDestroy(CHIPBooleanAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, bool value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPCharStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPCharStringAttributeCallback(); + + static void maybeDestroy(CHIPCharStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::CharSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPDoubleAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoubleAttributeCallback(); + + static void maybeDestroy(CHIPDoubleAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, double value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPFloatAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFloatAttributeCallback(); + + static void maybeDestroy(CHIPFloatAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, float value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8sAttributeCallback(); + + static void maybeDestroy(CHIPInt8sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8uAttributeCallback(); + + static void maybeDestroy(CHIPInt8uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16sAttributeCallback(); + + static void maybeDestroy(CHIPInt16sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16uAttributeCallback(); + + static void maybeDestroy(CHIPInt16uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32sAttributeCallback(); + + static void maybeDestroy(CHIPInt32sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32uAttributeCallback(); + + static void maybeDestroy(CHIPInt32uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64sAttributeCallback(); + + static void maybeDestroy(CHIPInt64sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64uAttributeCallback(); + + static void maybeDestroy(CHIPInt64uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPOctetStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPOctetStringAttributeCallback(); + + static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::ByteSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + + + + + + +class CHIPThirdSomeEnumAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPThirdSomeEnumAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPThirdSomeEnumAttributeCallback(); + + static void maybeDestroy(CHIPThirdSomeEnumAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, chip::app::Clusters::Third::MyEnum value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + +class CHIPThirdOptionsAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPThirdOptionsAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPThirdOptionsAttributeCallback(); + + static void maybeDestroy(CHIPThirdOptionsAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, chip::BitMask value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-InvokeSubscribeImpl.cpp index 1fd153ff362941..753863ee7814c4 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-ReadImpl.cpp index e289b3814c4c77..11efe7541f40b6 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/FirstClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp index d0c349bdda2a28..671610e33cdc7f 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-ReadImpl.cpp index cc54f89b6b7ded..8d07cda4cac889 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/SecondClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp index 7acf8d7dccec5f..2a7256ffbb526d 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-ReadImpl.cpp index 2cc8eb152609db..31012d0240eb99 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/jni/ThirdClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/CHIPReadReadCallbacks.h b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/CHIPReadReadCallbacks.h new file mode 100644 index 00000000000000..f5cedc144166f0 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/CHIPReadReadCallbacks.h @@ -0,0 +1,341 @@ +/* + * + * Copyright (c) 2023 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. + */ +#include + +#include +#include +#include +#include +#include + +class CHIPBooleanAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPBooleanAttributeCallback(); + + static void maybeDestroy(CHIPBooleanAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, bool value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPCharStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPCharStringAttributeCallback(); + + static void maybeDestroy(CHIPCharStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::CharSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPDoubleAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoubleAttributeCallback(); + + static void maybeDestroy(CHIPDoubleAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, double value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPFloatAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPFloatAttributeCallback(); + + static void maybeDestroy(CHIPFloatAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, float value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8sAttributeCallback(); + + static void maybeDestroy(CHIPInt8sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt8uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt8uAttributeCallback(); + + static void maybeDestroy(CHIPInt8uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint8_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16sAttributeCallback(); + + static void maybeDestroy(CHIPInt16sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt16uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt16uAttributeCallback(); + + static void maybeDestroy(CHIPInt16uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint16_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32sAttributeCallback(); + + static void maybeDestroy(CHIPInt32sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt32uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt32uAttributeCallback(); + + static void maybeDestroy(CHIPInt32uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint32_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64sAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64sAttributeCallback(); + + static void maybeDestroy(CHIPInt64sAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, int64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPInt64uAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPInt64uAttributeCallback(); + + static void maybeDestroy(CHIPInt64uAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, uint64_t value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; +class CHIPOctetStringAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPOctetStringAttributeCallback(); + + static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) { + if (!callback->keepAlive) { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::ByteSpan value); + static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + + + + + diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp index 5b8c3f5e0bc3c1..b6a4957c3a7d83 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-InvokeSubscribeImpl.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp index 64460b01e76d16..b8a9ef3264b3cb 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/simple_attribute/jni/MyClusterClient-ReadImpl.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn index 22c8803ee7ff64..1fd8d3e99f7f5c 100644 --- a/src/controller/data_model/BUILD.gn +++ b/src/controller/data_model/BUILD.gn @@ -43,6 +43,7 @@ if (current_os == "android" || build_java_matter_controller) { outputs = [ "jni/CHIPCallbackTypes.h", + "jni/CHIPReadCallbacks.h", "jni/IdentifyClient-ReadImpl.cpp", "jni/IdentifyClient-InvokeSubscribeImpl.cpp", "jni/GroupsClient-ReadImpl.cpp", diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 60427564a26525..84565a2bf18e08 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -62,7 +62,6 @@ shared_library("jni") { "zap-generated/CHIPInvokeCallbacks.cpp", "zap-generated/CHIPInvokeCallbacks.h", "zap-generated/CHIPReadCallbacks.cpp", - "zap-generated/CHIPReadCallbacks.h", ] deps = [ diff --git a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt index 242f8c1b19fdba..23d49866ca04ea 100644 --- a/src/controller/java/templates/CHIPClustersWrite-JNI.zapt +++ b/src/controller/java/templates/CHIPClustersWrite-JNI.zapt @@ -1,8 +1,8 @@ {{> header}} {{#if (chip_has_client_clusters)}} #include +#include #include "CHIPInvokeCallbacks.h" -#include "CHIPReadCallbacks.h" #include #include diff --git a/src/controller/java/templates/CHIPReadCallbacks-src.zapt b/src/controller/java/templates/CHIPReadCallbacks-src.zapt index a1fa202bf96e54..3a7ce97c8e68e6 100644 --- a/src/controller/java/templates/CHIPReadCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPReadCallbacks-src.zapt @@ -1,6 +1,6 @@ {{> header}} {{#if (chip_has_client_clusters)}} -#include "CHIPReadCallbacks.h" +#include #include diff --git a/src/controller/java/templates/CHIPReadCallbacks.zapt b/src/controller/java/templates/CHIPReadCallbacks.zapt deleted file mode 100644 index f15b4ec9e0f1bf..00000000000000 --- a/src/controller/java/templates/CHIPReadCallbacks.zapt +++ /dev/null @@ -1,72 +0,0 @@ -{{> header}} -#include - -#include -#include -#include -#include -#include - -{{#chip_server_global_responses}} -{{#unless (isStrEqual chipCallback.name "Unsupported")}} -class CHIP{{chipCallback.name}}AttributeCallback : public chip::Callback::Callback<{{chipCallback.name}}AttributeCallback> { -public: - CHIP{{chipCallback.name}}AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIP{{chipCallback.name}}AttributeCallback(); - - static void maybeDestroy(CHIP{{chipCallback.name}}AttributeCallback * callback) { - if (!callback->keepAlive) { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, {{chipCallback.type}} value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -{{/unless}} -{{/chip_server_global_responses}} - -{{#all_user_clusters}} -{{#zcl_attributes_server removeKeys='isOptional'}} -{{#if_unsupported_attribute_callback type isArray ../id}} -{{else}} -{{#if_basic_attribute type ../id}} -{{else}} -class CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback : public chip::Callback::Callback -{ -public: - CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback(); - - static void maybeDestroy(CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback * callback) { - if (!callback->keepAlive) { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} {{#if isArray}}list{{else}}value{{/if}}); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished(reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -{{/if_basic_attribute}} - -{{/if_unsupported_attribute_callback}} -{{/zcl_attributes_server}} -{{/all_user_clusters}} diff --git a/src/controller/java/templates/templates.json b/src/controller/java/templates/templates.json index c3fab06f887f81..90d7ff408acf7c 100644 --- a/src/controller/java/templates/templates.json +++ b/src/controller/java/templates/templates.json @@ -59,11 +59,6 @@ "name": "CHIP ZCL API for Java (native code for writes)", "output": "src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp" }, - { - "path": "CHIPReadCallbacks.zapt", - "name": "CHIP cluster attribute read callback for Java (native code)", - "output": "src/controller/java/zap-generated/CHIPReadCallbacks.h" - }, { "path": "CHIPReadCallbacks-src.zapt", "name": "CHIP cluster attribute read callback for Java (native code)", diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 9abeb686fd8a21..704671c5d5fa20 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -17,8 +17,8 @@ // THIS FILE IS GENERATED BY ZAP #include "CHIPInvokeCallbacks.h" -#include "CHIPReadCallbacks.h" #include +#include #include #include diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 652f8550370edb..0367add107cdf2 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -16,7 +16,7 @@ */ // THIS FILE IS GENERATED BY ZAP -#include "CHIPReadCallbacks.h" +#include #include diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h deleted file mode 100644 index c40a87808e2847..00000000000000 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ /dev/null @@ -1,14978 +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 -#include - -#include -#include -#include -#include -#include - -class CHIPBooleanAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBooleanAttributeCallback(); - - static void maybeDestroy(CHIPBooleanAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, bool value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPCharStringAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPCharStringAttributeCallback(); - - static void maybeDestroy(CHIPCharStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::CharSpan value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPDoubleAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoubleAttributeCallback(); - - static void maybeDestroy(CHIPDoubleAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, double value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPFloatAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFloatAttributeCallback(); - - static void maybeDestroy(CHIPFloatAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, float value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt8sAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt8sAttributeCallback(); - - static void maybeDestroy(CHIPInt8sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, int8_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt8uAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt8uAttributeCallback(); - - static void maybeDestroy(CHIPInt8uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, uint8_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt16sAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt16sAttributeCallback(); - - static void maybeDestroy(CHIPInt16sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, int16_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt16uAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt16uAttributeCallback(); - - static void maybeDestroy(CHIPInt16uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, uint16_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt32sAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt32sAttributeCallback(); - - static void maybeDestroy(CHIPInt32sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, int32_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt32uAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt32uAttributeCallback(); - - static void maybeDestroy(CHIPInt32uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, uint32_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt64sAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt64sAttributeCallback(); - - static void maybeDestroy(CHIPInt64sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, int64_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPInt64uAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPInt64uAttributeCallback(); - - static void maybeDestroy(CHIPInt64uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, uint64_t value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; -class CHIPOctetStringAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOctetStringAttributeCallback(); - - static void maybeDestroy(CHIPOctetStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::ByteSpan value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIdentifyGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIdentifyGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIdentifyGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPIdentifyGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIdentifyAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIdentifyAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIdentifyAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPIdentifyAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIdentifyEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPIdentifyEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIdentifyEventListAttributeCallback(); - - static void maybeDestroy(CHIPIdentifyEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIdentifyAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIdentifyAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIdentifyAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPIdentifyAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGroupsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGroupsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupsEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPGroupsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupsEventListAttributeCallback(); - - static void maybeDestroy(CHIPGroupsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPGroupsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPScenesLastConfiguredByAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPScenesLastConfiguredByAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPScenesLastConfiguredByAttributeCallback(); - - static void maybeDestroy(CHIPScenesLastConfiguredByAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPScenesGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPScenesGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPScenesGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPScenesGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPScenesAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPScenesAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPScenesAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPScenesAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPScenesEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPScenesEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPScenesEventListAttributeCallback(); - - static void maybeDestroy(CHIPScenesEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPScenesAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPScenesAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPScenesAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPScenesAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffStartUpOnOffAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPOnOffStartUpOnOffAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffStartUpOnOffAttributeCallback(); - - static void maybeDestroy(CHIPOnOffStartUpOnOffAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPOnOffEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffEventListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffAttributeListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPOnOffAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffSwitchConfigurationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffSwitchConfigurationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffSwitchConfigurationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffSwitchConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffSwitchConfigurationEventListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffSwitchConfigurationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOnOffSwitchConfigurationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOnOffSwitchConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOnOffSwitchConfigurationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOnOffSwitchConfigurationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlCurrentLevelAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlCurrentLevelAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlCurrentLevelAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlCurrentLevelAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlOnLevelAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlOnLevelAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlOnLevelAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlOnLevelAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlOnTransitionTimeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlOnTransitionTimeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlOnTransitionTimeAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlOnTransitionTimeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlOffTransitionTimeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlOffTransitionTimeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlOffTransitionTimeAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlOffTransitionTimeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlDefaultMoveRateAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlDefaultMoveRateAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlDefaultMoveRateAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlDefaultMoveRateAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlStartUpCurrentLevelAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlStartUpCurrentLevelAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlStartUpCurrentLevelAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlStartUpCurrentLevelAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLevelControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLevelControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLevelControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPLevelControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBinaryInputBasicGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBinaryInputBasicGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBinaryInputBasicGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBinaryInputBasicGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBinaryInputBasicAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBinaryInputBasicAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBinaryInputBasicAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBinaryInputBasicAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBinaryInputBasicEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBinaryInputBasicEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBinaryInputBasicEventListAttributeCallback(); - - static void maybeDestroy(CHIPBinaryInputBasicEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBinaryInputBasicAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBinaryInputBasicAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBinaryInputBasicAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBinaryInputBasicAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorDeviceTypeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorDeviceTypeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorDeviceTypeListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorDeviceTypeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorServerListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorServerListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorServerListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorServerListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorClientListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorClientListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorClientListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorClientListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorPartsListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorPartsListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorPartsListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorPartsListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorEventListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDescriptorAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDescriptorAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDescriptorAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPDescriptorAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBindingBindingAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPBindingBindingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBindingBindingAttributeCallback(); - - static void maybeDestroy(CHIPBindingBindingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBindingGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBindingGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBindingGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBindingGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBindingAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBindingAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBindingAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBindingAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBindingEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPBindingEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBindingEventListAttributeCallback(); - - static void maybeDestroy(CHIPBindingEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBindingAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBindingAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBindingAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBindingAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlAclAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPAccessControlAclAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlAclAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlAclAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlExtensionAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccessControlExtensionAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlExtensionAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlExtensionAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccessControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccessControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccessControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccessControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccessControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccessControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPAccessControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsActionListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPActionsActionListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsActionListAttributeCallback(); - - static void maybeDestroy(CHIPActionsActionListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsEndpointListsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPActionsEndpointListsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsEndpointListsAttributeCallback(); - - static void maybeDestroy(CHIPActionsEndpointListsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPActionsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPActionsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPActionsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPActionsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPActionsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsEventListAttributeCallback(); - - static void maybeDestroy(CHIPActionsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPActionsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPActionsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPActionsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPActionsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBasicInformationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBasicInformationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBasicInformationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBasicInformationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBasicInformationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBasicInformationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBasicInformationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBasicInformationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBasicInformationEventListAttributeCallback(); - - static void maybeDestroy(CHIPBasicInformationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBasicInformationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBasicInformationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBasicInformationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBasicInformationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateProviderGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateProviderAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateProviderEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateProviderEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateProviderEventListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateProviderEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateProviderAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorDefaultOTAProvidersAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorUpdateStateProgressAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorEventListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOtaSoftwareUpdateRequestorAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLocalizationConfigurationSupportedLocalesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLocalizationConfigurationSupportedLocalesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLocalizationConfigurationSupportedLocalesAttributeCallback(); - - static void maybeDestroy(CHIPLocalizationConfigurationSupportedLocalesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLocalizationConfigurationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLocalizationConfigurationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLocalizationConfigurationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLocalizationConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLocalizationConfigurationEventListAttributeCallback(); - - static void maybeDestroy(CHIPLocalizationConfigurationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLocalizationConfigurationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLocalizationConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLocalizationConfigurationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPLocalizationConfigurationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback(); - - static void maybeDestroy(CHIPTimeFormatLocalizationSupportedCalendarTypesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTimeFormatLocalizationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTimeFormatLocalizationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTimeFormatLocalizationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTimeFormatLocalizationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTimeFormatLocalizationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTimeFormatLocalizationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTimeFormatLocalizationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTimeFormatLocalizationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTimeFormatLocalizationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTimeFormatLocalizationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTimeFormatLocalizationEventListAttributeCallback(); - - static void maybeDestroy(CHIPTimeFormatLocalizationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTimeFormatLocalizationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTimeFormatLocalizationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTimeFormatLocalizationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPTimeFormatLocalizationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitLocalizationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitLocalizationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitLocalizationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUnitLocalizationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitLocalizationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitLocalizationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitLocalizationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUnitLocalizationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitLocalizationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitLocalizationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitLocalizationEventListAttributeCallback(); - - static void maybeDestroy(CHIPUnitLocalizationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitLocalizationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitLocalizationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitLocalizationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPUnitLocalizationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceConfigurationSourcesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceConfigurationSourcesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceConfigurationSourcesAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceConfigurationSourcesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceConfigurationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceConfigurationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceConfigurationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceConfigurationEventListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceConfigurationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceConfigurationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceConfigurationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceConfigurationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceWiredAssessedInputVoltageAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceWiredAssessedInputVoltageAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceWiredAssessedInputVoltageAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceWiredAssessedInputVoltageAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceWiredAssessedInputFrequencyAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceWiredAssessedInputFrequencyAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceWiredAssessedInputFrequencyAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceWiredAssessedInputFrequencyAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceWiredAssessedCurrentAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceWiredAssessedCurrentAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceWiredAssessedCurrentAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceWiredAssessedCurrentAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceActiveWiredFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceActiveWiredFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceActiveWiredFaultsAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceActiveWiredFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceBatVoltageAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceBatVoltageAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceBatVoltageAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceBatVoltageAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceBatPercentRemainingAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceBatPercentRemainingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceBatPercentRemainingAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceBatPercentRemainingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceBatTimeRemainingAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceBatTimeRemainingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceBatTimeRemainingAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceBatTimeRemainingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceActiveBatFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceActiveBatFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceActiveBatFaultsAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceActiveBatFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceBatTimeToFullChargeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceBatTimeToFullChargeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceBatTimeToFullChargeAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceBatTimeToFullChargeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceBatChargingCurrentAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceBatChargingCurrentAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceBatChargingCurrentAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceBatChargingCurrentAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceActiveBatChargeFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceActiveBatChargeFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceActiveBatChargeFaultsAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceActiveBatChargeFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceEventListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPowerSourceAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPowerSourceAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPowerSourceAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPPowerSourceAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralCommissioningGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralCommissioningGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralCommissioningGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralCommissioningAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralCommissioningAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralCommissioningAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralCommissioningEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralCommissioningEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralCommissioningEventListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralCommissioningEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralCommissioningAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralCommissioningAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralCommissioningAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralCommissioningAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningNetworksAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningNetworksAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningNetworksAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningNetworksAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningLastNetworkingStatusAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningLastNetworkingStatusAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningLastNetworkingStatusAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningLastNetworkingStatusAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningLastNetworkIDAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningLastNetworkIDAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningLastNetworkIDAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningLastNetworkIDAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningLastConnectErrorValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningLastConnectErrorValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningLastConnectErrorValueAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningLastConnectErrorValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningEventListAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPNetworkCommissioningAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPNetworkCommissioningAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPNetworkCommissioningAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPNetworkCommissioningAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDiagnosticLogsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDiagnosticLogsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDiagnosticLogsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDiagnosticLogsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDiagnosticLogsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDiagnosticLogsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDiagnosticLogsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDiagnosticLogsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDiagnosticLogsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDiagnosticLogsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDiagnosticLogsEventListAttributeCallback(); - - static void maybeDestroy(CHIPDiagnosticLogsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDiagnosticLogsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDiagnosticLogsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDiagnosticLogsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPDiagnosticLogsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsNetworkInterfacesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterface::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsActiveHardwareFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsActiveRadioFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsActiveNetworkFaultsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsEventListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGeneralDiagnosticsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGeneralDiagnosticsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGeneralDiagnosticsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPGeneralDiagnosticsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback(); - - static void maybeDestroy(CHIPSoftwareDiagnosticsThreadMetricsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetricsStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSoftwareDiagnosticsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSoftwareDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSoftwareDiagnosticsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPSoftwareDiagnosticsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSoftwareDiagnosticsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSoftwareDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSoftwareDiagnosticsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPSoftwareDiagnosticsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSoftwareDiagnosticsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSoftwareDiagnosticsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSoftwareDiagnosticsEventListAttributeCallback(); - - static void maybeDestroy(CHIPSoftwareDiagnosticsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSoftwareDiagnosticsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSoftwareDiagnosticsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSoftwareDiagnosticsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPSoftwareDiagnosticsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsChannelAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsChannelAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsChannelAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsChannelAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsRoutingRoleAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsRoutingRoleAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsRoutingRoleAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsRoutingRoleAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsNetworkNameAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsNetworkNameAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsNetworkNameAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsNetworkNameAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsPanIdAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsPanIdAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsPanIdAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsPanIdAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsExtendedPanIdAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsExtendedPanIdAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsExtendedPanIdAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsExtendedPanIdAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsMeshLocalPrefixAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsMeshLocalPrefixAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsMeshLocalPrefixAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsMeshLocalPrefixAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsNeighborTableAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsNeighborTableAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsNeighborTableAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsNeighborTableAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsRouteTableAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsRouteTableAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsRouteTableAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsRouteTableAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsPartitionIdAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsPartitionIdAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsPartitionIdAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsPartitionIdAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsWeightingAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsWeightingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsWeightingAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsWeightingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsDataVersionAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsDataVersionAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsDataVersionAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsDataVersionAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsStableDataVersionAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsStableDataVersionAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsStableDataVersionAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsStableDataVersionAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsLeaderRouterIdAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsLeaderRouterIdAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsLeaderRouterIdAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsLeaderRouterIdAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsActiveTimestampAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsActiveTimestampAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsActiveTimestampAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsActiveTimestampAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsPendingTimestampAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsPendingTimestampAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsPendingTimestampAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsPendingTimestampAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsDelayAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsDelayAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsDelayAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsDelayAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsChannelPage0MaskAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsActiveNetworkFaultsListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsEventListAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPThreadNetworkDiagnosticsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsBssidAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsBssidAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsBssidAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsBssidAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsSecurityTypeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsSecurityTypeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsSecurityTypeAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsSecurityTypeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsWiFiVersionAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsWiFiVersionAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsWiFiVersionAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsWiFiVersionAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsChannelNumberAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsChannelNumberAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsChannelNumberAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsChannelNumberAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsRssiAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsRssiAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsRssiAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsRssiAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsBeaconLostCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsBeaconLostCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsBeaconLostCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsBeaconLostCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsBeaconRxCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsPacketMulticastRxCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsPacketMulticastTxCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsPacketUnicastRxCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsPacketUnicastRxCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsPacketUnicastRxCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsPacketUnicastRxCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsPacketUnicastTxCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsPacketUnicastTxCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsPacketUnicastTxCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsPacketUnicastTxCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsCurrentMaxRateAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsCurrentMaxRateAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsCurrentMaxRateAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsCurrentMaxRateAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsOverrunCountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsOverrunCountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsOverrunCountAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsOverrunCountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsEventListAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPWiFiNetworkDiagnosticsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsPHYRateAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsPHYRateAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsPHYRateAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsPHYRateAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsFullDuplexAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsFullDuplexAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsFullDuplexAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsFullDuplexAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsCarrierDetectAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsEventListAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPEthernetNetworkDiagnosticsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBridgedDeviceBasicInformationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBridgedDeviceBasicInformationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBridgedDeviceBasicInformationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBridgedDeviceBasicInformationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBridgedDeviceBasicInformationEventListAttributeCallback(); - - static void maybeDestroy(CHIPBridgedDeviceBasicInformationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBridgedDeviceBasicInformationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBridgedDeviceBasicInformationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBridgedDeviceBasicInformationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBridgedDeviceBasicInformationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSwitchGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSwitchGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSwitchGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPSwitchGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSwitchAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSwitchAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSwitchAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPSwitchAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSwitchEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPSwitchEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSwitchEventListAttributeCallback(); - - static void maybeDestroy(CHIPSwitchEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPSwitchAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPSwitchAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPSwitchAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPSwitchAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningAdminFabricIndexAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningAdminVendorIdAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningAdminVendorIdAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningAdminVendorIdAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningAdminVendorIdAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningEventListAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAdministratorCommissioningAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAdministratorCommissioningAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAdministratorCommissioningAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPAdministratorCommissioningAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsNOCsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsNOCsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsNOCsAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsNOCsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsFabricsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsFabricsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsFabricsAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsFabricsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsTrustedRootCertificatesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsEventListAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOperationalCredentialsAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOperationalCredentialsAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOperationalCredentialsAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOperationalCredentialsAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementGroupKeyMapAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementGroupKeyMapAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementGroupKeyMapAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementGroupKeyMapAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementGroupTableAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementGroupTableAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementGroupTableAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementGroupTableAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementEventListAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPGroupKeyManagementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPGroupKeyManagementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPGroupKeyManagementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPGroupKeyManagementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFixedLabelLabelListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFixedLabelLabelListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFixedLabelLabelListAttributeCallback(); - - static void maybeDestroy(CHIPFixedLabelLabelListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFixedLabelGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFixedLabelGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFixedLabelGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFixedLabelGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFixedLabelAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFixedLabelAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFixedLabelAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFixedLabelAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFixedLabelEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFixedLabelEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFixedLabelEventListAttributeCallback(); - - static void maybeDestroy(CHIPFixedLabelEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFixedLabelAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFixedLabelAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFixedLabelAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPFixedLabelAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUserLabelLabelListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPUserLabelLabelListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUserLabelLabelListAttributeCallback(); - - static void maybeDestroy(CHIPUserLabelLabelListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUserLabelGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUserLabelGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUserLabelGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUserLabelGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUserLabelAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUserLabelAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUserLabelAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUserLabelAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUserLabelEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPUserLabelEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUserLabelEventListAttributeCallback(); - - static void maybeDestroy(CHIPUserLabelEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUserLabelAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUserLabelAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUserLabelAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPUserLabelAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBooleanStateGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBooleanStateGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBooleanStateGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBooleanStateGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBooleanStateAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBooleanStateAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBooleanStateAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBooleanStateAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBooleanStateEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBooleanStateEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBooleanStateEventListAttributeCallback(); - - static void maybeDestroy(CHIPBooleanStateEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBooleanStateAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBooleanStateAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBooleanStateAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBooleanStateAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectStandardNamespaceAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectStandardNamespaceAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectStandardNamespaceAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectStandardNamespaceAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectSupportedModesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectSupportedModesAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectSupportedModesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectStartUpModeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectStartUpModeAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectStartUpModeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectOnModeAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPModeSelectOnModeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectOnModeAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectOnModeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectEventListAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPModeSelectAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPModeSelectAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPModeSelectAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPModeSelectAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockLockStateAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPDoorLockLockStateAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockLockStateAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockLockStateAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockDoorStateAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPDoorLockDoorStateAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockDoorStateAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockDoorStateAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDoorLockGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDoorLockAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPDoorLockEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockEventListAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPDoorLockAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPDoorLockAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPDoorLockAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPDoorLockAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionLiftAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionLiftAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionLiftAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionLiftAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionTiltAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionTiltAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionTiltAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionTiltAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionLiftPercentageAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionTiltPercentageAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringTargetPositionLiftPercent100thsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringTargetPositionTiltPercent100thsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionLiftPercent100thsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringCurrentPositionTiltPercent100thsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringEventListAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWindowCoveringAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWindowCoveringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWindowCoveringAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPWindowCoveringAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBarrierControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBarrierControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBarrierControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBarrierControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBarrierControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBarrierControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBarrierControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBarrierControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBarrierControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBarrierControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBarrierControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPBarrierControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBarrierControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBarrierControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBarrierControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBarrierControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxPressureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxPressureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxPressureAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxPressureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxSpeedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxSpeedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxSpeedAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxSpeedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxFlowAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxFlowAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxFlowAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxFlowAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMinConstPressureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxConstPressureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMinCompPressureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMinCompPressureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMinCompPressureAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMinCompPressureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxCompPressureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxCompPressureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxCompPressureAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxCompPressureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMinConstSpeedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMinConstSpeedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMinConstSpeedAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMinConstSpeedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxConstSpeedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxConstSpeedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxConstSpeedAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxConstSpeedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMinConstFlowAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMinConstFlowAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMinConstFlowAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMinConstFlowAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxConstFlowAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxConstFlowAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxConstFlowAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxConstFlowAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMinConstTempAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMinConstTempAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMinConstTempAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMinConstTempAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlMaxConstTempAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlMaxConstTempAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlMaxConstTempAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlMaxConstTempAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlCapacityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlCapacityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlCapacityAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlCapacityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlSpeedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlSpeedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlSpeedAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlSpeedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlLifetimeRunningHoursAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlPowerAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlPowerAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlPowerAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlPowerAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlLifetimeEnergyConsumedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPumpConfigurationAndControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPumpConfigurationAndControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPumpConfigurationAndControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPPumpConfigurationAndControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatLocalTemperatureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatLocalTemperatureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatLocalTemperatureAttributeCallback(); - - static void maybeDestroy(CHIPThermostatLocalTemperatureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatOutdoorTemperatureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatOutdoorTemperatureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatOutdoorTemperatureAttributeCallback(); - - static void maybeDestroy(CHIPThermostatOutdoorTemperatureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatTemperatureSetpointHoldDurationAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatTemperatureSetpointHoldDurationAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatTemperatureSetpointHoldDurationAttributeCallback(); - - static void maybeDestroy(CHIPThermostatTemperatureSetpointHoldDurationAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatSetpointChangeAmountAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatSetpointChangeAmountAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatSetpointChangeAmountAttributeCallback(); - - static void maybeDestroy(CHIPThermostatSetpointChangeAmountAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatOccupiedSetbackAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatOccupiedSetbackAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatOccupiedSetbackAttributeCallback(); - - static void maybeDestroy(CHIPThermostatOccupiedSetbackAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatOccupiedSetbackMinAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatOccupiedSetbackMinAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatOccupiedSetbackMinAttributeCallback(); - - static void maybeDestroy(CHIPThermostatOccupiedSetbackMinAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatOccupiedSetbackMaxAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatOccupiedSetbackMaxAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatOccupiedSetbackMaxAttributeCallback(); - - static void maybeDestroy(CHIPThermostatOccupiedSetbackMaxAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUnoccupiedSetbackAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUnoccupiedSetbackAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUnoccupiedSetbackAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUnoccupiedSetbackAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUnoccupiedSetbackMinAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUnoccupiedSetbackMinAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUnoccupiedSetbackMinAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUnoccupiedSetbackMinAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUnoccupiedSetbackMaxAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUnoccupiedSetbackMaxAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUnoccupiedSetbackMaxAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUnoccupiedSetbackMaxAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatACCoilTemperatureAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatACCoilTemperatureAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatACCoilTemperatureAttributeCallback(); - - static void maybeDestroy(CHIPThermostatACCoilTemperatureAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatEventListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlPercentSettingAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlPercentSettingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlPercentSettingAttributeCallback(); - - static void maybeDestroy(CHIPFanControlPercentSettingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlSpeedSettingAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlSpeedSettingAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlSpeedSettingAttributeCallback(); - - static void maybeDestroy(CHIPFanControlSpeedSettingAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFanControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFanControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPFanControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFanControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFanControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFanControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPFanControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUserInterfaceConfigurationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context) - ->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUserInterfaceConfigurationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context) - ->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUserInterfaceConfigurationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPThermostatUserInterfaceConfigurationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlNumberOfPrimariesAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlNumberOfPrimariesAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlNumberOfPrimariesAttributeCallback(); - - static void maybeDestroy(CHIPColorControlNumberOfPrimariesAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary1IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary1IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary1IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary1IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary2IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary2IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary2IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary2IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary3IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary3IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary3IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary3IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary4IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary4IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary4IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary4IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary5IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary5IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary5IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary5IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlPrimary6IntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlPrimary6IntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlPrimary6IntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlPrimary6IntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlColorPointRIntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlColorPointRIntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlColorPointRIntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlColorPointRIntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlColorPointGIntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlColorPointGIntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlColorPointGIntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlColorPointGIntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlColorPointBIntensityAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlColorPointBIntensityAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlColorPointBIntensityAttributeCallback(); - - static void maybeDestroy(CHIPColorControlColorPointBIntensityAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlStartUpColorTemperatureMiredsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlStartUpColorTemperatureMiredsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlStartUpColorTemperatureMiredsAttributeCallback(); - - static void maybeDestroy(CHIPColorControlStartUpColorTemperatureMiredsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPColorControlGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPColorControlAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlEventListAttributeCallback(); - - static void maybeDestroy(CHIPColorControlEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPColorControlAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPColorControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPColorControlAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPColorControlAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationIntrinsicBallastFactorAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationIntrinsicBallastFactorAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationIntrinsicBallastFactorAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationIntrinsicBallastFactorAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationBallastFactorAdjustmentAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationLampRatedHoursAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationLampRatedHoursAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationLampRatedHoursAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationLampRatedHoursAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationLampBurnHoursAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationLampBurnHoursAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationLampBurnHoursAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationLampBurnHoursAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationLampBurnHoursTripPointAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationLampBurnHoursTripPointAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationLampBurnHoursTripPointAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationLampBurnHoursTripPointAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationEventListAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPBallastConfigurationAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPBallastConfigurationAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPBallastConfigurationAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPBallastConfigurationAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementMinMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPIlluminanceMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPIlluminanceMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPIlluminanceMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPIlluminanceMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementMinMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementMinMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementMinMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementMaxMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementMaxMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementMaxMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTemperatureMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTemperatureMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTemperatureMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPTemperatureMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementMinMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementMinMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementMinMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementMaxMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementMaxMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementMaxMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementScaledValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementScaledValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementScaledValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementMinScaledValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementMinScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementMinScaledValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementMinScaledValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementMaxScaledValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementMaxScaledValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementMaxScaledValueAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementMaxScaledValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPPressureMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPPressureMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPPressureMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPPressureMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementMinMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementMinMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementMinMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementMaxMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementMaxMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementMaxMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPFlowMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPFlowMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPFlowMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPFlowMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementMinMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementMaxMeasuredValueAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPRelativeHumidityMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPRelativeHumidityMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPRelativeHumidityMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPRelativeHumidityMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOccupancySensingGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOccupancySensingGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOccupancySensingGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOccupancySensingGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOccupancySensingAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOccupancySensingAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOccupancySensingAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPOccupancySensingAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOccupancySensingEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOccupancySensingEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOccupancySensingEventListAttributeCallback(); - - static void maybeDestroy(CHIPOccupancySensingEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPOccupancySensingAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPOccupancySensingAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPOccupancySensingAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPOccupancySensingAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWakeOnLanGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWakeOnLanGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWakeOnLanGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWakeOnLanGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWakeOnLanAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWakeOnLanAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWakeOnLanAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPWakeOnLanAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWakeOnLanEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPWakeOnLanEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWakeOnLanEventListAttributeCallback(); - - static void maybeDestroy(CHIPWakeOnLanEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPWakeOnLanAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPWakeOnLanAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPWakeOnLanAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPWakeOnLanAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPChannelChannelListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPChannelChannelListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPChannelChannelListAttributeCallback(); - - static void maybeDestroy(CHIPChannelChannelListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPChannelGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPChannelGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPChannelGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPChannelGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPChannelAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPChannelAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPChannelAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPChannelAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPChannelEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPChannelEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPChannelEventListAttributeCallback(); - - static void maybeDestroy(CHIPChannelEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPChannelAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPChannelAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPChannelAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPChannelAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTargetNavigatorTargetListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTargetNavigatorTargetListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTargetNavigatorTargetListAttributeCallback(); - - static void maybeDestroy(CHIPTargetNavigatorTargetListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTargetNavigatorGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTargetNavigatorGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTargetNavigatorGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTargetNavigatorGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTargetNavigatorAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTargetNavigatorAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTargetNavigatorAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPTargetNavigatorAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTargetNavigatorEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTargetNavigatorEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTargetNavigatorEventListAttributeCallback(); - - static void maybeDestroy(CHIPTargetNavigatorEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPTargetNavigatorAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPTargetNavigatorAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPTargetNavigatorAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPTargetNavigatorAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackStartTimeAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackStartTimeAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackStartTimeAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackStartTimeAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackDurationAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackDurationAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackDurationAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackDurationAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackSeekRangeEndAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackSeekRangeEndAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackSeekRangeEndAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackSeekRangeEndAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackSeekRangeStartAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackSeekRangeStartAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackSeekRangeStartAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackSeekRangeStartAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackEventListAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaPlaybackAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaPlaybackAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaPlaybackAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPMediaPlaybackAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaInputInputListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaInputInputListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaInputInputListAttributeCallback(); - - static void maybeDestroy(CHIPMediaInputInputListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaInputGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaInputGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaInputGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPMediaInputGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaInputAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaInputAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaInputAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPMediaInputAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaInputEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaInputEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaInputEventListAttributeCallback(); - - static void maybeDestroy(CHIPMediaInputEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPMediaInputAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPMediaInputAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPMediaInputAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPMediaInputAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLowPowerGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLowPowerGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLowPowerGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLowPowerGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLowPowerAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLowPowerAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLowPowerAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPLowPowerAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLowPowerEventListAttributeCallback : public chip::Callback::Callback -{ -public: - CHIPLowPowerEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLowPowerEventListAttributeCallback(); - - static void maybeDestroy(CHIPLowPowerEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPLowPowerAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPLowPowerAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPLowPowerAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPLowPowerAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPKeypadInputGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPKeypadInputGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPKeypadInputGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPKeypadInputGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPKeypadInputAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPKeypadInputAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPKeypadInputAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPKeypadInputAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPKeypadInputEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPKeypadInputEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPKeypadInputEventListAttributeCallback(); - - static void maybeDestroy(CHIPKeypadInputEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPKeypadInputAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPKeypadInputAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPKeypadInputAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPKeypadInputAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPContentLauncherAcceptHeaderAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPContentLauncherAcceptHeaderAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPContentLauncherAcceptHeaderAttributeCallback(); - - static void maybeDestroy(CHIPContentLauncherAcceptHeaderAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPContentLauncherGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPContentLauncherGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPContentLauncherGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPContentLauncherGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPContentLauncherAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPContentLauncherAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPContentLauncherAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPContentLauncherAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPContentLauncherEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPContentLauncherEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPContentLauncherEventListAttributeCallback(); - - static void maybeDestroy(CHIPContentLauncherEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPContentLauncherAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPContentLauncherAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPContentLauncherAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPContentLauncherAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAudioOutputOutputListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAudioOutputOutputListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAudioOutputOutputListAttributeCallback(); - - static void maybeDestroy(CHIPAudioOutputOutputListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAudioOutputGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAudioOutputGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAudioOutputGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAudioOutputGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAudioOutputAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAudioOutputAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAudioOutputAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAudioOutputAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAudioOutputEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAudioOutputEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAudioOutputEventListAttributeCallback(); - - static void maybeDestroy(CHIPAudioOutputEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAudioOutputAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAudioOutputAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAudioOutputAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPAudioOutputAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationLauncherCatalogListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationLauncherCatalogListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationLauncherCatalogListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationLauncherCatalogListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationLauncherGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationLauncherGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationLauncherGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationLauncherGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationLauncherAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationLauncherAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationLauncherAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationLauncherAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationLauncherEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationLauncherEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationLauncherEventListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationLauncherEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationLauncherAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationLauncherAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationLauncherAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationLauncherAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationBasicAllowedVendorListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationBasicAllowedVendorListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationBasicAllowedVendorListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationBasicAllowedVendorListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationBasicGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationBasicGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationBasicGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationBasicGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationBasicAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationBasicAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationBasicAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationBasicAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationBasicEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationBasicEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationBasicEventListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationBasicEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPApplicationBasicAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPApplicationBasicAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPApplicationBasicAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPApplicationBasicAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccountLoginGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccountLoginGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccountLoginGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAccountLoginGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccountLoginAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccountLoginAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccountLoginAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPAccountLoginAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccountLoginEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccountLoginEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccountLoginEventListAttributeCallback(); - - static void maybeDestroy(CHIPAccountLoginEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPAccountLoginAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPAccountLoginAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPAccountLoginAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPAccountLoginAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPElectricalMeasurementGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPElectricalMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPElectricalMeasurementGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPElectricalMeasurementGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPElectricalMeasurementAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPElectricalMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPElectricalMeasurementAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPElectricalMeasurementAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPElectricalMeasurementEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPElectricalMeasurementEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPElectricalMeasurementEventListAttributeCallback(); - - static void maybeDestroy(CHIPElectricalMeasurementEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPElectricalMeasurementAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPElectricalMeasurementAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPElectricalMeasurementAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPElectricalMeasurementAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPClientMonitoringExpectedClientsAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPClientMonitoringExpectedClientsAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPClientMonitoringExpectedClientsAttributeCallback(); - - static void maybeDestroy(CHIPClientMonitoringExpectedClientsAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::ClientMonitoring::Structs::MonitoringRegistration::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPClientMonitoringGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPClientMonitoringGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPClientMonitoringGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPClientMonitoringGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPClientMonitoringAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPClientMonitoringAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPClientMonitoringAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPClientMonitoringAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPClientMonitoringEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPClientMonitoringEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPClientMonitoringEventListAttributeCallback(); - - static void maybeDestroy(CHIPClientMonitoringEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPClientMonitoringAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPClientMonitoringAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPClientMonitoringAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPClientMonitoringAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListInt8uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListInt8uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListInt8uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListOctetStringAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListOctetStringAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListOctetStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListStructOctetStringAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListStructOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListStructOctetStringAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListStructOctetStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListNullablesAndOptionalsStructAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListNullablesAndOptionalsStructAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListNullablesAndOptionalsStructAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListNullablesAndOptionalsStructAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::DecodableType> & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListLongOctetStringAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListLongOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListLongOctetStringAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListLongOctetStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingListFabricScopedAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingListFabricScopedAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingListFabricScopedAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingListFabricScopedAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn( - void * context, - const chip::app::DataModel::DecodableList & - list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableBooleanAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableBooleanAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableBooleanAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableBooleanAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableBitmap8AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableBitmap8AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableBitmap8AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableBitmap8AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable> & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableBitmap16AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableBitmap16AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableBitmap16AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableBitmap16AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable> & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableBitmap32AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableBitmap32AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableBitmap32AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableBitmap32AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable> & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableBitmap64AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableBitmap64AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableBitmap64AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableBitmap64AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void - CallbackFn(void * context, - const chip::app::DataModel::Nullable> & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt8uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt8uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt8uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt16uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt16uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt16uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt24uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt24uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt24uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt24uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt32uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt32uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt32uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt32uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt40uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt40uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt40uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt40uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt48uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt48uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt48uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt48uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt56uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt56uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt56uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt56uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt64uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt64uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt64uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt64uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt8sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt8sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt8sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt16sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt16sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt16sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt24sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt24sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt24sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt24sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt32sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt32sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt32sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt32sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt40sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt40sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt40sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt40sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt48sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt48sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt48sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt48sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt56sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt56sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt56sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt56sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableInt64sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableInt64sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableInt64sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableInt64sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableEnum8AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableEnum8AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableEnum8AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableEnum8AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableEnum16AttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableEnum16AttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableEnum16AttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableEnum16AttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableFloatSingleAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableFloatSingleAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableFloatSingleAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableFloatSingleAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableFloatDoubleAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableFloatDoubleAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableFloatDoubleAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableFloatDoubleAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableOctetStringAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableOctetStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableOctetStringAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableOctetStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableCharStringAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableCharStringAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableCharStringAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableCharStringAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableEnumAttrAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableEnumAttrAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableEnumAttrAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableEnumAttrAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, - const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableRangeRestrictedInt8uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableRangeRestrictedInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableRangeRestrictedInt8uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableRangeRestrictedInt8uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableRangeRestrictedInt8sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableRangeRestrictedInt8sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableRangeRestrictedInt8sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableRangeRestrictedInt8sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableRangeRestrictedInt16uAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableRangeRestrictedInt16uAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableRangeRestrictedInt16uAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableRangeRestrictedInt16uAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingNullableRangeRestrictedInt16sAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingNullableRangeRestrictedInt16sAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingNullableRangeRestrictedInt16sAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingNullableRangeRestrictedInt16sAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, - subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingGeneratedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingGeneratedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingGeneratedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingAcceptedCommandListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingAcceptedCommandListAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingAcceptedCommandListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingEventListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingEventListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingEventListAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingEventListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -}; - -class CHIPUnitTestingAttributeListAttributeCallback - : public chip::Callback::Callback -{ -public: - CHIPUnitTestingAttributeListAttributeCallback(jobject javaCallback, bool keepAlive = false); - - ~CHIPUnitTestingAttributeListAttributeCallback(); - - static void maybeDestroy(CHIPUnitTestingAttributeListAttributeCallback * callback) - { - if (!callback->keepAlive) - { - callback->Cancel(); - chip::Platform::Delete(callback); - } - } - - static void CallbackFn(void * context, const chip::app::DataModel::DecodableList & list); - static void OnSubscriptionEstablished(void * context, chip::SubscriptionId subscriptionId) - { - CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( - reinterpret_cast(context)->javaCallbackRef, subscriptionId); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); - }; - -private: - jobject javaCallbackRef; - bool keepAlive; -};