CC2630在线和掉线标志在协议栈里怎么看?
有没有什么标志位?
基于home 1.2.2
YiKai Chen:
看ZDO_STATE_CHANGE
Alvin Chen:
ZDO_STATE_CHANGE:
typedef enum{ DEV_HOLD, // Initialized – not started automatically DEV_INIT, // Initialized – not connected to anything DEV_NWK_DISC, // Discovering PAN's to join DEV_NWK_JOINING, // Joining a PAN DEV_NWK_SEC_REJOIN_CURR_CHANNEL, // ReJoining a PAN in secure mode scanning in current channel, only for end devices DEV_END_DEVICE_UNAUTH, // Joined but not yet authenticated by trust center DEV_END_DEVICE, // Started as device after authentication DEV_ROUTER, // Device joined, authenticated and is a router DEV_COORD_STARTING, // Started as Zigbee Coordinator DEV_ZB_COORD, // Started as Zigbee Coordinator DEV_NWK_ORPHAN, // Device has lost information about its parent.. DEV_NWK_KA, // Device is sending KeepAlive message to its parent DEV_NWK_BACKOFF, // Device is waiting before trying to rejoin DEV_NWK_SEC_REJOIN_ALL_CHANNEL, // ReJoining a PAN in secure mode scanning in all channels, only for end devices DEV_NWK_TC_REJOIN_CURR_CHANNEL, // ReJoining a PAN in Trust center mode scanning in current channel, only for end devices DEV_NWK_TC_REJOIN_ALL_CHANNEL // ReJoining a PAN in Trust center mode scanning in all channels, only for end devices} devStates_t;
user5367314:
回复 Alvin Chen:
ZDO_STATE_CHANGE在应用程序里面根本没有啊?难道在ZstackCore里面?
应用程序这边想用指示灯指示节点是否入网
Alvin Chen:
回复 user5367314:
case zstackmsg_CmdIDs_DEV_STATE_CHANGE_IND:{// The ZStack Thread is indicating a State changezstackmsg_devStateChangeInd_t *pInd =(zstackmsg_devStateChangeInd_t *)pMsg;
// Only process the state change if it actually changed.if(savedState != pInd->req.state)
user5367314:
回复 Alvin Chen:
if(savedState != pInd->req.state)OnNet=1;//入网
elseOnNet=0;//掉线
这样判断正确吗?
YiKai Chen:
回复 user5367314:
應該試看pInd->req->state
user5367314:
回复 YiKai Chen:
测试发现,下面的这个case在协调器不断电,把节点断电重启,重启后节点并不会进入下面的函数,
是什么原因?节点第一次上电或者只重启协调器节点是可以进入下面的case的
case zstackmsg_CmdIDs_DEV_STATE_CHANGE_IND:
{
// The ZStack Thread is indicating a State change
zstackmsg_devStateChangeInd_t *pInd =
(zstackmsg_devStateChangeInd_t *)pMsg;// Only process the state change if it actually changed.
if(savedState != pInd->req.state)
YiKai Chen:
回复 user5367314:
节点是end device?
user5367314:
回复 YiKai Chen:
是enddevice ,CC2630
YiKai Chen:
回复 user5367314:
节点要有入網或是離網才會进入case zstackmsg_CmdIDs_DEV_STATE_CHANGE_IND: