Hi,
Looking for some ground on getting the netowork parameters set for a zigbee device, My intention is to limit the number of scan intervals and the scan time to save power on a sleepy end device.
A snipped code call on the device startup (after zboss_start () is called) will return 0xFF on the mgmt_nwk_update_ok_cb. (ZB_ZDP_STATUS_TIMEOUT_BY_STACK). Chaning the buffer definition will cause an abort error when calling zb_zdo_mgmt_nwk_update_req. Code below:
void mgmt_nwk_update_ok_cb(zb_uint8_t param)
{
zb_buf_t *buf = ZB_BUF_FROM_REF(param);
zb_uint8_t *zdp_cmd = ZB_BUF_BEGIN(buf);
zb_zdo_mgmt_nwk_update_notify_hdr_t *notify_resp = (zb_zdo_mgmt_nwk_update_notify_hdr_t *)zdp_cmd;
NRF_LOG_INFO("notify_resp status %hd, scanned_channels %x %x, total_transmissions %hd transmission_failures %hd, scanned_channels_list_count %hd",
notify_resp->status, notify_resp->scanned_channels,
¬ify_resp->scanned_channels + 1,
notify_resp->total_transmissions, notify_resp->transmission_failures,
notify_resp->scanned_channels_list_count);
if (notify_resp->status == ZB_ZDP_STATUS_SUCCESS)
{
NRF_LOG_INFO("mgmt_nwk_update_notify received, Ok");
}
else
{
NRF_LOG_INFO("mgmt_nwk_update_notify received, ERROR incorrect status %x", notify_resp->status);
}
zb_free_buf(buf);
}
static zb_void_t set_network_parameters(void)
{
zb_uint8_t tsn;
zb_buf_t* p_buf;
zb_zdo_mgmt_nwk_update_req_t *req;
zb_uint8_t param;
ZB_BUF_INITIAL_ALLOC(p_buf, sizeof(zb_zdo_mgmt_nwk_update_req_t), req);
param = ZB_REF_FROM_BUF(p_buf);
req->hdr.scan_channels = IEEE_CHANNEL_MASK;
req->hdr.scan_duration = 0x10;
req->scan_count = ZB_DEFAULT_SCAN_DURATION;
// req->update_id = ZB_NIB_UPDATE_ID();
req->dst_addr = 0;
tsn = zb_zdo_mgmt_nwk_update_req(param, mgmt_nwk_update_ok_cb);
NRF_LOG_RAW_INFO("Network parameters set\r\n");
}
1. What is wrong with this code?
2. How can I modify the scan_duration and scan_count effectively.
3. When is it correct to call zb_zdo_mgmt_nwk_update_req function?
Thx
Armand