Developing with ZBOSS for Zigbee
ZDO base constants and definitions

Data Structures

struct  zb_zdo_callback_info_s
 
struct  zb_zdo_default_resp_s
 
struct  zb_zdo_get_diag_data_req_params_s
 
struct  zb_zdo_get_diag_data_resp_params_s
 

Macros

#define ZB_ZDO_INVALID_TSN   0xFFU
 

Typedefs

typedef struct zb_zdo_callback_info_s zb_zdo_callback_info_t
 
typedef struct zb_zdo_default_resp_s zb_zdo_default_resp_t
 
typedef struct zb_zdo_get_diag_data_req_params_s zb_zdo_get_diag_data_req_params_t
 
typedef struct zb_zdo_get_diag_data_resp_params_s zb_zdo_get_diag_data_resp_params_t
 

Functions

void zb_zdo_get_diag_data (zb_uint16_t short_address, zb_uint8_t *lqi, zb_int8_t *rssi)
 Obtains last known LQI and RSSI values from device with specified short address. More...
 
zb_ret_t zb_zdo_get_diag_data_async (zb_bufid_t buf, zb_callback_t cb)
 Obtains last known LQI and RSSI values from the device with the specified short address. More...
 

Detailed Description

Function Documentation

◆ zb_zdo_get_diag_data()

void zb_zdo_get_diag_data ( zb_uint16_t  short_address,
zb_uint8_t lqi,
zb_int8_t rssi 
)

Obtains last known LQI and RSSI values from device with specified short address.

Parameters
[in]short_address- address of device
[in,out]lqi- pointer to zb_uint8_t variable to store lqi value
[in,out]rssi- pointer to zb_uint8_t variable to store rssi value

Example:

zb_uint8_t zcl_specific_cluster_cmd_handler(zb_uint8_t param)
{
TRACE_MSG(TRACE_APP1, ">> zcl_specific_cluster_cmd_handler", (FMT__0));
ZB_ZCL_COPY_PARSED_HEADER(param, &cmd_info);
g_dst_addr = ZB_ZCL_PARSED_HDR_SHORT_DATA(&cmd_info).source.u.short_addr;
g_endpoint = ZB_ZCL_PARSED_HDR_SHORT_DATA(&cmd_info).src_endpoint;
ZB_ZCL_DEBUG_DUMP_HEADER(&cmd_info);
TRACE_MSG(TRACE_APP3, "payload size: %i", (FMT__D, zb_buf_len(param)));
zb_zdo_get_diag_data(g_dst_addr, &lqi, &rssi);
TRACE_MSG(TRACE_APP3, "lqi %hd rssi %d", (FMT__H_H, lqi, rssi));
{
TRACE_ERROR,
"Unsupported \"from server\" command direction",
(FMT__0));
}
TRACE_MSG(TRACE_APP1, "<< zcl_specific_cluster_cmd_handler", (FMT__0));
return ZB_FALSE;
}

◆ zb_zdo_get_diag_data_async()

zb_ret_t zb_zdo_get_diag_data_async ( zb_bufid_t  buf,
zb_callback_t  cb 
)

Obtains last known LQI and RSSI values from the device with the specified short address.

Parameters
buf- a buffer with request params, see zb_zdo_get_diag_data_req_params_t
cb- a user's function to call when the response is ready. See zb_zdo_get_diag_data_resp_params_t for response params description.
Returns
status, RET_OK - request successfully sent, RET_INVALID_PARAMETER_1 if buf is ZB_BUF_INVALID, RET_INVALID_PARAMETER_2 if cb is NULL, RET_BUSY if this request can't be served at the moment

Example:

static void handle_diag_data_resp(zb_bufid_t buf)
{
TRACE_MSG(TRACE_APP1, "handle_diag_data_resp, status: %d, addr: 0x%x, lqi: %d, rssi: %d",
(FMT__D_D_D_D, resp_params->status, resp_params->short_address,
resp_params->lqi, resp_params->rssi));
}
static void send_diag_data_req(zb_uint16_t short_address)
{
buf = zb_buf_get_out();
if (buf != ZB_BUF_INVALID)
{
ZB_BZERO(req, sizeof(*req));
req->short_address = short_address;
zb_zdo_get_diag_data_async(buf, handle_diag_data_resp);
}
else
{
TRACE_MSG(TRACE_ERROR, "Failed to get a buffer", (FMT__0));
}
}
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:153
TRACE_MSG
#define TRACE_MSG(lm, fmts, args)
Put trace output.
Definition: zb_trace.h:359
zb_zcl_parsed_hdr_s
Definition: zb_zcl_common.h:1141
ZB_ZCL_FRAME_DIRECTION_TO_CLI
#define ZB_ZCL_FRAME_DIRECTION_TO_CLI
Definition: zb_zcl_common.h:1049
ZB_MAC_LQI_UNDEFINED
#define ZB_MAC_LQI_UNDEFINED
Definition: zboss_api_nwk.h:160
ZB_BUF_GET_PARAM
#define ZB_BUF_GET_PARAM(buf, type)
Definition: zboss_api_buf.h:447
zb_int8_t
signed char zb_int8_t
Project-local 1-byte signed int type.
Definition: zb_types.h:155
zb_zdo_get_diag_data_resp_params_s
Definition: zboss_api_zdo.h:1260
ZB_ZCL_PARSED_HDR_SHORT_DATA
#define ZB_ZCL_PARSED_HDR_SHORT_DATA(header)
Extract common addressing data from parsed ZCL structure.
Definition: zb_zcl_common.h:1206
ZB_MAC_RSSI_UNDEFINED
#define ZB_MAC_RSSI_UNDEFINED
Definition: zboss_api_nwk.h:164
zb_zdo_get_diag_data_async
zb_ret_t zb_zdo_get_diag_data_async(zb_bufid_t buf, zb_callback_t cb)
Obtains last known LQI and RSSI values from the device with the specified short address.
zb_zdo_get_diag_data
void zb_zdo_get_diag_data(zb_uint16_t short_address, zb_uint8_t *lqi, zb_int8_t *rssi)
Obtains last known LQI and RSSI values from device with specified short address.
zb_buf_get_out
#define zb_buf_get_out()
Definition: zboss_api_buf.h:238
zb_zcl_parsed_hdr_s::cmd_direction
zb_uint8_t cmd_direction
Definition: zb_zcl_common.h:1177
ZB_ZCL_COPY_PARSED_HEADER
#define ZB_ZCL_COPY_PARSED_HEADER(buf, dst)
Copy parsed ZCL header from buffer.
Definition: zb_zcl_common.h:1456
ZB_APS_ADDR_MODE_16_ENDP_PRESENT
#define ZB_APS_ADDR_MODE_16_ENDP_PRESENT
Definition: zboss_api_aps.h:107
zb_zdo_get_diag_data_req_params_s
Definition: zboss_api_zdo.h:1255
zb_uint16_t
unsigned short zb_uint16_t
Project-local 2-byte unsigned int type.
Definition: zb_types.h:157
zb_buf_free
#define zb_buf_free(buf)
Free packet buffer and put it into free list.
Definition: zboss_api_buf.h:333
ZB_FALSE
#define ZB_FALSE
Definition: zb_types.h:374
zb_buf_len
#define zb_buf_len(buf)
Definition: zboss_api_buf.h:361
zb_bufid_t
zb_uint8_t zb_bufid_t
Definition: zboss_api_buf.h:172