@@ -57,18 +57,44 @@ void ClearLocalMRPConfigOverride()
57
57
}
58
58
#endif
59
59
60
+ #if CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG
61
+ namespace {
62
+
63
+ // This is not a static member of ReliableMessageProtocolConfig because the free
64
+ // function GetLocalMRPConfig() needs access to it.
65
+ Optional<ReliableMessageProtocolConfig> sDynamicLocalMPRConfig ;
66
+
67
+ } // anonymous namespace
68
+
69
+ bool ReliableMessageProtocolConfig::SetLocalMRPConfig (const Optional<ReliableMessageProtocolConfig> & localMRPConfig)
70
+ {
71
+ auto oldConfig = GetLocalMRPConfig ();
72
+ sDynamicLocalMPRConfig = localMRPConfig;
73
+ return oldConfig != GetLocalMRPConfig ();
74
+ }
75
+ #endif // CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG
76
+
60
77
ReliableMessageProtocolConfig GetDefaultMRPConfig ()
61
78
{
62
79
// Default MRP intervals are defined in spec <4.12.8. Parameters and Constants>
63
80
static constexpr const System::Clock::Milliseconds32 idleRetransTimeout = 500_ms32;
64
81
static constexpr const System::Clock::Milliseconds32 activeRetransTimeout = 300_ms32;
65
82
static constexpr const System::Clock::Milliseconds16 activeThresholdTime = 4000_ms16;
83
+ static_assert (activeThresholdTime == kDefaultActiveTime , " Different active defaults?" );
66
84
return ReliableMessageProtocolConfig (idleRetransTimeout, activeRetransTimeout, activeThresholdTime);
67
85
}
68
86
69
87
Optional<ReliableMessageProtocolConfig> GetLocalMRPConfig ()
70
88
{
71
89
ReliableMessageProtocolConfig config (CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL, CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL);
90
+
91
+ #if CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG
92
+ if (sDynamicLocalMPRConfig .HasValue ())
93
+ {
94
+ config = sDynamicLocalMPRConfig .Value ();
95
+ }
96
+ #endif // CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG
97
+
72
98
#if CHIP_CONFIG_ENABLE_ICD_SERVER
73
99
// TODO ICD LIT shall not advertise the SII key
74
100
// Increase local MRP retry intervals by ICD polling intervals. That is, intervals for
0 commit comments