通路經理
本單元包含頻道管理員的函式。
摘要
啟用頻道管理員功能 (OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE) 後,即可使用本單元中的函式。只有 FTD 版本才能使用管道管理工具。
執行作業
otChannelManagerGetAutoChannelSelectionEnabled
bool otChannelManagerGetAutoChannelSelectionEnabled( otInstance *aInstance )
指出是否已啟用自動頻道選取功能。
| 詳細說明 | |||
|---|---|---|---|
| 參數 |
|
||
| 傳回 |
如果啟用這項政策,則為 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 )
要求 Thread 網路版本變更。
網路會在指定延遲時間後切換至指定版本 (請參閱 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 )
設定頻道變更的延遲時間 (以秒為單位)。
這個延遲時間應大於 Thread 網路中所有休眠裝置所使用的資料輪詢間隔時間。
| 詳細說明 | |||||
|---|---|---|---|---|---|
| 參數 |
|
||||
| 回傳值 |
|
||||
otChannelManagerSetFavoredChannels
void otChannelManagerSetFavoredChannels( otInstance *aInstance, uint32_t aChannelMask )
設定偏好的頻道遮罩。
| 詳細說明 | |||||
|---|---|---|---|---|---|
| 參數 |
|
||||
otChannelManagerSetSupportedChannels
void otChannelManagerSetSupportedChannels( otInstance *aInstance, uint32_t aChannelMask )
設定支援的頻道遮罩。
| 詳細說明 | |||||
|---|---|---|---|---|---|
| 參數 |
|
||||
資源
OpenThread API 參考資料主題源自原始碼,可於 GitHub 取得。如需更多資訊或為說明文件貢獻心力,請參閱資源。