Developing with ZBOSS
|
Data Structures | |
struct | zb_zdo_signal_leave_params_s |
Leave parameters. More... | |
struct | zb_zdo_signal_nlme_status_indication_params_s |
NLME status indication parameters. More... | |
struct | zb_zdo_signal_leave_indication_params_s |
Leave Indication 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_zdo_signal_can_sleep_params_s |
Sleep signal parameters. More... | |
struct | zb_zdo_signal_macsplit_dev_boot_params_s |
Macsplit device boot parameters. More... | |
struct | zb_zdo_signal_fb_initiator_finished_params_s |
F&B Initiator Finished signal parameters. More... | |
struct | zb_zdo_signal_device_update_params_s |
Device Updated signal parameters. More... | |
struct | zb_zdo_signal_device_authorized_params_s |
Device Authorized signal parameters. More... | |
struct | zb_zdo_app_signal_hdr_s |
Macros | |
#define | ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, type) ((type *)ZB_SAFE_PTR_CAST((((zb_uint8_t *)sg_p) + sizeof(zb_zdo_app_signal_hdr_t)))) |
#define | ZB_ZDO_SIGNAL_CUT_HEADER(buf) zb_buf_cut_left(buf, sizeof(zb_zdo_app_signal_hdr_t)) |
Cuts ZBOSS signal headers while keeping the signal parameter (if it was in the buffer). More... | |
#define | ZB_GET_APP_SIGNAL_STATUS(param) zb_buf_get_status(param) |
Get status from the application signal. More... | |
Functions | |
void | 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) |
Unpack application signal buffer in zboss_signal_handler() More... | |
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:
#define ZB_GET_APP_SIGNAL_STATUS | ( | param | ) | zb_buf_get_status(param) |
Get status from the application signal.
param | - buffer reference |
#define ZB_ZDO_SIGNAL_CUT_HEADER | ( | buf | ) | zb_buf_cut_left(buf, sizeof(zb_zdo_app_signal_hdr_t)) |
Cuts ZBOSS signal headers while keeping the signal parameter (if it was in the buffer).
buf | - pointer to a zb_buf_t structure. The buffer must be the one passed into zboss_signal_handler. |
#define ZB_ZDO_SIGNAL_GET_PARAMS | ( | sg_p, | |
type | |||
) | ((type *)ZB_SAFE_PTR_CAST((((zb_uint8_t *)sg_p) + sizeof(zb_zdo_app_signal_hdr_t)))) |
Obtains pointer to parameters passed with application signal.
sg_p | - pointer to application signal |
type | - parameter type |
Example
Association parameters.
Stack passes this parameter to application when some device associates to that.
typedef struct zb_zdo_app_signal_hdr_s zb_zdo_app_signal_hdr_t |
Application signal header
typedef enum zb_zdo_app_signal_type_e zb_zdo_app_signal_type_t |
The signals passed to zboss_signal_handler()
typedef struct zb_zdo_signal_can_sleep_params_s zb_zdo_signal_can_sleep_params_t |
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 of leave indication primitive.
typedef struct zb_zdo_signal_leave_params_s zb_zdo_signal_leave_params_t |
Leave parameters.
Stack passes this parameter to application when device leave the network.
Macsplit device boot parameters.
Macsplit passes this parameter to application when device is booted.
typedef struct zb_zdo_signal_nlme_status_indication_params_s zb_zdo_signal_nlme_status_indication_params_t |
NLME status indication parameters.
Stack passes this parameter to application when NLME status indication is generated.
typedef enum zb_zdp_status_e zb_zdp_status_t |
ZDP status values (2.4.5 ZDP Enumeration Description)
The signals passed to zboss_signal_handler()
Enumerator | |
---|---|
ZB_ZDO_SIGNAL_DEFAULT_START | Obsolete signal, used for pre-R21 ZBOSS API compatibility. Not recommended to use. When generated:
Status codes:
Signal parameters:
|
ZB_ZDO_SIGNAL_SKIP_STARTUP | Notifies the application that ZBOSS framework (scheduler, buffer pool, etc.) has started, but no join/rejoin/formation/BDB initialization has been done yet. When generated:
Status codes:
Signal parameters:
TRACE_MSG(TRACE_APP1, "ZB_ZDO_SIGNAL_SKIP_STARTUP: start commissioning", (FMT__0)); if (zb_bdb_is_factory_new()) { ZB_SCHEDULE_APP_ALARM_CANCEL(sp_com_button_pressed_reset_fd, ZB_ALARM_ANY_PARAM); } /* NVRAM is loaded, init relay state */ { sp_relay_on_off((zb_bool_t )ZB_ZCL_GET_ATTRIBUTE_VAL_8(attr_desc_on_off)); #ifdef SP_CONTROL4_COMPATIBLE if (!zb_bdb_is_factory_new()) { /* Increment BOOT_COUNT attribute */ g_dev_ctx.c4_attr.boot_count++; ZB_SCHEDULE_APP_CALLBACK(sp_write_app_data, 0); } #endif /* SP_CONTROL4_COMPATIBLE */ } /* Have zb_bdb_is_factory_new() check inside */ ZB_SCHEDULE_APP_CALLBACK(sp_start_join, SP_FIRST_JOIN_ATTEMPT); break; |
ZB_ZDO_SIGNAL_DEVICE_ANNCE | Notifies the application about the new device appearance. When generated:
Status codes:
Signal parameters: { zb_zdo_signal_device_annce_params_t *dev_annce_params = ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, zb_zdo_signal_device_annce_params_t); simple_gw_dev_annce_cb(dev_annce_params->device_short_addr); } break; |
ZB_ZDO_SIGNAL_LEAVE | Notifies the application that the device itself has left the network. When generated:
Status codes:
Signal parameters: case ZB_ZDO_SIGNAL_LEAVE: { zb_zdo_signal_leave_params_t *leave_params = ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, zb_zdo_signal_leave_params_t); light_control_retry_join(leave_params->leave_type); } break; |
ZB_ZDO_SIGNAL_ERROR | Corrupted or incorrect signal information. When generated:
Status codes:
Signal parameters:
|
ZB_BDB_SIGNAL_DEVICE_FIRST_START | Device started for the first time after the NVRAM erase. When generated:
Status codes:
Signal parameters:
TRACE_MSG(TRACE_APP1, "Device STARTED OK", (FMT__0)); #ifdef TEST_APS_FRAGMENTATION ZB_SCHEDULE_APP_ALARM(send_frag_data, 0, ZB_TIME_ONE_SECOND / 2); #endif break; |
ZB_BDB_SIGNAL_DEVICE_REBOOT | Device started using the NVRAM contents. When generated:
Status codes:
Signal parameters:
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_APP_ALARM_CANCEL(button_press_handler, ZB_ALARM_ANY_PARAM); ZB_SCHEDULE_APP_ALARM(button_press_handler, 0, 7 * ZB_TIME_ONE_SECOND); #endif break; |
ZB_BDB_SIGNAL_STEERING | BDB network steering completed (Network steering only). When generated:
Status codes:
Has additional data of type zb_zdo_signal_leave_indication_params_t. Signal parameters:
|
ZB_BDB_SIGNAL_FORMATION | BDB network formation completed (Network formation only). When generated:
Status codes:
Signal parameters:
|
ZB_BDB_SIGNAL_FINDING_AND_BINDING_TARGET_FINISHED | BDB finding and binding for a target endpoint completed. When generated:
Status codes:
Signal parameters:
|
ZB_BDB_SIGNAL_FINDING_AND_BINDING_INITIATOR_FINISHED | BDB finding and binding for an initiator endpoint completed. When generated:
Status codes: Signal parameters: |
ZB_NWK_SIGNAL_DEVICE_ASSOCIATED | Obsolete signal, used for pre-R21 ZBOSS API compatibility. Use ZB_ZDO_SIGNAL_DEVICE_ANNCE signal instead! When generated:
Status codes:
Signal parameters: |
ZB_ZDO_SIGNAL_LEAVE_INDICATION | Network leave indication. When generated:
Status codes:
Signal parameters: { zb_zdo_signal_leave_indication_params_t *leave_ind_params = ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, zb_zdo_signal_leave_indication_params_t); if (!leave_ind_params->rejoin) { simple_gw_leave_indication(leave_ind_params->device_addr); } } break; |
ZB_BDB_SIGNAL_WWAH_REJOIN_STARTED | WWAH Rejoin start indication. When generated:
Status codes:
Signal parameters: no |
ZB_COMMON_SIGNAL_CAN_SLEEP | Notifies the application that the MCU can sleep for the specified period of time.
|
ZB_ZDO_SIGNAL_PRODUCTION_CONFIG_READY | Notifies the application that the application specific part of the production configuration was found and restored and provides the application with this data. When generated:
Status codes:
Signal parameters:
|
ZB_NWK_SIGNAL_NO_ACTIVE_LINKS_LEFT | Notifies the application about the Neighbor Table expiration. It means that the neighbor devices did not send the Link Status messages for ZB_NWK_ROUTER_AGE_LIMIT * ZB_NWK_LINK_STATUS_PERIOD seconds. When generated:
Status codes:
Signal parameters:
|
ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED | Notifies the Zigbee Trust center application about a new device is authorized in the network. For Zigbee R21 devices it means that the TCKL exchange procedure was finished, for the legacy devices it means that the Transport key was send to the device. When generated:
Status codes:
|
ZB_ZDO_SIGNAL_DEVICE_UPDATE | Notifies the Zigbee Trust center or parent router application about a new device joined, rejoined or left the network. When generated:
Status codes:
Signal parameters: |
ZB_NWK_SIGNAL_PANID_CONFLICT_DETECTED | PAN ID conflict has been detected. Application has to decide whether to initiate its resolution or not.
|
ZB_NLME_STATUS_INDICATION | NLME status indication. Application may implement additional logic based on receiving some statuses.
|
Authorization types for ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED.
Enumerator | |
---|---|
ZB_ZDO_AUTHORIZATION_TYPE_LEGACY | Authorization type for legacy devices ( < r21) |
ZB_ZDO_AUTHORIZATION_TYPE_R21_TCLK | Authorization type for r21 device through TCLK |
Status codes for F&B Initiator Finished signal.
Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_LEGACY value of zb_zdo_authorization_type_t type.
Enumerator | |
---|---|
ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_SUCCESS | Authorization success |
ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_FAILED | Authorization failed |
Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_R21_TCLK value of zb_zdo_authorization_type_t type.
Enumerator | |
---|---|
ZB_ZDO_TCLK_AUTHORIZATION_SUCCESS | Authorization success |
ZB_ZDO_TCLK_AUTHORIZATION_TIMEOUT | Authorization timeout |
ZB_ZDO_TCLK_AUTHORIZATION_FAILED | Authorization failed |
enum zb_zdp_status_e |
ZDP status values (2.4.5 ZDP Enumeration Description)
zb_zdo_app_signal_type_t zb_get_app_signal | ( | zb_uint8_t | param, |
zb_zdo_app_signal_hdr_t ** | sg_p | ||
) |
Unpack application signal buffer in zboss_signal_handler()
param | - parameter of zboss_signal_handler() |
sg_p | - pointer to the extended signal info, if application wants it. Can be NULL. |
void 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.
param | - reference to the buffer which contains signal. See zb_get_app_signal. |