diff --git a/include/openthread/channel_manager.h b/include/openthread/channel_manager.h index af196eddc..2cef557b4 100644 --- a/include/openthread/channel_manager.h +++ b/include/openthread/channel_manager.h @@ -72,6 +72,14 @@ extern "C" { */ otError otChannelManagerRequestChannelChange(otInstance *aInstance, uint8_t aChannel); +/** + * This function gets the channel from the last successful call to `otChannelManagerRequestChannelChange()` + * + * @returns The last requested channel or zero if there has been no channel change request yet. + * + */ +uint8_t otChannelManagerGetRequestedChannel(otInstance *aInstance); + /** * This function gets the delay (in seconds) used by Channel Manager for a channel change. * diff --git a/src/core/api/channel_manager_api.cpp b/src/core/api/channel_manager_api.cpp index ccc97a690..36b2bb2fc 100644 --- a/src/core/api/channel_manager_api.cpp +++ b/src/core/api/channel_manager_api.cpp @@ -48,6 +48,13 @@ otError otChannelManagerRequestChannelChange(otInstance *aInstance, uint8_t aCha return instance.GetChannelManager().RequestChannelChange(aChannel); } +uint8_t otChannelManagerGetRequestedChannel(otInstance *aInstance) +{ + Instance &instance = *static_cast(aInstance); + + return instance.GetChannelManager().GetRequestedChannel(); +} + uint16_t otChannelManagerGetDelay(otInstance *aInstance) { Instance &instance = *static_cast(aInstance); diff --git a/src/core/utils/channel_manager.hpp b/src/core/utils/channel_manager.hpp index 0855067b3..644e68895 100644 --- a/src/core/utils/channel_manager.hpp +++ b/src/core/utils/channel_manager.hpp @@ -100,7 +100,15 @@ public: otError RequestChannelChange(uint8_t aChannel); /** - * This method gets the delay (in seconds) used for a channel change. + * This method gets the channel from the last successful call to `RequestChannelChange()`. + * + * @returns The last requested channel, or zero if there has been no channel change request yet. + * + */ + uint8_t GetRequestedChannel(void) const { return mChannel; } + + /** + * This method gets the delay (in seconds) used for a channel change. * * @returns The delay (in seconds) *