Logo
Developing with ZBOSS for Zigbee
SE commissioning API

Functions

zb_ret_t zb_se_service_discovery_start (zb_uint8_t endpoint)
 Puts device into the Service Discovery state. More...
 
void zb_se_service_discovery_stop ()
 Stops Service Discovery process started with zb_se_service_discovery_start(). More...
 
void zb_se_service_discovery_set_multiple_commodity_enabled (zb_uint8_t enabled)
 Allows enabling or disabling support for multiple commodity networks. More...
 
void zb_se_service_discovery_bind_req (zb_uint8_t param, zb_ieee_addr_t dst_ieee, zb_uint16_t dst_ep)
 Sends Bind Request command to the discovered SE device. More...
 

Detailed Description

Function Documentation

§ zb_se_service_discovery_bind_req()

void zb_se_service_discovery_bind_req ( zb_uint8_t  param,
zb_ieee_addr_t  dst_ieee,
zb_uint16_t  dst_ep 
)

#include </conan-data/ti_zigbee/9.14.00.04/library-lprf/ga/build/f6d18801b7b469a709ae7e8290b03ecdc7a7ad4c/zboss_r23/include/zboss_api_se.h>

Sends Bind Request command to the discovered SE device.

Parameters
[in]param- reference to the buffer, which will be used for outgoing ZDO Bind Request command
[in]dst_ieee- address of the found device
[in]dst_ep- device's endpoint
Note
This function should only be called after the application receives the ZB_SE_SIGNAL_SERVICE_DISCOVERY_DO_BIND signal.
Device information (address, endpoint) should be taken from a signal's parameter. Cluster ID will be taken automatically by stack.
Example
ZBOSS signal retrieving and preprocessing:
/* Application signal handler. Can be used to inform the application about important ZBOSS
* events or states (e.g., device started the first time, rebooted, key establishment completed, etc.).
* The application may ignore signals it is not interested in. */
{
TRACE_MSG(TRACE_APP1, ">> zboss_signal_handler: param %hd signal %hd status %hd",
(FMT__H_H_H, param, sig, ZB_GET_APP_SIGNAL_STATUS(param)));
if (ZB_GET_APP_SIGNAL_STATUS(param) == 0)
{
switch (sig)
{
if (zb_buf_len(param) > sizeof(zb_zdo_app_signal_hdr_t))
{
se_app_production_config_t *prod_cfg =
ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, se_app_production_config_t);
TRACE_MSG(TRACE_APP1, "Loading application production config", (FMT__0));
if (prod_cfg->version == SE_APP_PROD_CFG_CURRENT_VERSION)
{
zb_set_node_descriptor_manufacturer_code_req(prod_cfg->manuf_code, NULL);
}
}
break;
ZB_SE_SIGNAL_SERVICE_DISCOVERY_DO_BIND signal parameters retrieval:
{
TRACE_MSG(TRACE_APP1, "can bind cluster 0x%x commodity_type %d remote_dev " TRACE_FORMAT_64,
(FMT__D_D_A, bind_params->cluster_id, bind_params->commodity_type,
TRACE_ARG_64(bind_params->device_addr)));
ZB_SE_SIGNAL_SERVICE_DISCOVERY_DO_BIND signal handling:
{
#ifdef IHD_DEV_SUPPORT_MULTIPLE_COMMODITY
#endif
{
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
#ifdef IHD_DEV_SUPPORT_MULTIPLE_COMMODITY
g_dev_ctx.dev.lst[i].u.metering.device_type = bind_params->commodity_type;
#endif
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_METERING_DISCOVER_ATTRS;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
}
else if (bind_params->cluster_id == ZB_ZCL_CLUSTER_ID_PRICE)
{
#ifdef IHD_DEV_SUPPORT_MULTIPLE_COMMODITY
#endif
{
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
#ifdef IHD_DEV_SUPPORT_MULTIPLE_COMMODITY
g_dev_ctx.dev.lst[i].u.price.commodity_type = bind_params->commodity_type;
#endif
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_PRICE_GET_CURRENT_PRICE;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
}
else if (bind_params->cluster_id == ZB_ZCL_CLUSTER_ID_DRLC)
{
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_DRLC_GET_SCHEDULED_EVENTS;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
else if (bind_params->cluster_id == ZB_ZCL_CLUSTER_ID_MESSAGING)
{
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_MESSAGING_GET_LAST_MESSAGE;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
#if IHD_ENABLE_GET_CALENDAR
else if (bind_params->cluster_id == ZB_ZCL_CLUSTER_ID_CALENDAR)
{
TRACE_MSG(TRACE_APP1, "Send bind request to Calendar Server", (FMT__0));
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_CALENDAR_GET_CALENDAR;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
#endif
{
i = ihd_dev_add_to_list(bind_params->device_addr,
bind_params->cluster_id,
bind_params->endpoint);
if (i != 0xFF)
{
TRACE_MSG(TRACE_APP1, "Send bind request to Energy Management cluster", (FMT__0));
if(g_dev_ctx.dev.lst[i].pending_cmd == IHD_DEV_NO_CMD)
{
g_dev_ctx.dev.lst[i].pending_cmd = IHD_DEV_ENERGY_MANAGEMENT_SEND_MANAGE_EVENT;
ZB_SCHEDULE_APP_CALLBACK(ihd_dev_send_pending_cmd, i);
}
zb_se_service_discovery_bind_req(param, bind_params->device_addr, bind_params->endpoint);
param = 0;
}
}
}
break;
See also
zb_se_signal_service_discovery_bind_params_t()
ZB_SE_SIGNAL_SERVICE_DISCOVERY_DO_BIND

§ zb_se_service_discovery_set_multiple_commodity_enabled()

void zb_se_service_discovery_set_multiple_commodity_enabled ( zb_uint8_t  enabled)

#include </conan-data/ti_zigbee/9.14.00.04/library-lprf/ga/build/f6d18801b7b469a709ae7e8290b03ecdc7a7ad4c/zboss_r23/include/zboss_api_se.h>

Allows enabling or disabling support for multiple commodity networks.

In networks that support multiple commodities, the Service Discovery process will return multiple instances of certain clusters. The multiple-commodity feature allows the application to determine the type of metering, price, etc., that it has discovered by analyzing the commodity_type attribute (see zse_service_disc_dev_t). In a single-commodity network, this attribute is not supported, meaning all commodities are of the same type.

Parameters
[in]enabled- flag (1|0) indicates whether multiple-commodity support should be enabled
Note
Multiple commodity feature is enabled in ZBOSS stack by default.

§ zb_se_service_discovery_start()

zb_ret_t zb_se_service_discovery_start ( zb_uint8_t  endpoint)

#include </conan-data/ti_zigbee/9.14.00.04/library-lprf/ga/build/f6d18801b7b469a709ae7e8290b03ecdc7a7ad4c/zboss_r23/include/zboss_api_se.h>

Puts device into the Service Discovery state.

The Service Discovery mechanism is used to find other devices on the network that offer services matching those of the initiator device. The initiator device will receive a series of devices that meet the discovery criteria. It should decide whether to bind with each found device based on the cluster_id and commodity_type (see zse_service_disc_dev_t) values. The process stops when no more devices are available.

Parameters
[in]endpoint- source endpoint for service discovery
Return values
RET_OK- on success
RET_INVALID_PARAMETER_1- specified endpoint is invalid (zero, non-SE, has no client clusters)
Example
ZBOSS signal retrieving and preprocessing:
/* Application signal handler. Can be used to inform the application about important ZBOSS
* events or states (e.g., device started the first time, rebooted, key establishment completed, etc.).
* The application may ignore signals it is not interested in. */
{
TRACE_MSG(TRACE_APP1, ">> zboss_signal_handler: param %hd signal %hd status %hd",
(FMT__H_H_H, param, sig, ZB_GET_APP_SIGNAL_STATUS(param)));
if (ZB_GET_APP_SIGNAL_STATUS(param) == 0)
{
switch (sig)
{
if (zb_buf_len(param) > sizeof(zb_zdo_app_signal_hdr_t))
{
se_app_production_config_t *prod_cfg =
ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, se_app_production_config_t);
TRACE_MSG(TRACE_APP1, "Loading application production config", (FMT__0));
if (prod_cfg->version == SE_APP_PROD_CFG_CURRENT_VERSION)
{
zb_set_node_descriptor_manufacturer_code_req(prod_cfg->manuf_code, NULL);
}
}
break;
ZB_SE_SIGNAL_SERVICE_DISCOVERY_START signal handling:
#if defined ZB_USE_BUTTONS
if (dev_sd_start_enabled == ZB_FALSE) {
break;
}
#endif
TRACE_MSG(TRACE_APP1, "Start Service Discovery", (FMT__0));
zb_se_service_discovery_start(IHD_DEV_ENDPOINT);
zb_se_indicate_service_discovery_started();
break;

§ zb_se_service_discovery_stop()

void zb_se_service_discovery_stop ( )

#include </conan-data/ti_zigbee/9.14.00.04/library-lprf/ga/build/f6d18801b7b469a709ae7e8290b03ecdc7a7ad4c/zboss_r23/include/zboss_api_se.h>

Stops Service Discovery process started with zb_se_service_discovery_start().

This call allows for the premature termination of receiving matched devices without waiting for the process to finish. It is not a mandatory call for stopping the Service Discovery, but it can be useful if the initiator decides to break the discovery for some reason (e.g., if it doesn't need to bind multiple devices).