@@ -252,20 +252,32 @@ CHIP_ERROR CopyTextRecordValue(char * buffer, size_t bufferLen, chip::Optional<u
252
252
}
253
253
254
254
CHIP_ERROR CopyTextRecordValue (char * buffer, size_t bufferLen, const chip::Optional<ReliableMessageProtocolConfig> optional,
255
- bool isIdle )
255
+ TxtFieldKey key )
256
256
{
257
+ VerifyOrReturnError ((key == TxtFieldKey::kSessionIdleInterval || key == TxtFieldKey::kSessionActiveInterval ||
258
+ key == TxtFieldKey::kSessionActiveThreshold ),
259
+ CHIP_ERROR_INVALID_ARGUMENT);
257
260
VerifyOrReturnError (optional.HasValue (), CHIP_ERROR_WELL_UNINITIALIZED);
258
261
259
- auto retryInterval = isIdle ? optional.Value ().mIdleRetransTimeout : optional.Value ().mActiveRetransTimeout ;
260
-
261
- if (retryInterval > kMaxRetryInterval )
262
+ CHIP_ERROR err;
263
+ if (key == TxtFieldKey::kSessionActiveThreshold )
262
264
{
263
- ChipLogProgress (Discovery, " MRP retry interval %s value exceeds allowed range of 1 hour, using maximum available" ,
264
- isIdle ? " idle" : " active" );
265
- retryInterval = kMaxRetryInterval ;
265
+ err = CopyTextRecordValue (buffer, bufferLen, optional.Value ().mActiveThresholdTime .count ());
266
+ }
267
+ else
268
+ {
269
+ bool isIdle = (key == TxtFieldKey::kSessionIdleInterval );
270
+ auto retryInterval = isIdle ? optional.Value ().mIdleRetransTimeout : optional.Value ().mActiveRetransTimeout ;
271
+ if (retryInterval > kMaxRetryInterval )
272
+ {
273
+ ChipLogProgress (Discovery, " MRP retry interval %s value exceeds allowed range of 1 hour, using maximum available" ,
274
+ isIdle ? " idle" : " active" );
275
+ retryInterval = kMaxRetryInterval ;
276
+ }
277
+ err = CopyTextRecordValue (buffer, bufferLen, retryInterval.count ());
266
278
}
267
279
268
- return CopyTextRecordValue (buffer, bufferLen, retryInterval. count ()) ;
280
+ return err ;
269
281
}
270
282
271
283
template <class T >
@@ -275,9 +287,10 @@ CHIP_ERROR CopyTxtRecord(TxtFieldKey key, char * buffer, size_t bufferLen, const
275
287
{
276
288
case TxtFieldKey::kTcpSupported :
277
289
return CopyTextRecordValue (buffer, bufferLen, params.GetTcpSupported ());
278
- case TxtFieldKey::kSleepyIdleInterval :
279
- case TxtFieldKey::kSleepyActiveInterval :
280
- return CopyTextRecordValue (buffer, bufferLen, params.GetLocalMRPConfig (), key == TxtFieldKey::kSleepyIdleInterval );
290
+ case TxtFieldKey::kSessionIdleInterval :
291
+ case TxtFieldKey::kSessionActiveInterval :
292
+ case TxtFieldKey::kSessionActiveThreshold :
293
+ return CopyTextRecordValue (buffer, bufferLen, params.GetLocalMRPConfig (), key);
281
294
default :
282
295
return CHIP_ERROR_INVALID_ARGUMENT;
283
296
}
@@ -552,8 +565,9 @@ CHIP_ERROR DiscoveryImplPlatform::Advertise(const OperationalAdvertisingParamete
552
565
{
553
566
PREPARE_RECORDS (Operational);
554
567
555
- ADD_TXT_RECORD (SleepyIdleInterval);
556
- ADD_TXT_RECORD (SleepyActiveInterval);
568
+ ADD_TXT_RECORD (SessionIdleInterval);
569
+ ADD_TXT_RECORD (SessionActiveInterval);
570
+ ADD_TXT_RECORD (SessionActiveThreshold);
557
571
ADD_TXT_RECORD (TcpSupported);
558
572
559
573
ADD_PTR_RECORD (CompressedFabricId);
@@ -570,8 +584,9 @@ CHIP_ERROR DiscoveryImplPlatform::Advertise(const CommissionAdvertisingParameter
570
584
ADD_TXT_RECORD (VendorProduct);
571
585
ADD_TXT_RECORD (DeviceType);
572
586
ADD_TXT_RECORD (DeviceName);
573
- ADD_TXT_RECORD (SleepyIdleInterval);
574
- ADD_TXT_RECORD (SleepyActiveInterval);
587
+ ADD_TXT_RECORD (SessionIdleInterval);
588
+ ADD_TXT_RECORD (SessionActiveInterval);
589
+ ADD_TXT_RECORD (SessionActiveThreshold);
575
590
ADD_TXT_RECORD (TcpSupported);
576
591
577
592
ADD_PTR_RECORD (VendorId);
0 commit comments