頻道監控
這個模組含有管道監控功能。
摘要
啟用頻道監控功能 (OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
) 後,才能使用這個模組中的函式。
頻道監控功能會定期監控所有頻道,協助判斷頻道較乾淨 (較無幹擾的頻道)。
啟用頻道監控功能後,系統會執行零持續時間能源掃描,在每個取樣間隔的每個管道上收集一個 RSSI 樣本。RSSI 範例與預先指定的 RSSI 門檻進行比較。做為頻道品質的指標,頻道監控模組會維護 RSSI 樣本的平均頻率/百分比,也就是高於指定樣本視窗 (稱為頻道座位佔用率) 的門檻。
Functions |
|
---|---|
otChannelMonitorGetChannelOccupancy(otInstance *aInstance, uint8_t aChannel)
|
uint16_t
取得特定頻道目前的頻道座位情形。
|
otChannelMonitorGetRssiThreshold(otInstance *aInstance)
|
int8_t
取得 dBm 的頻道監控 RSSI 門檻。
|
otChannelMonitorGetSampleCount(otInstance *aInstance)
|
uint32_t
取得每個管道的 RSSI 樣本總數。
|
otChannelMonitorGetSampleInterval(otInstance *aInstance)
|
uint32_t
以毫秒為單位取得管道監控樣本。
|
otChannelMonitorGetSampleWindow(otInstance *aInstance)
|
uint32_t
針對平均樣本長度 (樣本數量) 取得頻道監控情形。
|
otChannelMonitorIsEnabled(otInstance *aInstance)
|
bool
這個函式會指出是否要啟用並執行頻道監控功能。
|
otChannelMonitorSetEnabled(otInstance *aInstance, bool aEnabled)
|
啟用或停用頻道監控作業。
|
Functions
otChannelMonitorGetChannelOccupancy
uint16_t otChannelMonitorGetChannelOccupancy( otInstance *aInstance, uint8_t aChannel )
取得特定頻道目前的頻道座位情形。
頻道座位佔用率值代表高於 RSSI 閾值 (「不良」的 RSSI 樣本) 的 RSSI 樣本平均速率/百分比。
如果是第一個「取樣視窗」的樣本,平均值不會改變為實際百分比 (也就是「樣本數量」的樣本數量除以樣本總數)。在取樣「樣本」後,平均值會採用指數加權的移動平均值。實際上,這表示平均值代表最多 3 * window
個樣本,權重為最新的 kSampleWindow
範例。
0xffff
的最大值表示所有 RSSI 樣本都高於 RSSI 門檻 (例如,100% 的樣本為「不良」)。
詳情 | |||||
---|---|---|---|---|---|
參數 |
|
||||
傳回 |
指定管道目前的頻道座位情形。
|
otChannelMonitorGetRssiThreshold
int8_t otChannelMonitorGetRssiThreshold( otInstance *aInstance )
取得 dBm 的頻道監控 RSSI 門檻。
詳情 | |||
---|---|---|---|
參數 |
|
||
傳回 |
dBm 的 RSSI 門檻。
|
otChannelMonitorGetSampleCount
uint32_t otChannelMonitorGetSampleCount( otInstance *aInstance )
取得每個管道的 RSSI 樣本總數。
從啟用通道至今,系統會依管道監控模組的數量計算其總數。
詳情 | |||
---|---|---|---|
參數 |
|
||
傳回 |
目前已取得各管道的 RSSI 樣本總數。
|
otChannelMonitorGetSampleInterval
uint32_t otChannelMonitorGetSampleInterval( otInstance *aInstance )
以毫秒為單位取得管道監控樣本。
詳情 | |||
---|---|---|---|
參數 |
|
||
傳回 |
頻道監控樣本間隔時間,單位為毫秒。
|
otChannelMonitorGetSampleWindow
uint32_t otChannelMonitorGetSampleWindow( otInstance *aInstance )
針對平均樣本長度 (樣本數量) 取得頻道監控情形。
詳情 | |||
---|---|---|---|
參數 |
|
||
傳回 |
平均樣本視窗。
|
otChannelMonitorIsEnabled
bool otChannelMonitorIsEnabled( otInstance *aInstance )
這個函式會指出是否要啟用並執行頻道監控功能。
詳情 | |||
---|---|---|---|
參數 |
|
||
傳回 |
如果頻道監控功能已啟用,則為 TRUE,否則傳回 FALSE。
|
otChannelMonitorSetEnabled
otError otChannelMonitorSetEnabled( otInstance *aInstance, bool aEnabled )
啟用或停用頻道監控作業。
作業開始後,系統會清除先前收集的資料。不過,停用之後,先前收集的資料仍然有效,可以讀取。
詳情 | |||||
---|---|---|---|---|---|
參數 |
|
||||
傳回值 |
|
資源
OpenThread API 參考資料主題出自原始碼,可於 GitHub 取得。如需更多資訊,或想參閱我們的說明文件,請參閱資源。