我用的是Zstack 2.5.1
其中API ZDP_EndDeviceBindReq( zAddrType_t *dstAddr,
uint16 LocalCoordinator,
byte endPoint,
uint16 ProfileID,
byte NumInClusters, cId_t *InClusterList,
byte NumOutClusters, cId_t *OutClusterList,
byte SecurityEnable )
想问一下:
ProfileID应该怎么设置?我没有在Zstack2.5.1中找到关于ProfileID的定义。
是否可以自己随便定义比如0x0101?
user4711142:
绑定成功后,会产生什么事件?
YiKai Chen:
ProfileID就是看你要用什麼profile,可以照Zigbee spec 規範,也可以自己定義自己的;绑定成功后,並不会产生什么事件
Alvin Chen:
回复 user4711142:
你绑定之后可以使用绑定方式发送数据,发送绑定请求,收到成功的rsp就算了可以了。
user4711142:
回复 YiKai Chen:
两个设备绑定成功后,我想用串口输出 绑定成功的提示。但是不知道在哪添加,
user4711142:
回复 user4711142:
static void MyApp_ProcessZDOMsgs( zdoIncomingMsg_t *inMsg )
{switch ( inMsg->clusterID ){case Mgmt_Leave_rsp:if(ZDO_ParseMgmtLeaveRsp(inMsg)==ZSuccess){HalUARTWrite(0,"Exti Success\r\n",strlen("Exti Success\r\n"));}else{HalUARTWrite(0,"Exti Error\r\n",strlen("Exti Error\r\n"));}break;case End_Device_Bind_rsp:if ( ZDO_ParseBindRsp( inMsg ) == ZSuccess ){//串口输出成功HalUARTWrite(0,"Binding Success\r\n",strlen("Binding Success\r\n"));}else{//串口输出失败HalUARTWrite(0,"Binding Error\r\n",strlen("Binding Error\r\n"));}break;default:break;}
}
添加在这里根本没有反应,请问是我放置的地方不对么?
YiKai Chen:
回复 user4711142:
試試放在ZDApp_ProcessMsgCBs裡面如下的Bind_rsp/End_Device_Bind_req中
case Bind_rsp:case Unbind_rsp:if (ZG_DEVICE_COORDINATOR_TYPE && matchED){ZDMatchSendState((uint8)((inMsg->clusterID == Bind_rsp) ? ZDMATCH_REASON_BIND_RSP : ZDMATCH_REASON_UNBIND_RSP),ZDO_ParseBindRsp(inMsg), inMsg->TransSeq );}break;
case End_Device_Bind_req:if (ZG_DEVICE_COORDINATOR_TYPE){ZDEndDeviceBind_t bindReq;ZDO_ParseEndDeviceBindReq( inMsg, &bindReq );ZDO_MatchEndDeviceBind( &bindReq );
// Freeing the cluster lists – if allocated.if ( bindReq.numInClusters )osal_mem_free( bindReq.inClusters );if ( bindReq.numOutClusters )osal_mem_free( bindReq.outClusters );}break;