渠道经理
此模块包含适用于频道管理器的函数。
摘要
如果启用了“频道管理器”功能 (OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE
),则可以使用此模块中的函数。渠道管理器仅适用于 FTD build。
函数 |
|
---|---|
otChannelManagerGetAutoChannelSelectionEnabled(otInstance *aInstance)
|
bool
此函数用于指明是否启用了自动渠道选择功能。
|
otChannelManagerGetAutoChannelSelectionInterval(otInstance *aInstance)
|
uint32_t
此函数可获取自动频道选择功能使用的周期(以秒为单位)。
|
otChannelManagerGetCcaFailureRateThreshold(otInstance *aInstance)
|
uint16_t
此函数可获取 CCA 失败率阈值。
|
otChannelManagerGetDelay(otInstance *aInstance)
|
uint16_t
此函数可获取渠道管理器更改频道所用的延迟时间(以秒为单位)。
|
otChannelManagerGetFavoredChannels(otInstance *aInstance)
|
uint32_t
此函数将获取首选通道掩码。
|
otChannelManagerGetRequestedChannel(otInstance *aInstance)
|
uint8_t
此函数获取上次成功调用
otChannelManagerRequestChannelChange() 的频道 |
otChannelManagerGetSupportedChannels(otInstance *aInstance)
|
uint32_t
此函数可获取受支持的通道掩码。
|
otChannelManagerRequestChannelChange(otInstance *aInstance, uint8_t aChannel)
|
void
此函数请求线程线程通道更改。
|
otChannelManagerRequestChannelSelect(otInstance *aInstance, bool aSkipQualityCheck)
|
此函数要求
ChannelManager 检查并选择新通道,然后启动通道更改。 |
otChannelManagerSetAutoChannelSelectionEnabled(otInstance *aInstance, bool aEnabled)
|
void
此函数用于启用/停用自动频道选择功能。
|
otChannelManagerSetAutoChannelSelectionInterval(otInstance *aInstance, uint32_t aInterval)
|
此函数设置自动频道选择功能使用的时间间隔(以秒为单位)。
|
otChannelManagerSetCcaFailureRateThreshold(otInstance *aInstance, uint16_t aThreshold)
|
void
此函数会设置 CCA 失败率阈值。
|
otChannelManagerSetDelay(otInstance *aInstance, uint16_t aDelay)
|
此函数设置频道变更所用的延迟时间(以秒为单位)。
|
otChannelManagerSetFavoredChannels(otInstance *aInstance, uint32_t aChannelMask)
|
void
此函数会设置首选通道掩码。
|
otChannelManagerSetSupportedChannels(otInstance *aInstance, uint32_t aChannelMask)
|
void
此函数可设置支持的通道掩码。
|
函数
otChannelManagerGetAutoChannelSelectionEnabled
bool otChannelManagerGetAutoChannelSelectionEnabled( otInstance *aInstance )
此函数用于指明是否启用了自动渠道选择功能。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
如果已启用,则为 TRUE;如果已停用,则为 FALSE。
|
otChannelManagerGetAutoChannelSelectionInterval
uint32_t otChannelManagerGetAutoChannelSelectionInterval( otInstance *aInstance )
此函数可获取自动频道选择功能使用的周期(以秒为单位)。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
间隔时间(以秒为单位)。
|
otChannelManagerGetCcaFailureRateThreshold
uint16_t otChannelManagerGetCcaFailureRateThreshold( otInstance *aInstance )
此函数可获取 CCA 失败率阈值。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
CCA 失败率阈值。值 0 映射到 0%,0xffff 映射到 100%。
|
otChannelManagerGetDelay
uint16_t otChannelManagerGetDelay( otInstance *aInstance )
此函数可获取渠道管理器更改频道所用的延迟时间(以秒为单位)。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
频道变更的延迟时间(以秒为单位)。
|
otChannelManagerGetFavoredChannels
uint32_t otChannelManagerGetFavoredChannels( otInstance *aInstance )
此函数将获取首选通道掩码。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
首选通道作为位掩码。
|
otChannelManagerGetRequestedChannel
uint8_t otChannelManagerGetRequestedChannel( otInstance *aInstance )
otChannelManagerGetSupportedChannels
uint32_t otChannelManagerGetSupportedChannels( otInstance *aInstance )
此函数可获取受支持的通道掩码。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
受支持的通道作为位掩码。
|
otChannelManagerRequestChannelChange
void otChannelManagerRequestChannelChange( otInstance *aInstance, uint8_t aChannel )
此函数请求线程线程通道更改。
网络在指定延迟之后切换到指定频道(请参阅 otChannelManagerSetDelay())。通过更新待处理操作数据集执行频道更改。
如果对此函数进行后续调用,系统会取消以前请求的渠道更改。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otChannelManagerRequestChannelSelect
otError otChannelManagerRequestChannelSelect( otInstance *aInstance, bool aSkipQualityCheck )
此函数要求 ChannelManager
检查并选择新的通道,然后启动通道变更。
与必须将频道作为参数进行提供的 otChannelManagerRequestChannelChange()
不同,此函数要求 ChannelManager
根据频道质量信息自行选择频道。
调用之后,频道管理员会执行以下 3 个步骤:
1) ChannelManager
负责确定频道变更是否有帮助。如果 aSkipQualityCheck
设为 true,系统会跳过此检查(强制选择频道并跳过质量检查)。此步骤会使用设备上收集的链路质量指标(例如 CCA 失败率、每个邻居的帧和消息错误率等)来确定当前频道质量是否达到要求频道更改的合理水平。
2) 如果第一步通过,ChannelManager
会选择一个可能效果更高的频道。它使用通过 ChannelMonitor
模块收集的频道质量数据。在此步骤中,将使用受支持和首选的频道。(请参阅 otChannelManagerSetSupportedChannels() 和 otChannelManagerSetFavoredChannels())。
3) 如果新选择的频道与当前频道不同,ChannelManager
会请求/启动频道变更过程(在内部调用 RequestChannelChange()
)。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otChannelManagerSetAutoChannelSelectionEnabled
void otChannelManagerSetAutoChannelSelectionEnabled( otInstance *aInstance, bool aEnabled )
此函数用于启用/停用自动频道选择功能。
启用后,ChannelManager
将定期调用 RequestChannelSelect(false)
。间隔可以通过 SetAutoChannelSelectionInterval()
设置。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otChannelManagerSetAutoChannelSelectionInterval
otError otChannelManagerSetAutoChannelSelectionInterval( otInstance *aInstance, uint32_t aInterval )
此函数设置自动频道选择功能使用的时间间隔(以秒为单位)。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otChannelManagerSetCcaFailureRateThreshold
void otChannelManagerSetCcaFailureRateThreshold( otInstance *aInstance, uint16_t aThreshold )
此函数会设置 CCA 失败率阈值。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otChannelManagerSetDelay
otError otChannelManagerSetDelay( otInstance *aInstance, uint16_t aDelay )
此函数设置频道变更所用的延迟时间(以秒为单位)。
延迟应长于线程网络内所有休眠端设备所使用的最大数据轮询时间间隔。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otChannelManagerSetFavoredChannels
void otChannelManagerSetFavoredChannels( otInstance *aInstance, uint32_t aChannelMask )
此函数会设置首选通道掩码。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otChannelManagerSetSupportedChannels
void otChannelManagerSetSupportedChannels( otInstance *aInstance, uint32_t aChannelMask )
此函数可设置支持的通道掩码。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
资源
OpenThread API 参考主题源自源代码,可在 GitHub 上找到。 如需了解详情或为我们的文档做贡献,请参阅资源。