Skip to content

Commit

Permalink
Return custom status code in invoke response callback (#29398)
Browse files Browse the repository at this point in the history
* Return custom status code in invoke response callback

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 5, 2024
1 parent 9bfcdb2 commit 1298376
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/controller/java/AndroidCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,16 @@ void InvokeCallback::OnResponse(app::CommandSender * apCommandSender, const app:
VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Unable to find onResponse method: %s", ErrorStr(err)));

DeviceLayer::StackUnlock unlock;
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj, static_cast<jlong>(aStatusIB.mStatus));
if (aStatusIB.mClusterStatus.HasValue())
{
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj,
static_cast<jlong>(aStatusIB.mClusterStatus.Value()));
}
else
{
env->CallVoidMethod(mJavaCallbackRef, onResponseMethod, invokeElementObj,
static_cast<jlong>(Protocols::InteractionModel::Status::Success));
}
VerifyOrReturn(!env->ExceptionCheck(), env->ExceptionDescribe());
}

Expand Down

0 comments on commit 1298376

Please sign in to comment.