zigbee学习之14—zstackapi解读2

zigbee学习之14—zstackapi解读2

ID:48277302

大小:74.31 KB

页数:4页

时间:2019-11-29

上传者:简单2019
zigbee学习之14—zstackapi解读2_第1页
zigbee学习之14—zstackapi解读2_第2页
zigbee学习之14—zstackapi解读2_第3页
zigbee学习之14—zstackapi解读2_第4页
资源描述:

《zigbee学习之14—zstackapi解读2》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

#1楼主:【原创】ZigBee学习之14——ZStackAPI解读2文章发表于:2010-02-0615:50ZDO邦定API绑定机制允许一个应用服务在不知道目标地址的情况下向对方(的应用服务)发送数据包。发送时使用的目标地址将由应用支持子层从绑定表中自动获得,从而能使消息顺利被目标节点的一个或多个应用服务,乃至分组接收。由于所有邦定信息都在Zigbee协调器中,所以只有协调器才能接收邦定请求。ZDOBindingAPIZDPBindingServiceCommandZDP_EndDeviceBindReq()End_Device_Bind_reqZDP_EndDeviceBindRsp()End_Device_Bind_rspZDP_BindReq()Bind_reqZDP_BindRsp()Bind_rspZDP_UnbindReq()Unbind_reqZDP_UnbindRsp()Unbind_rspafStatus_tZDP_EndDeviceBindReq(zAddrType_t*dstAddr,uint16LocalCoordinator,byteepIntf,uint16ProfileID,byteNumInClusters,byte*InClusterList,byteNumOutClusters,byte*OutClusterList,byteSecuritySuite);构建并发送节点设备邦定请求(HandBingding)。LocalCoordinator-设备父协调器的16位网络地址NumInClusters-输入簇中的clusterID数目InClusterList-输入clusterIDs的数组afStatus_tZDP_EndDeviceBindRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteSecurityEnable);Status-SUCCESS0NOT_SUPPORTED1TIMEOUT2NO_MATCH3afStatus_tZDP_BindReq(zAddrType_t*dstAddr,byte*SourceAddr,byteSrcEPIntf,byteClusterID,byte*DestinationAddr,byteDstEPIntf,byteSecuritySuite);请求协调器利用clusterID邦定应用ClusterID–要邦定的clusterIDDestinationAddr–接收消息的设备的64位地址afStatus_tZDP_BindRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteSecurityEnable);Status-SUCCESS0NOT_SUPPORTED1TABLE_FULL2afStatus_tZDP_UnbindReq(zAddrType_t*dstAddr,byte*SourceAddr,byteSrcEPIntf,byteClusterID,byte*DestinationAddr,byteDstEPIntf,byteSecuritySuite); 请求Zigbee协调器移除邦定。afStatus_tZDP_UnbindRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteSecurityEnable);Status-SUCCESS0x00NOT_SUPPORTED1NO_ENTRY2ZDO管理API这些消息用来取得设备状态和更新表格ZDPManagementAPIZDPNetworkManagementServiceCommandZDP_MgmtNwkDiscReq()Mgmt_NWK_Disc_reqZDP_MgmtNwkDiscRsp()Mgmt_NWK_Disc_rspZDP_MgmtLqiReq()Mgmt_Lqi_reqZDP_MgmtLqiRsp()Mgmt_Lqi_rspZDP_MgmtRtgReq()Mgmt_Lqi_reqZDP_MgmtRtgRsp()Mgmt_Rtg_rspZDP_MgmtBindReq()Mgmt_Bind_reqZDP_MgmtBindRsp()Mgmt_Bind_rspZDP_MgmtLeaveReq()Mgmt_Leave_reqZDP_MgmtLeaveRsp()Mgmt_Leave_rspZDP_MgmtDirectJoinReq()Mgmt_Direct_Join_reqZDP_MgmtDirectJoinRsp()Mgmt_Direct_Join_rspZDP_MgmtPermitJoinReq()Mgmt_Permit_Join_reqZDP_MgmtPermitJoinRsp()Mgmt_Permit_Join_rspafStatus_tZDP_MgmtNwkDiscReq(zAddrType_t*dstAddr,uint32ScanChannels,byteStartIndex,byteSecurityEnable);如果设备支持这个命令,调用此函数将为目标设备产生一个扫描网络的请求。只有设置ZDO_MGMT_NWKDISC_REQUEST编译选项(ZDConfig.h)才能调用此函数。afStatus_tZDP_MgmtNwkDiscRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteNetworkCount,byteStartIndex,byteNetworkCountList,networkDesc_t*NetworkList,byteSecurityEnable);若设置ZDO_MGMT_NWKDISC_RESPONSE编译选项,当接收到“ManagementNetworkDiscoveryRequest”消息后将自动产生这个消息。afStatus_tZDP_MgmtLqiReq(zAddrType_t*dstAddr,byteStartIndex,byteSecurityEnable);若设置ZDO_MGMT_LQI_REQUEST编译选项,调用此函数将为目标设备产生返回邻居列表的请求。ZStatus_tZDP_MgmtLqiRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteNeighborLqiEntries,byteStartIndex,byteNeighborLqiCount,neighborLqiItem_t*NeighborLqiList,byteSecurityEnable);afStatus_tZDP_MgmtRtgReq(zAddrType_t*dstAddr,byteStartIndex,byteSecurityEnable);若设置ZDO_MGMT_RTG_REQUEST编译选项,调用此函数将为目标设备产生返回路由列表的请求。 ZStatus_t–状态值,定义在ZComDef.h中的ZStatus_tZStatus_tZDP_MgmtRtgRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteRoutingTableEntries,byteStartIndex,byteRoutingListCount,rtgItem_t*RoutingTableList,byteSecurityEnable);若设置ZDO_MGMT_RTG_REQUEST编译选项,当接收到“ManagementRoutingRequest”消息后将自动产生这个消息。afStatus_tZDP_MgmtBindReq(zAddrType_t*dstAddr,byteStartIndex,byteSecurityEnable);若设置ZDO_MGMT_BIND_REQUEST编译选项,调用此函数将为目标设备产生返回邦定表的请求。ZStatus_tZDP_MgmtBindRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteBindingTableEntries,byteStartIndex,byteBindingTableListCount,apsBindingItem_t*BindingTableList,byteSecurityEnable);afStatus_tZDP_MgmtLeaveReq(zAddrType_t*dstAddr,byte*IEEEAddr,byteSecurityEnable);若设置ZDO_MGMT_LEAVE_REQUEST编译选项,调用此函数将请求目标设备脱离网络或者请求其他设备脱离网络ZStatus_tZDP_MgmtLeaveRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteSecurityEnable);若设置ZDO_MGMT_LEAVE_REQUEST编译选项,当接收到“ManagementLeaveReques”消息后将自动产生这个消息。afStatus_tZDP_MgmtDirectJoinReq(zAddrType_t*dstAddr,byte*deviceAddr,bytecapInfo,byteSecurityEnable);若设置ZDO_MGMT_JOINDIRECT_REQUEST编译选项,调用此函数将请求目标设备直接加入其他设备。deviceAddr–要加入的设备的64位地址capInfo–要加入设备的性能CAPINFO_ALTPANCOORD0x01CAPINFO_DEVICETYPE_FFD0x02CAPINFO_Power_AC0x04CAPINFO_RCVR_ON_IDLE0x08CAPINFO_SECURITY_CAPABLE0x40CAPINFO_ALLOC_ADDR0x80ZStatus_tZDP_MgmtDirectJoinRsp(byteTranSeq,zAddrType_t*dstAddr,byteStatus,byteSecurityEnable);afStatus_tZDP_MgmtPermitJoinReq(zAddrType_t*dstAddr,byteduration,byteTcSignificance,byteSecurityEnable);实际是直接调用宏ZDP_SendData(),函数构建并发送Mgmt_Permit_Joining_req来请求远端设备允许或不允许关联。这个请求由调试工具或者网络管理设备产生,duration-协调器或路由器允许关联的时间(单位为秒),0x00和0xff分别表示没有时间限制的禁止和允许。TcSignificance-如果设为0x01且远端设备为真实中心设备的话,命令将影响中心设备的授 权机制。ZStatus_tZDP_MgmtPermitJoinRsp(byte*TransSeq,zAddrType_t*dstAddr,byte*Statue,byteSecurityEnable);ZDO解析函数用来解析接收到的消息ZDO_NwkIEEEAddrResp_t*ZDO_ParseAddrRsp(zdoIncomingMsg_t*inMsg);解析NWK_addr_rsp和IEEE_addr_rsp消息inMsg-指向接收到的消息的指针ZDO_NwkIEEEAddrResp_t-指向解析后的结构的指针,结构体由osal_mem_alloc分配空间,所以需要调用osal_mem_free()来释放空间voidZDO_ParseNodeDescRsp(zdoIncomingMsg_t*inMsg,ZDO_NodeDescRsp_t*pNDRsp);解析Node_Desc_rsp消息pNDRsp-解析消息存放的地方voidZDO_ParsePowerDescRsp(zdoIncomingMsg_t*inMsg,ZDO_PowerRsp_t*pNPRsp);解析Power_Desc_rsp消息voidZDO_ParseSimpleDescRsp(zdoIncomingMsg_t*inMsg,ZDO_SimpleDescRsp_t*pSimpleDescRsp);pSimpleDescRsp-存放解析后的消息ZDO_ActiveEndpointRsp_t*ZDO_ParseEPListRsp(zdoIncomingMsg_t*inMsg);解析Active_EP_rsp或者Match_Desc_rsp的消息#defineZDO_ParseBindRsp(a)((uint8)(*(a->asdu)))解析Bind_rsp,Unbind_rsp或End_Device_Bind_rsp消息a-指向要解析的消息的指针ZDO_MgmNwkDiscRsp_t*ZDO_ParseMgmNwkDiscRsp(zdoIncomingMsg_t*inMsg);解析Mgmt_NWK_Disc_rsp消息ZDO_MgmtLqiRsp_t*ZDO_ParseMgmtLqiRsp(zdoIncomingMsg_t*inMsg);ZDO_MgmtRtgRsp_t*ZDO_ParseMgmtRtgRsp(zdoIncomingMsg_t*inMsg);ZDO_MgmtBindRsp_t*ZDO_ParseMgmtBindRsp(zdoIncomingMsg_t*inMsg);#defineZDO_ParseMgmtDirectJoinRsp(a)((uint8)(*(a->asdu)))#defineZDO_ParseMgmtLeaveRsp(a)((uint8)(*(a->asdu)))#defineZDO_ParseMgmtPermitJoinRsp(a)((uint8)(*(a->asdu)))ZDO_UserDescRsp_t*ZDO_ParseUserDescRsp(zdoIncomingMsg_t*inMsg);voidZDO_ParseServerDiscRsp(zdoIncomingMsg_t*inMsg,ZDO_ServerDiscRsp_t*pRsp);解析Server_Discovery_rsp消息voidZDO_ParseEndDeviceBindReq(zdoIncomingMsg_t*inMsg,ZDEndDeviceBind_t*bindReq);voidZDO_ParseBindUnbindReq(zdoIncomingMsg_t*inMsg,ZDO_BindUnbindReq_t*pReq);#defineZDO_ParseUserDescConf(a)((uint8)(*(a->asdu)))voidZDO_ParseDeviceAnnce(zdoIncomingMsg_t*inMsg,ZDO_DeviceAnnce_t*pAnnce);ZDO_MgmtNwkUpdateNotify_t*ZDO_ParseMgmtNwkUpdateNotify(zdoIncomingMsg_t*inMsg);

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
大家都在看
近期热门
关闭