openthread_sys

Function otChannelManagerRequestChannelSelect

Source
pub unsafe extern "C" fn otChannelManagerRequestChannelSelect(
    aInstance: *mut otInstance,
    aSkipQualityCheck: bool,
) -> otError
Expand description

Requests that ChannelManager checks and selects a new channel and starts a channel change.

Unlike the otChannelManagerRequestChannelChange() where the channel must be given as a parameter, this function asks the ChannelManager to select a channel by itself (based on collected channel quality info).

Once called, the Channel Manager will perform the following 3 steps:

  1. ChannelManager decides if the channel change would be helpful. This check can be skipped if aSkipQualityCheck is set to true (forcing a channel selection to happen and skipping the quality check). This step uses the collected link quality metrics on the device (such as CCA failure rate, frame and message error rates per neighbor, etc.) to determine if the current channel quality is at the level that justifies a channel change.

  2. If the first step passes, then ChannelManager selects a potentially better channel. It uses the collected channel quality data by ChannelMonitor module. The supported and favored channels are used at this step. (see otChannelManagerSetSupportedChannels() and otChannelManagerSetFavoredChannels()).

  3. If the newly selected channel is different from the current channel, ChannelManager requests/starts the channel change process (internally invoking a RequestChannelChange()).

@param[in] aInstance A pointer to an OpenThread instance. @param[in] aSkipQualityCheck Indicates whether the quality check (step 1) should be skipped.

@retval OT_ERROR_NONE Channel selection finished successfully. @retval OT_ERROR_NOT_FOUND Supported channel mask is empty, therefore could not select a channel.