Skip to content

Commit 1567435

Browse files
kkasperczyk-nopull[bot]
authored andcommitted
Added documentation regarding requesting SED poll interval update. (#11521)
In the #11314 PR there were some post-merge comments regarding missing documentation. * Added missing documentation for the RequestSEDFastPollingMode and SetSEDPollingConfig methods. * Added setting new mode only if it's different than the current one.
1 parent 2bbd8d2 commit 1567435

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

src/include/platform/ConnectivityManager.h

+15
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,22 @@ class ConnectivityManager
216216
// Sleepy end device methods
217217
#if CHIP_DEVICE_CONFIG_ENABLE_SED
218218
CHIP_ERROR GetSEDPollingConfig(SEDPollingConfig & pollingConfig);
219+
220+
/**
221+
* Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software
222+
* modules about the change.
223+
*
224+
* @param[in] pollingConfig polling intervals configuration to be set
225+
*/
219226
CHIP_ERROR SetSEDPollingConfig(const SEDPollingConfig & pollingConfig);
227+
228+
/**
229+
* Requests setting Sleepy End Device fast polling interval on or off.
230+
* Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling
231+
* consumers counter. Fast polling mode is set if the consumers counter is bigger than 0.
232+
*
233+
* @param[in] onOff true if fast polling should be enabled and false otherwise.
234+
*/
220235
CHIP_ERROR RequestSEDFastPollingMode(bool onOff);
221236
#endif
222237

src/include/platform/ThreadStackManager.h

+15
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,22 @@ class ThreadStackManager
153153

154154
#if CHIP_DEVICE_CONFIG_ENABLE_SED
155155
CHIP_ERROR GetSEDPollingConfig(ConnectivityManager::SEDPollingConfig & pollingConfig);
156+
157+
/**
158+
* Sets Sleepy End Device polling configuration and posts kSEDPollingIntervalChange event to inform other software
159+
* modules about the change.
160+
*
161+
* @param[in] pollingConfig polling intervals configuration to be set
162+
*/
156163
CHIP_ERROR SetSEDPollingConfig(const ConnectivityManager::SEDPollingConfig & pollingConfig);
164+
165+
/**
166+
* Requests setting Sleepy End Device fast polling interval on or off.
167+
* Every method call with onOff parameter set to true or false results in incrementing or decrementing the fast polling
168+
* consumers counter. Fast polling mode is set if the consumers counter is bigger than 0.
169+
*
170+
* @param[in] onOff true if fast polling should be enabled and false otherwise.
171+
*/
157172
CHIP_ERROR RequestSEDFastPollingMode(bool onOff);
158173
#endif
159174

src/messaging/ExchangeContext.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout)
8484
}
8585

8686
#if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED
87-
void ExchangeContext::UpdateSEDPollingMode(Transport::Type transportType)
87+
void ExchangeContext::UpdateSEDPollingMode()
8888
{
89-
if (transportType != Transport::Type::kBle)
89+
if (GetSessionHandle().GetPeerAddress(mExchangeMgr->GetSessionManager())->GetTransportType() != Transport::Type::kBle)
9090
{
9191
if (!IsResponseExpected() && !IsSendExpected() && (mExchangeMgr->GetNumActiveExchanges() == 1))
9292
{
@@ -488,8 +488,7 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload
488488
void ExchangeContext::MessageHandled()
489489
{
490490
#if CONFIG_DEVICE_LAYER && CHIP_DEVICE_CONFIG_ENABLE_SED
491-
const Transport::PeerAddress * peerAddress = GetSessionHandle().GetPeerAddress(mExchangeMgr->GetSessionManager());
492-
UpdateSEDPollingMode(peerAddress->GetTransportType());
491+
UpdateSEDPollingMode();
493492
#endif
494493

495494
if (mFlags.Has(Flags::kFlagClosed) || IsResponseExpected() || IsSendExpected())

src/messaging/ExchangeContext.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,11 @@ class DLL_EXPORT ExchangeContext : public ReliableMessageContext, public Referen
244244
* - set IDLE polling mode if all conditions are met:
245245
* - device doesn't expect getting response nor sending message
246246
* - there is no other active exchange than the current one
247-
* - active state is not forced (commissioning window is not opened)
248247
* - set ACTIVE polling mode if any of the conditions is met:
249248
* - device expects getting response or sending message
250249
* - there is another active exchange
251-
* - active state is forced (commissioning window is currently open)
252-
*
253-
* @param[in] transportType transport used by the exchange
254250
*/
255-
void UpdateSEDPollingMode(Transport::Type transportType);
251+
void UpdateSEDPollingMode();
256252
};
257253

258254
} // namespace Messaging

src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ template <class ImplClass>
14681468
CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_RequestSEDFastPollingMode(bool onOff)
14691469
{
14701470
CHIP_ERROR err = CHIP_NO_ERROR;
1471-
uint32_t interval;
1471+
ConnectivityManager::SEDPollingMode mode;
14721472

14731473
if (onOff)
14741474
{
@@ -1480,14 +1480,10 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_RequestSEDFastP
14801480
mFastPollingConsumers--;
14811481
}
14821482

1483-
if (mFastPollingConsumers > 0)
1484-
{
1485-
err = SetSEDPollingMode(ConnectivityManager::SEDPollingMode::Active);
1486-
}
1487-
else
1488-
{
1489-
err = SetSEDPollingMode(ConnectivityManager::SEDPollingMode::Idle);
1490-
}
1483+
mode = mFastPollingConsumers > 0 ? ConnectivityManager::SEDPollingMode::Active : ConnectivityManager::SEDPollingMode::Idle;
1484+
1485+
if (mPollingMode != mode)
1486+
err = SetSEDPollingMode(mode);
14911487

14921488
return err;
14931489
}

0 commit comments

Comments
 (0)