Skip to content

Commit

Permalink
Remove some useless chip::Platform::MakeUnique in src/app/tests/suite…
Browse files Browse the repository at this point in the history
…s/commands/interaction_model/InteractionModel.h (#18473)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jun 22, 2022
1 parent ec9e079 commit 1912592
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/app/tests/suites/commands/interaction_model/InteractionModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,11 @@ class InteractionModelCommands
chip::Messaging::ExchangeManager * exchangeManager = chip::app::InteractionModelEngine::GetInstance()->GetExchangeManager();
VerifyOrReturnError(exchangeManager != nullptr, CHIP_ERROR_INCORRECT_STATE);

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

ReturnErrorOnFailure(commandSender->AddRequestDataNoTimedCheck(commandPath, value, chip::NullOptional));
chip::app::CommandSender commandSender(mCallback, exchangeManager);
ReturnErrorOnFailure(commandSender.AddRequestDataNoTimedCheck(commandPath, value, chip::NullOptional));

chip::Transport::OutgoingGroupSession session(groupId, fabricIndex);
ReturnErrorOnFailure(commandSender->SendGroupCommandRequest(chip::SessionHandle(session)));
commandSender.release();

return CHIP_NO_ERROR;
return commandSender.SendGroupCommandRequest(chip::SessionHandle(session));
}

void Shutdown()
Expand Down Expand Up @@ -225,16 +220,11 @@ class InteractionModelWriter
chip::Messaging::ExchangeManager * exchangeManager = chip::app::InteractionModelEngine::GetInstance()->GetExchangeManager();
VerifyOrReturnError(exchangeManager != nullptr, CHIP_ERROR_INCORRECT_STATE);

auto writeClient =
chip::Platform::MakeUnique<chip::app::WriteClient>(exchangeManager, &mChunkedWriteCallback, chip::NullOptional);
VerifyOrReturnError(writeClient != nullptr, CHIP_ERROR_NO_MEMORY);
ReturnErrorOnFailure(writeClient->EncodeAttribute(attributePathParams, value, dataVersion));
chip::app::WriteClient writeClient(exchangeManager, &mChunkedWriteCallback, chip::NullOptional);
ReturnErrorOnFailure(writeClient.EncodeAttribute(attributePathParams, value, dataVersion));

chip::Transport::OutgoingGroupSession session(groupId, fabricIndex);
ReturnErrorOnFailure(writeClient->SendWriteRequest(chip::SessionHandle(session)));
writeClient.release();

return CHIP_NO_ERROR;
return writeClient.SendWriteRequest(chip::SessionHandle(session));
}

void Shutdown() { mWriteClient.reset(); }
Expand Down

0 comments on commit 1912592

Please sign in to comment.