if ( ( giDoorLockScreenMode == DOORLOCK_MAINMODE ) ||
( giDoorLockScreenMode == DOORLOCK_HELPMODE ) )
{
giDoorLockScreenMode = DOORLOCK_MAINMODE;
#ifdef ZCL_EZMODE
{
zclEZMode_InvokeData_t ezModeData;
static uint16 clusterIDs[] = { ZCL_CLUSTER_ID_CLOSURES_DOOR_LOCK }; // only bind on the on/off cluster
// Invoke EZ-Mode
ezModeData.endpoint = SAMPLEDOORLOCKCONTROLLER_ENDPOINT; // endpoint on which to invoke EZ-Mode
if ( ( zclSampleDoorLockController_NwkState == DEV_ZB_COORD ) ||
( zclSampleDoorLockController_NwkState == DEV_ROUTER ) ||
( zclSampleDoorLockController_NwkState == DEV_END_DEVICE ) )
{
ezModeData.onNetwork = TRUE; // node is already on the network
}
else
{
ezModeData.onNetwork = FALSE; // node is not yet on the network
}
ezModeData.initiator = TRUE; // DoorLock Controller is an initiator
ezModeData.numActiveInClusters = 0;
ezModeData.pActiveInClusterIDs = NULL;
ezModeData.numActiveOutClusters = 1; // active output cluster
ezModeData.pActiveOutClusterIDs = clusterIDs;
zcl_InvokeEZMode( &ezModeData );
#ifdef LCD_SUPPORTED
HalLcdWriteString( "EZMode", HAL_LCD_LINE_2 );
#endif
}
// NOT ZCL_EZMODE, Use EndDeviceBind
#else
{
zAddrType_t dstAddr;
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
// Initiate an End Device Bind Request, this bind request will
// only use a cluster list that is important to binding.
dstAddr.addrMode = afAddr16Bit;
dstAddr.addr.shortAddr = 0; // Coordinator makes the match
ZDP_EndDeviceBindReq( &dstAddr, NLME_GetShortAddr(),
SAMPLEDOORLOCKCONTROLLER_ENDPOINT,
ZCL_HA_PROFILE_ID,
0, NULL, // No incoming clusters to bind
ZCLSAMPLEDOORLOCKCONTROLLER_BINDINGLIST, bindingOutClusters,
TRUE );
}
#endif // ZCL_EZMODE
}
DLSApp_initializeStack();
//EZ-Mode自启动
// If not in PIN mode, start EZMode
if((giDlScreenMode == DLSAPP_MAINMODE) ||
(giDlScreenMode == DLSAPP_HELPMODE))
{
giDlScreenMode = DLSAPP_MAINMODE;
DLSApp_startEzMode();
}
Viki Shi:
抓包看一下是不是发包有延时
user5367314:
回复 Viki Shi:
你好:
CC2538作为协调器,基于SampleDoorLockController例程修改
CC2630作为终端设备,基于SampleDoorLock例程修改
我们想实现如下功能,请给一下大致的开发方向:
1.一个协调器控制多个终端,可以单独控制某个终端
2.同一个环境中有多个协调器,怎么能让某些终端只加入某个协调器(即使终端重启还是加入此协调器)
3.例程默认的是EZmode,我把按键绑定放在初始化里了,这样就自动绑定,
但是比如协调器开启的时候,终端过一段时间才上电,此时终端上电无法绑定了,该怎么设计,不管怎样都能自动绑定?
miffy:
回复 user5367314:
一直不明白绑定是什么意思,3.0.1协议栈默认都是打开NV_RESTORE的,终端入网成功以后,后面不管怎么掉电重新上电,都能正常工作的,没延时,所谓的延时也就是上电之后大概十几秒的时间,网络需要自动恢复,等恢复好了,就都正常了。