@@ -669,23 +669,25 @@ void WriteAttributesCallback::OnResponse(const app::WriteClient * apWriteClient,
669
669
JNIEnv * env = JniReferences::GetInstance ().GetEnvForCurrentThread ();
670
670
VerifyOrReturn (env != nullptr , ChipLogError (Controller, " Could not get JNIEnv for current thread" ));
671
671
JniLocalReferenceScope scope (env);
672
-
673
- if (aStatus.mStatus != Protocols::InteractionModel::Status::Success)
674
- {
675
- ReportError (&aPath, aStatus.mStatus );
676
- return ;
677
- }
678
-
679
672
jmethodID onResponseMethod;
680
673
VerifyOrReturn (mWrapperCallbackRef .HasValidObjectRef (),
681
674
ChipLogError (Controller, " mWrapperCallbackRef is not valid in %s" , __func__));
682
675
jobject wrapperCallback = mWrapperCallbackRef .ObjectRef ();
683
- err = JniReferences::GetInstance ().FindMethod (env, wrapperCallback, " onResponse" , " (IJJ )V" , &onResponseMethod);
676
+ err = JniReferences::GetInstance ().FindMethod (env, wrapperCallback, " onResponse" , " (IJJILjava/lang/Integer; )V" , &onResponseMethod);
684
677
VerifyOrReturn (err == CHIP_NO_ERROR, ChipLogError (Controller, " Unable to find onError method: %s" , ErrorStr (err)));
685
678
679
+ jobject jClusterState = nullptr ;
680
+ if (aStatus.mClusterStatus .HasValue ())
681
+ {
682
+ err = JniReferences::GetInstance ().CreateBoxedObject <jint>(
683
+ " java/lang/Integer" , " (I)V" , static_cast <jint>(aStatus.mClusterStatus .Value ()), jClusterState);
684
+ VerifyOrReturn (err == CHIP_NO_ERROR,
685
+ ChipLogError (Controller, " Could not CreateBoxedObject with error %" CHIP_ERROR_FORMAT, err.Format ()));
686
+ }
687
+
686
688
DeviceLayer::StackUnlock unlock;
687
689
env->CallVoidMethod (wrapperCallback, onResponseMethod, static_cast <jint>(aPath.mEndpointId ),
688
- static_cast <jlong>(aPath.mClusterId ), static_cast <jlong>(aPath.mAttributeId ));
690
+ static_cast <jlong>(aPath.mClusterId ), static_cast <jlong>(aPath.mAttributeId ), aStatus. mStatus , jClusterState );
689
691
VerifyOrReturn (!env->ExceptionCheck (), env->ExceptionDescribe ());
690
692
}
691
693
0 commit comments