Skip to content

Commit

Permalink
Make EncodableToTLV arguments const
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Jun 6, 2024
1 parent 72450e4 commit 8a0c95b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app/CommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class CommandHandler
* case AddResponseData fails.
*/
virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable) = 0;
const DataModel::EncodableToTLV & aEncodable) = 0;

/**
* Attempts to encode a response to a command.
Expand All @@ -171,7 +171,7 @@ class CommandHandler
* AddResponseData allows the caller to try to deal with any CHIP_ERRORs.
*/
virtual void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable) = 0;
const DataModel::EncodableToTLV & aEncodable) = 0;

/**
* Check whether the InvokeRequest we are handling is a timed invoke.
Expand Down
6 changes: 3 additions & 3 deletions src/app/CommandHandlerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterfac
}

CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable)
const DataModel::EncodableToTLV & aEncodable)
{
ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId,
aResponseCommandId };
Expand All @@ -134,7 +134,7 @@ CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aR
}

CHIP_ERROR CommandHandlerImpl::AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable)
const DataModel::EncodableToTLV & aEncodable)
{
// Return early when response should not be sent out.
VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR);
Expand Down Expand Up @@ -909,7 +909,7 @@ bool CommandHandlerImpl::IsTimedInvoke() const
}

void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable)
const DataModel::EncodableToTLV & aEncodable)
{
CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable);
if (err != CHIP_NO_ERROR)
Expand Down
6 changes: 3 additions & 3 deletions src/app/CommandHandlerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class CommandHandlerImpl : public CommandHandler
CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override;

CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable) override;
const DataModel::EncodableToTLV & aEncodable) override;
void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable) override;
const DataModel::EncodableToTLV & aEncodable) override;

Access::SubjectDescriptor GetSubjectDescriptor() const override;
FabricIndex GetAccessingFabricIndex() const override;
Expand Down Expand Up @@ -409,7 +409,7 @@ class CommandHandlerImpl : public CommandHandler
* @param [in] aEncodable the data to encode for the given aResponseCommandId
*/
CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
DataModel::EncodableToTLV & aEncodable);
const DataModel::EncodableToTLV & aEncodable);

void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder);

Expand Down

0 comments on commit 8a0c95b

Please sign in to comment.