原始链接
此模块包含控制原始链路层配置的函数。
摘要
类型定义符 |
|
---|---|
otLinkRawEnergyScanDone)(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
|
typedefvoid(*
该函数在收到 IEEE 802.15.4 帧时采用的指针。 |
otLinkRawReceiveDone)(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
|
typedefvoid(*
该函数在收到 IEEE 802.15.4 帧时采用的指针。 |
otLinkRawTransmitDone)(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
|
typedefvoid(*
该函数在收到 IEEE 802.15.4 帧时采用的指针。 |
函数 |
|
---|---|
otLinkRawEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback)
|
此方法开始无线装置上的能源扫描序列。
|
otLinkRawGetCaps(otInstance *aInstance)
|
获取电台功能。
|
otLinkRawGetPromiscuous(otInstance *aInstance)
|
bool
此函数获取混杂模式的状态。
|
otLinkRawGetRadioTime(otInstance *aInstance)
|
uint64_t
获取无线电芯片的当前平台时间(宽度为 64 位)。
|
otLinkRawGetRssi(otInstance *aInstance)
|
int8_t
获取最新的 RSSI 测量结果。
|
otLinkRawGetTransmitBuffer(otInstance *aInstance)
|
无线装置从“传输”转换为“接收”。
|
otLinkRawIsEnabled(otInstance *aInstance)
|
bool
此函数用于指示是否启用了原始链路层。
|
otLinkRawReceive(otInstance *aInstance)
|
正在将无线装置从休眠转换为接收。
|
otLinkRawSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter)
|
设置当前的 MAC 帧计数器值。
|
otLinkRawSetMacKey(otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKey *aPrevKey, const otMacKey *aCurrKey, const otMacKey *aNextKey)
|
更新 MAC 密钥和密钥索引。
|
otLinkRawSetPromiscuous(otInstance *aInstance, bool aEnable)
|
此函数可启用或停用混杂模式。
|
otLinkRawSetReceiveDone(otInstance *aInstance, otLinkRawReceiveDone aCallback)
|
此函数可启用/停用原始链路层。
|
otLinkRawSetShortAddress(otInstance *aInstance, uint16_t aShortAddress)
|
设置用于地址过滤的短地址。
|
otLinkRawSleep(otInstance *aInstance)
|
将无线装置从“接收”转换为“休眠”。
|
otLinkRawSrcMatchAddExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
将扩展地址添加到源匹配表。
|
otLinkRawSrcMatchAddShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
将源地址添加到源匹配表。
|
otLinkRawSrcMatchClearExtEntries(otInstance *aInstance)
|
从源匹配表中移除所有扩展地址。
|
otLinkRawSrcMatchClearExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
|
移除无线装置的源匹配表中的扩展地址。
|
otLinkRawSrcMatchClearShortEntries(otInstance *aInstance)
|
从源匹配表中移除所有短地址。
|
otLinkRawSrcMatchClearShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
正在移除源匹配表中的短地址。
|
otLinkRawSrcMatchEnable(otInstance *aInstance, bool aEnable)
|
为帧待处理启用/停用源匹配。
|
otLinkRawTransmit(otInstance *aInstance, otLinkRawTransmitDone aCallback)
|
此方法开始无线装置上的传输序列。
|
类型定义符
otLinkRawEnergyScanDone
void(* otLinkRawEnergyScanDone)(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
该函数在收到 IEEE 802.15.4 帧时采用的指针。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otLinkRawReceiveDone
void(* otLinkRawReceiveDone)(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
该函数在收到 IEEE 802.15.4 帧时采用的指针。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
otLinkRawTransmitDone
void(* otLinkRawTransmitDone)(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
该函数在收到 IEEE 802.15.4 帧时采用的指针。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
函数
otLinkRawEnergyScan
otError otLinkRawEnergyScan( otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback )
此方法开始无线装置上的能源扫描序列。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
返回值 |
|
otLinkRawGetCaps
otRadioCaps otLinkRawGetCaps( otInstance *aInstance )
获取电台功能。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
无线电功能位矢量。该堆栈会根据此值启用或停用某些函数。
|
otLinkRawGetPromiscuous
bool otLinkRawGetPromiscuous( otInstance *aInstance )
此函数获取混杂模式的状态。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawGetRadioTime
uint64_t otLinkRawGetRadioTime( otInstance *aInstance )
获取无线电芯片的当前平台时间(宽度为 64 位)。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
当前无线电时间(以微秒为单位)。
|
otLinkRawGetRssi
int8_t otLinkRawGetRssi( otInstance *aInstance )
获取最新的 RSSI 测量结果。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
有效的 RSSI(以 dBm 为单位)。如果 RSSI 无效,则为 127。
|
otLinkRawGetTransmitBuffer
otRadioFrame * otLinkRawGetTransmitBuffer( otInstance *aInstance )
无线装置从“传输”转换为“接收”。
此方法会返回一个指向传输缓冲区的指针。
调用方会在此缓冲区中生成 IEEE 802.15.4 帧,然后调用 otLinkRawTransmit() 来请求传输。
详情 | |||
---|---|---|---|
参数 |
|
||
返回值 |
指向传输缓冲区的指针;如果未启用原始链路层,则为 NULL。
|
otLinkRawIsEnabled
bool otLinkRawIsEnabled( otInstance *aInstance )
此函数用于指示是否启用了原始链路层。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawReceive
otError otLinkRawReceive( otInstance *aInstance )
正在将无线装置从休眠转换为接收。
打开收音机。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSetMacFrameCounter
otError otLinkRawSetMacFrameCounter( otInstance *aInstance, uint32_t aMacFrameCounter )
设置当前的 MAC 帧计数器值。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSetMacKey
otError otLinkRawSetMacKey( otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKey *aPrevKey, const otMacKey *aCurrKey, const otMacKey *aNextKey )
更新 MAC 密钥和密钥索引。
详情 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||||||
返回值 |
|
otLinkRawSetPromiscuous
otError otLinkRawSetPromiscuous( otInstance *aInstance, bool aEnable )
此函数可启用或停用混杂模式。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSetReceiveDone
otError otLinkRawSetReceiveDone( otInstance *aInstance, otLinkRawReceiveDone aCallback )
此函数可启用/停用原始链路层。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSetShortAddress
otError otLinkRawSetShortAddress( otInstance *aInstance, uint16_t aShortAddress )
设置用于地址过滤的短地址。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSleep
otError otLinkRawSleep( otInstance *aInstance )
将无线装置从“接收”转换为“休眠”。
关闭无线装置。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchAddExtEntry
otError otLinkRawSrcMatchAddExtEntry( otInstance *aInstance, const otExtAddress *aExtAddress )
将扩展地址添加到源匹配表。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchAddShortEntry
otError otLinkRawSrcMatchAddShortEntry( otInstance *aInstance, uint16_t aShortAddress )
将源地址添加到源匹配表。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchClearExtEntry
otError otLinkRawSrcMatchClearExtEntries( otInstance *aInstance )
从源匹配表中移除所有扩展地址。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSrcMatchClearExtEntry
otError otLinkRawSrcMatchClearExtEntry( otInstance *aInstance, const otExtAddress *aExtAddress )
移除无线装置的源匹配表中的扩展地址。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchClearShortEntry
otError otLinkRawSrcMatchClearShortEntries( otInstance *aInstance )
从源匹配表中移除所有短地址。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSrcMatchClearShortEntry
otError otLinkRawSrcMatchClearShortEntry( otInstance *aInstance, uint16_t aShortAddress )
正在移除源匹配表中的短地址。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchEnable
otError otLinkRawSrcMatchEnable( otInstance *aInstance, bool aEnable )
为帧待处理启用/停用源匹配。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawTransmit
otError otLinkRawTransmit( otInstance *aInstance, otLinkRawTransmitDone aCallback )
此方法开始无线装置上的传输序列。
调用方必须在请求传输之前在 otLinkRawGetTransmitBuffer() 提供的缓冲区中形成 IEEE 802.15.4 帧。通道和传输功率也包含在 otRadioFrame 结构中。
传输序列包括:
- 将无线装置从“接收”状态转换到“传输模式”。
- 发射具有给定通道的 PSDU 和特定的发射功率。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
资源
OpenThread API 参考主题源自源代码,可在 GitHub 上找到。 如需了解详情或为我们的文档做贡献,请参阅资源。