关于 afDataRequest
我调用了afDataRequest 给end device 发送了on命令
req.DstAddr = DstAddr;
req.DstEndpoint = DstEndpoint;
req.SrcEndpoint = SrcEndpoint;
req.ClusterID = ZCL_CLUSTER_ID_GEN_ON_OFF;
req.TransID = 0; //发送序列号
req.Options = 0;
req.Options = 0x20;
req.Radius = 16; //允许消息的跳转的数量
req.Len = 3;
memset(req.Data, 0 , sizeof(req.Data));
req.Data[0] = 1;
req.Data[1] = 0;
req.Data[2] = 1;
ret = afDataRequest(&req);
发送之后 下面这个函数会调用两次
void afProcess(uint8_t *rpcBuff, uint8_t rpcLen)
{
static int a = 0;
dbg_print(PRINT_LEVEL_VERBOSE, "afProcess: processing CMD0:%x, CMD1:%x\n",
rpcBuff[0], rpcBuff[1]);
//process the synchronous SRSP from SREQ
if ((rpcBuff[0] & MT_RPC_CMD_TYPE_MASK) == MT_RPC_CMD_SRSP)
{
processSrsp(rpcBuff, rpcLen);
}
else
{
printf("buf 0 0x%x\r\n",rpcBuff[0]);
//Read CMD1 and processes the specific SREQ
switch (rpcBuff[1])
{
case MT_AF_DATA_CONFIRM:
dbg_print(PRINT_LEVEL_VERBOSE, "afProcess: MT_AF_DATA_CONFIRM\n");
processDataConfirm(rpcBuff, rpcLen);
break;
case MT_AF_INCOMING_MSG:
dbg_print(PRINT_LEVEL_VERBOSE, "afProcess: MT_AF_INCOMING_MSG\n");
processIncomingMsg(rpcBuff, rpcLen);
break;
一次是进入if语句
另一次是else语句
这个数据交换是怎样的一个流程了
收到同步响应是什么类容
已解决
第一个是表示串口收到数据,第二个是发送数据成功或者收到无线数据。