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 |
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_nwk_addr_req
- zb_zdo_ieee_addr_req_t
- See also
- spec 2.4.3.1, 2.4.4.1
◆ 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:
- zb_zdo_nwk_addr_req
- zb_zdo_ieee_addr_req
- See also
- spec 2.4.3.1, 2.4.4.1
Typedef Documentation
◆ zb_zdo_ieee_addr_req_t
| typedef struct zb_zdo_ieee_addr_req_s 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
| typedef struct zb_zdo_ieee_addr_resp_s 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:
{ zb_bufid_t buf = param; zb_zdo_ieee_addr_req_param_t *req_param;\ if (dev_idx != SIMPLE_GW_INVALID_DEV_INDEX) { req_param = ZB_BUF_GET_PARAM(buf, zb_zdo_ieee_addr_req_param_t); req_param->nwk_addr = g_device_ctx.devices[dev_idx].short_addr; req_param->start_index = 0; req_param->request_type = 0; zb_zdo_ieee_addr_req(buf, device_ieee_addr_req_cb); } else { TRACE_MSG(TRACE_APP2, "No devices in discovery state were found!", (FMT__0)); zb_buf_free(buf); }}void device_ieee_addr_req_cb(zb_uint8_t param){ zb_bufid_t buf = param; zb_zdo_nwk_addr_resp_head_t *resp; zb_ieee_addr_t ieee_addr; zb_uint16_t nwk_addr; zb_uint8_t dev_idx; TRACE_MSG(TRACE_APP2, ">> device_ieee_addr_req_cb param %hd", (FMT__H, param)); resp = (zb_zdo_nwk_addr_resp_head_t*)zb_buf_begin(buf); { ZB_LETOH64(ieee_addr, resp->ieee_addr); ZB_LETOH16(&nwk_addr, &resp->nwk_addr); dev_idx = simple_gw_get_dev_index_by_short_addr(nwk_addr); if (dev_idx != SIMPLE_GW_INVALID_DEV_INDEX) { ZB_MEMCPY(g_device_ctx.devices[dev_idx].ieee_addr, ieee_addr, sizeof(zb_ieee_addr_t)); g_device_ctx.devices[dev_idx].dev_state = CONFIGURE_BINDING; /* The next step is to bind the Light control to the bulb */ ZB_SCHEDULE_APP_CALLBACK2(bind_device, param, dev_idx); param = 0; } else { TRACE_MSG(TRACE_APP2, "This resp is not for our device", (FMT__0)); } } if (param) { zb_buf_free(buf); } TRACE_MSG(TRACE_APP2, "<< device_ieee_addr_req_cb", (FMT__0));}
◆ 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; TRACE_MSG(TRACE_APP2, "bulb_nwk_addr_req: param %hd ieee "TRACE_FORMAT_64, (FMT__H_A, param, TRACE_ARG_64(ieee_addr))); req->dst_addr = ZB_NWK_BROADCAST_ALL_DEVICES; ZB_IEEE_ADDR_COPY(req->ieee_addr, ieee_addr); req->start_index = 0; req->request_type = 0; zb_zdo_nwk_addr_req(buf, bulb_nwk_addr_req_cb);}void bulb_nwk_addr_req_cb(zb_uint8_t param){ zb_bufid_t buf = param; zb_zdo_nwk_addr_resp_head_t *resp; zb_ieee_addr_t ieee_addr; zb_uint16_t nwk_addr; zb_address_ieee_ref_t addr_ref; TRACE_MSG(TRACE_APP2, ">> bulb_nwk_addr_req_cb param %hd", (FMT__H, param)); resp = (zb_zdo_nwk_addr_resp_head_t*)zb_buf_begin(buf); { 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); /* The next step is to bind the Light control to the bulb */ find_light_bulb(param, nwk_addr, g_device_ctx.pending_dev_ep); } zb_buf_free(param); TRACE_MSG(TRACE_APP2, "<< bulb_ieee_addr_req_cb", (FMT__0));}