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 <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Oct 11, 2023
1 parent b261701 commit 6c7b7c0
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 6c7b7c0

Please sign in to comment.