@@ -144,7 +144,8 @@ CHIP_ERROR PairingSession::EncodeSessionParameters(TLV::Tag tag, const ReliableM
144
144
return tlvWriter.EndContainer (mrpParamsContainer);
145
145
}
146
146
147
- CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent (TLV::Tag expectedTag, TLV::ContiguousBufferTLVReader & tlvReader)
147
+ CHIP_ERROR PairingSession::DecodeSessionParametersIfPresent (TLV::Tag expectedTag, TLV::ContiguousBufferTLVReader & tlvReader,
148
+ SessionParameters & outSessionParameters)
148
149
{
149
150
CHIP_ERROR err = CHIP_NO_ERROR;
150
151
@@ -167,7 +168,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
167
168
{
168
169
uint32_t idleRetransTimeout;
169
170
ReturnErrorOnFailure (tlvReader.Get (idleRetransTimeout));
170
- mRemoteSessionParams .SetMRPIdleRetransTimeout (System::Clock::Milliseconds32 (idleRetransTimeout));
171
+ outSessionParameters .SetMRPIdleRetransTimeout (System::Clock::Milliseconds32 (idleRetransTimeout));
171
172
172
173
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
173
174
SuccessOrExit (err = tlvReader.Next ());
@@ -177,7 +178,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
177
178
{
178
179
uint32_t activeRetransTimeout;
179
180
ReturnErrorOnFailure (tlvReader.Get (activeRetransTimeout));
180
- mRemoteSessionParams .SetMRPActiveRetransTimeout (System::Clock::Milliseconds32 (activeRetransTimeout));
181
+ outSessionParameters .SetMRPActiveRetransTimeout (System::Clock::Milliseconds32 (activeRetransTimeout));
181
182
182
183
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
183
184
SuccessOrExit (err = tlvReader.Next ());
@@ -187,7 +188,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
187
188
{
188
189
uint16_t activeThresholdTime;
189
190
ReturnErrorOnFailure (tlvReader.Get (activeThresholdTime));
190
- mRemoteSessionParams .SetMRPActiveThresholdTime (System::Clock::Milliseconds16 (activeThresholdTime));
191
+ outSessionParameters .SetMRPActiveThresholdTime (System::Clock::Milliseconds16 (activeThresholdTime));
191
192
192
193
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
193
194
SuccessOrExit (err = tlvReader.Next ());
@@ -197,7 +198,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
197
198
{
198
199
uint16_t dataModelRevision;
199
200
ReturnErrorOnFailure (tlvReader.Get (dataModelRevision));
200
- mRemoteSessionParams .SetDataModelRevision (dataModelRevision);
201
+ outSessionParameters .SetDataModelRevision (dataModelRevision);
201
202
202
203
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
203
204
SuccessOrExit (err = tlvReader.Next ());
@@ -207,7 +208,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
207
208
{
208
209
uint16_t interactionModelRevision;
209
210
ReturnErrorOnFailure (tlvReader.Get (interactionModelRevision));
210
- mRemoteSessionParams .SetInteractionModelRevision (interactionModelRevision);
211
+ outSessionParameters .SetInteractionModelRevision (interactionModelRevision);
211
212
212
213
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
213
214
SuccessOrExit (err = tlvReader.Next ());
@@ -217,7 +218,7 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
217
218
{
218
219
uint32_t specificationVersion;
219
220
ReturnErrorOnFailure (tlvReader.Get (specificationVersion));
220
- mRemoteSessionParams .SetSpecificationVersion (specificationVersion);
221
+ outSessionParameters .SetSpecificationVersion (specificationVersion);
221
222
222
223
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
223
224
SuccessOrExit (err = tlvReader.Next ());
@@ -227,15 +228,15 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TL
227
228
{
228
229
uint16_t maxPathsPerInvoke;
229
230
ReturnErrorOnFailure (tlvReader.Get (maxPathsPerInvoke));
230
- mRemoteSessionParams .SetMaxPathsPerInvoke (maxPathsPerInvoke);
231
+ outSessionParameters .SetMaxPathsPerInvoke (maxPathsPerInvoke);
231
232
232
233
// The next element is optional. If it's not present, return CHIP_NO_ERROR.
233
234
SuccessOrExit (err = tlvReader.Next ());
234
235
}
235
236
236
237
// Future proofing - Don't error out if there are other tags
237
238
exit :
238
- if (err == CHIP_END_OF_TLV)
239
+ if (err == CHIP_END_OF_TLV || err == CHIP_NO_ERROR )
239
240
{
240
241
return tlvReader.ExitContainer (containerType);
241
242
}
0 commit comments