Developing with ZBOSS for Zigbee
|
Modules | |
Tc_swap | |
Macros | |
#define | ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, type) ((type *)(void *)((((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_HIGH_SEQ_SECURED_REJOIN 4U |
#define | ZB_HIGH_SEQ_UNSECURED_JOIN 5U |
#define | ZB_HIGH_SEQ_UNSECURED_REJOIN 7U |
#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_bool_t | zb_signal_handler_add_back (zb_signal_handler_t handler) |
Add new signal handler to the end of a subscription chain. More... | |
zb_bool_t | zb_signal_handler_add_front (zb_signal_handler_t handler) |
Add new signal handler to the beginning of a subscription chain. More... | |
zb_bool_t | zb_signal_handler_remove (zb_signal_handler_t handler) |
Remove signal handler from the subscription chain. More... | |
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... | |
ZDP status values | |
| |
#define | ZB_ZDP_STATUS_SUCCESS 0x00U |
#define | ZB_ZDP_STATUS_INV_REQUESTTYPE 0x80U |
#define | ZB_ZDP_STATUS_DEVICE_NOT_FOUND 0x81U |
#define | ZB_ZDP_STATUS_INVALID_EP 0x82U |
#define | ZB_ZDP_STATUS_NOT_ACTIVE 0x83U |
#define | ZB_ZDP_STATUS_NOT_SUPPORTED 0x84U |
#define | ZB_ZDP_STATUS_TIMEOUT 0x85U |
#define | ZB_ZDP_STATUS_NO_MATCH 0x86U |
#define | ZB_ZDP_STATUS_NO_ENTRY 0x88U |
#define | ZB_ZDP_STATUS_NO_DESCRIPTOR 0x89U |
#define | ZB_ZDP_STATUS_INSUFFICIENT_SPACE 0x8aU |
#define | ZB_ZDP_STATUS_NOT_PERMITTED 0x8bU |
#define | ZB_ZDP_STATUS_TABLE_FULL 0x8cU |
#define | ZB_ZDP_STATUS_NOT_AUTHORIZED 0x8dU |
#define | ZB_ZDP_STATUS_INVALID_INDEX 0x8fU |
#define | ZB_ZDP_STATUS_FRAME_TOO_LARGE 0x90U |
#define | ZB_ZDP_STATUS_BAD_KEY_NEG_METHOD 0x91U |
#define | ZB_ZDP_STATUS_TEMPORARY_FAILURE 0x92U |
#define | ZB_ZDP_STATUS_DEV_ANNCE_SENDING_FAILED 0x0feU |
#define | ZB_ZDP_STATUS_TIMEOUT_BY_STACK 0xffU |
Status codes for F&B Initiator Finished signal | |
#define | ZB_ZDO_FB_INITIATOR_STATUS_SUCCESS 0U |
#define | ZB_ZDO_FB_INITIATOR_STATUS_CANCEL 1U |
#define | ZB_ZDO_FB_INITIATOR_STATUS_ALARM 2U |
#define | ZB_ZDO_FB_INITIATOR_STATUS_ERROR 3U |
Security/rejoin states of the 'status' field of APSME-Update-Device | |
#define | ZB_STD_SEQ_SECURED_REJOIN 0U |
#define | ZB_STD_SEQ_UNSECURED_JOIN 1U |
#define | ZB_DEVICE_LEFT 2U |
#define | ZB_STD_SEQ_UNSECURED_REJOIN 3U |
#define | ZB_JOIN_WITH_DLK 6U |
TC action on incoming Update Device | |
#define | ZB_TC_ACTION_AUTHORIZE 0u |
#define | ZB_TC_ACTION_DENY 1u |
#define | ZB_TC_ACTION_IGNORE 2u |
Authorization types for @ref ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED | |
#define | ZB_ZDO_AUTHORIZATION_TYPE_LEGACY 0U |
#define | ZB_ZDO_AUTHORIZATION_TYPE_R21_TCLK 1U |
#define | ZB_ZDO_AUTHORIZATION_TYPE_SE_CBKE 2U |
#define | ZB_ZDO_AUTHORIZATION_TYPE_DLK 3U |
Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_LEGACY value of @ref | |
#define | ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_SUCCESS 0U |
#define | ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_FAILED 1U |
Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_R21_TCLK and ZB_ZDO_AUTHORIZATION_TYPE_DLK | |
values zdo_authorization_type | |
#define | ZB_ZDO_TCLK_AUTHORIZATION_SUCCESS 0U |
#define | ZB_ZDO_TCLK_AUTHORIZATION_TIMEOUT 1U |
#define | ZB_ZDO_TCLK_AUTHORIZATION_FAILED 2U |
Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_SE_CBKE value @ref zdo_authorization_type | |
| |
#define | ZB_ZDO_CBKE_AUTHORIZATION_SUCCESS 0U |
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_BDB_SIGNAL_DEVICE_FIRST_START 5U |
Device started for the first time after the NVRAM erase. When generated:
Upon completing the typical device startup (network formation for ZC or rejoin/discovery/association for ZR and ZED).
Status codes:
RET_INTERRUPTED: The operation was cancelled with zb_bdb_reset_via_local_action()
Signal parameters:
#define ZB_BDB_SIGNAL_DEVICE_REBOOT 6U |
Device started using the NVRAM contents.
When generated:
Status codes:
RET_INTERRUPTED: The operation was cancelled with zb_bdb_reset_via_local_action()
Signal parameters:
#define ZB_BDB_SIGNAL_FINDING_AND_BINDING_INITIATOR_FINISHED 13U |
BDB finding and binding for an initiator endpoint completed.
When generated:
Status codes:
Signal parameters:
#define ZB_BDB_SIGNAL_FINDING_AND_BINDING_TARGET_FINISHED 12U |
BDB finding and binding for a target endpoint completed.
When generated:
Status codes:
Signal parameters:
#define ZB_BDB_SIGNAL_FORMATION 11U |
BDB network formation completed (Network formation only).
When generated:
Status codes:
Signal parameters:
#define ZB_BDB_SIGNAL_STEERING 10U |
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:
#define ZB_BDB_SIGNAL_WWAH_REJOIN_STARTED 20U |
WWAH Rejoin start indication.
When generated:
Status codes:
Signal parameters: no
#define ZB_COMMON_SIGNAL_CAN_SLEEP 22U |
Notifies the application that the MCU can sleep for the specified period of time.
When generated:
Status codes:
Signal parameters:
#define ZB_DEVICE_LEFT 2U |
Device left
#define ZB_GET_APP_SIGNAL_STATUS | ( | param | ) | zb_buf_get_status(param) |
Get status from the application signal.
param | - buffer reference |
#define ZB_HIGH_SEQ_SECURED_REJOIN 4U |
Device rejoin with high security
#define ZB_HIGH_SEQ_UNSECURED_JOIN 5U |
Device join without high security
#define ZB_HIGH_SEQ_UNSECURED_REJOIN 7U |
Device rejoin without high security
#define ZB_JOIN_WITH_DLK 6U |
Device join after network commissioning (r23). Note: non-standard status; do not send it.
#define ZB_NLME_STATUS_INDICATION 52U |
NLME status indication. Application may implement additional logic based on receiving some statuses.
#define ZB_NWK_SIGNAL_DEVICE_ASSOCIATED 18U |
Obsolete signal, used for pre-R21 ZBOSS API compatibility. Use ZB_ZDO_SIGNAL_DEVICE_ANNCE signal instead!
When generated:
Status codes:
Signal parameters:
#define ZB_NWK_SIGNAL_NO_ACTIVE_LINKS_LEFT 24U |
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:
#define ZB_NWK_SIGNAL_PANID_CONFLICT_DETECTED 51U |
PAN ID conflict has been detected. Application has to decide whether to initiate its resolution or not.
#define ZB_STD_SEQ_SECURED_REJOIN 0U |
Device rejoin with standard security
#define ZB_STD_SEQ_UNSECURED_JOIN 1U |
Device join without security
#define ZB_STD_SEQ_UNSECURED_REJOIN 3U |
Device rejoin without standard security
#define ZB_TC_ACTION_AUTHORIZE 0u |
authorize device
#define ZB_TC_ACTION_DENY 1u |
deby authorization - msend Remove device
#define ZB_TC_ACTION_IGNORE 2u |
ignore Update Device - that meay lead to authorization deny
#define ZB_TC_SWAPPED_SIGNAL 54U |
TC is swapped (signal at Joiner)
#define ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL 53U |
it is time to backup TC database (signal at TC)
#define ZB_ZDO_AUTHORIZATION_TYPE_DLK 3U |
Authorization type for r23 dynamic link key negotiation
#define ZB_ZDO_AUTHORIZATION_TYPE_LEGACY 0U |
Authorization type for legacy devices ( < r21)
#define ZB_ZDO_AUTHORIZATION_TYPE_R21_TCLK 1U |
Authorization type for r21 device through TCLK
#define ZB_ZDO_AUTHORIZATION_TYPE_SE_CBKE 2U |
Authorization type for SE through CBKE
#define ZB_ZDO_CBKE_AUTHORIZATION_SUCCESS 0U |
Authorization success
#define ZB_ZDO_FB_INITIATOR_STATUS_ALARM 2U |
F&B on the Initiator side is finished by timeout
#define ZB_ZDO_FB_INITIATOR_STATUS_CANCEL 1U |
F&B on the Initiator side is canceled
#define ZB_ZDO_FB_INITIATOR_STATUS_ERROR 3U |
F&B on the Initiator side is failure finished
#define ZB_ZDO_FB_INITIATOR_STATUS_SUCCESS 0U |
F&B with a Target on the Initiator side is success completed
#define ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_FAILED 1U |
Authorization failed
#define ZB_ZDO_LEGACY_DEVICE_AUTHORIZATION_SUCCESS 0U |
Authorization success
#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 zb_signal_handler_t. |
#define ZB_ZDO_SIGNAL_DEFAULT_START 0U |
Obsolete signal, used for pre-R21 ZBOSS API compatibility. Not recommended to use. When generated:
After the device has been started and the non-BDB commissioning completed.
Status codes:
Signal parameters:
#define ZB_ZDO_SIGNAL_DEVICE_ANNCE 2U |
Notifies the application about the new device appearance.
When generated:
Status codes:
Signal parameters:
#define ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED 47U |
Notifies the Zigbee Trust center application about a new device is authorized in the network. For Zigbee R21 devices it means that the TCLK exchange procedure was finished, for the legacy devices it means that the Transport key was send to the device.
When generated: - Authorization success - Authorization failed - Authorization timeout Status codes: - RET_OK: Device information updated. - Does not return error status. Signal parameters: - @ref zb_zdo_signal_device_authorized_params_t
#define ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_STARTED 50U |
Notifies the Joiner device that Device Interview was started
Status codes:
Device Interview is finished when device is authorized.
#define ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW 49U |
Notifies the Zigbee Trust center that new device is ready for Device Interview.
[in] | param_in | zb_zdo_signal_device_ready_for_interview_params_t |
TC can exchange APS encrypted APS Data (including ZDO) with Joiner during Device Interview. TC can finish Device Interview by calling either zb_tc_auth_device_after_interview() or zb_tc_reject_device_after_interview ().
Status codes:
Signal parameters:
#define ZB_ZDO_SIGNAL_DEVICE_UPDATE 48U |
Notifies the Zigbee Trust center or parent router application about a new device joined, rejoined or left the network.
When generated: - Standard device secured rejoin - Standard device unsecured join - Device left - Standard device trust center rejoin Status codes: - RET_OK: Device information updated. - Does not return error status. Signal parameters: - @ref zb_zdo_signal_device_update_params_t
#define ZB_ZDO_SIGNAL_ERROR 4U |
Corrupted or incorrect signal information.
When generated:
Status codes:
Signal parameters:
#define ZB_ZDO_SIGNAL_GET_PARAMS | ( | sg_p, | |
type | |||
) | ((type *)(void *)((((zb_uint8_t *)sg_p) + sizeof(zb_zdo_app_signal_hdr_t)))) |
Obtains pointer to parameters passed with application signal.
[in] | sg_p | - pointer to application signal |
[in] | type | - parameter type |
Example
#define ZB_ZDO_SIGNAL_LEAVE 3U |
Notifies the application that the device itself has left the network.
When generated:
Status codes:
Signal parameters:
@snippet light_sample/light_control/light_control.c signal_leave
#define ZB_ZDO_SIGNAL_LEAVE_INDICATION 19U |
Network leave indication.
When generated:
Status codes:
Signal parameters:
#define ZB_ZDO_SIGNAL_PRODUCTION_CONFIG_READY 23U |
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:
#define ZB_ZDO_SIGNAL_SKIP_STARTUP 1U |
Notifies the application that ZBOSS framework (scheduler, buffer pool, etc.) has started, but no join/rejoin/formation/BDB initialization has been done yet.
@parblock When generated:
Status codes: - RET_OK: Only ZBOSS framework has been initialized. - Does not return error status. Signal parameters: - none @snippet smart_plug_v2/sp_device/sp_device.c signal_skip_startup @endparblock
#define ZB_ZDO_TCLK_AUTHORIZATION_FAILED 2U |
Authorization failed
#define ZB_ZDO_TCLK_AUTHORIZATION_SUCCESS 0U |
Authorization success
#define ZB_ZDO_TCLK_AUTHORIZATION_TIMEOUT 1U |
Authorization timeout
#define ZB_ZDP_STATUS_BAD_KEY_NEG_METHOD 0x91U |
The request encountered a temporary failure but a retry at a later time should be attempted and may succeed.
#define ZB_ZDP_STATUS_DEVICE_NOT_FOUND 0x81U |
The supplied endpoint was equal to 0x00 or between 0xf1 and 0xff.
#define ZB_ZDP_STATUS_FRAME_TOO_LARGE 0x90U |
A TLV required for processing the ZDO Request was absent from the received ZDO message.
#define ZB_ZDP_STATUS_INSUFFICIENT_SPACE 0x8aU |
The device is not in the proper state to support the requested operation.
#define ZB_ZDP_STATUS_INV_REQUESTTYPE 0x80U |
The requested device did not exist on a device following a child descriptor request to a parent.
#define ZB_ZDP_STATUS_INVALID_EP 0x82U |
The requested endpoint is not described by simple descriptor.
#define ZB_ZDP_STATUS_INVALID_INDEX 0x8fU |
The response was too large to fit in a single unfragmented message.
#define ZB_ZDP_STATUS_NO_DESCRIPTOR 0x89U |
The device does not have storage space to support the requested operation.
#define ZB_ZDP_STATUS_NO_ENTRY 0x88U |
A child descriptor was not available following a discovery request to a parent.
#define ZB_ZDP_STATUS_NO_MATCH 0x86U |
The unbind request was unsuccessful due to the coordinator or source device not having an entry in its binding table to unbind.
#define ZB_ZDP_STATUS_NOT_ACTIVE 0x83U |
The requested optional feature is not supported on the target device.
#define ZB_ZDP_STATUS_NOT_AUTHORIZED 0x8dU |
The index in the received command is out of bounds.
#define ZB_ZDP_STATUS_NOT_PERMITTED 0x8bU |
The device does not have table space to support the operation.
#define ZB_ZDP_STATUS_NOT_SUPPORTED 0x84U |
A timeout has occurred with the requested operation.
#define ZB_ZDP_STATUS_SUCCESS 0x00U |
The requested operation or transmission was completed successfully. The supplied request type was invalid.
#define ZB_ZDP_STATUS_TABLE_FULL 0x8cU |
The permissions configuration table on the target indicates that the request is not authorized from this device.
#define ZB_ZDP_STATUS_TEMPORARY_FAILURE 0x92U |
Custom internal statuses.
#define ZB_ZDP_STATUS_TIMEOUT 0x85U |
The end device bind request was unsuccessful due to a failure to match any suitable clusters.
#define ZB_ZGP_SIGNAL_COMMISSIONING 21U |
ZGP commissioning signal.
When generated:
Status codes:
Signal parameters:
Association parameters.
Stack passes this parameter to application when some device associates to that.
typedef zb_bool_t(* zb_signal_handler_t) (zb_uint8_t param) |
ZBOSS signal handler function.
An application or any ZBOSS subsystem can subscribe to all ZBOSS signals through this function.
typedef struct zb_zdo_app_signal_hdr_s zb_zdo_app_signal_hdr_t |
Application signal header
typedef zb_uint8_t zb_zdo_app_signal_type_t |
Type for signals passed to an application signal handler.
Holds one of zdo_app_signal_type. Previously it was defined as enum but was converted to a set of defines due to MISRA violations.
Type for Authorization types for ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED.
Type for Status codes for F&B Initiator Finished signal.
Holds one of zdo_fb_initiator_finished_status. Kept only for backward compatibility as zdo_fb_initiator_finished_status were declared previously as enum. Can be removed in future releases.
Type for Authorization statuses for ZB_ZDO_AUTHORIZATION_TYPE_LEGACY value of zdo_authorization_type type.
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.
Type for Authorization types for ZB_ZDO_SIGNAL_DEVICE_AUTHORIZED.
typedef zb_uint8_t zb_zdp_status_t |
Type for ZDP status values.
Holds one of zdp_status. Kept for backward compatibility as zdp_status were declared previously as enum.
ZGP approve commissioning parameters.
Stack passes this parameter to application to notify about attempt GPD commissioning. Due to limited buffer memory, a pointer to the structure is passed.
ZGP commissioning parameters.
Stack passes this parameter to application to notify about GPD commissioning result.
ZGP mode changed parameters.
Stack passes this parameter to application to notify about GP mode change.
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. |
zb_bool_t zb_signal_handler_add_back | ( | zb_signal_handler_t | handler | ) |
Add new signal handler to the end of a subscription chain.
zb_bool_t zb_signal_handler_add_front | ( | zb_signal_handler_t | handler | ) |
Add new signal handler to the beginning of a subscription chain.
zb_bool_t zb_signal_handler_remove | ( | zb_signal_handler_t | handler | ) |
Remove signal handler from the subscription chain.
void zboss_signal_handler | ( | zb_uint8_t | param | ) |
Legacy ZBOSS application signal handler.
If implemented by a ZBOSS application, it will be called for every signal. See zdo_app_signal_type.
param | - reference to the buffer which contains signal. See zb_get_app_signal. |