Dears,
You can refer to ZDO_STATE_CHANGE code segment in your zcl_xxx.c as the followings. You can get devStates_t from MSGpkt->hdr.status and use it to judge what type your device is.
case ZDO_STATE_CHANGE:
_xxx_NwkState = (devStates_t)(MSGpkt->hdr.status);
if ( (_xxx_NwkState == DEV_ZB_COORD)
|| (_xxx_NwkState == DEV_ROUTER)
|| (_xxx_NwkState == DEV_END_DEVICE) )
.....