Skip to content

Commit

Permalink
Clean up group invoke requests (#18683)
Browse files Browse the repository at this point in the history
* code clean up

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
mkardous-silabs and restyled-commits authored May 23, 2022
1 parent 2db812e commit 0d5c917
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/controller/InvokeInteraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,15 @@ template <typename RequestObjectT>
CHIP_ERROR InvokeGroupCommandRequest(Messaging::ExchangeManager * exchangeMgr, chip::FabricIndex fabric, chip::GroupId groupId,
const RequestObjectT & requestCommandData)
{
CHIP_ERROR error = CHIP_NO_ERROR;
app::CommandPathParams commandPath = { groupId, RequestObjectT::GetClusterId(), RequestObjectT::GetCommandId(),
app::CommandPathFlags::kGroupIdValid };
Transport::OutgoingGroupSession session(groupId, fabric);

auto commandSender = chip::Platform::MakeUnique<app::CommandSender>(nullptr, exchangeMgr);
VerifyOrReturnError(commandSender != nullptr, CHIP_ERROR_NO_MEMORY);

error = commandSender->AddRequestData(commandPath, requestCommandData);
SuccessOrExit(error);

error = commandSender->SendGroupCommandRequest(SessionHandle(session));
SuccessOrExit(error);

exit:
chip::Platform::Delete(commandSender.release());
return error;
ReturnErrorOnFailure(commandSender->AddRequestData(commandPath, requestCommandData));
return commandSender->SendGroupCommandRequest(SessionHandle(session));
}

template <typename RequestObjectT>
Expand Down

0 comments on commit 0d5c917

Please sign in to comment.