From 1088687ec4006420cf873d3ee88541edc43126a7 Mon Sep 17 00:00:00 2001 From: Austin Hsieh <77706079+austinh0@users.noreply.github.com> Date: Mon, 21 Jun 2021 13:46:59 -0700 Subject: [PATCH] Regenerate all (#7796) --- src/controller/java/gen/CHIPClusters-JNI.cpp | 96 +++++++++++++++----- src/controller/java/gen/ChipClusters.java | 11 ++- 2 files changed, 80 insertions(+), 27 deletions(-) diff --git a/src/controller/java/gen/CHIPClusters-JNI.cpp b/src/controller/java/gen/CHIPClusters-JNI.cpp index 78d595f330f360..1cb31a4aaca61e 100644 --- a/src/controller/java/gen/CHIPClusters-JNI.cpp +++ b/src/controller/java/gen/CHIPClusters-JNI.cpp @@ -361,12 +361,12 @@ class CHIPApplicationLauncherClusterLaunchAppResponseCallback jobject javaCallbackRef; }; -class CHIPContentLaunchClusterLaunchContentResponseCallback - : public Callback::Callback +class CHIPContentLauncherClusterLaunchContentResponseCallback + : public Callback::Callback { public: - CHIPContentLaunchClusterLaunchContentResponseCallback(jobject javaCallback) : - Callback::Callback(CallbackFn, this) + CHIPContentLauncherClusterLaunchContentResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetEnvForCurrentThread(); if (env == nullptr) @@ -381,7 +381,7 @@ class CHIPContentLaunchClusterLaunchContentResponseCallback ChipLogError(Zcl, "Could not create global reference for Java callback"); } } - ~CHIPContentLaunchClusterLaunchContentResponseCallback() + ~CHIPContentLauncherClusterLaunchContentResponseCallback() { JNIEnv * env = JniReferences::GetEnvForCurrentThread(); if (env == nullptr) @@ -399,13 +399,13 @@ class CHIPContentLaunchClusterLaunchContentResponseCallback JNIEnv * env = JniReferences::GetEnvForCurrentThread(); jobject javaCallbackRef; jmethodID javaMethod; - CHIPContentLaunchClusterLaunchContentResponseCallback * cppCallback = nullptr; + CHIPContentLauncherClusterLaunchContentResponseCallback * cppCallback = nullptr; // ByteSpan is not properly returned yet, temporarily use empty string UtfString dataStr(env, ""); VerifyOrExit(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV); - cppCallback = reinterpret_cast(context); + cppCallback = reinterpret_cast(context); VerifyOrExit(cppCallback != nullptr, err = CHIP_JNI_ERROR_NULL_OBJECT); javaCallbackRef = cppCallback->javaCallbackRef; @@ -432,11 +432,12 @@ class CHIPContentLaunchClusterLaunchContentResponseCallback jobject javaCallbackRef; }; -class CHIPContentLaunchClusterLaunchURLResponseCallback : public Callback::Callback +class CHIPContentLauncherClusterLaunchURLResponseCallback + : public Callback::Callback { public: - CHIPContentLaunchClusterLaunchURLResponseCallback(jobject javaCallback) : - Callback::Callback(CallbackFn, this) + CHIPContentLauncherClusterLaunchURLResponseCallback(jobject javaCallback) : + Callback::Callback(CallbackFn, this) { JNIEnv * env = JniReferences::GetEnvForCurrentThread(); if (env == nullptr) @@ -451,7 +452,7 @@ class CHIPContentLaunchClusterLaunchURLResponseCallback : public Callback::Callb ChipLogError(Zcl, "Could not create global reference for Java callback"); } } - ~CHIPContentLaunchClusterLaunchURLResponseCallback() + ~CHIPContentLauncherClusterLaunchURLResponseCallback() { JNIEnv * env = JniReferences::GetEnvForCurrentThread(); if (env == nullptr) @@ -469,13 +470,13 @@ class CHIPContentLaunchClusterLaunchURLResponseCallback : public Callback::Callb JNIEnv * env = JniReferences::GetEnvForCurrentThread(); jobject javaCallbackRef; jmethodID javaMethod; - CHIPContentLaunchClusterLaunchURLResponseCallback * cppCallback = nullptr; + CHIPContentLauncherClusterLaunchURLResponseCallback * cppCallback = nullptr; // ByteSpan is not properly returned yet, temporarily use empty string UtfString dataStr(env, ""); VerifyOrExit(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV); - cppCallback = reinterpret_cast(context); + cppCallback = reinterpret_cast(context); VerifyOrExit(cppCallback != nullptr, err = CHIP_JNI_ERROR_NULL_OBJECT); javaCallbackRef = cppCallback->javaCallbackRef; @@ -5230,6 +5231,51 @@ JNI_METHOD(jlong, ApplicationBasicCluster, initWithDevice)(JNIEnv * env, jobject return reinterpret_cast(cppCluster); } +JNI_METHOD(void, ApplicationBasicCluster, changeStatus)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint status) +{ + StackLockGuard lock(JniReferences::GetStackLock()); + CHIP_ERROR err = CHIP_NO_ERROR; + ApplicationBasicCluster * cppCluster; + + CHIPDefaultSuccessCallback * onSuccess; + CHIPDefaultFailureCallback * onFailure; + + cppCluster = reinterpret_cast(clusterPtr); + VerifyOrExit(cppCluster != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + onSuccess = new CHIPDefaultSuccessCallback(callback); + VerifyOrExit(onSuccess != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + onFailure = new CHIPDefaultFailureCallback(callback); + VerifyOrExit(onFailure != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + err = cppCluster->ChangeStatus(onSuccess->Cancel(), onFailure->Cancel(), status); + SuccessOrExit(err); + +exit: + if (err != CHIP_NO_ERROR) + { + delete onSuccess; + delete onFailure; + + jthrowable exception; + jmethodID method; + + err = FindMethod(env, callback, "onError", "(Ljava/lang/Exception;)V", &method); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Error throwing IllegalStateException %d", err); + return; + } + + err = CreateIllegalStateException(env, "Error invoking cluster", err, exception); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Error throwing IllegalStateException %d", err); + return; + } + env->CallVoidMethod(callback, method, exception); + } +} JNI_METHOD(jlong, ApplicationLauncherCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) { StackLockGuard lock(JniReferences::GetStackLock()); @@ -6337,30 +6383,30 @@ JNI_METHOD(void, ColorControlCluster, stopMoveStep) env->CallVoidMethod(callback, method, exception); } } -JNI_METHOD(jlong, ContentLaunchCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) +JNI_METHOD(jlong, ContentLauncherCluster, initWithDevice)(JNIEnv * env, jobject self, jlong devicePtr, jint endpointId) { StackLockGuard lock(JniReferences::GetStackLock()); - ContentLaunchCluster * cppCluster = new ContentLaunchCluster(); + ContentLauncherCluster * cppCluster = new ContentLauncherCluster(); cppCluster->Associate(reinterpret_cast(devicePtr), endpointId); return reinterpret_cast(cppCluster); } -JNI_METHOD(void, ContentLaunchCluster, launchContent) +JNI_METHOD(void, ContentLauncherCluster, launchContent) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint autoPlay, jstring data) { StackLockGuard lock(JniReferences::GetStackLock()); CHIP_ERROR err = CHIP_NO_ERROR; - ContentLaunchCluster * cppCluster; + ContentLauncherCluster * cppCluster; JniUtfString dataStr(env, data); - CHIPContentLaunchClusterLaunchContentResponseCallback * onSuccess; + CHIPContentLauncherClusterLaunchContentResponseCallback * onSuccess; CHIPDefaultFailureCallback * onFailure; - cppCluster = reinterpret_cast(clusterPtr); + cppCluster = reinterpret_cast(clusterPtr); VerifyOrExit(cppCluster != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - onSuccess = new CHIPContentLaunchClusterLaunchContentResponseCallback(callback); + onSuccess = new CHIPContentLauncherClusterLaunchContentResponseCallback(callback); VerifyOrExit(onSuccess != nullptr, err = CHIP_ERROR_INCORRECT_STATE); onFailure = new CHIPDefaultFailureCallback(callback); VerifyOrExit(onFailure != nullptr, err = CHIP_ERROR_INCORRECT_STATE); @@ -6394,22 +6440,22 @@ JNI_METHOD(void, ContentLaunchCluster, launchContent) env->CallVoidMethod(callback, method, exception); } } -JNI_METHOD(void, ContentLaunchCluster, launchURL) +JNI_METHOD(void, ContentLauncherCluster, launchURL) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jstring contentURL, jstring displayString) { StackLockGuard lock(JniReferences::GetStackLock()); CHIP_ERROR err = CHIP_NO_ERROR; - ContentLaunchCluster * cppCluster; + ContentLauncherCluster * cppCluster; JniUtfString contentURLStr(env, contentURL); JniUtfString displayStringStr(env, displayString); - CHIPContentLaunchClusterLaunchURLResponseCallback * onSuccess; + CHIPContentLauncherClusterLaunchURLResponseCallback * onSuccess; CHIPDefaultFailureCallback * onFailure; - cppCluster = reinterpret_cast(clusterPtr); + cppCluster = reinterpret_cast(clusterPtr); VerifyOrExit(cppCluster != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - onSuccess = new CHIPContentLaunchClusterLaunchURLResponseCallback(callback); + onSuccess = new CHIPContentLauncherClusterLaunchURLResponseCallback(callback); VerifyOrExit(onSuccess != nullptr, err = CHIP_ERROR_INCORRECT_STATE); onFailure = new CHIPDefaultFailureCallback(callback); VerifyOrExit(onFailure != nullptr, err = CHIP_ERROR_INCORRECT_STATE); diff --git a/src/controller/java/gen/ChipClusters.java b/src/controller/java/gen/ChipClusters.java index 5357c1697eb414..b3087aba345aed 100644 --- a/src/controller/java/gen/ChipClusters.java +++ b/src/controller/java/gen/ChipClusters.java @@ -91,6 +91,13 @@ public ApplicationBasicCluster(long devicePtr, int endpointId) { @Override public native long initWithDevice(long devicePtr, int endpointId); + + public void changeStatus(DefaultClusterCallback callback, int status) { + changeStatus(chipClusterPtr, callback, status); + } + + private native void changeStatus( + long chipClusterPtr, DefaultClusterCallback callback, int status); } public static class ApplicationLauncherCluster extends BaseChipCluster { @@ -533,8 +540,8 @@ private native void stopMoveStep( long chipClusterPtr, DefaultClusterCallback callback, int optionsMask, int optionsOverride); } - public static class ContentLaunchCluster extends BaseChipCluster { - public ContentLaunchCluster(long devicePtr, int endpointId) { + public static class ContentLauncherCluster extends BaseChipCluster { + public ContentLauncherCluster(long devicePtr, int endpointId) { super(devicePtr, endpointId); }