|
46 | 46 | #include <system/SystemFaultInjection.h>
|
47 | 47 | #endif
|
48 | 48 |
|
| 49 | +#if CONFIG_BUILD_FOR_HOST_UNIT_TEST |
| 50 | +#include <messaging/ReliableMessageProtocolConfig.h> |
| 51 | +#endif |
| 52 | + |
49 | 53 | using namespace chip;
|
50 | 54 | using namespace chip::ArgParser;
|
51 | 55 | using namespace chip::Platform;
|
|
112 | 116 | kDeviceOption_WiFiSupports5g,
|
113 | 117 | #if CONFIG_BUILD_FOR_HOST_UNIT_TEST
|
114 | 118 | kDeviceOption_SubscriptionResumptionRetryIntervalSec,
|
| 119 | + kDeviceOption_IdleRetransmitTimeout, |
| 120 | + kDeviceOption_ActiveRetransmitTimeout, |
| 121 | + kDeviceOption_ActiveThresholdTime, |
115 | 122 | #endif
|
116 | 123 | #if CHIP_WITH_NLFAULTINJECTION
|
117 | 124 | kDeviceOption_FaultInjection,
|
@@ -187,6 +194,9 @@ OptionDef sDeviceOptionDefs[] = {
|
187 | 194 | #if CONFIG_BUILD_FOR_HOST_UNIT_TEST
|
188 | 195 | { "subscription-capacity", kArgumentRequired, kDeviceOption_SubscriptionCapacity },
|
189 | 196 | { "subscription-resumption-retry-interval", kArgumentRequired, kDeviceOption_SubscriptionResumptionRetryIntervalSec },
|
| 197 | + { "idle-retransmit-timeout", kArgumentRequired, kDeviceOption_IdleRetransmitTimeout }, |
| 198 | + { "active-retransmit-timeout", kArgumentRequired, kDeviceOption_ActiveRetransmitTimeout }, |
| 199 | + { "active-threshold-time", kArgumentRequired, kDeviceOption_ActiveThresholdTime }, |
190 | 200 | #endif
|
191 | 201 | #if CHIP_WITH_NLFAULTINJECTION
|
192 | 202 | { "faults", kArgumentRequired, kDeviceOption_FaultInjection },
|
@@ -335,6 +345,19 @@ const char * sDeviceOptionHelp =
|
335 | 345 | " Max number of subscriptions the device will allow\n"
|
336 | 346 | " --subscription-resumption-retry-interval\n"
|
337 | 347 | " subscription timeout resumption retry interval in seconds\n"
|
| 348 | + " --idle-retransmit-timeout <timeout>\n" |
| 349 | + " Sets the MRP idle retry interval (in milliseconds).\n" |
| 350 | + " This interval is used by the peer to calculate the retransmission timeout when the current device is considered idle.\n" |
| 351 | + "\n" |
| 352 | + " --active-retransmit-timeout <timeout>\n" |
| 353 | + " Sets the MRP active retry interval (in milliseconds).\n" |
| 354 | + " This interval is used by the peer to calculate the retransmission timeout when the current device is considered " |
| 355 | + "active.\n" |
| 356 | + "\n" |
| 357 | + " --active-threshold-time <time>\n" |
| 358 | + " Sets the MRP active threshold (in milliseconds).\n" |
| 359 | + " Specifies the time after which the device transitions from active to idle.\n" |
| 360 | + "\n" |
338 | 361 | #endif
|
339 | 362 | #if CHIP_WITH_NLFAULTINJECTION
|
340 | 363 | " --faults <fault-string,...>\n"
|
@@ -663,6 +686,32 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier,
|
663 | 686 | case kDeviceOption_SubscriptionResumptionRetryIntervalSec:
|
664 | 687 | LinuxDeviceOptions::GetInstance().subscriptionResumptionRetryIntervalSec = static_cast<int32_t>(atoi(aValue));
|
665 | 688 | break;
|
| 689 | + case kDeviceOption_IdleRetransmitTimeout: { |
| 690 | + auto mrpConfig = GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig()); |
| 691 | + auto idleRetransTimeout = System::Clock::Milliseconds32(static_cast<uint32_t>(strtoul(aValue, nullptr, 0))); |
| 692 | + auto activeRetransTimeout = mrpConfig.mActiveRetransTimeout; |
| 693 | + auto activeThresholdTime = mrpConfig.mActiveThresholdTime; |
| 694 | + OverrideLocalMRPConfig(idleRetransTimeout, activeRetransTimeout, activeThresholdTime); |
| 695 | + break; |
| 696 | + } |
| 697 | + |
| 698 | + case kDeviceOption_ActiveRetransmitTimeout: { |
| 699 | + auto mrpConfig = GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig()); |
| 700 | + auto idleRetransTimeout = mrpConfig.mIdleRetransTimeout; |
| 701 | + auto activeRetransTimeout = System::Clock::Milliseconds32(static_cast<uint32_t>(strtoul(aValue, nullptr, 0))); |
| 702 | + auto activeThresholdTime = mrpConfig.mActiveThresholdTime; |
| 703 | + OverrideLocalMRPConfig(idleRetransTimeout, activeRetransTimeout, activeThresholdTime); |
| 704 | + break; |
| 705 | + } |
| 706 | + |
| 707 | + case kDeviceOption_ActiveThresholdTime: { |
| 708 | + auto mrpConfig = GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig()); |
| 709 | + auto idleRetransTimeout = mrpConfig.mIdleRetransTimeout; |
| 710 | + auto activeRetransTimeout = mrpConfig.mActiveRetransTimeout; |
| 711 | + auto activeThresholdTime = System::Clock::Milliseconds16(static_cast<uint16_t>(strtoul(aValue, nullptr, 0))); |
| 712 | + OverrideLocalMRPConfig(idleRetransTimeout, activeRetransTimeout, activeThresholdTime); |
| 713 | + break; |
| 714 | + } |
666 | 715 | #endif
|
667 | 716 | #if CHIP_WITH_NLFAULTINJECTION
|
668 | 717 | case kDeviceOption_FaultInjection: {
|
|
0 commit comments