欢迎来到天天文库
浏览记录
ID:38774673
大小:20.36 KB
页数:19页
时间:2019-06-19
《关于zigbee协议栈SerialApp工程里ZDP_MatchDescReq发起的简单描述符绑定机制》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#ifdefined(ZDO_MATCH_REQUEST)//该函数进行简单描述符匹配/**********************************************************************@fnZDP_MatchDescReq**@briefThisbuildsandsendaMatch_Desc_reqmessage.This*functionsendsabroadcastorunicastmessage*requestingthelistofendpoint/interfacesthat*matchprofileIDandclusterIDs.**@
2、paramdstAddr-destinationaddress*@paramProfileID-ProfileID*@paramNumInClusters-numberofinputclusters*@paramInClusterList-inputclusterIDlist*@paramNumOutClusters-numberofoutputclusters*@paramOutClusterList-outputclusterIDlist*@paramSecurityEnable-SecurityOptions**@returnafStatus_t*/afStatus_tZDP_Match
3、DescReq(zAddrType_t*dstAddr,uint16nwkAddr,uint16ProfileID,byteNumInClusters,cId_t*InClusterList,byteNumOutClusters,cId_t*OutClusterList,byteSecurityEnable){byte*pBuf=ZDP_TmpBuf;//nwkAddr+ProfileID+NumInClusters+NumOutClusters.bytei,len=2+2+1+1;//nwkAddr+ProfileID+NumInClusters+NumOutClusters.(网络地址,P
4、ROfileID,输入输出簇数量)len+=(NumInClusters+NumOutClusters)*sizeof(uint16);if(len>=ZDP_BUF_SZ-1){returnafStatus_MEM_FAIL;}*pBuf++=LO_UINT16(nwkAddr);//NWKAddrOfInterest*pBuf++=HI_UINT16(nwkAddr);*pBuf++=LO_UINT16(ProfileID);//ProfileID*pBuf++=HI_UINT16(ProfileID);*pBuf++=NumInClusters;//Inputclusterlistif(
5、NumInClusters){for(i=0;i6、fileID,输入输出簇数量及其对应的簇的具体内容进行保存,保存在全局变量ZDP_TmpBuf中,并通过下面的函数fillAndSend函数发送returnfillAndSend(&ZDP_TransID,dstAddr,Match_Desc_req,len);//注意簇ID为Match_Desc_req }while(zdpMsgProcs[x].clusterID!=0xFFFF)//重点注意该函数及其结构体,里面有对应的根据簇ID进行相应处理的函数{if(zdpMsgProcs[x].clusterID==inMsg.clusterID)//注意该部分满足簇ID等于Match_Desc_7、req,会执行对应的处理函 数{zdpMsgProcs[x].pFn(&inMsg);return;}x++;}上面重要的函数及其结构体的处理如下所示typedefstruct{uint16clusterID;pfnZDPMsgProcessorpFn;}zdpMsgProcItem_t;CONSTzdpMsgProcItem_tzdpMsgProcs[]={{NWK_addr_req,zdpPr
6、fileID,输入输出簇数量及其对应的簇的具体内容进行保存,保存在全局变量ZDP_TmpBuf中,并通过下面的函数fillAndSend函数发送returnfillAndSend(&ZDP_TransID,dstAddr,Match_Desc_req,len);//注意簇ID为Match_Desc_req }while(zdpMsgProcs[x].clusterID!=0xFFFF)//重点注意该函数及其结构体,里面有对应的根据簇ID进行相应处理的函数{if(zdpMsgProcs[x].clusterID==inMsg.clusterID)//注意该部分满足簇ID等于Match_Desc_
7、req,会执行对应的处理函 数{zdpMsgProcs[x].pFn(&inMsg);return;}x++;}上面重要的函数及其结构体的处理如下所示typedefstruct{uint16clusterID;pfnZDPMsgProcessorpFn;}zdpMsgProcItem_t;CONSTzdpMsgProcItem_tzdpMsgProcs[]={{NWK_addr_req,zdpPr
此文档下载收益归作者所有