switch(pMsg->hdr.event)
{
case zstackmsg_CmdIDs_AF_INCOMING_MSG_IND:
{
// Process incoming data messages
zstackmsg_afIncomingMsgInd_t *pInd =
(zstackmsg_afIncomingMsgInd_t *)pMsg;
Switch_processAfIncomingMsgInd( &(pInd->req) );
}
break;
}
为什么这段代码不起作用呢
YiKai Chen:
把IAR的optimize level調成low 或者是medium 再試試
Kevin Qiu1:
数据包是否已经传入进来?抓个包看一下
user6383350:
回复 Kevin Qiu1:
今天又重新打断点调试看了下,原来协调器这端数据就没发送成功, 会执行到int suc=0;。为什么协调器广播发送数据到终端会失败呢?(禁用了EZ_MODE).zclReportCmd_t *pReportCmd;
pReportCmd = osal_mem_alloc( sizeof(zclReportCmd_t) + sizeof(zclReport_t) );if ( pReportCmd != NULL ){pReportCmd->numAttr = 1;pReportCmd->attrList[0].attrID = ATTRID_MS_TEMPERATURE_MEASURED_VALUE;pReportCmd->attrList[0].dataType = ZCL_DATATYPE_INT16;pReportCmd->attrList[0].attrData = (void *)(&zclSampleTemperatureSensor_MeasuredValue);afAddrType_t dstAddr;dstAddr.addrMode = (afAddrMode_t)AddrBroadcast;dstAddr.addr.shortAddr = 0xFFFF;dstAddr.endPoint = 20;dstAddr.panId = 0x8888;if(zcl_SendReportCmd( SWITCH_EP, &dstAddr,ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, ztsTransID++ )==ZSuccess){int suc=1;} else{int suc=0;}}
osal_mem_free( pReportCmd );
user6383350:
回复 YiKai Chen:
今天又重新打断点调试看了下,原来协调器这端数据就没发送成功, 会执行到int suc=0;。为什么协调器广播发送数据到终端会失败呢?(禁用了EZ_MODE).
zclReportCmd_t *pReportCmd;pReportCmd = osal_mem_alloc( sizeof(zclReportCmd_t) + sizeof(zclReport_t) );
if ( pReportCmd != NULL )
{
pReportCmd->numAttr = 1;
pReportCmd->attrList[0].attrID = ATTRID_MS_TEMPERATURE_MEASURED_VALUE;
pReportCmd->attrList[0].dataType = ZCL_DATATYPE_INT16;
pReportCmd->attrList[0].attrData = (void *)(&zclSampleTemperatureSensor_MeasuredValue);
afAddrType_t dstAddr;
dstAddr.addrMode = (afAddrMode_t)AddrBroadcast;
dstAddr.addr.shortAddr = 0xFFFF;
dstAddr.endPoint = 20;
dstAddr.panId = 0x8888;
if(zcl_SendReportCmd( SWITCH_EP, &dstAddr,
ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, ztsTransID++ )==ZSuccess)
{
int suc=1;
}
else
{
int suc=0;
}
}osal_mem_free( pReportCmd );
YiKai Chen:
回复 user6383350:
CC2630 ZED如果是休眠狀態下是收不到广播的、發送信息給ZED建議用单播