Wednesday, August 31, 2016

How to handle end node announcement, active endpoint response, and simple descriptor response in Z-Stack for CC2530 and CC2538.

When a Zigbee device joins network, it would broadcast end node announcement with its short and IEEE address. We can register a callback event in Z-Stack to receive end node announcement and store short/IEEE address of device to a device list. Then, we usually call ZDP_ActiveEPReq to request active endpoint and register a callback event in Z-Stack to receive active endpoint response and store it to device list. Finally, we can call ZDP_SimpleDescReq to request simple descriptor and register a callback event in Z-Stack to receive simple descriptor response and store it to device list too.

The following steps show you how to handle end node announcement in Z-Stack SampleLight.

1. Add "ZDO_RegisterForZDOMsg(task_id, Device_annce);" in zclSampleLight_Init().

2. Add the following codes to process Device_annce event in zclSampleLight_ProcessZDOMsgs and you would get end node announcement  information in devAnnce structure.

  ZDO_DeviceAnnce_t devAnnce;

if ( pMsg->clusterID == Device_annce )
      ZDO_ParseDeviceAnnce( pMsg, &devAnnce );





The following steps show you how to handle active endpoint response in Z-Stack SampleLight.

1. Add "ZDO_RegisterForZDOMsg(task_id, Active_EP_rsp);" in zclSampleLight_Init().

2. Add the following codes to process Active_EP_rsp event in zclSampleLight_ProcessZDOMsgs and you would get end node announcement information in pActiveEndpointRsp pointer of ZDO_ActiveEndpointRsp_t structure.

  ZDO_ActiveEndpointRsp_t *pActiveEndpointRsp;

  if ( pMsg->clusterID == Active_EP_rsp )
      pActiveEndpointRsp = ZDO_ParseEPListRsp( pMsg );


The following steps show you how to handle simple descriptor response in Z-Stack SampleLight.

1. Add "ZDO_RegisterForZDOMsg(task_id, Simple_Desc_rsp);" in zclSampleLight_Init().

2. Add the following codes to process Simple_Desc_rsp event in zclSampleLight_ProcessZDOMsgs and you would get simple descriptor in simpleDescRsp structure.

  ZDO_SimpleDescRsp_t simpleDescRsp;

  if ( pMsg->clusterID == Simple_Desc_rsp )
      ZDO_ParseSimpleDescRsp( pMsg, &simpleDescRsp );

No comments:

Post a Comment