[channel-manager] API to get the last requested channel (#2546)

This commits adds a new API to `ChannelManager` class (and a
a corresponding public OT API) to get the channel for the last
successfully requested channel change.
This commit is contained in:
Abtin Keshavarzian
2018-02-08 18:47:23 +00:00
committed by Jonathan Hui
parent 33a9b3e62b
commit e347a7ddba
3 changed files with 24 additions and 1 deletions
+8
View File
@@ -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.
*
+7
View File
@@ -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<Instance *>(aInstance);
return instance.GetChannelManager().GetRequestedChannel();
}
uint16_t otChannelManagerGetDelay(otInstance *aInstance)
{
Instance &instance = *static_cast<Instance *>(aInstance);
+9 -1
View File
@@ -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)
*