Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
edmont committed Oct 11, 2024
1 parent 23c6d86 commit 9663583
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions include/openthread/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ otError otLinkSetWakeupChannel(otInstance *aInstance, uint8_t aChannel);
* @retval OT_ERROR_INVALID_ARGS The listen duration is greater than the listen interval.
* @retval OT_ERROR_INVALID_STATE Could not enable listening for wake-up frames due to bad configuration.
*/
otError otLinkSetWedListenEnabled(otInstance *aInstance, bool aEnable);
otError otLinkSetWakeUpListenEnabled(otInstance *aInstance, bool aEnable);

/**
* Returns whether listening for wake-up frames is enabled.
Expand All @@ -1150,7 +1150,7 @@ otError otLinkSetWedListenEnabled(otInstance *aInstance, bool aEnable);
* @retval TRUE If listening for wake-up frames is enabled.
* @retval FALSE If listening for wake-up frames is not enabled.
*/
bool otLinkIsWedListenEnabled(otInstance *aInstance);
bool otLinkIsWakeupListenEnabled(otInstance *aInstance);

/**
* Gets the WED listen interval in microseconds.
Expand Down
6 changes: 3 additions & 3 deletions src/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8301,12 +8301,12 @@ template <> otError Interpreter::Process<Cmd("wakeup")>(Arg aArgs[])
* @cparam wakeup listen @ca{enable}
* @par
* Gets or sets current wake-up listening link state.
* @sa otLinkIsWedListenEnabled
* @sa otLinkSetWedListenEnabled
* @sa otLinkIsWakeupListenEnabled
* @sa otLinkSetWakeUpListenEnabled
*/
else if (aArgs[0] == "listen")
{
error = ProcessEnableDisable(aArgs + 1, otLinkIsWedListenEnabled, otLinkSetWedListenEnabled);
error = ProcessEnableDisable(aArgs + 1, otLinkIsWakeupListenEnabled, otLinkSetWakeUpListenEnabled);
}
#endif // OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE
else
Expand Down
8 changes: 4 additions & 4 deletions src/core/api/link_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,14 @@ otError otLinkGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
}

#if OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE
otError otLinkSetWedListenEnabled(otInstance *aInstance, bool aEnable)
otError otLinkSetWakeUpListenEnabled(otInstance *aInstance, bool aEnable)
{
return AsCoreType(aInstance).Get<Mac::Mac>().SetWedListenEnabled(aEnable);
return AsCoreType(aInstance).Get<Mac::Mac>().SetWakeupListenEnabled(aEnable);
}

bool otLinkIsWedListenEnabled(otInstance *aInstance)
bool otLinkIsWakeupListenEnabled(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<Mac::Mac>().IsWedListenEnabled();
return AsCoreType(aInstance).Get<Mac::Mac>().IsWakeupListenEnabled();
}

uint32_t otLinkGetWedListenInterval(otInstance *aInstance)
Expand Down
18 changes: 9 additions & 9 deletions src/core/mac/mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Mac::Mac(Instance &aInstance)
, mDelayingSleep(false)
#endif
#if OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE
, mWedListenEnabled(false)
, mWakeupListenEnabled(false)
#endif
, mOperation(kOperationIdle)
, mPendingOperations(0)
Expand Down Expand Up @@ -2351,9 +2351,9 @@ void Mac::SetCslChannel(uint8_t aChannel)
void Mac::SetCslPeriod(uint16_t aPeriod)
{
#if OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE
if (IsWedListenEnabled() && aPeriod != 0)
if (IsWakeupListenEnabled() && aPeriod != 0)
{
IgnoreError(SetWedListenEnabled(false));
IgnoreError(SetWakeupListenEnabled(false));
LogWarn("Disabling wake-up frame listening due to CSL period change");
}
#endif
Expand Down Expand Up @@ -2487,7 +2487,7 @@ Error Mac::SetWedListenDuration(uint16_t aDuration)
return error;
}

Error Mac::SetWedListenEnabled(bool aEnable)
Error Mac::SetWakeupListenEnabled(bool aEnable)
{
Error error = kErrorNone;

Expand All @@ -2501,13 +2501,13 @@ Error Mac::SetWedListenEnabled(bool aEnable)
}
#endif

if (aEnable == mWedListenEnabled)
if (aEnable == mWakeupListenEnabled)
{
LogInfo("Listening for wake up frames was already %s", aEnable ? "started" : "stopped");
ExitNow();
}

mWedListenEnabled = aEnable;
mWakeupListenEnabled = aEnable;
UpdateWakeupListening();

LogInfo("Listening for wake up frames %s: chan:%u, addr:%s", aEnable ? "started" : "stopped", mWakeupChannel,
Expand All @@ -2521,7 +2521,7 @@ void Mac::UpdateWakeupListening(void)
{
uint8_t channel = mWakeupChannel ? mWakeupChannel : mPanChannel;

mLinks.UpdateWakeupListening(mWedListenEnabled, mWedListenInterval, mWedListenDuration, channel);
mLinks.UpdateWakeupListening(mWakeupListenEnabled, mWedListenInterval, mWedListenDuration, channel);
}

Error Mac::HandleWakeupFrame(const RxFrame &aFrame)
Expand All @@ -2535,7 +2535,7 @@ Error Mac::HandleWakeupFrame(const RxFrame &aFrame)
uint8_t retryInterval;
uint8_t retryCount;

VerifyOrExit(mWedListenEnabled && aFrame.IsWakeupFrame());
VerifyOrExit(mWakeupListenEnabled && aFrame.IsWakeupFrame());
connectionIe = aFrame.GetConnectionIe();
retryInterval = connectionIe->GetRetryInterval();
retryCount = connectionIe->GetRetryCount();
Expand Down Expand Up @@ -2565,7 +2565,7 @@ Error Mac::HandleWakeupFrame(const RxFrame &aFrame)
#endif

// Stop receiving more wake up frames
IgnoreError(SetWedListenEnabled(false));
IgnoreError(SetWakeupListenEnabled(false));

// TODO: start MLE attach process with the WC
OT_UNUSED_VARIABLE(attachDelayMs);
Expand Down
6 changes: 3 additions & 3 deletions src/core/mac/mac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,15 @@ class Mac : public InstanceLocator, private NonCopyable
* @retval kErrorInvalidArgs Configured listen interval is not greater than listen duration.
* @retval kErrorInvalidState Could not enable/disable listening for wake-up frames.
*/
Error SetWedListenEnabled(bool aEnable);
Error SetWakeupListenEnabled(bool aEnable);

/**
* Returns whether listening for wake-up frames is enabled.
*
* @retval TRUE If listening for wake-up frames is enabled.
* @retval FALSE If listening for wake-up frames is not enabled.
*/
bool IsWedListenEnabled(void) const { return mWedListenEnabled; }
bool IsWakeupListenEnabled(void) const { return mWakeupListenEnabled; }
#endif // OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE

private:
Expand Down Expand Up @@ -864,7 +864,7 @@ class Mac : public InstanceLocator, private NonCopyable
bool mDelayingSleep : 1;
#endif
#if OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE
bool mWedListenEnabled : 1;
bool mWakeupListenEnabled : 1;
#endif
Operation mOperation;
uint16_t mPendingOperations;
Expand Down

0 comments on commit 9663583

Please sign in to comment.