原始链接
此模块包含用于控制原始链路层配置的函数。
摘要
类型定义符 |
|
---|---|
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 帧计数器值。
|
otLinkRawSetMacFrameCounterIfLarger(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 帧计数器值。
始终将 MAC 计数器设置为新的给定值 aMacFrameCounter
,与当前值无关。
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSetMacFrameCounterIfLarger
otError otLinkRawSetMacFrameCounterIfLarger(
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
)
正在向来源匹配表添加短地址。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchClearExtEntries
otError otLinkRawSrcMatchClearExtEntries(
otInstance *aInstance
)
从来源匹配表中移除所有扩展地址。
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otLinkRawSrcMatchClearExtEntry
otError otLinkRawSrcMatchClearExtEntry(
otInstance *aInstance,
const otExtAddress *aExtAddress
)
正在移除电台来源匹配表的扩展地址。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otLinkRawSrcMatchClearShortEntries
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 上提供的源代码。如需了解详情,或者为我们的文档做贡献,请参阅资源。