afAddrType_t dstAddr;
endPointDesc_t *epDesc;
uint8 rett;
cId_t cId;
uint8 pBuf[4]={1,2,3,4};
dstAddr.addr.shortAddr = 0x0000;
dstAddr.addrMode = (afAddrMode_t)afAddr16Bit;
dstAddr.endPoint = 10;
epDesc->endPoint=8;
epDesc->task_id = &zclIKH_TaskID;
epDesc->simpleDesc=NULL;
epDesc->latencyReq=(afNetworkLatencyReq_t)0;
cId = 1;
uint8 dataLen=4;
uint8 transId=0;
rett= AF_DataRequest(&dstAddr, epDesc,cId, dataLen, pBuf, &transId, AF_DISCV_ROUTE, AF_DEFAULT_RADIUS);
发送配置如下,单播从终端发给协调器,4个数据长度。
协调器接收端
inMsg.srcAddr.addrMode = Addr16Bit;
inMsg.srcAddr.addr.shortAddr = pData->srcAddr.addr.shortAddr;
inMsg.wasBroadcast = pData->wasBroadcast;
inMsg.clusterID = pData->clusterId;
inMsg.SecurityUse = pData->SecurityUse;
inMsg.asduLen = pData->cmd.DataLength-1;
inMsg.asdu = pData->cmd.Data+1;
inMsg.TransSeq = pData->cmd.Data[0];
inMsg.macDestAddr = pData->macDestAddr;
inMsg.macSrcAddr = pData->macSrcAddr;
接收端发现 长度为19,clusterID 也不对,源端地址是对的,数据也不对,抓包
和发送的不符啊,这是什么原因?
Alvin Chen:
你需要在 case AF_INCOMING_MSG_CMD:解析:
switch ( pkt->clusterId )
{
case GENERICAPP_CLUSTERID:
pkt->cmd.Data
参考Z-mesh 1.0的做法。3581.GenericApp.c