nRF5 SDK for Thread and Zigbee v2.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions
ZBOSS commissioning signals handler

Data Structures

struct  zb_zdo_signal_leave_params_s
 Leave parameters. More...
 
struct  zb_zdo_signal_leave_indication_params_s
 Leave Indication parameters. More...
 
struct  zb_zgp_signal_commissioning_params_s
 ZGP commissioning parameters. More...
 
struct  zb_nwk_signal_device_associated_params_s
 Association parameters. More...
 
struct  zb_zdo_signal_device_annce_params_s
 Association parameters. More...
 
struct  zb_bdb_signal_touchlink_nwk_started_params_s
 
struct  zb_bdb_signal_touchlink_nwk_joined_router_s
 
struct  zb_zdo_signal_can_sleep_params_s
 Sleep signal parameters. More...
 
struct  zb_zdo_app_signal_hdr_s
 

Macros

#define ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, type)   ((type *)(((zb_uint8_t *)sg_p) + sizeof(zb_zdo_app_signal_hdr_t)))
 
#define ZB_GET_APP_SIGNAL_STATUS(param)   (ZB_BUF_FROM_REF(param)->u.hdr.status)
 

Typedefs

typedef enum
zb_zdo_app_signal_type_e 
zb_zdo_app_signal_type_t
 
typedef zb_zdo_app_signal_type_t zb_zdo_app_signal_t
 
typedef struct
zb_zdo_signal_leave_params_s 
zb_zdo_signal_leave_params_t
 Leave parameters. More...
 
typedef struct
zb_zdo_signal_leave_indication_params_s 
zb_zdo_signal_leave_indication_params_t
 Leave Indication parameters. More...
 
typedef struct
zb_zgp_signal_commissioning_params_s 
zb_zgp_signal_commissioning_params_t
 ZGP commissioning parameters. More...
 
typedef struct
zb_nwk_signal_device_associated_params_s 
zb_nwk_signal_device_associated_params_t
 Association parameters. More...
 
typedef struct
zb_zdo_signal_device_annce_params_s 
zb_zdo_signal_device_annce_params_t
 Association parameters. More...
 
typedef struct
zb_bdb_signal_touchlink_nwk_started_params_s 
zb_bdb_signal_touchlink_nwk_started_params_t
 
typedef struct
zb_bdb_signal_touchlink_nwk_joined_router_s 
zb_bdb_signal_touchlink_nwk_joined_router_t
 
typedef struct
zb_zdo_signal_can_sleep_params_s 
zb_zdo_signal_can_sleep_params_t
 Sleep signal parameters. More...
 
typedef struct
zb_zdo_app_signal_hdr_s 
zb_zdo_app_signal_hdr_t
 
typedef zb_zdo_app_signal_hdr_t zb_zdo_app_event_t
 

Enumerations

enum  zb_zdo_app_signal_type_e {
  ZB_ZDO_SIGNAL_DEFAULT_START, ZB_ZDO_SIGNAL_SKIP_STARTUP, ZB_ZDO_SIGNAL_DEVICE_ANNCE, ZB_ZDO_SIGNAL_LEAVE,
  ZB_ZDO_SIGNAL_ERROR, ZB_BDB_SIGNAL_DEVICE_FIRST_START, ZB_BDB_SIGNAL_DEVICE_REBOOT, ZB_BDB_SIGNAL_TOUCHLINK_NWK_STARTED,
  ZB_BDB_SIGNAL_TOUCHLINK_NWK_JOINED_ROUTER, ZB_BDB_SIGNAL_TOUCHLINK, ZB_BDB_SIGNAL_STEERING, ZB_BDB_SIGNAL_FORMATION,
  ZB_BDB_SIGNAL_FINDING_AND_BINDING_TARGET_FINISHED, ZB_BDB_SIGNAL_FINDING_AND_BINDING_INITIATOR_FINISHED, ZB_BDB_SIGNAL_TOUCHLINK_TARGET, ZB_BDB_SIGNAL_TOUCHLINK_NWK,
  ZB_NWK_SIGNAL_DEVICE_ASSOCIATED, ZB_ZDO_SIGNAL_LEAVE_INDICATION, ZB_ZGP_SIGNAL_COMMISSIONING, ZB_COMMON_SIGNAL_CAN_SLEEP,
  ZB_ZDO_SIGNAL_PRODUCTION_CONFIG_READY, ZB_ZDO_APP_SIGNAL_COUNT
}
 

Functions

zb_void_t zboss_signal_handler (zb_uint8_t param)
 
zb_zdo_app_signal_type_t zb_get_app_signal (zb_uint8_t param, zb_zdo_app_signal_hdr_t **sg_p)
 

Detailed Description

There are tools that allow an application to handle Zigbee events like network formation, association status, leave indication, and others. Due to its nature, different Zigbee events appear asynchronously and ZBOSS informs the application about it through application signals. The application may handle or ignore a received signal. All application signals are processed in the application with a predefined callback function zboss_signal_handler(). It is mandatory for each application to implement this function, even if there is no need to process a signal.

There are policies that should be taken into account while implementing zboss_signal_handler() function:

Macro Definition Documentation

#define ZB_GET_APP_SIGNAL_STATUS (   param)    (ZB_BUF_FROM_REF(param)->u.hdr.status)

Get status from application signal

Parameters
param- buffer reference
Returns
status, see zb_ret_t
#define ZB_ZDO_SIGNAL_GET_PARAMS (   sg_p,
  type 
)    ((type *)(((zb_uint8_t *)sg_p) + sizeof(zb_zdo_app_signal_hdr_t)))

Obtains pointer to parameters passed with application signal.

Parameters
sg_p- pointer to application signal
type- parameter type
Returns
pointer to signal parameters

Example

simple_gw_dev_annce_cb(dev_annce_params->device_short_addr);

Typedef Documentation

Association parameters.

Stack passes this parameter to application when some device associates to us.

Application signal header

Signals passed to zboss_signal_handler()

Sleep signal parameters.

Stack passes this parameter to application when device ready to sleep.

Association parameters.

Stack passes this parameter to application when some device joins/rejoins to network.

Leave Indication parameters.

Stack passes this parameter to application upon receipt leave.indication primitive.

Leave parameters.

Stack passes this parameter to application when device itself lefts network.

ZGP commissioning parameters.

Stack passes this parameter to application to notify about GPD commissioning result.

Enumeration Type Documentation

Signals passed to zboss_signal_handler()

Enumerator
ZB_ZDO_SIGNAL_DEFAULT_START 

Default signal, for pre-R21 ZBOSS API compatibility.

The signal has Code+statusonly.

ZB_ZDO_SIGNAL_SKIP_STARTUP 

Notifies the application that ZBOSS framework (scheduler, buffer pool, etc.) started, but no join/rejoin/formation/BDB initialization is done yet.

That signal is generated if application called zb_zdo_start_no_autostart() instead of zboss_start() before zboss_main_loop(). Useful, for instance, when some HW (like, sensor connected via UART etc) must be initialized before ZigBee commissioning, but having ZBOSS scheduler running.

The signal has Code+statusonly.

{
zb_zdo_app_signal_t sig = zb_get_app_signal(param, &sg_p);
TRACE_MSG(TRACE_APP1, "zboss_signal_handler: status %hd signal %hd",
(FMT__H_H, ZB_GET_APP_SIGNAL_STATUS(param), sig));
if (ZB_GET_APP_SIGNAL_STATUS(param) == 0)
{
switch(sig)
{
TRACE_MSG(TRACE_APP1, "ZB_ZDO_SIGNAL_SKIP_STARTUP: start commissioning", (FMT__0));
/* NVRAM is loaded, init relay state */
{
sp_relay_on_off((zb_bool_t )ZB_ZCL_GET_ATTRIBUTE_VAL_8(attr_desc_on_off));
}
/* Have zb_bdb_is_factory_new() check inside */
ZB_SCHEDULE_CALLBACK(sp_start_join, SP_FIRST_JOIN_ATTEMPT);
break;
ZB_ZDO_SIGNAL_DEVICE_ANNCE 

Inform App about receiving device_annce.

                      The even has additional data of
                      zb_zdo_signal_device_annce_params_t type.

                      @snippet simple_gw.c signal_device_annce
ZB_ZDO_SIGNAL_LEAVE 

The device itself has left the network.

               The evemnt has an additional data of type
               zb_zdo_signal_leave_params_t.

               @snippet application/light_sample/light_control/light_control.c signal_leave
ZB_ZDO_SIGNAL_ERROR 

some mess in the buffer

ZB_BDB_SIGNAL_DEVICE_FIRST_START 

Device started and commissioned first time after NVRAM erase.

The signal has Code + Status only.

TRACE_MSG(TRACE_APP1, "Device STARTED OK", (FMT__0));
#ifdef TEST_APS_FRAGMENTATION
ZB_SCHEDULE_ALARM(send_frag_data, 0, ZB_TIME_ONE_SECOND / 2);
#endif
buf = ZB_GET_OUT_BUF();
if (!buf)
{
TRACE_MSG(TRACE_APP1, "no buffer available", (FMT__0));
break;
}
/* Example: send permit join request to close network */
/** [zb_zdo_mgmt_permit_joining_req] */
req_param->dest_addr = 0xfffc;
req_param->permit_duration = 0;
req_param->tc_significance = 1;
/** [zb_zdo_mgmt_permit_joining_req] */
break;
ZB_BDB_SIGNAL_DEVICE_REBOOT 

BDB initialization completed after device reboot, use NVRAM contents during initialization. Device joined/rejoined and started.

The signal has Code + Status only.

TRACE_MSG(TRACE_APP1, "Device RESTARTED OK", (FMT__0));
#ifndef ZB_USE_BUTTONS
/* Do not have buttons in simulator - just start periodic on/off sending */
cmd_in_progress = ZB_FALSE;
ZB_SCHEDULE_ALARM(button_press_handler, 0, 7 * ZB_TIME_ONE_SECOND);
#endif
break;
ZB_BDB_SIGNAL_TOUCHLINK_NWK_STARTED 

Inform the Touchlink initiator that the new Zigbee network created.

{
light_control_led_on_off(BULB_LED_NEW_DEV_JOINED, 1);
ZB_IEEE_ADDR_COPY(g_device_ctx.pending_dev_addr, sig_params->device_ieee_addr);
g_device_ctx.pending_dev_ep = sig_params->endpoint;
TRACE_MSG(TRACE_APP1, "ZB_BDB_SIGNAL_TOUCHLINK_NWK_STARTED: remember dev "TRACE_FORMAT_64, (FMT__A, TRACE_ARG_64(g_device_ctx.pending_dev_addr)));
TRACE_MSG(TRACE_APP1, "profile 0x%x ep %hd", (FMT__D_H, sig_params->profile_id, sig_params->endpoint));
}
break;
ZB_BDB_SIGNAL_TOUCHLINK_NWK_JOINED_ROUTER 

Inform the Touchlink initiator that the new router joined the network.

{
light_control_led_on_off(BULB_LED_NEW_DEV_JOINED, 1);
ZB_IEEE_ADDR_COPY(g_device_ctx.pending_dev_addr, sig_params->device_ieee_addr);
g_device_ctx.pending_dev_ep = sig_params->endpoint;
TRACE_MSG(TRACE_APP1, "ZB_BDB_SIGNAL_TOUCHLINK_NWK_JOINED_ROUTER: remember dev "TRACE_FORMAT_64, (FMT__A, TRACE_ARG_64(g_device_ctx.pending_dev_addr)));
TRACE_MSG(TRACE_APP1, "profile 0x%x ep %hd", (FMT__D_H, sig_params->profile_id, sig_params->endpoint));
}
break;
ZB_BDB_SIGNAL_TOUCHLINK 

Touchlink commissioning done.

ZB_BDB_SIGNAL_STEERING 

BDB steering completed.

ZB_BDB_SIGNAL_FORMATION 

BDB formation completed.

ZB_BDB_SIGNAL_FINDING_AND_BINDING_TARGET_FINISHED 

BDB finding and binding target completed.

ZB_BDB_SIGNAL_FINDING_AND_BINDING_INITIATOR_FINISHED 

BDB finding and binding initiator completed.

ZB_BDB_SIGNAL_TOUCHLINK_TARGET 

Touchlink Target started.

ZB_BDB_SIGNAL_TOUCHLINK_NWK 

Touchlink Target Network started.

ZB_NWK_SIGNAL_DEVICE_ASSOCIATED 

New device associated to ZigBee Coordinator or router. Note: that signal exists due to historical reasons. Its usage is not recommented. Base your logic on ZB_ZDO_SIGNAL_DEVICE_ANNCE instead.

ZB_ZDO_SIGNAL_LEAVE_INDICATION 

NWK leave indication from the child received

Has additional data of type zb_zdo_signal_leave_indication_params_t.

{
if (!leave_ind_params->rejoin)
{
simple_gw_leave_indication(leave_ind_params->device_addr);
}
}
break;
ZB_ZGP_SIGNAL_COMMISSIONING 

ZGP commissioning complete signal

Called when GPCB is leaving commissioning mode.

See also
zb_zgp_signal_commissioning_params_t.
{
TRACE_MSG(TRACE_ZCL1, "> zboss_signal_handler %hd", (FMT__H, param));
if (ZB_GET_APP_SIGNAL_STATUS(param) == 0)
{
switch(sig)
{
TRACE_MSG(TRACE_APP1, "Device STARTED OK", (FMT__0));
#ifndef ZB_USE_BUTTONS
/* if we do not have buttons, use alarm */
ZB_SCHEDULE_ALARM(start_comm, 0,
#endif
break;
{
comm_done_cb(comm_params->zgpd_id, comm_params->result);
}
break;
{
TRACE_MSG(TRACE_APP1, "Loading application production config", (FMT__0));
break;
}
ZB_COMMON_SIGNAL_CAN_SLEEP 

Notifies application that MCU can go to sleep.

                      Passed up with parameter @ref zb_zdo_signal_can_sleep_params_t
ZB_ZDO_SIGNAL_PRODUCTION_CONFIG_READY 

Notifies application that application specific part of production configuration can be applied

Passed up with application specific data from production configuration.

Function Documentation

zb_zdo_app_signal_type_t zb_get_app_signal ( zb_uint8_t  param,
zb_zdo_app_signal_hdr_t **  sg_p 
)

If any parameters are needed to be passed to the zboss_signal_handler, it will be better to inherit zb_zdo_app_signal_t and introduce the structure something like this:

typedef struct zb_zdo_app_my_custom_signal_s { zb_zdo_app_signal_t super; zb_my_custom_data_type_t my_custom_data; } Unpack application signal buffer in zboss_signal_handler()

Parameters
param- parameter of zboss_signal_handler()
sg_p- pointer to the extended signal info, if application wants it. Can be NULL.
Returns
application signal
zb_void_t zboss_signal_handler ( zb_uint8_t  param)

ZBOSS application signal handler.

Mandatory for all applications implemented on the top of ZBOSS stack. See zb_zdo_app_signal_type_e.

Parameters
param- reference to the buffer which contains signal. See zb_get_app_signal.

Documentation feedback | Developer Zone | Subscribe | Updated