ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:20.10KB ,
资源ID:7421482      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7421482.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(关于zigbee协议栈SerialApp工程里ZDPMatchDescReq发起的简单描述符绑定机制.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

关于zigbee协议栈SerialApp工程里ZDPMatchDescReq发起的简单描述符绑定机制.docx

1、关于zigbee协议栈SerialApp工程里ZDPMatchDescReq发起的简单描述符绑定机制#if defined ( ZDO_MATCH_REQUEST )/该函数进行简单描述符匹配/* * fn ZDP_MatchDescReq * * brief This builds and send a Match_Desc_req message. This * function sends a broadcast or unicast message * requesting the list of endpoint/interfaces that * match profile ID

2、and cluster IDs. * * param dstAddr - destination address * param ProfileID - Profile ID * param NumInClusters - number of input clusters * param InClusterList - input cluster ID list * param NumOutClusters - number of output clusters * param OutClusterList - output cluster ID list * param SecurityEn

3、able - Security Options * * return afStatus_t */afStatus_t ZDP_MatchDescReq( zAddrType_t *dstAddr, uint16 nwkAddr, uint16 ProfileID, byte NumInClusters, cId_t *InClusterList, byte NumOutClusters, cId_t *OutClusterList, byte SecurityEnable ) byte *pBuf = ZDP_TmpBuf; / nwkAddr+ProfileID+NumInClusters+

4、NumOutClusters. byte i, len = 2 + 2 + 1 + 1; / nwkAddr+ProfileID+NumInClusters+NumOutClusters.(网络地址,PROfileID,输入输出簇 数量) len += (NumInClusters + NumOutClusters) * sizeof(uint16); if ( len = ZDP_BUF_SZ-1 ) return afStatus_MEM_FAIL; *pBuf+ = LO_UINT16( nwkAddr ); / NWKAddrOfInterest *pBuf+ = HI_UINT16(

5、 nwkAddr ); *pBuf+ = LO_UINT16( ProfileID ); / Profile ID *pBuf+ = HI_UINT16( ProfileID ); *pBuf+ = NumInClusters; / Input cluster list if ( NumInClusters ) for (i=0; iNumInClusters; +i) *pBuf+ = LO_UINT16( InClusterListi ); *pBuf+ = HI_UINT16( InClusterListi ); *pBuf+ = NumOutClusters; / Output clu

6、ster list if ( NumOutClusters ) for (i=0; iasdu; aoi = BUILD_UINT16( msg0, msg1 );/保存网络地址 profileID = BUILD_UINT16( msg2, msg3 );/保存空中接收过来的Profile ID msg += 4; if ( ADDR_BCAST_NOT_ME = NLME_IsAddressBroadcast(aoi) ) ZDP_MatchDescRsp( inMsg-TransSeq, &(inMsg-srcAddr), ZDP_INVALID_REQTYPE, ZDAppNwkAdd

7、r.addr.shortAddr, 0, NULL, inMsg-SecurityUse ); return; else if ( (ADDR_NOT_BCAST = NLME_IsAddressBroadcast(aoi) & (aoi != ZDAppNwkAddr.addr.shortAddr) ) ZDP_MatchDescRsp( inMsg-TransSeq, &(inMsg-srcAddr), ZDP_INVALID_REQTYPE, ZDAppNwkAddr.addr.shortAddr, 0, NULL, inMsg-SecurityUse ); return; numInC

8、lusters = *msg+; if ( numInClusters ) inClusters = (uint16*)osal_mem_alloc( numInClusters * sizeof( uint16 ) ); msg = ZDO_ConvertOTAClusters( numInClusters, msg, inClusters );/将空中传过来的输入簇列表进行整理保存 numOutClusters = *msg+; if ( numOutClusters ) outClusters = (uint16 *)osal_mem_alloc( numOutClusters * si

9、zeof( uint16 ) ); msg = ZDO_ConvertOTAClusters( numOutClusters, msg, outClusters );/将空中传过来的输出簇列表进行整理保存 / First count the number of endpoints that match./数出跟空中传过来消息匹配的端口数量 epDesc = epList;/保存本设备的注册端点列表 while ( epDesc ) / Dont search endpoint 0 and check if response is allowed if ( epDesc-epDesc-endPo

10、int != ZDO_EP & (epDesc-flags&eEP_AllowMatch) )/本设备满条件:端点号不为0并且允许匹配 if ( epDesc-pfnDescCB )/?什么意思处理的回调函数,该选项默认为NULL sDesc = (SimpleDescriptionFormat_t *)epDesc-pfnDescCB( AF_DESCRIPTOR_SIMPLE, epDesc-epDesc-endPoint ); allocated = TRUE; else sDesc = epDesc-epDesc-simpleDesc;/保存本设备简单描述符在sDesc! alloca

11、ted = FALSE; if ( sDesc & sDesc-AppProfId = profileID )/本设备的简单描述符不为空并且ProfileID等于空中传过来要匹配的ProfileID uint8 *uint8Buf = (uint8 *)ZDOBuildBuf; / If there are no search input/ouput clusters - respond if ( (numInClusters = 0) & (numOutClusters = 0)/或者输入簇数量跟输出簇数量为零 / Are there matching input clusters? | (

12、ZDO_AnyClusterMatches( numInClusters, inClusters, sDesc-AppNumInClusters, sDesc-pAppInClusterList )/或者空中输入簇和本设备的输入簇匹配 / Are there matching output clusters? | (ZDO_AnyClusterMatches( numOutClusters, outClusters, sDesc-AppNumOutClusters, sDesc-pAppOutClusterList ) /或者空中输出簇和本设备的输出簇匹配 ) / Notify the end

13、point of the match. 公告匹配的设备 uint8 bufLen = sizeof( ZDO_MatchDescRspSent_t ) + (numOutClusters + numInClusters) * sizeof(uint16); ZDO_MatchDescRspSent_t *pRspSent = (ZDO_MatchDescRspSent_t *) osal_msg_allocate( bufLen ); if (pRspSent) pRspSent-hdr.event = ZDO_MATCH_DESC_RSP_SENT; pRspSent-nwkAddr = i

14、nMsg-srcAddr.addr.shortAddr;/保存空中源地址 pRspSent-numInClusters = numInClusters; pRspSent-numOutClusters = numOutClusters; if (numInClusters) pRspSent-pInClusters = (uint16*) (pRspSent + 1); osal_memcpy(pRspSent-pInClusters, inClusters, numInClusters * sizeof(uint16);/将空中的输入簇列表进行了保存 else pRspSent-pInClu

15、sters = NULL; if (numOutClusters) pRspSent-pOutClusters = (uint16*)(pRspSent + 1) + numInClusters; osal_memcpy(pRspSent-pOutClusters, outClusters, numOutClusters * sizeof(uint16);/将空中的输出簇列表进行了保存 else pRspSent-pOutClusters = NULL; osal_msg_send( *epDesc-epDesc-task_id, (uint8 *)pRspSent );/ uint8Bufe

16、pCnt+ = sDesc-EndPoint; if ( allocated ) osal_mem_free( sDesc ); epDesc = epDesc-nextDesc; /找下一个端点 / Send the message only if at least one match found. if ( epCnt ) if ( ZSuccess = ZDP_MatchDescRsp( inMsg-TransSeq, &(inMsg-srcAddr), ZDP_SUCCESS, ZDAppNwkAddr.addr.shortAddr, epCnt, (uint8 *)ZDOBuildB

17、uf, inMsg-SecurityUse ) )/见下 #if defined( LCD_SUPPORTED ) HalLcdWriteScreen( Match Desc Req, Rsp Sent );#endif else #if defined( LCD_SUPPORTED ) HalLcdWriteScreen( Match Desc Req, Non Matched );#endif if ( inClusters ) osal_mem_free( inClusters ); if ( outClusters ) osal_mem_free( outClusters );/* *

18、 ZDP_MatchDescRsp - Send an list of endpoint that match */#define ZDP_MatchDescRsp( TransSeq, dstAddr, Status, nwkAddr, Count, pEPList, SecurityEnable ) ZDP_EPRsp( Match_Desc_rsp, TransSeq, dstAddr, Status, nwkAddr, Count, pEPList, SecurityEnable ) /注意簇ID为Match_Desc_rsp* * fn ZDP_EPRsp * * brief Thi

19、s builds and send an endpoint list. Used in * Active_EP_rsp and Match_Desc_Rsp * message. This function sends unicast message to the * requesting device. * * param MsgType - either Active_EP_rsp or Match_Desc_Rsp * param dstAddr - destination address * param Status - message status (ZDP_SUCCESS or o

20、ther) * param nwkAddr - Devices short address that this response describes * param Count - number of endpoint/interfaces in list * param pEPIntfList - Array of Endpoint/Interfaces * param SecurityEnable - Security Options * * return afStatus_t */afStatus_t ZDP_EPRsp( uint16 MsgType, byte TransSeq, z

21、AddrType_t *dstAddr, byte Status, uint16 nwkAddr, byte Count, byte *pEPList, byte SecurityEnable ) byte *pBuf = ZDP_TmpBuf; byte len = 1 + 2 + 1; / Status + nwkAddr + endpoint/interface count. byte txOptions; if ( MsgType = Match_Desc_rsp ) txOptions = AF_MSG_ACK_REQUEST; else txOptions = 0; *pBuf+

22、= Status; *pBuf+ = LO_UINT16( nwkAddr ); *pBuf+ = HI_UINT16( nwkAddr ); /分装本设备的网络地址 *pBuf+ = Count; / Endpoint/Interface count /簇匹配的数量 if ( Count ) len += Count; osal_memcpy( pBuf, pEPList, Count ); FillAndSendTxOptions( &TransSeq, dstAddr, MsgType, len, txOptions );#define FillAndSendTxOptions( TRA

23、NSSEQ, ADDR, ID, LEN, TxO ) afStatus_t stat; ZDP_TxOptions = (TxO); stat = fillAndSend( (TRANSSEQ), (ADDR), (ID), (LEN) ); ZDP_TxOptions = AF_TX_OPTIONS_NONE; return stat; static afStatus_t fillAndSend( uint8 *transSeq, zAddrType_t *addr, cId_t clusterID, byte len ) afAddrType_t afAddr; ZADDR_TO_AFA

24、DDR( addr, afAddr ); *(ZDP_TmpBuf-1) = *transSeq; return AF_DataRequest( &afAddr, &ZDApp_epDesc, clusterID, (uint16)(len+1), (uint8*)(ZDP_TmpBuf-1), transSeq, ZDP_TxOptions, AF_DEFAULT_RADIUS );void ZDApp_ProcessOSALMsg( osal_event_hdr_t *msgPtr ) / Data Confirmation message fields byte sentEP; / This should always be 0 byte sentStatus; afDataConfirm_t *afDataConfirm; switch ( msgPtr-event ) / Incoming ZDO Message case AF_INCOMING_MSG_CMD: ZDP_IncomingData( (afIncomingMSGPacket_t *)msgPtr ); break; case ZDO_CB_MSG: Z

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1