Developing with ZBOSS for Zigbee
ZDO address discovery

Data Structures

struct  zb_zdo_nwk_addr_req_s
 NWK_addr_req command primitive.
More...
 
struct  zb_zdo_nwk_addr_req_param_s
 Parameters for nwk_addr_req command. More...
 
struct  zb_zdo_nwk_addr_resp_head_s
 NWK_addr_req response frame. More...
 
struct  zb_zdo_nwk_addr_resp_ext_s
 NWK_addr_req response frame tail. More...
 
struct  zb_zdo_nwk_addr_resp_ext2_s
 NWK_addr_req response frame tail. More...
 
struct  zb_zdo_ieee_addr_req_s
 Parameters of IEEE_addr_req primitive. More...
 
struct  zb_zdo_ieee_addr_req_param_s
 Parameters for ieee_addr_req command. More...
 
struct  zb_zdo_ieee_addr_resp_s
 
struct  zb_zdo_ieee_addr_resp_ext_s
 ZDO IEEE address response frame tail. More...
 
struct  zb_zdo_ieee_addr_resp_ext2_s
 ZDO IEEE address response frame tail. More...
 

Macros

#define ZB_ZDO_SINGLE_DEVICE_RESP   0U
 
#define ZB_ZDO_EXTENDED_DEVICE_RESP   1U
 

Typedefs

typedef struct zb_zdo_nwk_addr_req_s zb_zdo_nwk_addr_req_t
 NWK_addr_req command primitive.

 
typedef struct zb_zdo_nwk_addr_req_param_s zb_zdo_nwk_addr_req_param_t
 Parameters for nwk_addr_req command.
 
typedef struct zb_zdo_nwk_addr_resp_head_s zb_zdo_nwk_addr_resp_head_t
 NWK_addr_req response frame.
 
typedef struct zb_zdo_nwk_addr_resp_ext_s zb_zdo_nwk_addr_resp_ext_t
 NWK_addr_req response frame tail.
 
typedef struct zb_zdo_nwk_addr_resp_ext2_s zb_zdo_nwk_addr_resp_ext2_t
 NWK_addr_req response frame tail.
 
typedef struct zb_zdo_ieee_addr_req_s zb_zdo_ieee_addr_req_t
 Parameters of IEEE_addr_req primitive. More...
 
typedef struct zb_zdo_ieee_addr_req_param_s zb_zdo_ieee_addr_req_param_t
 Parameters for ieee_addr_req command.
 
typedef struct zb_zdo_ieee_addr_resp_s zb_zdo_ieee_addr_resp_t
 
typedef struct zb_zdo_ieee_addr_resp_ext_s zb_zdo_ieee_addr_resp_ext_t
 ZDO IEEE address response frame tail.
 
typedef struct zb_zdo_ieee_addr_resp_ext2_s zb_zdo_ieee_addr_resp_ext2_t
 ZDO IEEE address response frame tail.
 

Functions

zb_uint8_t zb_zdo_nwk_addr_req (zb_uint8_t param, zb_callback_t cb)
 Sends NWK_addr_req primitive. More...
 
zb_uint8_t zb_zdo_ieee_addr_req (zb_uint8_t param, zb_callback_t cb)
 IEEE_addr_req primitive. More...
 

Detailed Description

Macro Definition Documentation

◆ ZB_ZDO_EXTENDED_DEVICE_RESP

#define ZB_ZDO_EXTENDED_DEVICE_RESP   1U

Request Type parameter value of zb_zdo_nwk_addr_req_t and zb_zdo_ieee_addr_req_t for receiving an Extended device response used in the following commands accordingly:

◆ ZB_ZDO_SINGLE_DEVICE_RESP

#define ZB_ZDO_SINGLE_DEVICE_RESP   0U

Request Type parameter value of zb_zdo_nwk_addr_req_t and zb_zdo_ieee_addr_req_t for receiving a Single device response used in the following commands accordingly:

Typedef Documentation

◆ zb_zdo_ieee_addr_req_t

Parameters of IEEE_addr_req primitive.

To be put into buffer as data (means - after space alloc).

◆ zb_zdo_ieee_addr_resp_t

brief ZDO IEEE address response frame

Function Documentation

◆ zb_zdo_ieee_addr_req()

zb_uint8_t zb_zdo_ieee_addr_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

IEEE_addr_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_ieee_addr_req_s. Parameters must be put into the buffer as data (allocated).
cb- user's function to call when got response from the remote.
Returns
- ZDP transaction sequence number or 0xFF if operation cannot be performed now (nor enough memory, resources, etc.)

Example:

{
req->nwk_addr = ind->src_addr;
req->dst_addr = req->nwk_addr;
req->request_type = ZB_ZDO_SINGLE_DEV_RESPONSE;
req->start_index = 0;
tsn = zb_zdo_ieee_addr_req(buf, ieee_addr_callback);
if (tsn == ZB_ZDO_INVALID_TSN)
{
TRACE_MSG(TRACE_ZDO2, "request failed", (FMT__0));
}
}
void ieee_addr_callback(zb_uint8_t param)
{
zb_bufid_t buf = param;
zb_ieee_addr_t ieee_addr;
zb_uint16_t nwk_addr;
TRACE_MSG(TRACE_ZDO2, "zb_get_peer_short_addr_cb param %hd", (FMT__H, param));
TRACE_ZDO2, "resp status %hd, nwk addr %d", (FMT__H_D, resp->status, resp->nwk_addr));
ZB_DUMP_IEEE_ADDR(resp->ieee_addr);
{
ZB_LETOH64(ieee_addr, resp->ieee_addr);
ZB_LETOH16(&nwk_addr, &resp->nwk_addr);
zb_address_update(ieee_addr, nwk_addr, ZB_TRUE, &addr_ref);
}
}

◆ zb_zdo_nwk_addr_req()

zb_uint8_t zb_zdo_nwk_addr_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Sends NWK_addr_req primitive.

Parameters
param- index of buffer with primitive parameters - zb_zdo_nwk_addr_req_param_s
cb- user's function to call when got response from the remote. zb_zdo_nwk_addr_resp_head_s passed to cb as parameter.
Returns
- ZDP transaction sequence number or 0xFF if operation cannot be performed now (nor enough memory, resources, etc.)

Example:

{
zb_bufid_t buf = param;
req_param->dst_addr = 0;
zb_address_ieee_by_ref(req_param->ieee_addr, short_addr);
req_param->start_index = 0;
tsn = zb_zdo_nwk_addr_req(param, zb_get_peer_short_addr_cb);
if (tsn == ZB_ZDO_INVALID_TSN)
{
TRACE_MSG(TRACE_ZDO2, "request failed", (FMT__0));
}
}
void zb_get_peer_short_addr_cb(zb_uint8_t param)
{
zb_bufid_t buf = param;
zb_ieee_addr_t ieee_addr;
zb_uint16_t nwk_addr;
TRACE_MSG(TRACE_ZDO2, "zb_get_peer_short_addr_cb param %hd", (FMT__H, param));
TRACE_MSG(TRACE_ZDO2, "resp status %hd, nwk addr %d", (FMT__H_D, resp->status, resp->nwk_addr));
ZB_DUMP_IEEE_ADDR(resp->ieee_addr);
// additionally check tsn if needed
//if (resp->tsn == my_saved_tsn)
{
ZB_LETOH64(ieee_addr, resp->ieee_addr);
ZB_LETOH16(&nwk_addr, &resp->nwk_addr);
zb_address_update(ieee_addr, nwk_addr, ZB_TRUE, &addr_ref);
}
}
zb_zdo_nwk_addr_resp_head_s
NWK_addr_req response frame.
Definition: zboss_api_zdo.h:1225
zb_zdo_nwk_addr_req_param_s::request_type
zb_uint8_t request_type
Definition: zboss_api_zdo.h:1213
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:149
TRACE_MSG
#define TRACE_MSG(lm, fmts, args)
Put trace output.
Definition: zb_trace.h:348
zb_zdo_ieee_addr_req_param_s::dst_addr
zb_uint16_t dst_addr
Definition: zboss_api_zdo.h:1301
ZB_ZDO_SINGLE_DEVICE_RESP
#define ZB_ZDO_SINGLE_DEVICE_RESP
Definition: zboss_api_zdo.h:1181
zb_zdo_nwk_addr_resp_head_s::nwk_addr
zb_uint16_t nwk_addr
Definition: zboss_api_zdo.h:1230
zb_zdo_nwk_addr_req_param_s::start_index
zb_uint8_t start_index
Definition: zboss_api_zdo.h:1216
zb_zdo_ieee_addr_req_param_s::start_index
zb_uint8_t start_index
Definition: zboss_api_zdo.h:1307
zb_zdo_ieee_addr_req_param_s::request_type
zb_uint8_t request_type
Definition: zboss_api_zdo.h:1304
zb_zdo_ieee_addr_req
zb_uint8_t zb_zdo_ieee_addr_req(zb_uint8_t param, zb_callback_t cb)
IEEE_addr_req primitive.
ZB_LETOH16
#define ZB_LETOH16
Definition: zb_types.h:790
ZB_BUF_GET_PARAM
#define ZB_BUF_GET_PARAM(buf, type)
Definition: zboss_api_buf.h:455
ZB_TRUE
#define ZB_TRUE
Definition: zb_types.h:371
zb_zdo_nwk_addr_req_param_s
Parameters for nwk_addr_req command.
Definition: zboss_api_zdo.h:1208
zb_zdo_ieee_addr_req_param_s
Parameters for ieee_addr_req command.
Definition: zboss_api_zdo.h:1299
ZB_ZDP_STATUS_SUCCESS
#define ZB_ZDP_STATUS_SUCCESS
Definition: zboss_api_zdo.h:41
zb_zdo_nwk_addr_req_param_s::ieee_addr
zb_ieee_addr_t ieee_addr
Definition: zboss_api_zdo.h:1211
zb_buf_begin
#define zb_buf_begin(buf)
Definition: zboss_api_buf.h:343
zb_ieee_addr_t
zb_64bit_addr_t zb_ieee_addr_t
Long (64-bit) device address.
Definition: zb_types.h:550
zb_zdo_nwk_addr_req
zb_uint8_t zb_zdo_nwk_addr_req(zb_uint8_t param, zb_callback_t cb)
Sends NWK_addr_req primitive.
zb_address_ieee_ref_t
zb_uint8_t zb_address_ieee_ref_t
Definition: zb_address.h:64
zb_zdo_nwk_addr_resp_head_s::ieee_addr
zb_ieee_addr_t ieee_addr
Definition: zboss_api_zdo.h:1229
zb_uint16_t
unsigned short zb_uint16_t
Project-local 2-byte unsigned int type.
Definition: zb_types.h:153
zb_buf_free
#define zb_buf_free(buf)
Free packet buffer and put it into free list.
Definition: zboss_api_buf.h:333
zb_address_update
zb_ret_t zb_address_update(zb_ieee_addr_t ieee_address, zb_uint16_t short_address, zb_bool_t lock, zb_address_ieee_ref_t *ref_p)
zb_zdo_nwk_addr_resp_head_s::status
zb_uint8_t status
Definition: zboss_api_zdo.h:1228
zb_bufid_t
zb_uint8_t zb_bufid_t
Definition: zboss_api_buf.h:172
zb_zdo_nwk_addr_req_param_s::dst_addr
zb_uint16_t dst_addr
Definition: zboss_api_zdo.h:1210
zb_zdo_ieee_addr_req_param_s::nwk_addr
zb_uint16_t nwk_addr
Definition: zboss_api_zdo.h:1302
zb_address_ieee_by_ref
void zb_address_ieee_by_ref(zb_ieee_addr_t ieee_address, zb_address_ieee_ref_t ref)