Skip to content

Commit 2b6969e

Browse files
authored
Make EncodableToTLV arguments const (#33785)
1 parent a2a25fb commit 2b6969e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/app/CommandHandler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class CommandHandler
155155
* case AddResponseData fails.
156156
*/
157157
virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
158-
DataModel::EncodableToTLV & aEncodable) = 0;
158+
const DataModel::EncodableToTLV & aEncodable) = 0;
159159

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

176176
/**
177177
* Check whether the InvokeRequest we are handling is a timed invoke.

src/app/CommandHandlerImpl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterfac
114114
}
115115

116116
CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
117-
DataModel::EncodableToTLV & aEncodable)
117+
const DataModel::EncodableToTLV & aEncodable)
118118
{
119119
ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId,
120120
aResponseCommandId };
@@ -134,7 +134,7 @@ CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aR
134134
}
135135

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

911911
void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
912-
DataModel::EncodableToTLV & aEncodable)
912+
const DataModel::EncodableToTLV & aEncodable)
913913
{
914914
CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable);
915915
if (err != CHIP_NO_ERROR)

src/app/CommandHandlerImpl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ class CommandHandlerImpl : public CommandHandler
125125
CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override;
126126

127127
CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
128-
DataModel::EncodableToTLV & aEncodable) override;
128+
const DataModel::EncodableToTLV & aEncodable) override;
129129
void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId,
130-
DataModel::EncodableToTLV & aEncodable) override;
130+
const DataModel::EncodableToTLV & aEncodable) override;
131131

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

414414
void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder);
415415

0 commit comments

Comments
 (0)