From 5135af37abc71e73ee0e0f602fceef02db6ed522 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 28 Jun 2023 08:41:56 -0400 Subject: [PATCH] stop using `controller-clusters.zap` in zap_generate_all (#26948) * separate out zap input, so we have control over it * Switch zcl_clusters on for python * Fix more loops to use the generic non-zap helpers * Switch zap generate to use zcl * update generate.py and change CHIPClientCallbacks.zapt * Restyled by autopep8 * Fix another comment location * Remove import from optional to make linter happy * Skip restyling java generated files * Run zap_regen_all * Fix restyle path to include a glob * Switch global callbacks to jinja * update unit tests * Fix global logic and codegen * Codegen updated, validated that global callbacks is now identical * Fix lint issue * Update codegen logic to not depend on zap for src/controller/java/templates/ClusterInfo-java.zapt * Also fix src/controller/java/templates/ChipClusters-java.zapt * Use ANDROID_NDK_HOME env even for newer gradle build as the environment variable itself was deprecated (see https://github.com/android/ndk-samples/wiki/Configure-NDK-Path#android_ndk_home) * Fixed indent a bit * Updated comments a bit about controller-clusters.zap * Be explicit on matter file name on codegen * Remove duplicate output name * Fix file path for CHIPClientCallbacks.h * Update scripts/tools/zap_regen_all.py Co-authored-by: Boris Zbarsky * Do some renames and code review updates --------- Co-authored-by: Andrei Litvin Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- examples/android/CHIPTest/app/build.gradle | 1 + examples/android/CHIPTool/app/build.gradle | 1 + .../java/CHIPGlobalCallbacks_cpp.jinja | 76 ++ .../matter_idl/generators/java/__init__.py | 84 +- .../matter_idl/tests/available_tests.yaml | 5 + .../shared/jni/CHIPGlobalCallbacks.cpp | 603 ++++++++++++ scripts/tools/zap/generate.py | 57 +- scripts/tools/zap_regen_all.py | 94 +- src/controller/data_model/BUILD.gn | 5 +- .../java/templates/CHIPReadCallbacks-src.zapt | 74 -- .../java/templates/ChipClusters-java.zapt | 28 +- .../java/templates/ClusterInfo-java.zapt | 16 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 647 ------------ .../chip/devicecontroller/ChipClusters.java | 614 ++++++++++-- .../devicecontroller/ClusterInfoMapping.java | 919 ++++++++++++++++++ 15 files changed, 2367 insertions(+), 857 deletions(-) create mode 100644 scripts/py_matter_idl/matter_idl/generators/java/CHIPGlobalCallbacks_cpp.jinja create mode 100644 scripts/py_matter_idl/matter_idl/tests/outputs/shared/jni/CHIPGlobalCallbacks.cpp diff --git a/examples/android/CHIPTest/app/build.gradle b/examples/android/CHIPTest/app/build.gradle index 3d391d8f386c78..8e3762408147ea 100644 --- a/examples/android/CHIPTest/app/build.gradle +++ b/examples/android/CHIPTest/app/build.gradle @@ -10,6 +10,7 @@ println 'matterUTestLib='+matterUTestLib android { compileSdkVersion 30 buildToolsVersion "30.0.3" + ndkPath System.getenv("ANDROID_NDK_HOME") defaultConfig { applicationId "com.tcl.chip.chiptest" diff --git a/examples/android/CHIPTool/app/build.gradle b/examples/android/CHIPTool/app/build.gradle index 9f116f92d04cd4..368930259ea66a 100644 --- a/examples/android/CHIPTool/app/build.gradle +++ b/examples/android/CHIPTool/app/build.gradle @@ -4,6 +4,7 @@ apply plugin: 'kotlin-parcelize' android { compileSdkVersion 31 + ndkPath System.getenv("ANDROID_NDK_HOME") ndkVersion "23.2.8568313" diff --git a/scripts/py_matter_idl/matter_idl/generators/java/CHIPGlobalCallbacks_cpp.jinja b/scripts/py_matter_idl/matter_idl/generators/java/CHIPGlobalCallbacks_cpp.jinja new file mode 100644 index 00000000000000..3042568424a86e --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/generators/java/CHIPGlobalCallbacks_cpp.jinja @@ -0,0 +1,76 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +{% for type in globalTypes -%} +{%- set typeLookup = idl | createLookupContext(None) -%} +{%- set encodable = type.idl_type | globalAsEncodable(typeLookup) -%} +CHIP{{type.name}}AttributeCallback::CHIP{{type.name}}AttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback<{{type.name}}AttributeCallback>(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIP{{type.name}}AttributeCallback::~CHIP{{type.name}}AttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIP{{type.name}}AttributeCallback::CallbackFn(void * context, {{type.cpp_type}} value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + {%- if encodable.is_octet_string %} + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "([B)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + + VerifyOrReturn(chip::CanCastTo(value.size()), ChipLogError(Zcl, "Value too long")); + jbyteArray valueArr = env->NewByteArray(static_cast(value.size())); + env->ExceptionClear(); + env->SetByteArrayRegion(valueArr, 0, static_cast(value.size()), reinterpret_cast(value.data())); + + env->CallVoidMethod(javaCallbackRef, javaMethod, valueArr); + {%- elif encodable.is_char_string %} + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/String;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + + chip::UtfString valueStr(env, value); + env->CallVoidMethod(javaCallbackRef, javaMethod, valueStr.jniValue()); + {%- else %} + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "({{encodable.unboxed_java_signature}})V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast<{{encodable.jni_fundamental_type}}>(value)); + {%- endif %} +} + +{% endfor %} 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 8f376704c4bd3b..0dd602eb136eb3 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py @@ -35,25 +35,26 @@ class GenerateTarget: @dataclasses.dataclass class GlobalType: - name: str # java name + name: str # java name cpp_type: str # underlying type + idl_type: str # assumed IDL 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"), + GlobalType("Boolean", "bool", "boolean"), + GlobalType("CharString", "const chip::CharSpan", "char_string"), + GlobalType("Double", "double", "double"), + GlobalType("Float", "float", "single"), + GlobalType("Int8s", "int8_t", "int8s"), + GlobalType("Int8u", "uint8_t", "int8u"), + GlobalType("Int16s", "int16_t", "int16s"), + GlobalType("Int16u", "uint16_t", "int16u"), + GlobalType("Int32s", "int32_t", "int32s"), + GlobalType("Int32u", "uint32_t", "int32u"), + GlobalType("Int64s", "int64_t", "int64s"), + GlobalType("Int64u", "uint64_t", "int64u"), + GlobalType("OctetString", "const chip::ByteSpan", "octet_string"), ] @@ -423,6 +424,23 @@ def get_underlying_enum(self): raise Exception("Enum %s not found" % self.data_type.name) return e + @property + def jni_fundamental_type(self): + java_type = self.boxed_java_type + + if java_type == 'Boolean': + return 'jboolean' + elif java_type == 'Float': + return 'jfloat' + elif java_type == 'Double': + return 'jdouble' + elif java_type == 'Long': + return 'jlong' + elif java_type == 'Integer': + return 'jint' + + raise Exception("Unknown jni fundamental type.") + @property def boxed_java_type(self): t = ParseDataType(self.data_type, self.context) @@ -460,6 +478,30 @@ def boxed_java_type(self): else: return "Object" + @property + def unboxed_java_signature(self): + if self.is_optional or self.is_list: + raise Exception("Not a basic type: %r" % self) + + t = ParseDataType(self.data_type, self.context) + + if isinstance(t, FundamentalType): + if t == FundamentalType.BOOL: + return "Z" + elif t == FundamentalType.FLOAT: + return "F" + elif t == FundamentalType.DOUBLE: + return "D" + else: + raise Exception("Unknown fundamental type") + elif isinstance(t, BasicInteger): + if t.byte_count >= 3: + return "J" + else: + return "I" + else: + raise Exception("Not a basic type: %r" % self) + @property def boxed_java_signature(self): # Optional takes precedence over list - Optional compiles down to just java.util.Optional. @@ -504,6 +546,13 @@ def boxed_java_signature(self): return "Lchip/devicecontroller/ChipStructs${}Cluster{};".format(self.context.cluster.name, self.data_type.name) +def GlobalEncodableValueFrom(typeName: str, context: TypeLookupContext) -> EncodableValue: + """ + Filter to convert a global type name to an encodable value + """ + return EncodableValue(context, DataType(name=typeName), {}) + + def EncodableValueFrom(field: Field, context: TypeLookupContext) -> EncodableValue: """ Filter to convert a standard field to an EncodableValue. @@ -526,7 +575,7 @@ def EncodableValueFrom(field: Field, context: TypeLookupContext) -> EncodableVal return EncodableValue(context, field.data_type, attrs) -def CreateLookupContext(idl: Idl, cluster: Cluster) -> TypeLookupContext: +def CreateLookupContext(idl: Idl, cluster: Optional[Cluster]) -> TypeLookupContext: """ A filter to mark a lookup context to be within a specific cluster. @@ -579,6 +628,7 @@ def __init__(self, storage: GeneratorStorage, idl: Idl, **kargs): self.jinja_env.filters['toBoxedJavaType'] = ToBoxedJavaType self.jinja_env.filters['lowercaseFirst'] = LowercaseFirst self.jinja_env.filters['asEncodable'] = EncodableValueFrom + self.jinja_env.filters['globalAsEncodable'] = GlobalEncodableValueFrom self.jinja_env.filters['createLookupContext'] = CreateLookupContext self.jinja_env.filters['canGenerateSubscribe'] = CanGenerateSubscribe self.jinja_env.filters['decodableJniType'] = DecodableJniType @@ -602,7 +652,9 @@ def internal_render_all(self): GenerateTarget(template="CHIPCallbackTypes.jinja", output_name="jni/CHIPCallbackTypes.h"), GenerateTarget(template="CHIPReadCallbacks_h.jinja", - output_name="jni/CHIPReadCallbacks.h") + output_name="jni/CHIPReadCallbacks.h"), + GenerateTarget(template="CHIPGlobalCallbacks_cpp.jinja", + output_name="jni/CHIPGlobalCallbacks.cpp"), ] for target in large_targets: 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 c16e97b5dba7d4..f8f757bef4b3e3 100644 --- a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml +++ b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml @@ -16,18 +16,21 @@ java-jni: 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 + jni/CHIPGlobalCallbacks.cpp: outputs/shared/jni/CHIPGlobalCallbacks.cpp 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 + jni/CHIPGlobalCallbacks.cpp: outputs/shared/jni/CHIPGlobalCallbacks.cpp 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 + jni/CHIPGlobalCallbacks.cpp: outputs/shared/jni/CHIPGlobalCallbacks.cpp inputs/several_clusters.matter: jni/FirstClient-ReadImpl.cpp: outputs/several_clusters/jni/FirstClient-ReadImpl.cpp @@ -38,12 +41,14 @@ java-jni: 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 + jni/CHIPGlobalCallbacks.cpp: outputs/shared/jni/CHIPGlobalCallbacks.cpp 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 + jni/CHIPGlobalCallbacks.cpp: outputs/shared/jni/CHIPGlobalCallbacks.cpp java-class: inputs/several_clusters.matter: diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/shared/jni/CHIPGlobalCallbacks.cpp b/scripts/py_matter_idl/matter_idl/tests/outputs/shared/jni/CHIPGlobalCallbacks.cpp new file mode 100644 index 00000000000000..e89045213a74c8 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/shared/jni/CHIPGlobalCallbacks.cpp @@ -0,0 +1,603 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +CHIPBooleanAttributeCallback::CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPBooleanAttributeCallback::~CHIPBooleanAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPBooleanAttributeCallback::CallbackFn(void * context, bool value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Z)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPCharStringAttributeCallback::CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPCharStringAttributeCallback::~CHIPCharStringAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPCharStringAttributeCallback::CallbackFn(void * context, const chip::CharSpan value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/String;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + + chip::UtfString valueStr(env, value); + env->CallVoidMethod(javaCallbackRef, javaMethod, valueStr.jniValue()); +} + +CHIPDoubleAttributeCallback::CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDoubleAttributeCallback::~CHIPDoubleAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDoubleAttributeCallback::CallbackFn(void * context, double value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(D)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPFloatAttributeCallback::CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPFloatAttributeCallback::~CHIPFloatAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPFloatAttributeCallback::CallbackFn(void * context, float value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(F)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt8sAttributeCallback::CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt8sAttributeCallback::~CHIPInt8sAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt8sAttributeCallback::CallbackFn(void * context, int8_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt8uAttributeCallback::CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt8uAttributeCallback::~CHIPInt8uAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt8uAttributeCallback::CallbackFn(void * context, uint8_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt16sAttributeCallback::CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt16sAttributeCallback::~CHIPInt16sAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt16sAttributeCallback::CallbackFn(void * context, int16_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt16uAttributeCallback::CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt16uAttributeCallback::~CHIPInt16uAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt16uAttributeCallback::CallbackFn(void * context, uint16_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt32sAttributeCallback::CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt32sAttributeCallback::~CHIPInt32sAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt32sAttributeCallback::CallbackFn(void * context, int32_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt32uAttributeCallback::CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt32uAttributeCallback::~CHIPInt32uAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt32uAttributeCallback::CallbackFn(void * context, uint32_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt64sAttributeCallback::CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt64sAttributeCallback::~CHIPInt64sAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt64sAttributeCallback::CallbackFn(void * context, int64_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPInt64uAttributeCallback::CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPInt64uAttributeCallback::~CHIPInt64uAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPInt64uAttributeCallback::CallbackFn(void * context, uint64_t value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); +} + +CHIPOctetStringAttributeCallback::CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPOctetStringAttributeCallback::~CHIPOctetStringAttributeCallback() { + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPOctetStringAttributeCallback::CallbackFn(void * context, const chip::ByteSpan value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a + // null callback. + jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "([B)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); + + VerifyOrReturn(chip::CanCastTo(value.size()), ChipLogError(Zcl, "Value too long")); + jbyteArray valueArr = env->NewByteArray(static_cast(value.size())); + env->ExceptionClear(); + env->SetByteArrayRegion(valueArr, 0, static_cast(value.size()), reinterpret_cast(value.data())); + + env->CallVoidMethod(javaCallbackRef, javaMethod, valueArr); +} + + diff --git a/scripts/tools/zap/generate.py b/scripts/tools/zap/generate.py index 5b1f4f4c629f49..46ae0ebf95a187 100755 --- a/scripts/tools/zap/generate.py +++ b/scripts/tools/zap/generate.py @@ -34,7 +34,7 @@ @dataclass class CmdLineArgs: - zapFile: str + zapFile: Optional[str] zclFile: str templateFile: str outputDir: str @@ -44,6 +44,7 @@ class CmdLineArgs: version_check: bool = True lock_file: Optional[str] = None delete_output_dir: bool = False + matter_file_name: Optional[str] = None CHIP_ROOT_DIR = os.path.realpath( @@ -118,13 +119,15 @@ def runArgumentsParser() -> CmdLineArgs: parser = argparse.ArgumentParser( description='Generate artifacts from .zapt templates') - parser.add_argument('zap', help='Path to the application .zap file') + parser.add_argument('zap', nargs="?", default=None, help='Path to the application .zap file') parser.add_argument('-t', '--templates', default=default_templates, help='Path to the .zapt templates records to use for generating artifacts (default: "' + default_templates + '")') parser.add_argument('-z', '--zcl', help='Path to the zcl templates records to use for generating artifacts (default: autodetect read from zap file)') parser.add_argument('-o', '--output-dir', default=None, help='Output directory for the generated files (default: a temporary directory in out)') + parser.add_argument('-m', '--matter-file-name', default=None, + help='Where to copy any generated .matter file') parser.add_argument('--run-bootstrap', default=None, action='store_true', help='Automatically run ZAP bootstrap. By default the bootstrap is not triggered') parser.add_argument('--parallel', action='store_true') @@ -143,6 +146,7 @@ def runArgumentsParser() -> CmdLineArgs: parser.set_defaults(version_check=True) parser.set_defaults(lock_file=None) parser.set_defaults(keep_output_dir=False) + parser.set_defaults(matter_file_name=None) args = parser.parse_args() delete_output_dir = False @@ -154,7 +158,10 @@ def runArgumentsParser() -> CmdLineArgs: else: output_dir = '' - zap_file = getFilePath(args.zap) + if args.zap: + zap_file = getFilePath(args.zap) + else: + zap_file = None if args.zcl: zcl_file = getFilePath(args.zcl) @@ -164,6 +171,11 @@ def runArgumentsParser() -> CmdLineArgs: templates_file = getFilePath(args.templates) output_dir = getDirPath(output_dir) + if args.matter_file_name: + matter_file_name = getFilePath(args.matter_file_name) + else: + matter_file_name = None + return CmdLineArgs( zap_file, zcl_file, templates_file, output_dir, args.run_bootstrap, parallel=args.parallel, @@ -171,10 +183,24 @@ def runArgumentsParser() -> CmdLineArgs: version_check=args.version_check, lock_file=args.lock_file, delete_output_dir=delete_output_dir, + matter_file_name=matter_file_name, ) -def extractGeneratedIdl(output_dir, zap_config_path): +def matterPathFromZapPath(zap_config_path): + if not zap_config_path: + return None + + target_path = zap_config_path.replace(".zap", ".matter") + if not target_path.endswith(".matter"): + # We expect "something.zap" and don't handle corner cases of + # multiple extensions. This is to work with existing codebase only + raise Error("Unexpected input zap file %s" % self.zap_config) + + return target_path + + +def extractGeneratedIdl(output_dir, matter_name): """Find a file Clusters.matter in the output directory and place it along with the input zap file. @@ -184,13 +210,7 @@ def extractGeneratedIdl(output_dir, zap_config_path): if not os.path.exists(idl_path): return - target_path = zap_config_path.replace(".zap", ".matter") - if not target_path.endswith(".matter"): - # We expect "something.zap" and don't handle corner cases of - # multiple extensions. This is to work with existing codebase only - raise Error("Unexpected input zap file %s" % self.zap_config) - - shutil.move(idl_path, target_path) + shutil.move(idl_path, matter_name) def runGeneration(cmdLineArgs): @@ -205,8 +225,11 @@ def runGeneration(cmdLineArgs): if cmdLineArgs.version_check: tool.version_check() - args = ['-z', zcl_file, '-g', templates_file, - '-i', zap_file, '-o', output_dir] + args = ['-z', zcl_file, '-g', templates_file, '-o', output_dir] + + if zap_file: + args.append('-i') + args.append(zap_file) if parallel: # Parallel-compatible runs will need separate state @@ -214,7 +237,13 @@ def runGeneration(cmdLineArgs): tool.run('generate', *args) - extractGeneratedIdl(output_dir, zap_file) + if cmdLineArgs.matter_file_name: + matter_name = cmdLineArgs.matter_file_name + else: + matter_name = matterPathFromZapPath(zap_file) + + if matter_name: + extractGeneratedIdl(output_dir, matter_name) def getClangFormatBinaryChoices(): diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 4bf94f15203a03..9522d008579d41 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -27,13 +27,14 @@ from dataclasses import dataclass from enum import Flag, auto from pathlib import Path +from typing import List CHIP_ROOT_DIR = os.path.realpath( os.path.join(os.path.dirname(__file__), '../..')) -# Type of targets that can be re-generated class TargetType(Flag): + """Type of targets that can be re-generated""" # Tests for golden images TESTS = auto() @@ -65,6 +66,52 @@ class TargetType(Flag): } +class ZapInput: + """ZAP may be run from a .zap configuration or from just cluster XML. + + Running from a '.zap' configuration will load the cluster XML and + it will also load cluster enabling and settings defined in the .zap + configuration. + + For `client-side` code generation, CHIP wants to explicitly not depend + on zap enabling/disabling as everything should be enabled. + """ + + @staticmethod + def FromZap(f): + return ZapInput(zap_file=str(f)) + + @staticmethod + def FromPropertiesJson(f): + """ Build without a ".zap" file, use the `-z/--zclProperties` command in zap. """ + return ZapInput(properties_json=str(f)) + + def __init__(self, zap_file=None, properties_json=None): + if zap_file and properties_json: + raise Exception("only one of zap/zcl should be specified") + self.zap_file = zap_file + self.properties_json = properties_json + + @property + def value(self) -> str: + if self.zap_file: + return f"ZAP:{self.zap_file}" + return f"ZCL:{self.properties_json}" + + @property + def is_for_chef_example(self) -> bool: + if self.zap_file is None: + return False + + return "chef" in self.zap_file + + def build_command(self, script: str) -> List[str]: + """What command to execute for this zap input. """ + if self.zap_file: + return [script, self.zap_file] + return [script, '-z', self.properties_json] + + @dataclass class TargetRunStats: config: str @@ -88,18 +135,19 @@ class ZapDistinctOutput: class ZAPGenerateTarget: @staticmethod - def MatterIdlTarget(zap_config, client_side=False): + def MatterIdlTarget(zap_config: ZapInput, client_side=False, matter_file_name=None): if client_side: - return ZAPGenerateTarget(zap_config, template="src/app/zap-templates/matter-idl-client.json", output_dir=None) + return ZAPGenerateTarget(zap_config, matter_file_name=matter_file_name, template="src/app/zap-templates/matter-idl-client.json", output_dir=None) else: # NOTE: this assumes `src/app/zap-templates/matter-idl-server.json` is the # DEFAULT generation target and it needs no output_dir - return ZAPGenerateTarget(zap_config, template=None, output_dir=None) + return ZAPGenerateTarget(zap_config, matter_file_name=matter_file_name, template=None, output_dir=None) - def __init__(self, zap_config, template, output_dir=None): + def __init__(self, zap_config: ZapInput, template, output_dir=None, matter_file_name=None): self.script = './scripts/tools/zap/generate.py' - self.zap_config = str(zap_config) + self.zap_config = zap_config self.template = template + self.matter_file_name = matter_file_name if output_dir: # make sure we convert any os.PathLike object to string @@ -119,7 +167,7 @@ def distinct_output(self): # output_directory is MIS-USED here because zap files may reside in the same # directory (e.g. chef) so we claim the zap config is an output directory # for uniqueness - return ZapDistinctOutput(input_template=None, output_directory=self.zap_config) + return ZapDistinctOutput(input_template=None, output_directory=self.zap_config.value) else: return ZapDistinctOutput(input_template=self.template, output_directory=self.output_dir) @@ -131,7 +179,7 @@ def log_command(self): def build_cmd(self): """Builds the command line we would run to generate this target. """ - cmd = [self.script, self.zap_config] + cmd = self.zap_config.build_command(self.script) if self.template: cmd.append('-t') @@ -143,6 +191,10 @@ def build_cmd(self): cmd.append('-o') cmd.append(self.output_dir) + if self.matter_file_name: + cmd.append('-m') + cmd.append(self.matter_file_name) + return cmd def generate(self) -> TargetRunStats: @@ -155,8 +207,8 @@ def generate(self) -> TargetRunStats: subprocess.check_call(cmd) generate_end = time.time() - if "chef" in self.zap_config: - idl_path = self.zap_config.replace(".zap", ".matter") + if self.zap_config.is_for_chef_example: + idl_path = self.zap_config.zap_file.replace(".zap", ".matter") target_path = os.path.join("examples", "chef", "devices", @@ -164,7 +216,7 @@ def generate(self) -> TargetRunStats: os.rename(idl_path, target_path) return TargetRunStats( generate_time=generate_end - generate_start, - config=self.zap_config, + config=self.zap_config.value, template=self.template, ) @@ -303,8 +355,8 @@ def getGlobalTemplatesTargets(): template = os.path.join( 'examples', 'placeholder', 'linux', 'apps', example_name, 'templates', 'templates.json') - targets.append(ZAPGenerateTarget.MatterIdlTarget(filepath)) - targets.append(ZAPGenerateTarget(filepath, output_dir=output_dir, template=template)) + targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromZap(filepath))) + targets.append(ZAPGenerateTarget(ZapInput.FromZap(filepath), output_dir=output_dir, template=template)) continue if example_name == "chef": @@ -326,9 +378,10 @@ def getGlobalTemplatesTargets(): # a name like output_dir = os.path.join( 'zzz_generated', generate_subdir, 'zap-generated') - targets.append(ZAPGenerateTarget.MatterIdlTarget(filepath)) + targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromZap(filepath))) - targets.append(ZAPGenerateTarget.MatterIdlTarget('src/controller/data_model/controller-clusters.zap', client_side=True)) + targets.append(ZAPGenerateTarget.MatterIdlTarget(ZapInput.FromPropertiesJson('src/app/zap-templates/zcl/zcl.json'), + client_side=True, matter_file_name="src/controller/data_model/controller-clusters.matter")) return targets @@ -345,14 +398,13 @@ def getCodegenTemplates(): def getTestsTemplatesTargets(test_target): + zap_input = ZapInput.FromPropertiesJson('src/app/zap-templates/zcl/zcl.json') templates = { 'chip-tool': { - 'zap': 'src/controller/data_model/controller-clusters.zap', 'template': 'examples/chip-tool/templates/tests/templates.json', 'output_dir': 'zzz_generated/chip-tool/zap-generated' }, 'darwin-framework-tool': { - 'zap': 'src/controller/data_model/controller-clusters.zap', 'template': 'examples/darwin-framework-tool/templates/tests/templates.json', 'output_dir': 'zzz_generated/darwin-framework-tool/zap-generated' } @@ -363,8 +415,7 @@ def getTestsTemplatesTargets(test_target): if test_target == 'all' or test_target == key: logging.info("Found test target %s (via %s)" % (key, target['template'])) - targets.append(ZAPGenerateTarget( - target['zap'], template=target['template'], output_dir=target['output_dir'])) + targets.append(ZAPGenerateTarget(zap_input, template=target['template'], output_dir=target['output_dir'])) return targets @@ -374,7 +425,7 @@ def getGoldenTestImageTargets(): def getSpecificTemplatesTargets(): - zap_filepath = 'src/controller/data_model/controller-clusters.zap' + zap_input = ZapInput.FromPropertiesJson('src/app/zap-templates/zcl/zcl.json') # Mapping of required template and output directory templates = { @@ -390,8 +441,7 @@ def getSpecificTemplatesTargets(): targets = [] for template, output_dir in templates.items(): logging.info("Found specific template %s" % template) - targets.append(ZAPGenerateTarget( - zap_filepath, template=template, output_dir=output_dir)) + targets.append(ZAPGenerateTarget(zap_input, template=template, output_dir=output_dir)) return targets diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn index f97ccd00a43af7..72e981c8a60992 100644 --- a/src/controller/data_model/BUILD.gn +++ b/src/controller/data_model/BUILD.gn @@ -80,8 +80,6 @@ if (current_os == "android" || matter_enable_java_compilation) { "jni/BromodichloromethaneConcentrationMeasurementClient-ReadImpl.cpp", "jni/BromoformConcentrationMeasurementClient-InvokeSubscribeImpl.cpp", "jni/BromoformConcentrationMeasurementClient-ReadImpl.cpp", - "jni/CHIPCallbackTypes.h", - "jni/CHIPReadCallbacks.h", "jni/CarbonDioxideConcentrationMeasurementClient-InvokeSubscribeImpl.cpp", "jni/CarbonDioxideConcentrationMeasurementClient-ReadImpl.cpp", "jni/CarbonMonoxideConcentrationMeasurementClient-InvokeSubscribeImpl.cpp", @@ -90,6 +88,9 @@ if (current_os == "android" || matter_enable_java_compilation) { "jni/CeramicFilterMonitoringClient-ReadImpl.cpp", "jni/ChannelClient-InvokeSubscribeImpl.cpp", "jni/ChannelClient-ReadImpl.cpp", + "jni/CHIPCallbackTypes.h", + "jni/CHIPGlobalCallbacks.cpp", + "jni/CHIPReadCallbacks.h", "jni/ChloraminesConcentrationMeasurementClient-InvokeSubscribeImpl.cpp", "jni/ChloraminesConcentrationMeasurementClient-ReadImpl.cpp", "jni/ChlorineConcentrationMeasurementClient-InvokeSubscribeImpl.cpp", diff --git a/src/controller/java/templates/CHIPReadCallbacks-src.zapt b/src/controller/java/templates/CHIPReadCallbacks-src.zapt index 7e5853380d367d..b1feb25f3e5316 100644 --- a/src/controller/java/templates/CHIPReadCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPReadCallbacks-src.zapt @@ -10,80 +10,6 @@ #include #include -{{#chip_server_global_responses}} -{{! TODO: Add support for struct-typed attributes }} -{{#unless (isStrEqual chipCallback.name "Unsupported")}} - -CHIP{{chipCallback.name}}AttributeCallback::CHIP{{chipCallback.name}}AttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback<{{chipCallback.name}}AttributeCallback>(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIP{{chipCallback.name}}AttributeCallback::~CHIP{{chipCallback.name}}AttributeCallback() { - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIP{{chipCallback.name}}AttributeCallback::CallbackFn(void * context, {{chipCallback.type}} value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback(reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - {{#unless (isStrEqual chipCallback.name "OctetString")}} - {{#unless (isStrEqual chipCallback.name "CharString")}} - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "({{convertCTypeToJniSignature chipCallback.type false}})V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast<{{convertBasicCTypeToJniType chipCallback.type}}>(value)); - {{/unless}} - {{/unless}} - - {{#if (isStrEqual chipCallback.name "OctetString")}} - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "([B)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - - VerifyOrReturn(chip::CanCastTo(value.size()), ChipLogError(Zcl, "Value too long")); - jbyteArray valueArr = env->NewByteArray(static_cast(value.size())); - env->ExceptionClear(); - env->SetByteArrayRegion(valueArr, 0, static_cast(value.size()), reinterpret_cast(value.data())); - - env->CallVoidMethod(javaCallbackRef, javaMethod, valueArr); - {{/if}} - - {{#if (isStrEqual chipCallback.name "CharString")}} - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/String;)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - - chip::UtfString valueStr(env, value); - env->CallVoidMethod(javaCallbackRef, javaMethod, valueStr.jniValue()); - {{/if}} -} -{{/unless}} -{{/chip_server_global_responses}} - {{#zcl_clusters}} {{#zcl_attributes_server removeKeys='isOptional'}} {{! TODO: Add support for struct-typed attributes }} diff --git a/src/controller/java/templates/ChipClusters-java.zapt b/src/controller/java/templates/ChipClusters-java.zapt index 59cd477d802c89..1f02502b7ac533 100644 --- a/src/controller/java/templates/ChipClusters-java.zapt +++ b/src/controller/java/templates/ChipClusters-java.zapt @@ -110,9 +110,8 @@ public class ChipClusters { @Override public native long initWithDevice(long devicePtr, int endpointId); - {{#all_user_cluster_generated_commands}} - {{#if_compare clusterId ../id operator='=='}} - {{#if (is_str_equal commandSource 'client')}} + {{#zcl_commands}} + {{#if (is_str_equal source 'client')}} {{#unless mustUseTimedInvoke}} public void {{asLowerCamelCase name}}({{#if hasSpecificResponse}}{{asUpperCamelCase responseName}}Callback{{else}}DefaultClusterCallback{{/if}} callback @@ -127,29 +126,24 @@ public class ChipClusters { {{asLowerCamelCase name}}(chipClusterPtr, callback{{#zcl_command_arguments}}, {{asLowerCamelCase label}}{{/zcl_command_arguments}}, timedInvokeTimeoutMs); } {{/if}} - {{/if_compare}} - {{/all_user_cluster_generated_commands}} - {{#all_user_cluster_generated_commands}} - {{#if_compare clusterId ../id operator='=='}} - {{#if (is_str_equal commandSource 'client')}} + {{/zcl_commands}} + {{#zcl_commands}} + {{#if (is_str_equal source 'client')}} private native void {{asLowerCamelCase name}}(long chipClusterPtr, {{#if hasSpecificResponse}}{{asUpperCamelCase responseName}}Callback{{else}}DefaultClusterCallback{{/if}} Callback {{#zcl_command_arguments}}, {{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}} , @Nullable Integer timedInvokeTimeoutMs); {{/if}} - {{/if_compare}} - {{/all_user_cluster_generated_commands}} - {{#all_user_cluster_generated_commands}} - {{#if_compare clusterId ../id operator='=='}} - {{#if (is_str_equal commandSource 'server')}} + {{/zcl_commands}} + {{#zcl_commands}} + {{#if (is_str_equal source 'server')}} public interface {{asUpperCamelCase name}}Callback { void onSuccess({{#zcl_command_arguments}}{{#not_first}}, {{/not_first}}{{asJavaType type chipType parent.parent.name includeAnnotations=true clusterId=parent.parent.id}} {{asLowerCamelCase label}}{{/zcl_command_arguments}}); - + void onError(Exception error); } - {{/if}} - {{/if_compare}} - {{/all_user_cluster_generated_commands}} + {{/if}} + {{/zcl_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} {{#if_unsupported_attribute_callback type isArray ../id}} diff --git a/src/controller/java/templates/ClusterInfo-java.zapt b/src/controller/java/templates/ClusterInfo-java.zapt index 53666f7b68424c..d80780c2819e1f 100644 --- a/src/controller/java/templates/ClusterInfo-java.zapt +++ b/src/controller/java/templates/ClusterInfo-java.zapt @@ -198,9 +198,8 @@ public class ClusterInfoMapping { } } {{#zcl_clusters}} - {{#all_user_cluster_generated_commands}} - {{#if_compare clusterId ../id operator='=='}} - {{#if (is_str_equal commandSource 'server')}} + {{#zcl_commands}} + {{#if (is_str_equal source 'server')}} public static class Delegated{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Callback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}Callback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -235,8 +234,7 @@ public class ClusterInfoMapping { } {{/if}} - {{/if_compare}} - {{/all_user_cluster_generated_commands}} + {{/zcl_commands}} {{#zcl_attributes_server removeKeys='isOptional'}} {{#if_unsupported_attribute_callback type isArray ../id}} {{else}} @@ -311,9 +309,8 @@ public class ClusterInfoMapping { Map> commandMap = new HashMap<>(); {{#zcl_clusters}} Map {{asLowerCamelCase name}}ClusterInteractionInfoMap = new LinkedHashMap<>(); - {{#all_user_cluster_generated_commands}} - {{#if_compare clusterId ../id operator='=='}} - {{#if (is_str_equal commandSource 'client')}} + {{#zcl_commands}} + {{#if (is_str_equal source 'client')}} Map {{asLowerCamelCase ../name}}{{asLowerCamelCase name}}CommandParams = new LinkedHashMap(); {{! TODO: fill out parameter types }} {{#if hasArguments}} @@ -362,8 +359,7 @@ public class ClusterInfoMapping { {{/if}} {{asLowerCamelCase ../name}}ClusterInteractionInfoMap.put("{{asLowerCamelCase name}}", {{asLowerCamelCase ../name}}{{asLowerCamelCase name}}InteractionInfo); {{/if}} - {{/if_compare}} - {{/all_user_cluster_generated_commands}} + {{/zcl_commands}} commandMap.put("{{asLowerCamelCase name}}", {{asLowerCamelCase name}}ClusterInteractionInfoMap); {{/zcl_clusters}} return commandMap; diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index d113e22b7436cc..9471d374bc6092 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -27,653 +27,6 @@ #include #include -CHIPBooleanAttributeCallback::CHIPBooleanAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPBooleanAttributeCallback::~CHIPBooleanAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPBooleanAttributeCallback::CallbackFn(void * context, bool value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Z)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPCharStringAttributeCallback::CHIPCharStringAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPCharStringAttributeCallback::~CHIPCharStringAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPCharStringAttributeCallback::CallbackFn(void * context, const chip::CharSpan value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/String;)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - - chip::UtfString valueStr(env, value); - env->CallVoidMethod(javaCallbackRef, javaMethod, valueStr.jniValue()); -} - -CHIPDoubleAttributeCallback::CHIPDoubleAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPDoubleAttributeCallback::~CHIPDoubleAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPDoubleAttributeCallback::CallbackFn(void * context, double value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(D)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPFloatAttributeCallback::CHIPFloatAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPFloatAttributeCallback::~CHIPFloatAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPFloatAttributeCallback::CallbackFn(void * context, float value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(F)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt8sAttributeCallback::CHIPInt8sAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt8sAttributeCallback::~CHIPInt8sAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt8sAttributeCallback::CallbackFn(void * context, int8_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt8uAttributeCallback::CHIPInt8uAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt8uAttributeCallback::~CHIPInt8uAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt8uAttributeCallback::CallbackFn(void * context, uint8_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt16sAttributeCallback::CHIPInt16sAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt16sAttributeCallback::~CHIPInt16sAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt16sAttributeCallback::CallbackFn(void * context, int16_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt16uAttributeCallback::CHIPInt16uAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt16uAttributeCallback::~CHIPInt16uAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt16uAttributeCallback::CallbackFn(void * context, uint16_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(I)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt32sAttributeCallback::CHIPInt32sAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt32sAttributeCallback::~CHIPInt32sAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt32sAttributeCallback::CallbackFn(void * context, int32_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt32uAttributeCallback::CHIPInt32uAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt32uAttributeCallback::~CHIPInt32uAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt32uAttributeCallback::CallbackFn(void * context, uint32_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt64sAttributeCallback::CHIPInt64sAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt64sAttributeCallback::~CHIPInt64sAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt64sAttributeCallback::CallbackFn(void * context, int64_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPInt64uAttributeCallback::CHIPInt64uAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPInt64uAttributeCallback::~CHIPInt64uAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPInt64uAttributeCallback::CallbackFn(void * context, uint64_t value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(J)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - env->CallVoidMethod(javaCallbackRef, javaMethod, static_cast(value)); -} - -CHIPOctetStringAttributeCallback::CHIPOctetStringAttributeCallback(jobject javaCallback, bool keepAlive) : - chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - return; - } - javaCallbackRef = env->NewGlobalRef(javaCallback); - if (javaCallbackRef == nullptr) - { - ChipLogError(Zcl, "Could not create global reference for Java callback"); - } -} - -CHIPOctetStringAttributeCallback::~CHIPOctetStringAttributeCallback() -{ - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - if (env == nullptr) - { - ChipLogError(Zcl, "Could not delete global reference for Java callback"); - return; - } - env->DeleteGlobalRef(javaCallbackRef); -} - -void CHIPOctetStringAttributeCallback::CallbackFn(void * context, const chip::ByteSpan value) -{ - chip::DeviceLayer::StackUnlock unlock; - CHIP_ERROR err = CHIP_NO_ERROR; - - JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); - VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); - - std::unique_ptr cppCallback( - reinterpret_cast(context), maybeDestroy); - - // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. - jobject javaCallbackRef = cppCallback.get()->javaCallbackRef; - VerifyOrReturn(javaCallbackRef != nullptr, - ChipLogDetail(Zcl, "Early return from attribute callback since Java callback is null")); - - jmethodID javaMethod; - - err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "([B)V", &javaMethod); - VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess method")); - - VerifyOrReturn(chip::CanCastTo(value.size()), ChipLogError(Zcl, "Value too long")); - jbyteArray valueArr = env->NewByteArray(static_cast(value.size())); - env->ExceptionClear(); - env->SetByteArrayRegion(valueArr, 0, static_cast(value.size()), reinterpret_cast(value.data())); - - env->CallVoidMethod(javaCallbackRef, javaMethod, valueArr); -} - CHIPIdentifyGeneratedCommandListAttributeCallback::CHIPIdentifyGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 6b848ae9a7f385..c3280d68346e26 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -432,25 +432,25 @@ private native void addGroupIfIdentifying(long chipClusterPtr, DefaultClusterCal , @Nullable Integer timedInvokeTimeoutMs); public interface AddGroupResponseCallback { void onSuccess(Integer status, Integer groupID); - + void onError(Exception error); } public interface ViewGroupResponseCallback { void onSuccess(Integer status, Integer groupID, String groupName); - + void onError(Exception error); } public interface GetGroupMembershipResponseCallback { void onSuccess(@Nullable Integer capacity, ArrayList groupList); - + void onError(Exception error); } public interface RemoveGroupResponseCallback { void onSuccess(Integer status, Integer groupID); - + void onError(Exception error); } @@ -696,6 +696,39 @@ public void getSceneMembership(GetSceneMembershipResponseCallback callback , int timedInvokeTimeoutMs) { getSceneMembership(chipClusterPtr, callback, groupID, timedInvokeTimeoutMs); } + + public void enhancedAddScene(EnhancedAddSceneResponseCallback callback + , Integer groupID, Integer sceneID, Integer transitionTime, String sceneName, ArrayList extensionFieldSets) { + enhancedAddScene(chipClusterPtr, callback, groupID, sceneID, transitionTime, sceneName, extensionFieldSets, null); + } + + public void enhancedAddScene(EnhancedAddSceneResponseCallback callback + , Integer groupID, Integer sceneID, Integer transitionTime, String sceneName, ArrayList extensionFieldSets + , int timedInvokeTimeoutMs) { + enhancedAddScene(chipClusterPtr, callback, groupID, sceneID, transitionTime, sceneName, extensionFieldSets, timedInvokeTimeoutMs); + } + + public void enhancedViewScene(EnhancedViewSceneResponseCallback callback + , Integer groupID, Integer sceneID) { + enhancedViewScene(chipClusterPtr, callback, groupID, sceneID, null); + } + + public void enhancedViewScene(EnhancedViewSceneResponseCallback callback + , Integer groupID, Integer sceneID + , int timedInvokeTimeoutMs) { + enhancedViewScene(chipClusterPtr, callback, groupID, sceneID, timedInvokeTimeoutMs); + } + + public void copyScene(CopySceneResponseCallback callback + , Integer mode, Integer groupIdentifierFrom, Integer sceneIdentifierFrom, Integer groupIdentifierTo, Integer sceneIdentifierTo) { + copyScene(chipClusterPtr, callback, mode, groupIdentifierFrom, sceneIdentifierFrom, groupIdentifierTo, sceneIdentifierTo, null); + } + + public void copyScene(CopySceneResponseCallback callback + , Integer mode, Integer groupIdentifierFrom, Integer sceneIdentifierFrom, Integer groupIdentifierTo, Integer sceneIdentifierTo + , int timedInvokeTimeoutMs) { + copyScene(chipClusterPtr, callback, mode, groupIdentifierFrom, sceneIdentifierFrom, groupIdentifierTo, sceneIdentifierTo, timedInvokeTimeoutMs); + } private native void addScene(long chipClusterPtr, AddSceneResponseCallback Callback , Integer groupID, Integer sceneID, Integer transitionTime, String sceneName, ArrayList extensionFieldSets , @Nullable Integer timedInvokeTimeoutMs); @@ -717,39 +750,66 @@ private native void recallScene(long chipClusterPtr, DefaultClusterCallback Call private native void getSceneMembership(long chipClusterPtr, GetSceneMembershipResponseCallback Callback , Integer groupID , @Nullable Integer timedInvokeTimeoutMs); + private native void enhancedAddScene(long chipClusterPtr, EnhancedAddSceneResponseCallback Callback + , Integer groupID, Integer sceneID, Integer transitionTime, String sceneName, ArrayList extensionFieldSets + , @Nullable Integer timedInvokeTimeoutMs); + private native void enhancedViewScene(long chipClusterPtr, EnhancedViewSceneResponseCallback Callback + , Integer groupID, Integer sceneID + , @Nullable Integer timedInvokeTimeoutMs); + private native void copyScene(long chipClusterPtr, CopySceneResponseCallback Callback + , Integer mode, Integer groupIdentifierFrom, Integer sceneIdentifierFrom, Integer groupIdentifierTo, Integer sceneIdentifierTo + , @Nullable Integer timedInvokeTimeoutMs); public interface AddSceneResponseCallback { void onSuccess(Integer status, Integer groupID, Integer sceneID); - + void onError(Exception error); } public interface ViewSceneResponseCallback { void onSuccess(Integer status, Integer groupID, Integer sceneID, Optional transitionTime, Optional sceneName, Optional> extensionFieldSets); - + void onError(Exception error); } public interface RemoveSceneResponseCallback { void onSuccess(Integer status, Integer groupID, Integer sceneID); - + void onError(Exception error); } public interface RemoveAllScenesResponseCallback { void onSuccess(Integer status, Integer groupID); - + void onError(Exception error); } public interface StoreSceneResponseCallback { void onSuccess(Integer status, Integer groupID, Integer sceneID); - + void onError(Exception error); } public interface GetSceneMembershipResponseCallback { void onSuccess(Integer status, @Nullable Integer capacity, Integer groupID, Optional> sceneList); - + + void onError(Exception error); + } + + public interface EnhancedAddSceneResponseCallback { + void onSuccess(Integer status, Integer groupID, Integer sceneID); + + void onError(Exception error); + } + + public interface EnhancedViewSceneResponseCallback { + void onSuccess(Integer status, Integer groupID, Integer sceneID, Optional transitionTime, Optional sceneName, Optional> extensionFieldSets); + + void onError(Exception error); + } + + public interface CopySceneResponseCallback { + void onSuccess(Integer status, Integer groupIdentifierFrom, Integer sceneIdentifierFrom); + void onError(Exception error); } @@ -1694,6 +1754,17 @@ public void stopWithOnOff(DefaultClusterCallback callback , int timedInvokeTimeoutMs) { stopWithOnOff(chipClusterPtr, callback, optionsMask, optionsOverride, timedInvokeTimeoutMs); } + + public void moveToClosestFrequency(DefaultClusterCallback callback + , Integer frequency) { + moveToClosestFrequency(chipClusterPtr, callback, frequency, null); + } + + public void moveToClosestFrequency(DefaultClusterCallback callback + , Integer frequency + , int timedInvokeTimeoutMs) { + moveToClosestFrequency(chipClusterPtr, callback, frequency, timedInvokeTimeoutMs); + } private native void moveToLevel(long chipClusterPtr, DefaultClusterCallback Callback , Integer level, @Nullable Integer transitionTime, Integer optionsMask, Integer optionsOverride , @Nullable Integer timedInvokeTimeoutMs); @@ -1718,6 +1789,9 @@ private native void stepWithOnOff(long chipClusterPtr, DefaultClusterCallback Ca private native void stopWithOnOff(long chipClusterPtr, DefaultClusterCallback Callback , Integer optionsMask, Integer optionsOverride , @Nullable Integer timedInvokeTimeoutMs); + private native void moveToClosestFrequency(long chipClusterPtr, DefaultClusterCallback Callback + , Integer frequency + , @Nullable Integer timedInvokeTimeoutMs); public interface CurrentLevelAttributeCallback { void onSuccess(@Nullable Integer value); @@ -3812,6 +3886,20 @@ public BasicInformationCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void mfgSpecificPing(DefaultClusterCallback callback + ) { + mfgSpecificPing(chipClusterPtr, callback, null); + } + + public void mfgSpecificPing(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + mfgSpecificPing(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void mfgSpecificPing(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -4389,13 +4477,13 @@ private native void notifyUpdateApplied(long chipClusterPtr, DefaultClusterCallb , @Nullable Integer timedInvokeTimeoutMs); public interface QueryImageResponseCallback { void onSuccess(Integer status, Optional delayedActionTime, Optional imageURI, Optional softwareVersion, Optional softwareVersionString, Optional updateToken, Optional userConsentNeeded, Optional metadataForRequestor); - + void onError(Exception error); } public interface ApplyUpdateResponseCallback { void onSuccess(Integer action, Long delayedActionTime); - + void onError(Exception error); } @@ -6402,19 +6490,19 @@ private native void commissioningComplete(long chipClusterPtr, CommissioningComp , @Nullable Integer timedInvokeTimeoutMs); public interface ArmFailSafeResponseCallback { void onSuccess(Integer errorCode, String debugText); - + void onError(Exception error); } public interface SetRegulatoryConfigResponseCallback { void onSuccess(Integer errorCode, String debugText); - + void onError(Exception error); } public interface CommissioningCompleteResponseCallback { void onSuccess(Integer errorCode, String debugText); - + void onError(Exception error); } @@ -6735,19 +6823,19 @@ private native void reorderNetwork(long chipClusterPtr, NetworkConfigResponseCal , @Nullable Integer timedInvokeTimeoutMs); public interface ScanNetworksResponseCallback { void onSuccess(Integer networkingStatus, Optional debugText, Optional> wiFiScanResults, Optional> threadScanResults); - + void onError(Exception error); } public interface NetworkConfigResponseCallback { void onSuccess(Integer networkingStatus, Optional debugText, Optional networkIndex); - + void onError(Exception error); } public interface ConnectNetworkResponseCallback { void onSuccess(Integer networkingStatus, Optional debugText, @Nullable Long errorValue); - + void onError(Exception error); } @@ -7094,7 +7182,7 @@ private native void retrieveLogsRequest(long chipClusterPtr, RetrieveLogsRespons , @Nullable Integer timedInvokeTimeoutMs); public interface RetrieveLogsResponseCallback { void onSuccess(Integer status, byte[] logContent, Optional UTCTimeStamp, Optional timeSinceBoot); - + void onError(Exception error); } @@ -10135,7 +10223,7 @@ private native void setDefaultNTP(long chipClusterPtr, DefaultClusterCallback Ca , @Nullable Integer timedInvokeTimeoutMs); public interface SetTimeZoneResponseCallback { void onSuccess(Boolean DSTOffsetRequired); - + void onError(Exception error); } @@ -11538,25 +11626,25 @@ private native void addTrustedRootCertificate(long chipClusterPtr, DefaultCluste , @Nullable Integer timedInvokeTimeoutMs); public interface AttestationResponseCallback { void onSuccess(byte[] attestationElements, byte[] attestationSignature); - + void onError(Exception error); } public interface CertificateChainResponseCallback { void onSuccess(byte[] certificate); - + void onError(Exception error); } public interface CSRResponseCallback { void onSuccess(byte[] NOCSRElements, byte[] attestationSignature); - + void onError(Exception error); } public interface NOCResponseCallback { void onSuccess(Integer statusCode, Optional fabricIndex, Optional debugText); - + void onError(Exception error); } @@ -11893,13 +11981,13 @@ private native void keySetReadAllIndices(long chipClusterPtr, KeySetReadAllIndic , @Nullable Integer timedInvokeTimeoutMs); public interface KeySetReadResponseCallback { void onSuccess(ChipStructs.GroupKeyManagementClusterGroupKeySetStruct groupKeySet); - + void onError(Exception error); } public interface KeySetReadAllIndicesResponseCallback { void onSuccess(ArrayList groupKeySetIDs); - + void onError(Exception error); } @@ -13140,7 +13228,7 @@ private native void stayActiveRequest(long chipClusterPtr, DefaultClusterCallbac , @Nullable Integer timedInvokeTimeoutMs); public interface RegisterClientResponseCallback { void onSuccess(Long ICDCounter); - + void onError(Exception error); } @@ -13737,7 +13825,7 @@ private native void changeToMode(long chipClusterPtr, ChangeToModeResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeToModeResponseCallback { void onSuccess(Integer status, Optional statusText); - + void onError(Exception error); } @@ -14012,7 +14100,7 @@ private native void changeToMode(long chipClusterPtr, ChangeToModeResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeToModeResponseCallback { void onSuccess(Integer status, Optional statusText); - + void onError(Exception error); } @@ -14542,7 +14630,7 @@ private native void changeToMode(long chipClusterPtr, ChangeToModeResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeToModeResponseCallback { void onSuccess(Integer status, Optional statusText); - + void onError(Exception error); } @@ -14817,7 +14905,7 @@ private native void changeToMode(long chipClusterPtr, ChangeToModeResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeToModeResponseCallback { void onSuccess(Integer status, Optional statusText); - + void onError(Exception error); } @@ -15574,7 +15662,7 @@ private native void changeToMode(long chipClusterPtr, ChangeToModeResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeToModeResponseCallback { void onSuccess(Integer status, Optional statusText); - + void onError(Exception error); } @@ -16425,9 +16513,23 @@ public void reset(DefaultClusterCallback callback , int timedInvokeTimeoutMs) { reset(chipClusterPtr, callback, alarms, timedInvokeTimeoutMs); } + + public void modifyEnabledAlarms(DefaultClusterCallback callback + , Long mask) { + modifyEnabledAlarms(chipClusterPtr, callback, mask, null); + } + + public void modifyEnabledAlarms(DefaultClusterCallback callback + , Long mask + , int timedInvokeTimeoutMs) { + modifyEnabledAlarms(chipClusterPtr, callback, mask, timedInvokeTimeoutMs); + } private native void reset(long chipClusterPtr, DefaultClusterCallback Callback , Long alarms , @Nullable Integer timedInvokeTimeoutMs); + private native void modifyEnabledAlarms(long chipClusterPtr, DefaultClusterCallback Callback + , Long mask + , @Nullable Integer timedInvokeTimeoutMs); public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); @@ -16651,6 +16753,68 @@ public OperationalStateCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void pause(OperationalCommandResponseCallback callback + ) { + pause(chipClusterPtr, callback, null); + } + + public void pause(OperationalCommandResponseCallback callback + + , int timedInvokeTimeoutMs) { + pause(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + + public void stop(OperationalCommandResponseCallback callback + ) { + stop(chipClusterPtr, callback, null); + } + + public void stop(OperationalCommandResponseCallback callback + + , int timedInvokeTimeoutMs) { + stop(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + + public void start(OperationalCommandResponseCallback callback + ) { + start(chipClusterPtr, callback, null); + } + + public void start(OperationalCommandResponseCallback callback + + , int timedInvokeTimeoutMs) { + start(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + + public void resume(OperationalCommandResponseCallback callback + ) { + resume(chipClusterPtr, callback, null); + } + + public void resume(OperationalCommandResponseCallback callback + + , int timedInvokeTimeoutMs) { + resume(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void pause(long chipClusterPtr, OperationalCommandResponseCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + private native void stop(long chipClusterPtr, OperationalCommandResponseCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + private native void start(long chipClusterPtr, OperationalCommandResponseCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + private native void resume(long chipClusterPtr, OperationalCommandResponseCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface OperationalCommandResponseCallback { + void onSuccess(ChipStructs.OperationalStateClusterErrorStateStruct commandResponseState); + + void onError(Exception error); + } + + public interface PhaseListAttributeCallback { void onSuccess(@Nullable List valueList); void onError(Exception ex); @@ -16950,7 +17114,7 @@ private native void resume(long chipClusterPtr, OperationalCommandResponseCallba , @Nullable Integer timedInvokeTimeoutMs); public interface OperationalCommandResponseCallback { void onSuccess(ChipStructs.RvcOperationalStateClusterErrorStateStruct commandResponseState); - + void onError(Exception error); } @@ -17197,6 +17361,20 @@ public HepaFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -17419,6 +17597,20 @@ public ActivatedCarbonFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -17641,6 +17833,20 @@ public CeramicFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -17863,6 +18069,20 @@ public ElectrostaticFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -18085,6 +18305,20 @@ public UvFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -18307,6 +18541,20 @@ public IonizingFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -18529,6 +18777,20 @@ public ZeoliteFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -18751,6 +19013,20 @@ public OzoneFilterMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -18973,6 +19249,20 @@ public WaterTankMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -19195,6 +19485,20 @@ public FuelTankMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -19417,6 +19721,20 @@ public InkCartridgeMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -19639,6 +19957,20 @@ public TonerCartridgeMonitoringCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void resetCondition(DefaultClusterCallback callback + ) { + resetCondition(chipClusterPtr, callback, null); + } + + public void resetCondition(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + resetCondition(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + private native void resetCondition(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -20030,6 +20362,13 @@ public void clearCredential(DefaultClusterCallback callback , int timedInvokeTimeoutMs) { clearCredential(chipClusterPtr, callback, credential, timedInvokeTimeoutMs); } + + + public void unboltDoor(DefaultClusterCallback callback + , Optional PINCode + , int timedInvokeTimeoutMs) { + unboltDoor(chipClusterPtr, callback, PINCode, timedInvokeTimeoutMs); + } private native void lockDoor(long chipClusterPtr, DefaultClusterCallback Callback , Optional PINCode , @Nullable Integer timedInvokeTimeoutMs); @@ -20084,39 +20423,42 @@ private native void getCredentialStatus(long chipClusterPtr, GetCredentialStatus private native void clearCredential(long chipClusterPtr, DefaultClusterCallback Callback , @Nullable ChipStructs.DoorLockClusterCredentialStruct credential , @Nullable Integer timedInvokeTimeoutMs); + private native void unboltDoor(long chipClusterPtr, DefaultClusterCallback Callback + , Optional PINCode + , @Nullable Integer timedInvokeTimeoutMs); public interface GetWeekDayScheduleResponseCallback { void onSuccess(Integer weekDayIndex, Integer userIndex, Integer status, Optional daysMask, Optional startHour, Optional startMinute, Optional endHour, Optional endMinute); - + void onError(Exception error); } public interface GetYearDayScheduleResponseCallback { void onSuccess(Integer yearDayIndex, Integer userIndex, Integer status, Optional localStartTime, Optional localEndTime); - + void onError(Exception error); } public interface GetHolidayScheduleResponseCallback { void onSuccess(Integer holidayIndex, Integer status, Optional localStartTime, Optional localEndTime, Optional operatingMode); - + void onError(Exception error); } public interface GetUserResponseCallback { void onSuccess(Integer userIndex, @Nullable String userName, @Nullable Long userUniqueID, @Nullable Integer userStatus, @Nullable Integer userType, @Nullable Integer credentialRule, @Nullable ArrayList credentials, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextUserIndex); - + void onError(Exception error); } public interface SetCredentialResponseCallback { void onSuccess(Integer status, @Nullable Integer userIndex, @Nullable Integer nextCredentialIndex); - + void onError(Exception error); } public interface GetCredentialStatusResponseCallback { void onSuccess(Boolean credentialExists, @Nullable Integer userIndex, @Nullable Integer creatorFabricIndex, @Nullable Integer lastModifiedFabricIndex, @Nullable Integer nextCredentialIndex); - + void onError(Exception error); } @@ -23018,7 +23360,7 @@ private native void clearWeeklySchedule(long chipClusterPtr, DefaultClusterCallb , @Nullable Integer timedInvokeTimeoutMs); public interface GetWeeklyScheduleResponseCallback { void onSuccess(Integer numberOfTransitionsForSequence, Integer dayOfWeekForSequence, Integer modeForSequence, ArrayList transitions); - + void onError(Exception error); } @@ -24398,6 +24740,20 @@ public FanControlCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void step(DefaultClusterCallback callback + , Integer direction, Optional wrap, Optional lowestOff) { + step(chipClusterPtr, callback, direction, wrap, lowestOff, null); + } + + public void step(DefaultClusterCallback callback + , Integer direction, Optional wrap, Optional lowestOff + , int timedInvokeTimeoutMs) { + step(chipClusterPtr, callback, direction, wrap, lowestOff, timedInvokeTimeoutMs); + } + private native void step(long chipClusterPtr, DefaultClusterCallback Callback + , Integer direction, Optional wrap, Optional lowestOff + , @Nullable Integer timedInvokeTimeoutMs); + public interface PercentSettingAttributeCallback { void onSuccess(@Nullable Integer value); void onError(Exception ex); @@ -42836,7 +43192,7 @@ private native void skipChannel(long chipClusterPtr, DefaultClusterCallback Call , @Nullable Integer timedInvokeTimeoutMs); public interface ChangeChannelResponseCallback { void onSuccess(Integer status, Optional data); - + void onError(Exception error); } @@ -43026,7 +43382,7 @@ private native void navigateTarget(long chipClusterPtr, NavigateTargetResponseCa , @Nullable Integer timedInvokeTimeoutMs); public interface NavigateTargetResponseCallback { void onSuccess(Integer status, Optional data); - + void onError(Exception error); } @@ -43375,7 +43731,7 @@ private native void seek(long chipClusterPtr, PlaybackResponseCallback Callback , @Nullable Integer timedInvokeTimeoutMs); public interface PlaybackResponseCallback { void onSuccess(Integer status, Optional data); - + void onError(Exception error); } @@ -44080,7 +44436,7 @@ private native void sendKey(long chipClusterPtr, SendKeyResponseCallback Callbac , @Nullable Integer timedInvokeTimeoutMs); public interface SendKeyResponseCallback { void onSuccess(Integer status); - + void onError(Exception error); } @@ -44260,7 +44616,7 @@ private native void launchURL(long chipClusterPtr, LauncherResponseCallback Call , @Nullable Integer timedInvokeTimeoutMs); public interface LauncherResponseCallback { void onSuccess(Integer status, Optional data); - + void onError(Exception error); } @@ -44723,7 +45079,7 @@ private native void hideApp(long chipClusterPtr, LauncherResponseCallback Callba , @Nullable Integer timedInvokeTimeoutMs); public interface LauncherResponseCallback { void onSuccess(Integer status, Optional data); - + void onError(Exception error); } @@ -45213,7 +45569,7 @@ private native void logout(long chipClusterPtr, DefaultClusterCallback Callback , @Nullable Integer timedInvokeTimeoutMs); public interface GetSetupPINResponseCallback { void onSuccess(String setupPIN); - + void onError(Exception error); } @@ -45364,6 +45720,46 @@ public ElectricalMeasurementCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void getProfileInfoCommand(DefaultClusterCallback callback + ) { + getProfileInfoCommand(chipClusterPtr, callback, null); + } + + public void getProfileInfoCommand(DefaultClusterCallback callback + + , int timedInvokeTimeoutMs) { + getProfileInfoCommand(chipClusterPtr, callback, timedInvokeTimeoutMs); + } + + public void getMeasurementProfileCommand(DefaultClusterCallback callback + , Integer attributeId, Long startTime, Integer numberOfIntervals) { + getMeasurementProfileCommand(chipClusterPtr, callback, attributeId, startTime, numberOfIntervals, null); + } + + public void getMeasurementProfileCommand(DefaultClusterCallback callback + , Integer attributeId, Long startTime, Integer numberOfIntervals + , int timedInvokeTimeoutMs) { + getMeasurementProfileCommand(chipClusterPtr, callback, attributeId, startTime, numberOfIntervals, timedInvokeTimeoutMs); + } + private native void getProfileInfoCommand(long chipClusterPtr, DefaultClusterCallback Callback + + , @Nullable Integer timedInvokeTimeoutMs); + private native void getMeasurementProfileCommand(long chipClusterPtr, DefaultClusterCallback Callback + , Integer attributeId, Long startTime, Integer numberOfIntervals + , @Nullable Integer timedInvokeTimeoutMs); + public interface GetProfileInfoResponseCommandCallback { + void onSuccess(Integer profileCount, Integer profileIntervalPeriod, Integer maxNumberOfIntervals, ArrayList listOfAttributes); + + void onError(Exception error); + } + + public interface GetMeasurementProfileResponseCommandCallback { + void onSuccess(Long startTime, Integer status, Integer profileIntervalPeriod, Integer numberOfIntervalsDelivered, Integer attributeId, ArrayList intervals); + + void onError(Exception error); + } + + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); @@ -48069,6 +48465,28 @@ public void testAddArguments(TestAddArgumentsResponseCallback callback testAddArguments(chipClusterPtr, callback, arg1, arg2, timedInvokeTimeoutMs); } + public void testSimpleArgumentRequest(TestSimpleArgumentResponseCallback callback + , Boolean arg1) { + testSimpleArgumentRequest(chipClusterPtr, callback, arg1, null); + } + + public void testSimpleArgumentRequest(TestSimpleArgumentResponseCallback callback + , Boolean arg1 + , int timedInvokeTimeoutMs) { + testSimpleArgumentRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); + } + + public void testStructArrayArgumentRequest(TestStructArrayArgumentResponseCallback callback + , ArrayList arg1, ArrayList arg2, ArrayList arg3, ArrayList arg4, Integer arg5, Boolean arg6) { + testStructArrayArgumentRequest(chipClusterPtr, callback, arg1, arg2, arg3, arg4, arg5, arg6, null); + } + + public void testStructArrayArgumentRequest(TestStructArrayArgumentResponseCallback callback + , ArrayList arg1, ArrayList arg2, ArrayList arg3, ArrayList arg4, Integer arg5, Boolean arg6 + , int timedInvokeTimeoutMs) { + testStructArrayArgumentRequest(chipClusterPtr, callback, arg1, arg2, arg3, arg4, arg5, arg6, timedInvokeTimeoutMs); + } + public void testStructArgumentRequest(BooleanResponseCallback callback , ChipStructs.UnitTestingClusterSimpleStruct arg1) { testStructArgumentRequest(chipClusterPtr, callback, arg1, null); @@ -48168,6 +48586,17 @@ public void testNullableOptionalRequest(TestNullableOptionalResponseCallback cal testNullableOptionalRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); } + public void testComplexNullableOptionalRequest(TestComplexNullableOptionalResponseCallback callback + , @Nullable Integer nullableInt, Optional optionalInt, @Nullable Optional nullableOptionalInt, @Nullable String nullableString, Optional optionalString, @Nullable Optional nullableOptionalString, @Nullable ChipStructs.UnitTestingClusterSimpleStruct nullableStruct, Optional optionalStruct, @Nullable Optional nullableOptionalStruct, @Nullable ArrayList nullableList, Optional> optionalList, @Nullable Optional> nullableOptionalList) { + testComplexNullableOptionalRequest(chipClusterPtr, callback, nullableInt, optionalInt, nullableOptionalInt, nullableString, optionalString, nullableOptionalString, nullableStruct, optionalStruct, nullableOptionalStruct, nullableList, optionalList, nullableOptionalList, null); + } + + public void testComplexNullableOptionalRequest(TestComplexNullableOptionalResponseCallback callback + , @Nullable Integer nullableInt, Optional optionalInt, @Nullable Optional nullableOptionalInt, @Nullable String nullableString, Optional optionalString, @Nullable Optional nullableOptionalString, @Nullable ChipStructs.UnitTestingClusterSimpleStruct nullableStruct, Optional optionalStruct, @Nullable Optional nullableOptionalStruct, @Nullable ArrayList nullableList, Optional> optionalList, @Nullable Optional> nullableOptionalList + , int timedInvokeTimeoutMs) { + testComplexNullableOptionalRequest(chipClusterPtr, callback, nullableInt, optionalInt, nullableOptionalInt, nullableString, optionalString, nullableOptionalString, nullableStruct, optionalStruct, nullableOptionalStruct, nullableList, optionalList, nullableOptionalList, timedInvokeTimeoutMs); + } + public void simpleStructEchoRequest(SimpleStructResponseCallback callback , ChipStructs.UnitTestingClusterSimpleStruct arg1) { simpleStructEchoRequest(chipClusterPtr, callback, arg1, null); @@ -48207,6 +48636,17 @@ public void testEmitTestEventRequest(TestEmitTestEventResponseCallback callback , int timedInvokeTimeoutMs) { testEmitTestEventRequest(chipClusterPtr, callback, arg1, arg2, arg3, timedInvokeTimeoutMs); } + + public void testEmitTestFabricScopedEventRequest(TestEmitTestFabricScopedEventResponseCallback callback + , Integer arg1) { + testEmitTestFabricScopedEventRequest(chipClusterPtr, callback, arg1, null); + } + + public void testEmitTestFabricScopedEventRequest(TestEmitTestFabricScopedEventResponseCallback callback + , Integer arg1 + , int timedInvokeTimeoutMs) { + testEmitTestFabricScopedEventRequest(chipClusterPtr, callback, arg1, timedInvokeTimeoutMs); + } private native void test(long chipClusterPtr, DefaultClusterCallback Callback , @Nullable Integer timedInvokeTimeoutMs); @@ -48222,6 +48662,12 @@ private native void testUnknownCommand(long chipClusterPtr, DefaultClusterCallba private native void testAddArguments(long chipClusterPtr, TestAddArgumentsResponseCallback Callback , Integer arg1, Integer arg2 , @Nullable Integer timedInvokeTimeoutMs); + private native void testSimpleArgumentRequest(long chipClusterPtr, TestSimpleArgumentResponseCallback Callback + , Boolean arg1 + , @Nullable Integer timedInvokeTimeoutMs); + private native void testStructArrayArgumentRequest(long chipClusterPtr, TestStructArrayArgumentResponseCallback Callback + , ArrayList arg1, ArrayList arg2, ArrayList arg3, ArrayList arg4, Integer arg5, Boolean arg6 + , @Nullable Integer timedInvokeTimeoutMs); private native void testStructArgumentRequest(long chipClusterPtr, BooleanResponseCallback Callback , ChipStructs.UnitTestingClusterSimpleStruct arg1 , @Nullable Integer timedInvokeTimeoutMs); @@ -48249,6 +48695,9 @@ private native void testEnumsRequest(long chipClusterPtr, TestEnumsResponseCallb private native void testNullableOptionalRequest(long chipClusterPtr, TestNullableOptionalResponseCallback Callback , @Nullable Optional arg1 , @Nullable Integer timedInvokeTimeoutMs); + private native void testComplexNullableOptionalRequest(long chipClusterPtr, TestComplexNullableOptionalResponseCallback Callback + , @Nullable Integer nullableInt, Optional optionalInt, @Nullable Optional nullableOptionalInt, @Nullable String nullableString, Optional optionalString, @Nullable Optional nullableOptionalString, @Nullable ChipStructs.UnitTestingClusterSimpleStruct nullableStruct, Optional optionalStruct, @Nullable Optional nullableOptionalStruct, @Nullable ArrayList nullableList, Optional> optionalList, @Nullable Optional> nullableOptionalList + , @Nullable Integer timedInvokeTimeoutMs); private native void simpleStructEchoRequest(long chipClusterPtr, SimpleStructResponseCallback Callback , ChipStructs.UnitTestingClusterSimpleStruct arg1 , @Nullable Integer timedInvokeTimeoutMs); @@ -48261,51 +48710,78 @@ private native void testSimpleOptionalArgumentRequest(long chipClusterPtr, Defau private native void testEmitTestEventRequest(long chipClusterPtr, TestEmitTestEventResponseCallback Callback , Integer arg1, Integer arg2, Boolean arg3 , @Nullable Integer timedInvokeTimeoutMs); + private native void testEmitTestFabricScopedEventRequest(long chipClusterPtr, TestEmitTestFabricScopedEventResponseCallback Callback + , Integer arg1 + , @Nullable Integer timedInvokeTimeoutMs); public interface TestSpecificResponseCallback { void onSuccess(Integer returnValue); - + void onError(Exception error); } public interface TestAddArgumentsResponseCallback { void onSuccess(Integer returnValue); - + + void onError(Exception error); + } + + public interface TestSimpleArgumentResponseCallback { + void onSuccess(Boolean returnValue); + + void onError(Exception error); + } + + public interface TestStructArrayArgumentResponseCallback { + void onSuccess(ArrayList arg1, ArrayList arg2, ArrayList arg3, ArrayList arg4, Integer arg5, Boolean arg6); + void onError(Exception error); } public interface TestListInt8UReverseResponseCallback { void onSuccess(ArrayList arg1); - + void onError(Exception error); } public interface TestEnumsResponseCallback { void onSuccess(Integer arg1, Integer arg2); - + void onError(Exception error); } public interface TestNullableOptionalResponseCallback { void onSuccess(Boolean wasPresent, Optional wasNull, Optional value, @Nullable Optional originalValue); - + + void onError(Exception error); + } + + public interface TestComplexNullableOptionalResponseCallback { + void onSuccess(Boolean nullableIntWasNull, Optional nullableIntValue, Boolean optionalIntWasPresent, Optional optionalIntValue, Boolean nullableOptionalIntWasPresent, Optional nullableOptionalIntWasNull, Optional nullableOptionalIntValue, Boolean nullableStringWasNull, Optional nullableStringValue, Boolean optionalStringWasPresent, Optional optionalStringValue, Boolean nullableOptionalStringWasPresent, Optional nullableOptionalStringWasNull, Optional nullableOptionalStringValue, Boolean nullableStructWasNull, Optional nullableStructValue, Boolean optionalStructWasPresent, Optional optionalStructValue, Boolean nullableOptionalStructWasPresent, Optional nullableOptionalStructWasNull, Optional nullableOptionalStructValue, Boolean nullableListWasNull, Optional> nullableListValue, Boolean optionalListWasPresent, Optional> optionalListValue, Boolean nullableOptionalListWasPresent, Optional nullableOptionalListWasNull, Optional> nullableOptionalListValue); + void onError(Exception error); } public interface BooleanResponseCallback { void onSuccess(Boolean value); - + void onError(Exception error); } public interface SimpleStructResponseCallback { void onSuccess(ChipStructs.UnitTestingClusterSimpleStruct arg1); - + void onError(Exception error); } public interface TestEmitTestEventResponseCallback { void onSuccess(Long value); - + + void onError(Exception error); + } + + public interface TestEmitTestFabricScopedEventResponseCallback { + void onSuccess(Long value); + void onError(Exception error); } @@ -50883,6 +51359,34 @@ public FaultInjectionCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + public void failAtFault(DefaultClusterCallback callback + , Integer type, Long id, Long numCallsToSkip, Long numCallsToFail, Boolean takeMutex) { + failAtFault(chipClusterPtr, callback, type, id, numCallsToSkip, numCallsToFail, takeMutex, null); + } + + public void failAtFault(DefaultClusterCallback callback + , Integer type, Long id, Long numCallsToSkip, Long numCallsToFail, Boolean takeMutex + , int timedInvokeTimeoutMs) { + failAtFault(chipClusterPtr, callback, type, id, numCallsToSkip, numCallsToFail, takeMutex, timedInvokeTimeoutMs); + } + + public void failRandomlyAtFault(DefaultClusterCallback callback + , Integer type, Long id, Integer percentage) { + failRandomlyAtFault(chipClusterPtr, callback, type, id, percentage, null); + } + + public void failRandomlyAtFault(DefaultClusterCallback callback + , Integer type, Long id, Integer percentage + , int timedInvokeTimeoutMs) { + failRandomlyAtFault(chipClusterPtr, callback, type, id, percentage, timedInvokeTimeoutMs); + } + private native void failAtFault(long chipClusterPtr, DefaultClusterCallback Callback + , Integer type, Long id, Long numCallsToSkip, Long numCallsToFail, Boolean takeMutex + , @Nullable Integer timedInvokeTimeoutMs); + private native void failRandomlyAtFault(long chipClusterPtr, DefaultClusterCallback Callback + , Integer type, Long id, Integer percentage + , @Nullable Integer timedInvokeTimeoutMs); + public interface GeneratedCommandListAttributeCallback { void onSuccess( List valueList); void onError(Exception ex); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java index d34fdec327f3b9..8670eb8f8a1887 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterInfoMapping.java @@ -618,6 +618,87 @@ public void onError(Exception error) { } } + public static class DelegatedScenesClusterEnhancedAddSceneResponseCallback implements ChipClusters.ScenesCluster.EnhancedAddSceneResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer Status, Integer GroupID, Integer SceneID) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo StatusResponseValue = new CommandResponseInfo("Status", "Integer"); + responseValues.put(StatusResponseValue, Status); + CommandResponseInfo GroupIDResponseValue = new CommandResponseInfo("GroupID", "Integer"); + responseValues.put(GroupIDResponseValue, GroupID); + CommandResponseInfo SceneIDResponseValue = new CommandResponseInfo("SceneID", "Integer"); + responseValues.put(SceneIDResponseValue, SceneID); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedScenesClusterEnhancedViewSceneResponseCallback implements ChipClusters.ScenesCluster.EnhancedViewSceneResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer Status, Integer GroupID, Integer SceneID, Optional TransitionTime, Optional SceneName, Optional> ExtensionFieldSets) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo StatusResponseValue = new CommandResponseInfo("Status", "Integer"); + responseValues.put(StatusResponseValue, Status); + CommandResponseInfo GroupIDResponseValue = new CommandResponseInfo("GroupID", "Integer"); + responseValues.put(GroupIDResponseValue, GroupID); + CommandResponseInfo SceneIDResponseValue = new CommandResponseInfo("SceneID", "Integer"); + responseValues.put(SceneIDResponseValue, SceneID); + CommandResponseInfo TransitionTimeResponseValue = new CommandResponseInfo("TransitionTime", "Optional"); + responseValues.put(TransitionTimeResponseValue, TransitionTime); + CommandResponseInfo SceneNameResponseValue = new CommandResponseInfo("SceneName", "Optional"); + responseValues.put(SceneNameResponseValue, SceneName); + // ExtensionFieldSets: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedScenesClusterCopySceneResponseCallback implements ChipClusters.ScenesCluster.CopySceneResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer Status, Integer GroupIdentifierFrom, Integer SceneIdentifierFrom) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo StatusResponseValue = new CommandResponseInfo("Status", "Integer"); + responseValues.put(StatusResponseValue, Status); + CommandResponseInfo GroupIdentifierFromResponseValue = new CommandResponseInfo("GroupIdentifierFrom", "Integer"); + responseValues.put(GroupIdentifierFromResponseValue, GroupIdentifierFrom); + CommandResponseInfo SceneIdentifierFromResponseValue = new CommandResponseInfo("SceneIdentifierFrom", "Integer"); + responseValues.put(SceneIdentifierFromResponseValue, SceneIdentifierFrom); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedScenesClusterLastConfiguredByAttributeCallback implements ChipClusters.ScenesCluster.LastConfiguredByAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -7233,6 +7314,27 @@ public void onError(Exception ex) { } } + public static class DelegatedOperationalStateClusterOperationalCommandResponseCallback implements ChipClusters.OperationalStateCluster.OperationalCommandResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.OperationalStateClusterErrorStateStruct CommandResponseState) { + Map responseValues = new LinkedHashMap<>(); + // CommandResponseState: Struct ErrorStateStruct + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedOperationalStateClusterPhaseListAttributeCallback implements ChipClusters.OperationalStateCluster.PhaseListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -18778,6 +18880,64 @@ public void onError(Exception ex) { } } + public static class DelegatedElectricalMeasurementClusterGetProfileInfoResponseCommandCallback implements ChipClusters.ElectricalMeasurementCluster.GetProfileInfoResponseCommandCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Integer profileCount, Integer profileIntervalPeriod, Integer maxNumberOfIntervals, ArrayList listOfAttributes) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo profileCountResponseValue = new CommandResponseInfo("profileCount", "Integer"); + responseValues.put(profileCountResponseValue, profileCount); + CommandResponseInfo profileIntervalPeriodResponseValue = new CommandResponseInfo("profileIntervalPeriod", "Integer"); + responseValues.put(profileIntervalPeriodResponseValue, profileIntervalPeriod); + CommandResponseInfo maxNumberOfIntervalsResponseValue = new CommandResponseInfo("maxNumberOfIntervals", "Integer"); + responseValues.put(maxNumberOfIntervalsResponseValue, maxNumberOfIntervals); + // listOfAttributes: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedElectricalMeasurementClusterGetMeasurementProfileResponseCommandCallback implements ChipClusters.ElectricalMeasurementCluster.GetMeasurementProfileResponseCommandCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Long startTime, Integer status, Integer profileIntervalPeriod, Integer numberOfIntervalsDelivered, Integer attributeId, ArrayList intervals) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo startTimeResponseValue = new CommandResponseInfo("startTime", "Long"); + responseValues.put(startTimeResponseValue, startTime); + CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer"); + responseValues.put(statusResponseValue, status); + CommandResponseInfo profileIntervalPeriodResponseValue = new CommandResponseInfo("profileIntervalPeriod", "Integer"); + responseValues.put(profileIntervalPeriodResponseValue, profileIntervalPeriod); + CommandResponseInfo numberOfIntervalsDeliveredResponseValue = new CommandResponseInfo("numberOfIntervalsDelivered", "Integer"); + responseValues.put(numberOfIntervalsDeliveredResponseValue, numberOfIntervalsDelivered); + CommandResponseInfo attributeIdResponseValue = new CommandResponseInfo("attributeId", "Integer"); + responseValues.put(attributeIdResponseValue, attributeId); + // intervals: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedElectricalMeasurementClusterGeneratedCommandListAttributeCallback implements ChipClusters.ElectricalMeasurementCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -18897,6 +19057,58 @@ public void onError(Exception error) { } } + public static class DelegatedUnitTestingClusterTestSimpleArgumentResponseCallback implements ChipClusters.UnitTestingCluster.TestSimpleArgumentResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Boolean returnValue) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo returnValueResponseValue = new CommandResponseInfo("returnValue", "Boolean"); + responseValues.put(returnValueResponseValue, returnValue); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + + public static class DelegatedUnitTestingClusterTestStructArrayArgumentResponseCallback implements ChipClusters.UnitTestingCluster.TestStructArrayArgumentResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ArrayList arg1, ArrayList arg2, ArrayList arg3, ArrayList arg4, Integer arg5, Boolean arg6) { + Map responseValues = new LinkedHashMap<>(); + // arg1: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + // arg2: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + // arg3: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + // arg4: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo arg5ResponseValue = new CommandResponseInfo("arg5", "Integer"); + responseValues.put(arg5ResponseValue, arg5); + CommandResponseInfo arg6ResponseValue = new CommandResponseInfo("arg6", "Boolean"); + responseValues.put(arg6ResponseValue, arg6); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedUnitTestingClusterTestListInt8UReverseResponseCallback implements ChipClusters.UnitTestingCluster.TestListInt8UReverseResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -18968,6 +19180,81 @@ public void onError(Exception error) { } } + public static class DelegatedUnitTestingClusterTestComplexNullableOptionalResponseCallback implements ChipClusters.UnitTestingCluster.TestComplexNullableOptionalResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Boolean NullableIntWasNull, Optional NullableIntValue, Boolean OptionalIntWasPresent, Optional OptionalIntValue, Boolean NullableOptionalIntWasPresent, Optional NullableOptionalIntWasNull, Optional NullableOptionalIntValue, Boolean NullableStringWasNull, Optional NullableStringValue, Boolean OptionalStringWasPresent, Optional OptionalStringValue, Boolean NullableOptionalStringWasPresent, Optional NullableOptionalStringWasNull, Optional NullableOptionalStringValue, Boolean NullableStructWasNull, Optional NullableStructValue, Boolean OptionalStructWasPresent, Optional OptionalStructValue, Boolean NullableOptionalStructWasPresent, Optional NullableOptionalStructWasNull, Optional NullableOptionalStructValue, Boolean NullableListWasNull, Optional> NullableListValue, Boolean OptionalListWasPresent, Optional> OptionalListValue, Boolean NullableOptionalListWasPresent, Optional NullableOptionalListWasNull, Optional> NullableOptionalListValue) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo NullableIntWasNullResponseValue = new CommandResponseInfo("NullableIntWasNull", "Boolean"); + responseValues.put(NullableIntWasNullResponseValue, NullableIntWasNull); + CommandResponseInfo NullableIntValueResponseValue = new CommandResponseInfo("NullableIntValue", "Optional"); + responseValues.put(NullableIntValueResponseValue, NullableIntValue); + CommandResponseInfo OptionalIntWasPresentResponseValue = new CommandResponseInfo("OptionalIntWasPresent", "Boolean"); + responseValues.put(OptionalIntWasPresentResponseValue, OptionalIntWasPresent); + CommandResponseInfo OptionalIntValueResponseValue = new CommandResponseInfo("OptionalIntValue", "Optional"); + responseValues.put(OptionalIntValueResponseValue, OptionalIntValue); + CommandResponseInfo NullableOptionalIntWasPresentResponseValue = new CommandResponseInfo("NullableOptionalIntWasPresent", "Boolean"); + responseValues.put(NullableOptionalIntWasPresentResponseValue, NullableOptionalIntWasPresent); + CommandResponseInfo NullableOptionalIntWasNullResponseValue = new CommandResponseInfo("NullableOptionalIntWasNull", "Optional"); + responseValues.put(NullableOptionalIntWasNullResponseValue, NullableOptionalIntWasNull); + CommandResponseInfo NullableOptionalIntValueResponseValue = new CommandResponseInfo("NullableOptionalIntValue", "Optional"); + responseValues.put(NullableOptionalIntValueResponseValue, NullableOptionalIntValue); + CommandResponseInfo NullableStringWasNullResponseValue = new CommandResponseInfo("NullableStringWasNull", "Boolean"); + responseValues.put(NullableStringWasNullResponseValue, NullableStringWasNull); + CommandResponseInfo NullableStringValueResponseValue = new CommandResponseInfo("NullableStringValue", "Optional"); + responseValues.put(NullableStringValueResponseValue, NullableStringValue); + CommandResponseInfo OptionalStringWasPresentResponseValue = new CommandResponseInfo("OptionalStringWasPresent", "Boolean"); + responseValues.put(OptionalStringWasPresentResponseValue, OptionalStringWasPresent); + CommandResponseInfo OptionalStringValueResponseValue = new CommandResponseInfo("OptionalStringValue", "Optional"); + responseValues.put(OptionalStringValueResponseValue, OptionalStringValue); + CommandResponseInfo NullableOptionalStringWasPresentResponseValue = new CommandResponseInfo("NullableOptionalStringWasPresent", "Boolean"); + responseValues.put(NullableOptionalStringWasPresentResponseValue, NullableOptionalStringWasPresent); + CommandResponseInfo NullableOptionalStringWasNullResponseValue = new CommandResponseInfo("NullableOptionalStringWasNull", "Optional"); + responseValues.put(NullableOptionalStringWasNullResponseValue, NullableOptionalStringWasNull); + CommandResponseInfo NullableOptionalStringValueResponseValue = new CommandResponseInfo("NullableOptionalStringValue", "Optional"); + responseValues.put(NullableOptionalStringValueResponseValue, NullableOptionalStringValue); + CommandResponseInfo NullableStructWasNullResponseValue = new CommandResponseInfo("NullableStructWasNull", "Boolean"); + responseValues.put(NullableStructWasNullResponseValue, NullableStructWasNull); + // NullableStructValue: Struct SimpleStruct + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo OptionalStructWasPresentResponseValue = new CommandResponseInfo("OptionalStructWasPresent", "Boolean"); + responseValues.put(OptionalStructWasPresentResponseValue, OptionalStructWasPresent); + // OptionalStructValue: Struct SimpleStruct + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo NullableOptionalStructWasPresentResponseValue = new CommandResponseInfo("NullableOptionalStructWasPresent", "Boolean"); + responseValues.put(NullableOptionalStructWasPresentResponseValue, NullableOptionalStructWasPresent); + CommandResponseInfo NullableOptionalStructWasNullResponseValue = new CommandResponseInfo("NullableOptionalStructWasNull", "Optional"); + responseValues.put(NullableOptionalStructWasNullResponseValue, NullableOptionalStructWasNull); + // NullableOptionalStructValue: Struct SimpleStruct + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo NullableListWasNullResponseValue = new CommandResponseInfo("NullableListWasNull", "Boolean"); + responseValues.put(NullableListWasNullResponseValue, NullableListWasNull); + // NullableListValue: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo OptionalListWasPresentResponseValue = new CommandResponseInfo("OptionalListWasPresent", "Boolean"); + responseValues.put(OptionalListWasPresentResponseValue, OptionalListWasPresent); + // OptionalListValue: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + CommandResponseInfo NullableOptionalListWasPresentResponseValue = new CommandResponseInfo("NullableOptionalListWasPresent", "Boolean"); + responseValues.put(NullableOptionalListWasPresentResponseValue, NullableOptionalListWasPresent); + CommandResponseInfo NullableOptionalListWasNullResponseValue = new CommandResponseInfo("NullableOptionalListWasNull", "Optional"); + responseValues.put(NullableOptionalListWasNullResponseValue, NullableOptionalListWasNull); + // NullableOptionalListValue: /* TYPE WARNING: array array defaults to */ uint8_t * + // Conversion from this type to Java is not properly implemented yet + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedUnitTestingClusterBooleanResponseCallback implements ChipClusters.UnitTestingCluster.BooleanResponseCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -19031,6 +19318,27 @@ public void onError(Exception error) { } } + public static class DelegatedUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback implements ChipClusters.UnitTestingCluster.TestEmitTestFabricScopedEventResponseCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo valueResponseValue = new CommandResponseInfo("value", "Long"); + responseValues.put(valueResponseValue, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception error) { + callback.onFailure(error); + } + } + public static class DelegatedUnitTestingClusterListInt8uAttributeCallback implements ChipClusters.UnitTestingCluster.ListInt8uAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -20774,6 +21082,99 @@ public Map> getCommandMap() { scenesgetSceneMembershipCommandParams ); scenesClusterInteractionInfoMap.put("getSceneMembership", scenesgetSceneMembershipInteractionInfo); + Map scenesenhancedAddSceneCommandParams = new LinkedHashMap(); + CommandParameterInfo scenesenhancedAddScenegroupIDCommandParameterInfo = new CommandParameterInfo("groupID", Integer.class, Integer.class); + scenesenhancedAddSceneCommandParams.put("groupID",scenesenhancedAddScenegroupIDCommandParameterInfo); + + CommandParameterInfo scenesenhancedAddScenesceneIDCommandParameterInfo = new CommandParameterInfo("sceneID", Integer.class, Integer.class); + scenesenhancedAddSceneCommandParams.put("sceneID",scenesenhancedAddScenesceneIDCommandParameterInfo); + + CommandParameterInfo scenesenhancedAddScenetransitionTimeCommandParameterInfo = new CommandParameterInfo("transitionTime", Integer.class, Integer.class); + scenesenhancedAddSceneCommandParams.put("transitionTime",scenesenhancedAddScenetransitionTimeCommandParameterInfo); + + CommandParameterInfo scenesenhancedAddScenesceneNameCommandParameterInfo = new CommandParameterInfo("sceneName", String.class, String.class); + scenesenhancedAddSceneCommandParams.put("sceneName",scenesenhancedAddScenesceneNameCommandParameterInfo); + + InteractionInfo scenesenhancedAddSceneInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ScenesCluster) cluster) + .enhancedAddScene((ChipClusters.ScenesCluster.EnhancedAddSceneResponseCallback) callback + , (Integer) + commandArguments.get("groupID") + , (Integer) + commandArguments.get("sceneID") + , (Integer) + commandArguments.get("transitionTime") + , (String) + commandArguments.get("sceneName") + , (ArrayList) + commandArguments.get("extensionFieldSets") + + ); + }, + () -> new DelegatedScenesClusterEnhancedAddSceneResponseCallback(), + scenesenhancedAddSceneCommandParams + ); + scenesClusterInteractionInfoMap.put("enhancedAddScene", scenesenhancedAddSceneInteractionInfo); + Map scenesenhancedViewSceneCommandParams = new LinkedHashMap(); + CommandParameterInfo scenesenhancedViewScenegroupIDCommandParameterInfo = new CommandParameterInfo("groupID", Integer.class, Integer.class); + scenesenhancedViewSceneCommandParams.put("groupID",scenesenhancedViewScenegroupIDCommandParameterInfo); + + CommandParameterInfo scenesenhancedViewScenesceneIDCommandParameterInfo = new CommandParameterInfo("sceneID", Integer.class, Integer.class); + scenesenhancedViewSceneCommandParams.put("sceneID",scenesenhancedViewScenesceneIDCommandParameterInfo); + + InteractionInfo scenesenhancedViewSceneInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ScenesCluster) cluster) + .enhancedViewScene((ChipClusters.ScenesCluster.EnhancedViewSceneResponseCallback) callback + , (Integer) + commandArguments.get("groupID") + , (Integer) + commandArguments.get("sceneID") + + ); + }, + () -> new DelegatedScenesClusterEnhancedViewSceneResponseCallback(), + scenesenhancedViewSceneCommandParams + ); + scenesClusterInteractionInfoMap.put("enhancedViewScene", scenesenhancedViewSceneInteractionInfo); + Map scenescopySceneCommandParams = new LinkedHashMap(); + CommandParameterInfo scenescopyScenemodeCommandParameterInfo = new CommandParameterInfo("mode", Integer.class, Integer.class); + scenescopySceneCommandParams.put("mode",scenescopyScenemodeCommandParameterInfo); + + CommandParameterInfo scenescopyScenegroupIdentifierFromCommandParameterInfo = new CommandParameterInfo("groupIdentifierFrom", Integer.class, Integer.class); + scenescopySceneCommandParams.put("groupIdentifierFrom",scenescopyScenegroupIdentifierFromCommandParameterInfo); + + CommandParameterInfo scenescopyScenesceneIdentifierFromCommandParameterInfo = new CommandParameterInfo("sceneIdentifierFrom", Integer.class, Integer.class); + scenescopySceneCommandParams.put("sceneIdentifierFrom",scenescopyScenesceneIdentifierFromCommandParameterInfo); + + CommandParameterInfo scenescopyScenegroupIdentifierToCommandParameterInfo = new CommandParameterInfo("groupIdentifierTo", Integer.class, Integer.class); + scenescopySceneCommandParams.put("groupIdentifierTo",scenescopyScenegroupIdentifierToCommandParameterInfo); + + CommandParameterInfo scenescopyScenesceneIdentifierToCommandParameterInfo = new CommandParameterInfo("sceneIdentifierTo", Integer.class, Integer.class); + scenescopySceneCommandParams.put("sceneIdentifierTo",scenescopyScenesceneIdentifierToCommandParameterInfo); + + InteractionInfo scenescopySceneInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ScenesCluster) cluster) + .copyScene((ChipClusters.ScenesCluster.CopySceneResponseCallback) callback + , (Integer) + commandArguments.get("mode") + , (Integer) + commandArguments.get("groupIdentifierFrom") + , (Integer) + commandArguments.get("sceneIdentifierFrom") + , (Integer) + commandArguments.get("groupIdentifierTo") + , (Integer) + commandArguments.get("sceneIdentifierTo") + + ); + }, + () -> new DelegatedScenesClusterCopySceneResponseCallback(), + scenescopySceneCommandParams + ); + scenesClusterInteractionInfoMap.put("copyScene", scenescopySceneInteractionInfo); commandMap.put("scenes", scenesClusterInteractionInfoMap); Map onOffClusterInteractionInfoMap = new LinkedHashMap<>(); Map onOffoffCommandParams = new LinkedHashMap(); @@ -21123,6 +21524,23 @@ public Map> getCommandMap() { levelControlstopWithOnOffCommandParams ); levelControlClusterInteractionInfoMap.put("stopWithOnOff", levelControlstopWithOnOffInteractionInfo); + Map levelControlmoveToClosestFrequencyCommandParams = new LinkedHashMap(); + CommandParameterInfo levelControlmoveToClosestFrequencyfrequencyCommandParameterInfo = new CommandParameterInfo("frequency", Integer.class, Integer.class); + levelControlmoveToClosestFrequencyCommandParams.put("frequency",levelControlmoveToClosestFrequencyfrequencyCommandParameterInfo); + + InteractionInfo levelControlmoveToClosestFrequencyInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.LevelControlCluster) cluster) + .moveToClosestFrequency((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("frequency") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + levelControlmoveToClosestFrequencyCommandParams + ); + levelControlClusterInteractionInfoMap.put("moveToClosestFrequency", levelControlmoveToClosestFrequencyInteractionInfo); commandMap.put("levelControl", levelControlClusterInteractionInfoMap); Map binaryInputBasicClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("binaryInputBasic", binaryInputBasicClusterInteractionInfoMap); @@ -21426,6 +21844,18 @@ public Map> getCommandMap() { actionsClusterInteractionInfoMap.put("disableActionWithDuration", actionsdisableActionWithDurationInteractionInfo); commandMap.put("actions", actionsClusterInteractionInfoMap); Map basicInformationClusterInteractionInfoMap = new LinkedHashMap<>(); + Map basicInformationmfgSpecificPingCommandParams = new LinkedHashMap(); + InteractionInfo basicInformationmfgSpecificPingInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.BasicInformationCluster) cluster) + .mfgSpecificPing((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + basicInformationmfgSpecificPingCommandParams + ); + basicInformationClusterInteractionInfoMap.put("mfgSpecificPing", basicInformationmfgSpecificPingInteractionInfo); commandMap.put("basicInformation", basicInformationClusterInteractionInfoMap); Map otaSoftwareUpdateProviderClusterInteractionInfoMap = new LinkedHashMap<>(); Map otaSoftwareUpdateProviderqueryImageCommandParams = new LinkedHashMap(); @@ -22536,8 +22966,73 @@ public Map> getCommandMap() { dishwasherAlarmresetCommandParams ); dishwasherAlarmClusterInteractionInfoMap.put("reset", dishwasherAlarmresetInteractionInfo); + Map dishwasherAlarmmodifyEnabledAlarmsCommandParams = new LinkedHashMap(); + CommandParameterInfo dishwasherAlarmmodifyEnabledAlarmsmaskCommandParameterInfo = new CommandParameterInfo("mask", Long.class, Long.class); + dishwasherAlarmmodifyEnabledAlarmsCommandParams.put("mask",dishwasherAlarmmodifyEnabledAlarmsmaskCommandParameterInfo); + + InteractionInfo dishwasherAlarmmodifyEnabledAlarmsInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DishwasherAlarmCluster) cluster) + .modifyEnabledAlarms((DefaultClusterCallback) callback + , (Long) + commandArguments.get("mask") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + dishwasherAlarmmodifyEnabledAlarmsCommandParams + ); + dishwasherAlarmClusterInteractionInfoMap.put("modifyEnabledAlarms", dishwasherAlarmmodifyEnabledAlarmsInteractionInfo); commandMap.put("dishwasherAlarm", dishwasherAlarmClusterInteractionInfoMap); Map operationalStateClusterInteractionInfoMap = new LinkedHashMap<>(); + Map operationalStatepauseCommandParams = new LinkedHashMap(); + InteractionInfo operationalStatepauseInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OperationalStateCluster) cluster) + .pause((ChipClusters.OperationalStateCluster.OperationalCommandResponseCallback) callback + + ); + }, + () -> new DelegatedOperationalStateClusterOperationalCommandResponseCallback(), + operationalStatepauseCommandParams + ); + operationalStateClusterInteractionInfoMap.put("pause", operationalStatepauseInteractionInfo); + Map operationalStatestopCommandParams = new LinkedHashMap(); + InteractionInfo operationalStatestopInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OperationalStateCluster) cluster) + .stop((ChipClusters.OperationalStateCluster.OperationalCommandResponseCallback) callback + + ); + }, + () -> new DelegatedOperationalStateClusterOperationalCommandResponseCallback(), + operationalStatestopCommandParams + ); + operationalStateClusterInteractionInfoMap.put("stop", operationalStatestopInteractionInfo); + Map operationalStatestartCommandParams = new LinkedHashMap(); + InteractionInfo operationalStatestartInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OperationalStateCluster) cluster) + .start((ChipClusters.OperationalStateCluster.OperationalCommandResponseCallback) callback + + ); + }, + () -> new DelegatedOperationalStateClusterOperationalCommandResponseCallback(), + operationalStatestartCommandParams + ); + operationalStateClusterInteractionInfoMap.put("start", operationalStatestartInteractionInfo); + Map operationalStateresumeCommandParams = new LinkedHashMap(); + InteractionInfo operationalStateresumeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OperationalStateCluster) cluster) + .resume((ChipClusters.OperationalStateCluster.OperationalCommandResponseCallback) callback + + ); + }, + () -> new DelegatedOperationalStateClusterOperationalCommandResponseCallback(), + operationalStateresumeCommandParams + ); + operationalStateClusterInteractionInfoMap.put("resume", operationalStateresumeInteractionInfo); commandMap.put("operationalState", operationalStateClusterInteractionInfoMap); Map rvcOperationalStateClusterInteractionInfoMap = new LinkedHashMap<>(); Map rvcOperationalStatepauseCommandParams = new LinkedHashMap(); @@ -22590,28 +23085,172 @@ public Map> getCommandMap() { rvcOperationalStateClusterInteractionInfoMap.put("resume", rvcOperationalStateresumeInteractionInfo); commandMap.put("rvcOperationalState", rvcOperationalStateClusterInteractionInfoMap); Map hepaFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map hepaFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo hepaFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.HepaFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + hepaFilterMonitoringresetConditionCommandParams + ); + hepaFilterMonitoringClusterInteractionInfoMap.put("resetCondition", hepaFilterMonitoringresetConditionInteractionInfo); commandMap.put("hepaFilterMonitoring", hepaFilterMonitoringClusterInteractionInfoMap); Map activatedCarbonFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map activatedCarbonFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo activatedCarbonFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ActivatedCarbonFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + activatedCarbonFilterMonitoringresetConditionCommandParams + ); + activatedCarbonFilterMonitoringClusterInteractionInfoMap.put("resetCondition", activatedCarbonFilterMonitoringresetConditionInteractionInfo); commandMap.put("activatedCarbonFilterMonitoring", activatedCarbonFilterMonitoringClusterInteractionInfoMap); Map ceramicFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map ceramicFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo ceramicFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.CeramicFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + ceramicFilterMonitoringresetConditionCommandParams + ); + ceramicFilterMonitoringClusterInteractionInfoMap.put("resetCondition", ceramicFilterMonitoringresetConditionInteractionInfo); commandMap.put("ceramicFilterMonitoring", ceramicFilterMonitoringClusterInteractionInfoMap); Map electrostaticFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map electrostaticFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo electrostaticFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectrostaticFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + electrostaticFilterMonitoringresetConditionCommandParams + ); + electrostaticFilterMonitoringClusterInteractionInfoMap.put("resetCondition", electrostaticFilterMonitoringresetConditionInteractionInfo); commandMap.put("electrostaticFilterMonitoring", electrostaticFilterMonitoringClusterInteractionInfoMap); Map uvFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map uvFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo uvFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UvFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + uvFilterMonitoringresetConditionCommandParams + ); + uvFilterMonitoringClusterInteractionInfoMap.put("resetCondition", uvFilterMonitoringresetConditionInteractionInfo); commandMap.put("uvFilterMonitoring", uvFilterMonitoringClusterInteractionInfoMap); Map ionizingFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map ionizingFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo ionizingFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.IonizingFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + ionizingFilterMonitoringresetConditionCommandParams + ); + ionizingFilterMonitoringClusterInteractionInfoMap.put("resetCondition", ionizingFilterMonitoringresetConditionInteractionInfo); commandMap.put("ionizingFilterMonitoring", ionizingFilterMonitoringClusterInteractionInfoMap); Map zeoliteFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map zeoliteFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo zeoliteFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ZeoliteFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + zeoliteFilterMonitoringresetConditionCommandParams + ); + zeoliteFilterMonitoringClusterInteractionInfoMap.put("resetCondition", zeoliteFilterMonitoringresetConditionInteractionInfo); commandMap.put("zeoliteFilterMonitoring", zeoliteFilterMonitoringClusterInteractionInfoMap); Map ozoneFilterMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map ozoneFilterMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo ozoneFilterMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OzoneFilterMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + ozoneFilterMonitoringresetConditionCommandParams + ); + ozoneFilterMonitoringClusterInteractionInfoMap.put("resetCondition", ozoneFilterMonitoringresetConditionInteractionInfo); commandMap.put("ozoneFilterMonitoring", ozoneFilterMonitoringClusterInteractionInfoMap); Map waterTankMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map waterTankMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo waterTankMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.WaterTankMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + waterTankMonitoringresetConditionCommandParams + ); + waterTankMonitoringClusterInteractionInfoMap.put("resetCondition", waterTankMonitoringresetConditionInteractionInfo); commandMap.put("waterTankMonitoring", waterTankMonitoringClusterInteractionInfoMap); Map fuelTankMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map fuelTankMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo fuelTankMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FuelTankMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + fuelTankMonitoringresetConditionCommandParams + ); + fuelTankMonitoringClusterInteractionInfoMap.put("resetCondition", fuelTankMonitoringresetConditionInteractionInfo); commandMap.put("fuelTankMonitoring", fuelTankMonitoringClusterInteractionInfoMap); Map inkCartridgeMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map inkCartridgeMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo inkCartridgeMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.InkCartridgeMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + inkCartridgeMonitoringresetConditionCommandParams + ); + inkCartridgeMonitoringClusterInteractionInfoMap.put("resetCondition", inkCartridgeMonitoringresetConditionInteractionInfo); commandMap.put("inkCartridgeMonitoring", inkCartridgeMonitoringClusterInteractionInfoMap); Map tonerCartridgeMonitoringClusterInteractionInfoMap = new LinkedHashMap<>(); + Map tonerCartridgeMonitoringresetConditionCommandParams = new LinkedHashMap(); + InteractionInfo tonerCartridgeMonitoringresetConditionInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TonerCartridgeMonitoringCluster) cluster) + .resetCondition((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + tonerCartridgeMonitoringresetConditionCommandParams + ); + tonerCartridgeMonitoringClusterInteractionInfoMap.put("resetCondition", tonerCartridgeMonitoringresetConditionInteractionInfo); commandMap.put("tonerCartridgeMonitoring", tonerCartridgeMonitoringClusterInteractionInfoMap); Map doorLockClusterInteractionInfoMap = new LinkedHashMap<>(); Map doorLocklockDoorCommandParams = new LinkedHashMap(); @@ -23051,6 +23690,23 @@ public Map> getCommandMap() { doorLockclearCredentialCommandParams ); doorLockClusterInteractionInfoMap.put("clearCredential", doorLockclearCredentialInteractionInfo); + Map doorLockunboltDoorCommandParams = new LinkedHashMap(); + CommandParameterInfo doorLockunboltDoorPINCodeCommandParameterInfo = new CommandParameterInfo("PINCode", Optional.class, byte[].class); + doorLockunboltDoorCommandParams.put("PINCode",doorLockunboltDoorPINCodeCommandParameterInfo); + + InteractionInfo doorLockunboltDoorInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .unboltDoor((DefaultClusterCallback) callback + , (Optional) + commandArguments.get("PINCode") + , 10000 + ); + }, + () -> new DelegatedDefaultClusterCallback(), + doorLockunboltDoorCommandParams + ); + doorLockClusterInteractionInfoMap.put("unboltDoor", doorLockunboltDoorInteractionInfo); commandMap.put("doorLock", doorLockClusterInteractionInfoMap); Map windowCoveringClusterInteractionInfoMap = new LinkedHashMap<>(); Map windowCoveringupOrOpenCommandParams = new LinkedHashMap(); @@ -23279,6 +23935,33 @@ public Map> getCommandMap() { thermostatClusterInteractionInfoMap.put("clearWeeklySchedule", thermostatclearWeeklyScheduleInteractionInfo); commandMap.put("thermostat", thermostatClusterInteractionInfoMap); Map fanControlClusterInteractionInfoMap = new LinkedHashMap<>(); + Map fanControlstepCommandParams = new LinkedHashMap(); + CommandParameterInfo fanControlstepdirectionCommandParameterInfo = new CommandParameterInfo("direction", Integer.class, Integer.class); + fanControlstepCommandParams.put("direction",fanControlstepdirectionCommandParameterInfo); + + CommandParameterInfo fanControlstepwrapCommandParameterInfo = new CommandParameterInfo("wrap", Optional.class, Boolean.class); + fanControlstepCommandParams.put("wrap",fanControlstepwrapCommandParameterInfo); + + CommandParameterInfo fanControlsteplowestOffCommandParameterInfo = new CommandParameterInfo("lowestOff", Optional.class, Boolean.class); + fanControlstepCommandParams.put("lowestOff",fanControlsteplowestOffCommandParameterInfo); + + InteractionInfo fanControlstepInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FanControlCluster) cluster) + .step((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("direction") + , (Optional) + commandArguments.get("wrap") + , (Optional) + commandArguments.get("lowestOff") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + fanControlstepCommandParams + ); + fanControlClusterInteractionInfoMap.put("step", fanControlstepInteractionInfo); commandMap.put("fanControl", fanControlClusterInteractionInfoMap); Map thermostatUserInterfaceConfigurationClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("thermostatUserInterfaceConfiguration", thermostatUserInterfaceConfigurationClusterInteractionInfoMap); @@ -24580,6 +25263,45 @@ public Map> getCommandMap() { accountLoginClusterInteractionInfoMap.put("logout", accountLoginlogoutInteractionInfo); commandMap.put("accountLogin", accountLoginClusterInteractionInfoMap); Map electricalMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); + Map electricalMeasurementgetProfileInfoCommandCommandParams = new LinkedHashMap(); + InteractionInfo electricalMeasurementgetProfileInfoCommandInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalMeasurementCluster) cluster) + .getProfileInfoCommand((DefaultClusterCallback) callback + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + electricalMeasurementgetProfileInfoCommandCommandParams + ); + electricalMeasurementClusterInteractionInfoMap.put("getProfileInfoCommand", electricalMeasurementgetProfileInfoCommandInteractionInfo); + Map electricalMeasurementgetMeasurementProfileCommandCommandParams = new LinkedHashMap(); + CommandParameterInfo electricalMeasurementgetMeasurementProfileCommandattributeIdCommandParameterInfo = new CommandParameterInfo("attributeId", Integer.class, Integer.class); + electricalMeasurementgetMeasurementProfileCommandCommandParams.put("attributeId",electricalMeasurementgetMeasurementProfileCommandattributeIdCommandParameterInfo); + + CommandParameterInfo electricalMeasurementgetMeasurementProfileCommandstartTimeCommandParameterInfo = new CommandParameterInfo("startTime", Long.class, Long.class); + electricalMeasurementgetMeasurementProfileCommandCommandParams.put("startTime",electricalMeasurementgetMeasurementProfileCommandstartTimeCommandParameterInfo); + + CommandParameterInfo electricalMeasurementgetMeasurementProfileCommandnumberOfIntervalsCommandParameterInfo = new CommandParameterInfo("numberOfIntervals", Integer.class, Integer.class); + electricalMeasurementgetMeasurementProfileCommandCommandParams.put("numberOfIntervals",electricalMeasurementgetMeasurementProfileCommandnumberOfIntervalsCommandParameterInfo); + + InteractionInfo electricalMeasurementgetMeasurementProfileCommandInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalMeasurementCluster) cluster) + .getMeasurementProfileCommand((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("attributeId") + , (Long) + commandArguments.get("startTime") + , (Integer) + commandArguments.get("numberOfIntervals") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + electricalMeasurementgetMeasurementProfileCommandCommandParams + ); + electricalMeasurementClusterInteractionInfoMap.put("getMeasurementProfileCommand", electricalMeasurementgetMeasurementProfileCommandInteractionInfo); commandMap.put("electricalMeasurement", electricalMeasurementClusterInteractionInfoMap); Map unitTestingClusterInteractionInfoMap = new LinkedHashMap<>(); Map unitTestingtestCommandParams = new LinkedHashMap(); @@ -24652,6 +25374,59 @@ public Map> getCommandMap() { unitTestingtestAddArgumentsCommandParams ); unitTestingClusterInteractionInfoMap.put("testAddArguments", unitTestingtestAddArgumentsInteractionInfo); + Map unitTestingtestSimpleArgumentRequestCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingtestSimpleArgumentRequestarg1CommandParameterInfo = new CommandParameterInfo("arg1", Boolean.class, Boolean.class); + unitTestingtestSimpleArgumentRequestCommandParams.put("arg1",unitTestingtestSimpleArgumentRequestarg1CommandParameterInfo); + + InteractionInfo unitTestingtestSimpleArgumentRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster) + .testSimpleArgumentRequest((ChipClusters.UnitTestingCluster.TestSimpleArgumentResponseCallback) callback + , (Boolean) + commandArguments.get("arg1") + + ); + }, + () -> new DelegatedUnitTestingClusterTestSimpleArgumentResponseCallback(), + unitTestingtestSimpleArgumentRequestCommandParams + ); + unitTestingClusterInteractionInfoMap.put("testSimpleArgumentRequest", unitTestingtestSimpleArgumentRequestInteractionInfo); + Map unitTestingtestStructArrayArgumentRequestCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingtestStructArrayArgumentRequestarg3CommandParameterInfo = new CommandParameterInfo("arg3", ArrayList.class, Integer.class); + unitTestingtestStructArrayArgumentRequestCommandParams.put("arg3",unitTestingtestStructArrayArgumentRequestarg3CommandParameterInfo); + + CommandParameterInfo unitTestingtestStructArrayArgumentRequestarg4CommandParameterInfo = new CommandParameterInfo("arg4", ArrayList.class, Integer.class); + unitTestingtestStructArrayArgumentRequestCommandParams.put("arg4",unitTestingtestStructArrayArgumentRequestarg4CommandParameterInfo); + + CommandParameterInfo unitTestingtestStructArrayArgumentRequestarg5CommandParameterInfo = new CommandParameterInfo("arg5", Integer.class, Integer.class); + unitTestingtestStructArrayArgumentRequestCommandParams.put("arg5",unitTestingtestStructArrayArgumentRequestarg5CommandParameterInfo); + + CommandParameterInfo unitTestingtestStructArrayArgumentRequestarg6CommandParameterInfo = new CommandParameterInfo("arg6", Boolean.class, Boolean.class); + unitTestingtestStructArrayArgumentRequestCommandParams.put("arg6",unitTestingtestStructArrayArgumentRequestarg6CommandParameterInfo); + + InteractionInfo unitTestingtestStructArrayArgumentRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster) + .testStructArrayArgumentRequest((ChipClusters.UnitTestingCluster.TestStructArrayArgumentResponseCallback) callback + , (ArrayList) + commandArguments.get("arg1") + , (ArrayList) + commandArguments.get("arg2") + , (ArrayList) + commandArguments.get("arg3") + , (ArrayList) + commandArguments.get("arg4") + , (Integer) + commandArguments.get("arg5") + , (Boolean) + commandArguments.get("arg6") + + ); + }, + () -> new DelegatedUnitTestingClusterTestStructArrayArgumentResponseCallback(), + unitTestingtestStructArrayArgumentRequestCommandParams + ); + unitTestingClusterInteractionInfoMap.put("testStructArrayArgumentRequest", unitTestingtestStructArrayArgumentRequestInteractionInfo); Map unitTestingtestStructArgumentRequestCommandParams = new LinkedHashMap(); InteractionInfo unitTestingtestStructArgumentRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -24795,6 +25570,69 @@ public Map> getCommandMap() { unitTestingtestNullableOptionalRequestCommandParams ); unitTestingClusterInteractionInfoMap.put("testNullableOptionalRequest", unitTestingtestNullableOptionalRequestInteractionInfo); + Map unitTestingtestComplexNullableOptionalRequestCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableIntCommandParameterInfo = new CommandParameterInfo("nullableInt", Integer.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableInt",unitTestingtestComplexNullableOptionalRequestnullableIntCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestoptionalIntCommandParameterInfo = new CommandParameterInfo("optionalInt", Optional.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("optionalInt",unitTestingtestComplexNullableOptionalRequestoptionalIntCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableOptionalIntCommandParameterInfo = new CommandParameterInfo("nullableOptionalInt", Optional.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableOptionalInt",unitTestingtestComplexNullableOptionalRequestnullableOptionalIntCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableStringCommandParameterInfo = new CommandParameterInfo("nullableString", String.class, String.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableString",unitTestingtestComplexNullableOptionalRequestnullableStringCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestoptionalStringCommandParameterInfo = new CommandParameterInfo("optionalString", Optional.class, String.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("optionalString",unitTestingtestComplexNullableOptionalRequestoptionalStringCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableOptionalStringCommandParameterInfo = new CommandParameterInfo("nullableOptionalString", Optional.class, String.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableOptionalString",unitTestingtestComplexNullableOptionalRequestnullableOptionalStringCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableListCommandParameterInfo = new CommandParameterInfo("nullableList", ArrayList.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableList",unitTestingtestComplexNullableOptionalRequestnullableListCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestoptionalListCommandParameterInfo = new CommandParameterInfo("optionalList", Optional.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("optionalList",unitTestingtestComplexNullableOptionalRequestoptionalListCommandParameterInfo); + + CommandParameterInfo unitTestingtestComplexNullableOptionalRequestnullableOptionalListCommandParameterInfo = new CommandParameterInfo("nullableOptionalList", Optional.class, Integer.class); + unitTestingtestComplexNullableOptionalRequestCommandParams.put("nullableOptionalList",unitTestingtestComplexNullableOptionalRequestnullableOptionalListCommandParameterInfo); + + InteractionInfo unitTestingtestComplexNullableOptionalRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster) + .testComplexNullableOptionalRequest((ChipClusters.UnitTestingCluster.TestComplexNullableOptionalResponseCallback) callback + , (Integer) + commandArguments.get("nullableInt") + , (Optional) + commandArguments.get("optionalInt") + , (Optional) + commandArguments.get("nullableOptionalInt") + , (String) + commandArguments.get("nullableString") + , (Optional) + commandArguments.get("optionalString") + , (Optional) + commandArguments.get("nullableOptionalString") + , (ChipStructs.UnitTestingClusterSimpleStruct) + commandArguments.get("nullableStruct") + , (Optional) + commandArguments.get("optionalStruct") + , (Optional) + commandArguments.get("nullableOptionalStruct") + , (ArrayList) + commandArguments.get("nullableList") + , (Optional>) + commandArguments.get("optionalList") + , (Optional>) + commandArguments.get("nullableOptionalList") + + ); + }, + () -> new DelegatedUnitTestingClusterTestComplexNullableOptionalResponseCallback(), + unitTestingtestComplexNullableOptionalRequestCommandParams + ); + unitTestingClusterInteractionInfoMap.put("testComplexNullableOptionalRequest", unitTestingtestComplexNullableOptionalRequestInteractionInfo); Map unitTestingsimpleStructEchoRequestCommandParams = new LinkedHashMap(); InteractionInfo unitTestingsimpleStructEchoRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { @@ -24865,8 +25703,89 @@ public Map> getCommandMap() { unitTestingtestEmitTestEventRequestCommandParams ); unitTestingClusterInteractionInfoMap.put("testEmitTestEventRequest", unitTestingtestEmitTestEventRequestInteractionInfo); + Map unitTestingtestEmitTestFabricScopedEventRequestCommandParams = new LinkedHashMap(); + CommandParameterInfo unitTestingtestEmitTestFabricScopedEventRequestarg1CommandParameterInfo = new CommandParameterInfo("arg1", Integer.class, Integer.class); + unitTestingtestEmitTestFabricScopedEventRequestCommandParams.put("arg1",unitTestingtestEmitTestFabricScopedEventRequestarg1CommandParameterInfo); + + InteractionInfo unitTestingtestEmitTestFabricScopedEventRequestInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.UnitTestingCluster) cluster) + .testEmitTestFabricScopedEventRequest((ChipClusters.UnitTestingCluster.TestEmitTestFabricScopedEventResponseCallback) callback + , (Integer) + commandArguments.get("arg1") + + ); + }, + () -> new DelegatedUnitTestingClusterTestEmitTestFabricScopedEventResponseCallback(), + unitTestingtestEmitTestFabricScopedEventRequestCommandParams + ); + unitTestingClusterInteractionInfoMap.put("testEmitTestFabricScopedEventRequest", unitTestingtestEmitTestFabricScopedEventRequestInteractionInfo); commandMap.put("unitTesting", unitTestingClusterInteractionInfoMap); Map faultInjectionClusterInteractionInfoMap = new LinkedHashMap<>(); + Map faultInjectionfailAtFaultCommandParams = new LinkedHashMap(); + CommandParameterInfo faultInjectionfailAtFaulttypeCommandParameterInfo = new CommandParameterInfo("type", Integer.class, Integer.class); + faultInjectionfailAtFaultCommandParams.put("type",faultInjectionfailAtFaulttypeCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultidCommandParameterInfo = new CommandParameterInfo("id", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put("id",faultInjectionfailAtFaultidCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultnumCallsToSkipCommandParameterInfo = new CommandParameterInfo("numCallsToSkip", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put("numCallsToSkip",faultInjectionfailAtFaultnumCallsToSkipCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaultnumCallsToFailCommandParameterInfo = new CommandParameterInfo("numCallsToFail", Long.class, Long.class); + faultInjectionfailAtFaultCommandParams.put("numCallsToFail",faultInjectionfailAtFaultnumCallsToFailCommandParameterInfo); + + CommandParameterInfo faultInjectionfailAtFaulttakeMutexCommandParameterInfo = new CommandParameterInfo("takeMutex", Boolean.class, Boolean.class); + faultInjectionfailAtFaultCommandParams.put("takeMutex",faultInjectionfailAtFaulttakeMutexCommandParameterInfo); + + InteractionInfo faultInjectionfailAtFaultInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .failAtFault((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("type") + , (Long) + commandArguments.get("id") + , (Long) + commandArguments.get("numCallsToSkip") + , (Long) + commandArguments.get("numCallsToFail") + , (Boolean) + commandArguments.get("takeMutex") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + faultInjectionfailAtFaultCommandParams + ); + faultInjectionClusterInteractionInfoMap.put("failAtFault", faultInjectionfailAtFaultInteractionInfo); + Map faultInjectionfailRandomlyAtFaultCommandParams = new LinkedHashMap(); + CommandParameterInfo faultInjectionfailRandomlyAtFaulttypeCommandParameterInfo = new CommandParameterInfo("type", Integer.class, Integer.class); + faultInjectionfailRandomlyAtFaultCommandParams.put("type",faultInjectionfailRandomlyAtFaulttypeCommandParameterInfo); + + CommandParameterInfo faultInjectionfailRandomlyAtFaultidCommandParameterInfo = new CommandParameterInfo("id", Long.class, Long.class); + faultInjectionfailRandomlyAtFaultCommandParams.put("id",faultInjectionfailRandomlyAtFaultidCommandParameterInfo); + + CommandParameterInfo faultInjectionfailRandomlyAtFaultpercentageCommandParameterInfo = new CommandParameterInfo("percentage", Integer.class, Integer.class); + faultInjectionfailRandomlyAtFaultCommandParams.put("percentage",faultInjectionfailRandomlyAtFaultpercentageCommandParameterInfo); + + InteractionInfo faultInjectionfailRandomlyAtFaultInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.FaultInjectionCluster) cluster) + .failRandomlyAtFault((DefaultClusterCallback) callback + , (Integer) + commandArguments.get("type") + , (Long) + commandArguments.get("id") + , (Integer) + commandArguments.get("percentage") + + ); + }, + () -> new DelegatedDefaultClusterCallback(), + faultInjectionfailRandomlyAtFaultCommandParams + ); + faultInjectionClusterInteractionInfoMap.put("failRandomlyAtFault", faultInjectionfailRandomlyAtFaultInteractionInfo); commandMap.put("faultInjection", faultInjectionClusterInteractionInfoMap); return commandMap; }