|
对楼主的绑定过程有点不太明白,根据程序:
if ( keys & HAL_KEY_SW_2 )
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
// Initiate an End Device Bind Request for the mandatory endpoint 绑定设备用的
txAddr.addrMode = Addr16Bit;
txAddr.addr.shortAddr = 0x0000; // Coordinator
ZDP_EndDeviceBindReq( &txAddr, NLME_GetShortAddr(),
SerialApp_epDesc.endPoint,
SERIALAPP_PROFID,
SERIALAPP_MAX_CLUSTERS, (cId_t *)SerialApp_ClusterList,
SERIALAPP_MAX_CLUSTERS, (cId_t *)SerialApp_ClusterList,
FALSE );
}
if ( keys & HAL_KEY_SW_3 )
{
}
if ( keys & HAL_KEY_SW_4 )
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
// Initiate a Match Description Request (Service Discovery)
txAddr.addrMode = AddrBroadcast;
txAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;
ZDP_MatchDescReq( &txAddr, NWK_BROADCAST_SHORTADDR, //绑定匹配的回复信息
SERIALAPP_PROFID,
SERIALAPP_MAX_CLUSTERS, (cId_t *)SerialApp_ClusterList,
SERIALAPP_MAX_CLUSTERS, (cId_t *)SerialApp_ClusterList,
FALSE );
应该是终端设备按下 HAL_KEY_SW_2 向协调器发出绑定请求,然后协调器按下 HAL_KEY_SW_4 ,广播请求的回复。为什么楼主说两个设备都按HAL_KEY_SW_2,就可以绑定成功呢?确实我做过实验也验证了下楼主说的是对的,但跟据程序看就不明白?指点下!谢谢! |
|