協(xié)議棧發(fā)送函數(shù)af datarequest說明_第1頁
協(xié)議棧發(fā)送函數(shù)af datarequest說明_第2頁
協(xié)議棧發(fā)送函數(shù)af datarequest說明_第3頁
協(xié)議棧發(fā)送函數(shù)af datarequest說明_第4頁
協(xié)議棧發(fā)送函數(shù)af datarequest說明_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

Z-Stack協(xié)議Z-StackvoidSampleApp_SendFlashMessageuint16Z-Stack協(xié)議Z-StackvoidSampleApp_SendFlashMessageuint16flashTimeflashTime為發(fā)afStatus_tAF_DataRequest(afAddrType_t*dstAddr,endPointDesc_tuint16cID,uint16len,uint8*buf,uint8*transID,uint8options,uint8radius)typedef{{uint16}byteendPoint241—2541-}{ AddrNotPresent,//間接傳送Addr16Bit,//指定地址單點傳送(Unicast)16=AddrGroup,//組尋址(Group AddrBroadcast//廣播傳送}UicastafAddrModeAddr16Bit間接傳送當(dāng)應(yīng)用程序不清楚數(shù)據(jù)包的最終目標(biāo)的時候使用間接傳送。將模式設(shè)置為AddrNotPresent上一個版本的ZigBee(ZigBee04),有一個選項可以講綁定表保存在協(xié)調(diào)器(CoordinatorBinding)。廣播傳送設(shè)置為AddrBroadcast。目標(biāo)地址可以設(shè)置為下面廣播地址的一種:NWK_BROADCAST_SHORTADDR_DEVALL0xFFFFAddrNotPresent上一個版本的ZigBee(ZigBee04),有一個選項可以講綁定表保存在協(xié)調(diào)器(CoordinatorBinding)。廣播傳送設(shè)置為AddrBroadcast。目標(biāo)地址可以設(shè)置為下面廣播地址的一種:NWK_BROADCAST_SHORTADDR_DEVALL0xFFFF中)。NWK_BROADCAST_SHORTADDR_DEVRXON(0xFFFDNWK_BROADCAST_SHORTADDR_DEVZCZR(0xFFFC)——數(shù)據(jù)包發(fā)送給所有的路組尋址(Group式設(shè)置為afAddrGroup并且addr.shortAddr設(shè)置為組ID。Z-stackAPI一個設(shè)備怎樣加入到一個ID為1的組當(dāng)中:group= be {AddrNotPresent=AddrGroup3IEEE64==AddrBroadcast=MAC地址,另一種是MAC地址,另一種是16位網(wǎng)絡(luò)地址常由制造商或者被安裝時設(shè)置。這些地址由IEEE來維護(hù)和分配。描述,每個終端都必須要有一個ZigBee的簡單描述。typedef{byteendPointbyte*task_id;//PointertolocationoftheApplicationtaskSimpleDescriptionFormat_t*simpleDescafNetworkLatencyReq_tlatencyReq}typedef{byteEndPoint;//EPID(EP=Enduint16AppProfIdprofileID(uint16AppDeviceId;//DeviceAppDevVer:4;//DeviceVersion0x00為VersionReserved:4;//AF_V1_SUPPORTusesforAppNumInClustersbyte;typedef{typedef{}第三個參數(shù):uint16cID第四個參數(shù) 第五個參數(shù):uint8 指向發(fā)送數(shù)據(jù)緩沖的指AF_DISCV_ROUTE0x20總要包含這個選AF_SKIP_ROUTING0x80設(shè)置這個選項將導(dǎo)致設(shè)備跳過路由而直接發(fā)送消typedef{afStatus_FAILED=0x80,}下面是這個函數(shù)完整的源代碼******CommonfunctionalityforinvokingAPSDE_DataReq()forbothSendMultiandMSG-Send.input***@param*dstAddr-FullZBdestinationaddress:NwkAddr+End*srcEP-Origination(i.e.respondtoorackto)End****---AvalidclusterIDasspecifiedbytheProfile.Numberofbytesofdatapointedtobynextparam.Apointertothedatabytestosend.****---AvalidclusterIDasspecifiedbytheProfile.Numberofbytesofdatapointedtobynextparam.Apointertothedatabytestosend.beusedasthetransactionsequencenumberof*******options-ValidbitmaskofTxoptions.radius-NormallysettoAF_DEFAULT_RADIUS.*transID-Incrementedbyoneifthereturnvalueis*@returnafStatus_t-SeepreviousdefinitionofafStatus_...uint16cID,uint16len,uint8options,){pDescCBpfnDescCB;ZStatus_tstat;afDataReqMTU_tmtu;//Verifysourceendpointif(srcEP==NULL){return}#if!defined(REFLECTORif(dstAddr->addrMode==afAddrNotPresent{return}Verifydestinationaddressreq.dstAddr.addr.shortAddr=dstAddr-Validatebroadcastingif(dstAddr->addrMode==)(dstAddr->addrMode==afAddrBroadcast){//if(dstAddr->addrMode==)(dstAddr->addrMode==afAddrBroadcast){//Checkforvalidif({//ForcemodedstAddr->addr.shortAddr dstAddr->addrMode=}{Addressisnotavalidbroadcasttype)if(dstAddr->addrMode=={return}}}elseif(dstAddr->addrMode!=afAddrGroup&&dstAddr->addrMode!=afAddrNotPresent){return}req.dstAddr.addrMode=dstAfileID==afGetDescCB(srcEP))if({uint16*pID=(uint16if(pID){fileID=*pID;osal_mem_free(pID}}elseif(srcEP->simpleDesc{fileID=srcEP->simpleDesc-}req.txOptions=if((({options&AF_ACK_REQUESTreq.dstAddr.addrMode!=AddrBroadcastreq.dstAddr.addrMode!=AddrGroup))))req.txOptions}if(optionsreq.txOptions=if((({options&AF_ACK_REQUESTreq.dstAddr.addrMode!=AddrBroadcastreq.dstAddr.addrMode!=AddrGroup))))req.txOptions}if(options&AF_SKIP_ROUTING{req.txOptions}if(options&AF_EN_SECURITY{req.txOptions=}{}=mtu.kvp=======req.radiusCounter=radius;if(len>afDataReqMTU(&mtu){if{req.txOptions|=AF_FRAGMENTED|APS_TX_OPTIONS_ACK;stat=(*apsfSendFragmented)(&req);}{stat=}}{stat=APSDE_DataReq(&req{stat=}}{stat=APSDE_DataReq(&req}IfthisisanEndPoint-to-EndPointmessageonthesamedevice,itwillnotgetaddedtotheNWKdatabufs.SoitwillnotgoOTAanditwillAF_DATA_CONFIRM_CMDhere.NotethatAPSDE_DataConfirm()onlygeneratesonemessagewiththefirstinlineTransSeqNumber,evenonamultiAlsonotethatareflected

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論