nRF5 SDK for Thread and Zigbee v3.2.0
Data Structures | Macros | Typedefs | Functions
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))
 

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

Macro Definition Documentation

#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

Typedef Documentation

Parameters of Active_desc_req primitive.

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

Parameters of match_desc_req primitive.

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

Match_Desc_rsp response structure.

See also
ZB spec, subclause 2.4.4.1.7

Parameters of Node_desc_req primitive.

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

Parameters of Power_desc_req primitive.

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

Parameters of Simple_desc_req primitive.

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

Parameters for System_Server_Discovery_req call.

See also
ZB spec, subclause 2.4.3.1.13.

Request parameters for System_Server_Discovery_req.

See also
ZB spec, subclause 2.4.3.1.13.

Response parameters for System_Server_Discovery_rsp.

See also
ZB spec, subclause 2.4.4.1.10.

Function Documentation

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:

void active_ep_callback(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
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_callback 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, "Error incorrect status/addr", (FMT__0));
g_error++;
}
TRACE_MSG(TRACE_APS1, " ep count %hd, ep %hd", (FMT__H_H, resp->ep_count, *ep_list));
if (resp->ep_count != 1 || *ep_list != 1)
{
TRACE_MSG(TRACE_APS3, "Error incorrect ep count or ep value", (FMT__0));
g_error++;
}
send_match_desc_req(buf);
}
void send_active_ep_req(zb_buf_t *buf)
{
req->nwk_addr = 0; //coord addr
zb_zdo_active_ep_req(ZB_REF_FROM_BUF(buf), active_ep_callback);
}

See tp_zdo_bv_09 sample

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:

void match_desc_callback(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
zb_uint8_t *match_list = (zb_uint8_t*)(resp + 1);
TRACE_MSG(TRACE_APS1, "match_desc_callback 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, "Error incorrect status/addr", (FMT__0));
g_error++;
}
/*
asdu=Match_Descr_rsp(Status=0x00=Success, NWKAddrOfInterest=0x0000,
MatchLength=0x01, MatchList=0x01)
*/
TRACE_MSG(TRACE_APS1, "match_len %hd, list %hd ", (FMT__H_H, resp->match_len, *match_list));
if (resp->match_len != 1 || *match_list != 1)
{
TRACE_MSG(TRACE_APS1, "Error incorrect match result", (FMT__0));
g_error++;
}
TRACE_MSG(TRACE_APS1, "test is finished, error counter %hd", (FMT__H, g_error));
if (g_error <= 1)
{
/* one error is allowed - power descriptor is different */
TRACE_MSG(TRACE_APS1, "Test status: OK", (FMT__0));
}
else
{
TRACE_MSG(TRACE_APS1, "Test FAILED", (FMT__0));
}
}
void send_match_desc_req(zb_buf_t *buf)
{
ZB_BUF_INITIAL_ALLOC(buf, sizeof(zb_zdo_match_desc_param_t) + (2 + 3) * sizeof(zb_uint16_t), req);
/*
NWKAddrOfInterest=0x0000 16-bit DUT ZC NWK address
ProfileID=Profile of interest to match=0x0103
NumInClusters=Number of input clusters to match=0x02,
InClusterList=matching cluster list=0x54 0xe0
NumOutClusters=return value=0x03
OutClusterList=return value=0x1c 0x38 0xa8
*/
req->nwk_addr = 0; //send to coordinator
req->profile_id = 0x0103;
req->num_in_clusters = 2;
req->num_out_clusters = 3;
req->cluster_list[0] = 0x54;
req->cluster_list[1] = 0xe0;
req->cluster_list[2] = 0x1c;
req->cluster_list[3] = 0x38;
req->cluster_list[4] = 0xa8;
zb_zdo_match_desc_req(ZB_REF_FROM_BUF(buf), match_desc_callback);
}

See tp_zdo_bv_09 sample

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:

void node_desc_callback(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
TRACE_MSG(TRACE_APS1, "node_desc_callback: 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));
g_error++;
}
ZB_LETOH16_XOR(resp->node_desc.node_desc_flags);
TRACE_MSG(TRACE_APS1, "logic type %hd, aps flag %hd, frequency %hd",
(FMT__H_H_H, ZB_GET_NODE_DESC_LOGICAL_TYPE(&resp->node_desc), ZB_GET_NODE_DESC_APS_FLAGS(&resp->node_desc),
ZB_GET_NODE_DESC_FREQ_BAND(&resp->node_desc)));
if (ZB_GET_NODE_DESC_LOGICAL_TYPE(&resp->node_desc) != 0 || ZB_GET_NODE_DESC_APS_FLAGS(&resp->node_desc) != 0
|| ZB_GET_NODE_DESC_FREQ_BAND(&resp->node_desc) != ZB_FREQ_BAND_2400 )
{
TRACE_MSG(TRACE_APS1, "Error incorrect type/flags/freq", (FMT__0));
g_error++;
}
TRACE_MSG(TRACE_APS1, "mac cap 0x%hx, manufact code %hd, max buf %hd, max transfer %hd",
if ((resp->node_desc.mac_capability_flags & 0xB) != 0xB /*0b0X001X11*/ || (resp->node_desc.mac_capability_flags & ~0x4f) != 0 ||
{
TRACE_MSG(TRACE_APS1, "Error incorrect cap/manuf code/max transfer", (FMT__0));
g_error++;
}
send_power_desc_req(buf);
}
void get_node_desc()
{
zb_buf_t *asdu;
TRACE_MSG(TRACE_APS1, "get_node_desc", (FMT__0));
asdu = zb_get_out_buf();
if (!asdu)
{
TRACE_MSG(TRACE_ERROR, "out buf alloc failed!", (FMT__0));
}
else
{
req->nwk_addr = 0; //send to coordinator
zb_zdo_node_desc_req(ZB_REF_FROM_BUF(asdu), node_desc_callback);
}
}

See tp_zdo_bv_09 sample

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:

void node_power_desc_callback(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
TRACE_MSG(TRACE_APS1, " node_power_desc_callback 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));
g_error++;
}
TRACE_MSG(TRACE_APS1, "power mode %hd, avail power src %hd, cur power src %hd, cur power level %hd",
(FMT__H_H_H_H, ZB_GET_POWER_DESC_CUR_POWER_MODE(&resp->power_desc),
ZB_GET_POWER_DESC_AVAIL_POWER_SOURCES(&resp->power_desc),
ZB_GET_POWER_DESC_CUR_POWER_SOURCE(&resp->power_desc),
ZB_GET_POWER_DESC_CUR_POWER_SOURCE_LEVEL(&resp->power_desc)));
/* PowerDescriptor=Current power mode=0b0000, Available power mode=0b0111, Current
power source=0b0001, Current power source level=0b1100 */
if (ZB_GET_POWER_DESC_CUR_POWER_MODE(&resp->power_desc) != 0 ||
ZB_GET_POWER_DESC_AVAIL_POWER_SOURCES(&resp->power_desc) != 0x7 ||
ZB_GET_POWER_DESC_CUR_POWER_SOURCE(&resp->power_desc) != 0x1 ||
ZB_GET_POWER_DESC_CUR_POWER_SOURCE_LEVEL(&resp->power_desc) != 0xC)
{
TRACE_MSG(TRACE_APS1, "Error incorrect power desc", (FMT__0));
g_error++;
}
send_simple_desc_req(buf);
}
void send_power_desc_req(zb_buf_t *buf)
{
req->nwk_addr = 0; //send to coordinator
zb_zdo_power_desc_req(ZB_REF_FROM_BUF(buf), node_power_desc_callback);
}

See tp_zdo_bv_09 sample

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:

void simple_desc_callback(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
TRACE_MSG(TRACE_APS1, "simple_desc_callback 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));
g_error++;
}
/*
simple descriptor for test SimpleDescriptor=
Endpoint=0x01, Application profile identifier=0x0103, Application device
identifier=0x0000, Application device version=0b0000, Application
flags=0b0000, Application input cluster count=0x0A, Application input
cluster list=0x00 0x03 0x04 0x38 0x54 0x70 0x8c 0xc4 0xe0 0xff,
Application output cluster count=0x0A, Application output cluster
list=0x00 0x01 0x02 0x1c 0x38 0x70 0x8c 0xa8 0xc4 0xff
*/
TRACE_MSG(TRACE_APS1, "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, "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)));
}
send_active_ep_req(buf);
}
void send_simple_desc_req(zb_buf_t *buf)
{
req->nwk_addr = 0; //send to coordinator
req->endpoint = 1;
zb_zdo_simple_desc_req(ZB_REF_FROM_BUF(buf), simple_desc_callback);
}

See tp_zdo_bv_09 sample

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 or 0xFF if operation cannot be performed now (nor enough memory, resources, etc.)

Example:

static void get_nwk_manager_cb(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
{
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));
}
}
static void get_nwk_manager()
{
zb_buf_t *asdu;
asdu = ZB_GET_OUT_BUF();
if (!asdu)
{
TRACE_MSG(TRACE_ERROR, "out buf alloc failed!", (FMT__0));
}
else
{
req_param->server_mask = (ZB_NETWORK_MANAGER)|(ZB_STACK_SPEC_VERSION << 9);
}
}

See tp_pro_bv_36 sample


Documentation feedback | Developer Zone | Subscribe | Updated