Skip to content

Commit 8882fd3

Browse files
yufengwangcarestyled-commits
authored andcommitted
Return custom status code in invoke response callback (project-chip#29398)
* Return custom status code in invoke response callback * Restyled by clang-format --------- Co-authored-by: Restyled.io <[email protected]>
1 parent ede80d5 commit 8882fd3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/controller/java/AndroidCallbacks.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,16 @@ void InvokeCallback::OnResponse(app::CommandSender * apCommandSender, const app:
832832
VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onResponse method: %s", ErrorStr(err)));
833833

834834
DeviceLayer::StackUnlock unlock;
835-
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj, static_cast<jlong>(aStatusIB.mStatus));
835+
if (aStatusIB.mClusterStatus.HasValue())
836+
{
837+
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj,
838+
static_cast<jlong>(aStatusIB.mClusterStatus.Value()));
839+
}
840+
else
841+
{
842+
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj,
843+
static_cast<jlong>(Protocols::InteractionModel::Status::Success));
844+
}
836845
VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe());
837846
}
838847

0 commit comments

Comments
 (0)