@@ -669,23 +669,27 @@ 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" ,
677
+ &onResponseMethod);
684
678
VerifyOrReturn (err == CHIP_NO_ERROR, ChipLogError (Controller, " Unable to find onError method: %s" , ErrorStr (err)));
685
679
680
+ jobject jClusterState = nullptr ;
681
+ if (aStatus.mClusterStatus .HasValue ())
682
+ {
683
+ err = JniReferences::GetInstance ().CreateBoxedObject <jint>(
684
+ " java/lang/Integer" , " (I)V" , static_cast <jint>(aStatus.mClusterStatus .Value ()), jClusterState);
685
+ VerifyOrReturn (err == CHIP_NO_ERROR,
686
+ ChipLogError (Controller, " Could not CreateBoxedObject with error %" CHIP_ERROR_FORMAT, err.Format ()));
687
+ }
688
+
686
689
DeviceLayer::StackUnlock unlock;
687
690
env->CallVoidMethod (wrapperCallback, onResponseMethod, static_cast <jint>(aPath.mEndpointId ),
688
- static_cast <jlong>(aPath.mClusterId ), static_cast <jlong>(aPath.mAttributeId ));
691
+ static_cast <jlong>(aPath.mClusterId ), static_cast <jlong>(aPath.mAttributeId ), aStatus.mStatus ,
692
+ jClusterState);
689
693
VerifyOrReturn (!env->ExceptionCheck (), env->ExceptionDescribe ());
690
694
}
691
695
0 commit comments