网络共同处理器
此模块包含用于控制线程堆栈的执行的函数。
总结
类型定义符 |
|
---|---|
otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount)
|
typedefbool(*
定义委托(函数指针)类型以控制滑出/戳操作的行为。 |
otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress)
|
typedefvoid(*
定义用于发起联接过程的处理程序(函数指针)类型。 |
otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix)
|
typedefvoid(*
定义用于设置旧版 ULA 前缀的处理程序(函数指针)类型。 |
otNcpHandlerStartLegacy)(void)
|
typedefvoid(*
定义用于启动旧版网络的处理程序(函数指针)类型。 |
otNcpHandlerStopLegacy)(void)
|
typedefvoid(*
定义用于停止旧版网络的处理程序(函数指针)类型。 |
otNcpHdlcSendCallback)(const uint8_t *aBuf, uint16_t aBufLength)
|
typedefint(*
可调用此函数指针发送 HDLC 编码的 NCP 数据。 |
otNcpLegacyHandlers
|
typedefstruct otNcpLegacyHandlers
定义包含所有旧版处理程序(函数指针)的结构体。 |
函数 |
|
---|---|
otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix)
|
void
旧版堆栈会调用此回调,以通知旧版 ULA 前缀已更改。
|
otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr)
|
void
旧版堆栈会调用此回调,以通知新的旧版节点确实已加入网络。
|
otNcpHdlcInit(otInstance *aInstance, otNcpHdlcSendCallback aSendCallback)
|
void
基于 HDLC 框架初始化 NCP。
|
otNcpHdlcReceive(const uint8_t *aBuf, uint16_t aBufLength)
|
void
在收到 HDLC 编码的 NCP 数据后,系统会调用此函数。
|
otNcpHdlcSendDone(void)
|
void
此函数在 NCP 发送完成后调用。
|
otNcpPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
|
void
使用
otNcpStreamWrite 写入 OpenThread 日志。 |
otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers)
|
void
此方法会向 NCP 注册一组旧版处理程序。
|
otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate)
|
void
此方法用于向 NCP 模块注册窥探/调用委托函数。
|
otNcpSpiInit(otInstance *aInstance)
|
void
根据 SPI 框架初始化 NCP。
|
otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen)
|
通过特定数据流将数据发送到主机。
|
结构体 |
|
---|---|
otNcpLegacyHandlers |
定义包含所有旧版处理程序(函数指针)的结构体。 |
类型定义符
otNcpDelegateAllowPeekPoke
bool(* otNcpDelegateAllowPeekPoke)(uint32_t aAddress, uint16_t aCount)
定义委托(函数指针)类型以控制滑出/戳操作的行为。
调用此委托函数来确定允许对特定内存区域执行 pock 操作还是 poke 操作。如果 NCP 支持跳转/Pock 命令,则启用该服务。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
为 True 时,可允许出现给定内存区域,但其他情况下为 False。
|
otNcpHandlerJoinLegacyNode
void(* otNcpHandlerJoinLegacyNode)(const otExtAddress *aExtAddress)
定义用于发起联接过程的处理程序(函数指针)类型。
调用用于向任何或特定节点启动旧版加入过程。
详情 | |||
---|---|---|---|
参数 |
|
otNcpHandlerSetLegacyUlaPrefix
void(* otNcpHandlerSetLegacyUlaPrefix)(const uint8_t *aUlaPrefix)
定义用于设置旧版 ULA 前缀的处理程序(函数指针)类型。
调用以设置旧版 ULA 前缀。
详情 | |||
---|---|---|---|
参数 |
|
otNcpHandlerStartLegacy
void(* otNcpHandlerStartLegacy)(void)
定义用于启动旧版网络的处理程序(函数指针)类型。
调用以启动旧版网络。
otNcpHandlerStopLegacy
void(* otNcpHandlerStopLegacy)(void)
定义用于停止旧版网络的处理程序(函数指针)类型。
调用以停止旧版网络。
otNcpHdlcSendCallback
int(* otNcpHdlcSendCallback)(const uint8_t *aBuf, uint16_t aBufLength)
可调用此函数指针发送 HDLC 编码的 NCP 数据。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
回调处理的字节数。
|
函数
otNcpHandleDidReceiveNewLegacyUlaPrefix
void otNcpHandleDidReceiveNewLegacyUlaPrefix( const uint8_t *aUlaPrefix )
旧版堆栈会调用此回调,以通知旧版 ULA 前缀已更改。
详情 | |||
---|---|---|---|
参数 |
|
otNcpHandleLegacyNodeDidJoin
void otNcpHandleLegacyNodeDidJoin( const otExtAddress *aExtAddr )
旧版堆栈会调用此回调,以通知新的旧版节点确实已加入网络。
详情 | |||
---|---|---|---|
参数 |
|
OTNcpHdlcInit
void otNcpHdlcInit( otInstance *aInstance, otNcpHdlcSendCallback aSendCallback )
基于 HDLC 框架初始化 NCP。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
OTNcpHdlcReceive
void otNcpHdlcReceive( const uint8_t *aBuf, uint16_t aBufLength )
在收到 HDLC 编码的 NCP 数据后,系统会调用此函数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
oNcpHdlcSendDone
void otNcpHdlcSendDone( void )
此函数在 NCP 发送完成后调用。
otNcpPlatLogv
void otNcpPlatLogv( otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs )
使用 otNcpStreamWrite
写入 OpenThread 日志。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
otNcpRegisterLegacyHandlers
void otNcpRegisterLegacyHandlers( const otNcpLegacyHandlers *aHandlers )
此方法会向 NCP 注册一组旧版处理程序。
结构 aHandlers
提供的处理程序集由 NCP 代码用于启动/停止旧式网络。aHandlers
可以为 NULL,以停用对 NCP 的旧版支持。给定处理程序结构体中的各个处理程序也可以是 NULL。
详情 | |||
---|---|---|---|
参数 |
|
otNcpRegisterPeekPokeDelagates
void otNcpRegisterPeekPokeDelagates( otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate )
此方法用于向 NCP 模块注册窥探/调用委托函数。
NCP 模块会调用委托函数,以确定是否允许对特定内存区域执行 poke 或 sike 操作。如果委托指针设置为 NULL,则允许对任何地址执行快速查看/写入操作。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
2017 年 5 月 10 日
void otNcpSpiInit( otInstance *aInstance )
根据 SPI 框架初始化 NCP。
详情 | |||
---|---|---|---|
参数 |
|
otNcpStreamWrite
otError otNcpStreamWrite( int aStreamId, const uint8_t *aDataPtr, int aDataLen )
通过特定数据流将数据发送到主机。
此函数尝试使用指定的 aStreamId 将给定数据发送到主机。这对于报告错误消息、实现调试/诊断控制台以及可能其他类型的数据流非常有用。
写入完全或被拒绝。系统不会尝试部分写入。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
宏
OT_NCP_LEGACY_ULA_PREFIX_LENGTH
OT_NCP_LEGACY_ULA_PREFIX_LENGTH 8
旧版 ULA 大小(以字节为单位)
资源
OpenThread API 的参考主题源自 GitHub 上的源代码。 如需了解详情或为我们的文档做贡献,请参阅资源。