Developing with ZBOSS
ZDO services discovery

Data Structures

struct  zb_zdo_node_desc_req_s
 Parameters of Node_desc_req primitive. More...
 
struct  zb_zdo_desc_resp_hdr_s
 Header of Node_desc_resp primitive. More...
 
struct  zb_zdo_node_desc_resp_s
 Parameters of Node_desc_resp primitive. More...
 
struct  zb_zdo_simple_desc_resp_hdr_s
 Header of simple_desc_resp primitive. More...
 
struct  zb_zdo_simple_desc_resp_s
 Parameters of simple_desc_resp primitive. More...
 
struct  zb_zdo_child_info_s
 
struct  zb_zdo_parent_annce_s
 Header of parent_annce primitive. More...
 
struct  zb_zdo_parent_annce_rsp_hdr_s
 Header of parent_annce_rsp primitive. More...
 
struct  zb_zdo_parent_annce_rsp_s
 Parameters of parent_annce_rsp primitive. More...
 
struct  zb_zdo_power_desc_resp_s
 Parameters of Power_desc_resp primitive. More...
 
struct  zb_zdo_power_desc_req_s
 Parameters of Power_desc_req primitive. More...
 
struct  zb_zdo_simple_desc_req_s
 Parameters of Simple_desc_req primitive. More...
 
struct  zb_zdo_active_ep_req_s
 Parameters of Active_desc_req primitive. More...
 
struct  zb_zdo_ep_resp_s
 Active EP response. More...
 
struct  zb_zdo_match_desc_param_s
 Parameters of match_desc_req primitive. More...
 
struct  zb_zdo_match_desc_req_head_s
 Match_desc_req head. More...
 
struct  zb_zdo_match_desc_req_tail_s
 Match_desc_req tail. More...
 
struct  zb_zdo_match_desc_resp_s
 Match_Desc_rsp response structure. More...
 
struct  zb_zdo_system_server_discovery_req_s
 Request parameters for System_Server_Discovery_req. More...
 
struct  zb_zdo_system_server_discovery_resp_s
 Response parameters for System_Server_Discovery_rsp. More...
 

Macros

#define ZB_PARENT_ANNCE_JITTER()   (ZB_APS_PARENT_ANNOUNCE_BASE_TIMER + ZB_RANDOM_JTR(ZB_APS_PARENT_ANNOUNCE_JITTER_MAX))
 Jitter used for sending Parent Annce.
 

Typedefs

typedef struct zb_zdo_node_desc_req_s zb_zdo_node_desc_req_t
 Parameters of Node_desc_req primitive. More...
 
typedef struct zb_zdo_desc_resp_hdr_s zb_zdo_desc_resp_hdr_t
 Header of Node_desc_resp primitive.
 
typedef struct zb_zdo_node_desc_resp_s zb_zdo_node_desc_resp_t
 Parameters of Node_desc_resp primitive.
 
typedef struct zb_zdo_simple_desc_resp_hdr_s zb_zdo_simple_desc_resp_hdr_t
 Header of simple_desc_resp primitive.
 
typedef struct zb_zdo_simple_desc_resp_s zb_zdo_simple_desc_resp_t
 Parameters of simple_desc_resp primitive.
 
typedef struct zb_zdo_child_info_s zb_zdo_child_info_t
 
typedef struct zb_zdo_parent_annce_s zb_zdo_parent_annce_t
 Header of parent_annce primitive.
 
typedef struct zb_zdo_parent_annce_rsp_hdr_s zb_zdo_parent_annce_rsp_hdr_t
 Header of parent_annce_rsp primitive.
 
typedef struct zb_zdo_parent_annce_rsp_s zb_zdo_parent_annce_rsp_t
 Parameters of parent_annce_rsp primitive.
 
typedef struct zb_zdo_power_desc_resp_s zb_zdo_power_desc_resp_t
 Parameters of Power_desc_resp primitive.
 
typedef struct zb_zdo_power_desc_req_s zb_zdo_power_desc_req_t
 Parameters of Power_desc_req primitive. More...
 
typedef struct zb_zdo_simple_desc_req_s zb_zdo_simple_desc_req_t
 Parameters of Simple_desc_req primitive. More...
 
typedef struct zb_zdo_active_ep_req_s zb_zdo_active_ep_req_t
 Parameters of Active_desc_req primitive. More...
 
typedef struct zb_zdo_ep_resp_s zb_zdo_ep_resp_t
 Active EP response.
 
typedef struct zb_zdo_match_desc_param_s zb_zdo_match_desc_param_t
 Parameters of match_desc_req primitive. More...
 
typedef struct zb_zdo_match_desc_req_head_s zb_zdo_match_desc_req_head_t
 Match_desc_req head.
 
typedef struct zb_zdo_match_desc_req_tail_s zb_zdo_match_desc_req_tail_t
 Match_desc_req tail.
 
typedef struct zb_zdo_match_desc_resp_s zb_zdo_match_desc_resp_t
 Match_Desc_rsp response structure. More...
 
typedef struct zb_zdo_system_server_discovery_req_s zb_zdo_system_server_discovery_req_t
 Request parameters for System_Server_Discovery_req. More...
 
typedef zb_zdo_system_server_discovery_req_t zb_zdo_system_server_discovery_param_t
 Parameters for System_Server_Discovery_req call. More...
 
typedef struct zb_zdo_system_server_discovery_resp_s zb_zdo_system_server_discovery_resp_t
 Response parameters for System_Server_Discovery_rsp. More...
 

Functions

zb_uint8_t zb_zdo_node_desc_req (zb_uint8_t param, zb_callback_t cb)
 Node_desc_req primitive. More...
 
zb_uint8_t zb_zdo_power_desc_req (zb_uint8_t param, zb_callback_t cb)
 Power_desc_req primitive. More...
 
zb_uint8_t zb_zdo_simple_desc_req (zb_uint8_t param, zb_callback_t cb)
 Simple_desc_req primitive. More...
 
zb_uint8_t zb_zdo_active_ep_req (zb_uint8_t param, zb_callback_t cb)
 Active_desc_req primitive. More...
 
zb_uint8_t zb_zdo_match_desc_req (zb_uint8_t param, zb_callback_t cb)
 Match_desc_req primitive. More...
 
zb_uint8_t zb_zdo_system_server_discovery_req (zb_uint8_t param, zb_callback_t cb)
 Performs System_Server_Discovery_req. More...
 

Detailed Description

Typedef Documentation

◆ zb_zdo_active_ep_req_t

Parameters of Active_desc_req primitive.

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

◆ zb_zdo_match_desc_param_t

Parameters of match_desc_req primitive.

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

◆ zb_zdo_match_desc_resp_t

Match_Desc_rsp response structure.

See also
ZB spec, subclause 2.4.4.1.7

◆ zb_zdo_node_desc_req_t

Parameters of Node_desc_req primitive.

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

◆ zb_zdo_power_desc_req_t

Parameters of Power_desc_req primitive.

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

◆ zb_zdo_simple_desc_req_t

Parameters of Simple_desc_req primitive.

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

◆ zb_zdo_system_server_discovery_param_t

Parameters for System_Server_Discovery_req call.

See also
ZB spec, subclause 2.4.3.1.13.

◆ zb_zdo_system_server_discovery_req_t

Request parameters for System_Server_Discovery_req.

See also
ZB spec, subclause 2.4.3.1.13.

◆ zb_zdo_system_server_discovery_resp_t

Response parameters for System_Server_Discovery_rsp.

See also
ZB spec, subclause 2.4.4.1.10.

Function Documentation

◆ zb_zdo_active_ep_req()

zb_uint8_t zb_zdo_active_ep_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Active_desc_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_active_ep_req_s. Parameters must be put into 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:

static void send_active_ep_req(zb_bufid_t buf)
{
if (!buf)
{
zb_buf_get_out_delayed(send_active_ep_req);
}
else
{
req->nwk_addr = 0; /*send to coordinator*/
zb_zdo_active_ep_req(buf, active_ep_callback);
}
}
static void active_ep_callback(zb_bufid_t buf)
{
zb_uint8_t *zdp_cmd = zb_buf_begin(buf);
zb_uint8_t *ep_list = zdp_cmd + sizeof(zb_zdo_ep_resp_t);
TRACE_MSG(TRACE_APS1, "active_ep_resp: status %hd, addr 0x%x",
(FMT__H, resp->status, resp->nwk_addr));
if (resp->status != ZB_ZDP_STATUS_SUCCESS || resp->nwk_addr != 0x0)
{
TRACE_MSG(TRACE_APS1, "active_ep_resp: Error incorrect status/addr", (FMT__0));
}
TRACE_MSG(TRACE_APS1, "active_ep_resp: ep count %hd, ep numbers:", (FMT__H, resp->ep_count));
for (int i = 0; i < resp->ep_count; i++)
{
TRACE_MSG(TRACE_APS1, "active_ep_resp: ep %hd", (FMT__H_H, *(ep_list + i)));
}
ZB_SCHEDULE_APP_CALLBACK(send_system_server_discovery_req, buf);
}

See application/onoff_server sample

◆ zb_zdo_match_desc_req()

zb_uint8_t zb_zdo_match_desc_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Match_desc_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_match_desc_param_s.
cb- user's function to call when got response from the remote. If command is
broadcast, then user's function will be called as many times as number of
responses received plus one more time with status ZB_ZDP_STATUS_TIMEOUT to indicate that no more responses will be received.
Returns
- ZDP transaction sequence number or 0xFF if operation cannot be performed now (nor enough memory, resources, etc.)

Example:

zb_void_t find_light_bulb(zb_uint8_t param)
{
zb_bufid_t buf = param;
TRACE_MSG(TRACE_APP1, ">> find_light_bulb %hd", (FMT__H, param));
req = zb_buf_initial_alloc(buf, sizeof(zb_zdo_match_desc_param_t) + (1) * sizeof(zb_uint16_t));
req->profile_id = g_profile_id;
/* We are searching for On/Off of Level Control Server */
req->num_in_clusters = 2;
req->num_out_clusters = 0;
zb_zdo_match_desc_req(param, find_light_bulb_cb);
TRACE_MSG(TRACE_APP1, "<< find_light_bulb %hd", (FMT__H, param));
}
zb_void_t find_light_bulb_cb(zb_uint8_t param)
{
zb_bufid_t buf = param;
zb_uint8_t *match_ep;
TRACE_MSG(TRACE_APP1, ">> find_light_bulb_cb param %hd, resp match_len %hd", (FMT__H_H, param, resp->match_len));
if (resp->status == ZB_ZDP_STATUS_SUCCESS && resp->match_len > 0)
{
TRACE_MSG(TRACE_APP2, "Server is found, continue normal work...", (FMT__0));
/* Match EP list follows right after response header */
match_ep = (zb_uint8_t*)(resp + 1);
/* we are searching for exact cluster, so only 1 EP maybe found */
g_device_ctx.bulb_params.endpoint = *match_ep;
g_device_ctx.bulb_params.short_addr = ind->src_addr;
TRACE_MSG(TRACE_APP2, "find bulb addr %d ep %hd",
(FMT__D_H, g_device_ctx.bulb_params.short_addr, g_device_ctx.bulb_params.endpoint));
/* Next step is to resolve the IEEE address of the bulb */
ZB_SCHEDULE_APP_CALLBACK(bulb_ieee_addr_req, param);
}
else
{
}
}

See light_sample

◆ zb_zdo_node_desc_req()

zb_uint8_t zb_zdo_node_desc_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Node_desc_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_node_desc_req_s. Parameters must be put into 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:

static void send_node_desc_req(zb_bufid_t buf)
{
TRACE_MSG(TRACE_APS1, "send_node_desc_req", (FMT__0));
if (!buf)
{
zb_buf_get_out_delayed(send_node_desc_req);
}
else
{
req->nwk_addr = 0; //send to coordinator
zb_zdo_node_desc_req(buf, node_desc_callback);
}
}
static void node_desc_callback(zb_bufid_t buf)
{
zb_uint8_t *zdp_cmd = zb_buf_begin(buf);
TRACE_MSG(TRACE_APS1, "node_desc_response: status %hd, addr 0x%x",
(FMT__H_D, resp->hdr.status, resp->hdr.nwk_addr));
if (resp->hdr.status != ZB_ZDP_STATUS_SUCCESS || resp->hdr.nwk_addr != 0x0)
{
TRACE_MSG(TRACE_APS1, "Error incorrect status/addr", (FMT__0));
}
TRACE_MSG(TRACE_APS1, "node_desc_response: logic type %hd, aps flag %hd, frequency %hd",
(FMT__H_H_H, (resp->node_desc.node_desc_flags & 0x7), ((resp->node_desc.node_desc_flags & 0x700) >> 8), ((resp->node_desc.node_desc_flags & 0xF800) >> 11)));
TRACE_MSG(TRACE_APS1, "node_desc_response: mac cap 0x%hx, manufact code %d, max buf %hd, max transfer %hd",

See application/onoff_server sample

◆ zb_zdo_power_desc_req()

zb_uint8_t zb_zdo_power_desc_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Power_desc_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_power_desc_req_s. Parameters must be put into 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:

static void send_power_desc_req(zb_bufid_t buf)
{
if (!buf)
{
zb_buf_get_out_delayed(send_power_desc_req);
}
else
{
req->nwk_addr = 0; /* send to coordinator*/
zb_zdo_power_desc_req(buf, power_desc_callback);
}
}
static void power_desc_callback(zb_bufid_t buf)
{
zb_uint8_t *zdp_cmd = zb_buf_begin(buf);
TRACE_MSG(TRACE_APS1, "power_desc_resp: status %hd, addr 0x%x",
(FMT__H, resp->hdr.status, resp->hdr.nwk_addr));
if (resp->hdr.status != ZB_ZDP_STATUS_SUCCESS || resp->hdr.nwk_addr != 0x0)
{
TRACE_MSG(TRACE_APS1, "Error incorrect status/addr", (FMT__0));
}
TRACE_MSG(TRACE_APS1, "power mode %hd, avail power src %hd, cur power src %hd, cur power level %hd",
(FMT__H_H_H_H, (resp->power_desc.power_desc_flags & 0x000F),
((resp->power_desc.power_desc_flags & 0x00F0) >> 4),
((resp->power_desc.power_desc_flags & 0x0F00) >> 8),
((resp->power_desc.power_desc_flags & 0xF000) >> 12)));

See application/onoff_server sample

◆ zb_zdo_simple_desc_req()

zb_uint8_t zb_zdo_simple_desc_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Simple_desc_req primitive.

Parameters
param- index of buffer with primitive parameters zb_zdo_simple_desc_req_s.
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:

static void send_simple_desc_req(zb_bufid_t buf)
{
if (!buf)
{
zb_buf_get_out_delayed(send_simple_desc_req);
}
else
{
req->nwk_addr = 0; /* send to coordinator */
req->endpoint = 5;
zb_zdo_simple_desc_req(buf, simple_desc_callback);
}
}
static void simple_desc_callback(zb_bufid_t buf)
{
zb_uint8_t *zdp_cmd = zb_buf_begin(buf);
TRACE_MSG(TRACE_APS1, "simple_desc_resp: status %hd, addr 0x%x",
(FMT__H, resp->hdr.status, resp->hdr.nwk_addr));
if (resp->hdr.status != ZB_ZDP_STATUS_SUCCESS || resp->hdr.nwk_addr != 0x0)
{
TRACE_MSG(TRACE_APS1, "Error incorrect status/addr", (FMT__0));
}
TRACE_MSG(TRACE_APS1, "simple_desc_resp: ep %hd, app prof %d, dev id %d, dev ver %hd, input count 0x%hx, output count 0x%hx",
(FMT__H_D_D_H_H_H, resp->simple_desc.endpoint, resp->simple_desc.app_profile_id,
resp->simple_desc.app_device_id, resp->simple_desc.app_device_version,
resp->simple_desc.app_input_cluster_count, resp->simple_desc.app_output_cluster_count));
TRACE_MSG(TRACE_APS1, "simple_desc_resp: clusters:", (FMT__0));
for(i = 0; i < resp->simple_desc.app_input_cluster_count + resp->simple_desc.app_output_cluster_count; i++)
{
TRACE_MSG(TRACE_APS1, " 0x%hx", (FMT__H, *(resp->simple_desc.app_cluster_list + i)));
}

See application/onoff_server sample

◆ zb_zdo_system_server_discovery_req()

zb_uint8_t zb_zdo_system_server_discovery_req ( zb_uint8_t  param,
zb_callback_t  cb 
)

Performs System_Server_Discovery_req.

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

Example:

static void send_system_server_discovery_req(zb_bufid_t buf)
{
if (!buf)
{
zb_buf_get_out_delayed(send_system_server_discovery_req);
}
else
{
zb_zdo_system_server_discovery_req(buf, system_server_discovery_req_cb);
}
}
static void system_server_discovery_req_cb(zb_uint8_t param)
{
zb_uint8_t *zdp_cmd = zb_buf_begin(param);
{
TRACE_MSG(TRACE_APS2, "system_server_discovery received, status: OK", (FMT__0));
}
else
{
TRACE_MSG(TRACE_ERROR, "ERROR receiving system_server_discovery status %x, mask %x",
(FMT__D_D, resp->status, resp->server_mask));
}
zb_buf_free(param);
}

See application/onoff_server sample