Logo
Developing with ZBOSS for Zigbee
zboss_api.h File Reference
#include "zb_version.h"
#include "zb_channel_page.h"
#include "zboss_api_core.h"
#include "zboss_api_buf.h"
#include "zboss_api_internal.h"
#include "zboss_api_nwk.h"
#include "zboss_api_af.h"
#include "zboss_api_zdo.h"
#include "zboss_api_aps.h"
#include "zb_ha.h"
#include "zb_diag.h"
#include "zb_lite.h"

Data Structures

struct  zb_secur_ic_get_list_req_s
 Request for zb_secur_ic_get_list_req. More...
 
struct  zb_secur_ic_get_list_resp_s
 Response for zb_secur_ic_get_list_req. More...
 
struct  zb_secur_ic_entry_s
 IC entry type zb_secur_ic_get_list_req. More...
 
struct  zb_secur_ic_get_by_idx_req_s
 Request for zb_secur_ic_get_by_idx_req. More...
 
struct  zb_secur_ic_get_by_idx_resp_s
 Response for zb_secur_ic_get_by_idx_req. More...
 
struct  zb_secur_ic_remove_req_s
 Request for zb_secur_ic_remove_req. More...
 
struct  zb_secur_ic_remove_resp_s
 Response for zb_secur_ic_remove_req. More...
 
struct  zb_secur_ic_remove_all_req_s
 Request for zb_secur_ic_remove_all_req. More...
 
struct  zb_secur_ic_remove_all_resp_s
 Response for zb_secur_ic_remove_all_req. More...
 
struct  zb_nvram_failure_report_s
 Structure that contains report about any NVRAM failure. Pointer to this structure will be set as additional info in error_app_handler with error code ERROR_CODE(ERROR_CATEGORY_NVRAM, ZB_ERROR_NVRAM_WRITE_VALIDATION_FAILURE). Upon receiving of this error, user can decide what to do: More...
 

Macros

#define ZB_INIT(trace_comment)
 
#define ZB_JOINED()   zb_zdo_joined()
 
#define ZB_TLV_KEY_ECDHE_METHOD_ENABLE(var, method)   ((var) |= (1u << (method)))
 
#define ZB_TLV_PSK_SECRET_ENABLE(var, secret)   ZB_TLV_KEY_ECDHE_METHOD_ENABLE((var), (secret))
 
#define zb_set_supported_key_neg_method   zb_set_supported_key_neg_mthd
 
#define zb_set_supported_key_neg_method_direct   zb_set_supported_key_neg_mthd_direct
 
#define zb_get_supported_key_neg_method   zb_get_supported_key_neg_mtd
 
#define zb_get_supported_key_neg_method_direct   zb_get_supported_key_neg_mtd_direct
 
#define ZB_NVRAM_DATA_SET_TYPE_PAGE_HDR_R22   30u
 
#define ZB_NVRAM_APP_DATASET_NUMBER   4U
 
#define ZB_SCHED_SLEEP_THRESHOLD_MS   20U
 
#define ZB_MAXIMUM_SLEEP_THRESHOLD_MS   86400000U
 
IC types

/* Set passcode for joiner */
zb_secur_ic_set(ZB_IC_TYPE_PASSCODE, g_r23_zed_passcode);
#define ZB_IC_TYPE_48   0U
 
#define ZB_IC_TYPE_64   1U
 
#define ZB_IC_TYPE_96   2U
 
#define ZB_IC_TYPE_128   3U
 
#define ZB_IC_TYPE_PASSCODE   4U /*<! Not an Installcode indeed, but r23 passcode (4 bytes) - extends to 128bit */
 
#define ZB_IC_TYPE_128_HASHED
 
#define ZB_IC_TYPE_MAX   6U
 
Channel pages' numbers

Note: These values were members of enum zb_channel_page_num_e type but were converted to a set of macros due to MISRA violations.

#define ZB_CHANNEL_PAGE0_2_4_GHZ   0U
 
#define ZB_CHANNEL_PAGE23_SUB_GHZ   23U
 
#define ZB_CHANNEL_PAGE24_SUB_GHZ   24U
 
#define ZB_CHANNEL_PAGE25_SUB_GHZ   25U
 
#define ZB_CHANNEL_PAGE26_SUB_GHZ   26U
 
#define ZB_CHANNEL_PAGE27_SUB_GHZ   27U
 
#define ZB_CHANNEL_PAGE28_SUB_GHZ   28U
 
#define ZB_CHANNEL_PAGE29_SUB_GHZ   29U
 
#define ZB_CHANNEL_PAGE30_SUB_GHZ   30U
 
#define ZB_CHANNEL_PAGE31_SUB_GHZ   31U
 
End Device (ED) timeout request

#define ED_AGING_TIMEOUT_10SEC   0U
 
#define ED_AGING_TIMEOUT_2MIN   1U
 
#define ED_AGING_TIMEOUT_4MIN   2U
 
#define ED_AGING_TIMEOUT_8MIN   3U
 
#define ED_AGING_TIMEOUT_16MIN   4U
 
#define ED_AGING_TIMEOUT_32MIN   5U
 
#define ED_AGING_TIMEOUT_64MIN   6U
 
#define ED_AGING_TIMEOUT_128MIN   7U
 
#define ED_AGING_TIMEOUT_256MIN   8U
 
#define ED_AGING_TIMEOUT_512MIN   9U
 
#define ED_AGING_TIMEOUT_1024MIN   10U
 
#define ED_AGING_TIMEOUT_2048MIN   11U
 
#define ED_AGING_TIMEOUT_4096MIN   12U
 
#define ED_AGING_TIMEOUT_8192MIN   13U
 
#define ED_AGING_TIMEOUT_16384MIN   14U
 
ZC/ZR supported keepalive methods

#define ED_KEEPALIVE_DISABLED   0U
 
#define MAC_DATA_POLL_KEEPALIVE   1U
 
#define ED_TIMEOUT_REQUEST_KEEPALIVE   2U
 
#define BOTH_KEEPALIVE_METHODS   3U
 

Typedefs

typedef zb_uint8_t zb_ic_types_t
 Type for IC types. More...
 
typedef void(* zb_secur_ic_add_cb_t) (zb_ret_t status)
 
typedef struct zb_secur_ic_get_list_req_s zb_secur_ic_get_list_req_t
 Request for zb_secur_ic_get_list_req. More...
 
typedef struct zb_secur_ic_get_list_resp_s zb_secur_ic_get_list_resp_t
 Response for zb_secur_ic_get_list_req. More...
 
typedef struct zb_secur_ic_entry_s zb_secur_ic_entry_t
 IC entry type zb_secur_ic_get_list_req. More...
 
typedef struct zb_secur_ic_get_by_idx_req_s zb_secur_ic_get_by_idx_req_t
 Request for zb_secur_ic_get_by_idx_req. More...
 
typedef struct zb_secur_ic_get_by_idx_resp_s zb_secur_ic_get_by_idx_resp_t
 Response for zb_secur_ic_get_by_idx_req. More...
 
typedef struct zb_secur_ic_remove_req_s zb_secur_ic_remove_req_t
 Request for zb_secur_ic_remove_req. More...
 
typedef struct zb_secur_ic_remove_resp_s zb_secur_ic_remove_resp_t
 Response for zb_secur_ic_remove_req. More...
 
typedef struct zb_secur_ic_remove_all_req_s zb_secur_ic_remove_all_req_t
 Request for zb_secur_ic_remove_all_req. More...
 
typedef struct zb_secur_ic_remove_all_resp_s zb_secur_ic_remove_all_resp_t
 Response for zb_secur_ic_remove_all_req. More...
 
typedef void(* zb_set_manufacturer_code_cb_t) (zb_ret_t status)
 
typedef zb_uint8_t nwk_requested_timeout_t
 Type for End Device (ED) timeout request. More...
 
typedef zb_uint8_t nwk_keepalive_supported_method_t
 Type for ZC/ZR supported keepalive methods. More...
 
typedef zb_bool_t(* zb_signal_handler_t) (zb_uint8_t param)
 ZBOSS signal handler function. More...
 
typedef enum zb_nvram_dataset_types_e zb_nvram_dataset_types_t
 
typedef struct zb_nvram_failure_report_s zb_nvram_failure_report_t
 Structure that contains report about any NVRAM failure. Pointer to this structure will be set as additional info in error_app_handler with error code ERROR_CODE(ERROR_CATEGORY_NVRAM, ZB_ERROR_NVRAM_WRITE_VALIDATION_FAILURE). Upon receiving of this error, user can decide what to do: More...
 
typedef void(* zb_nvram_read_app_data_t) (zb_uint8_t page, zb_uint32_t pos, zb_uint16_t payload_length)
 
typedef zb_ret_t(* zb_nvram_write_app_data_t) (zb_uint8_t page, zb_uint32_t pos)
 
typedef zb_uint16_t(* zb_nvram_get_app_data_size_t) (void)
 

Enumerations

enum  zb_nvram_dataset_types_e {
  ZB_NVRAM_RESERVED = 0, ZB_NVRAM_COMMON_DATA = 1, ZB_NVRAM_HA_DATA = 2, ZB_NVRAM_ZCL_REPORTING_DATA = 3,
  ZB_NVRAM_APS_SECURE_DATA_GAP = 4, ZB_NVRAM_APS_BINDING_DATA_GAP = 5, ZB_NVRAM_HA_POLL_CONTROL_DATA = 6, ZB_NVRAM_APS_SECURE_DATA = 7,
  ZB_NVRAM_DATASET_GRPW_DATA = 8, ZB_NVRAM_APP_DATA1 = 9, ZB_NVRAM_APP_DATA2 = 10, ZB_NVRAM_ADDR_MAP = 11,
  ZB_NVRAM_NEIGHBOUR_TBL = 12, ZB_NVRAM_INSTALLCODES = 13, ZB_NVRAM_IB_COUNTERS = 14, ZB_NVRAM_APS_BINDING_DATA = 15,
  ZB_NVRAM_DATASET_GP_PRPOXYT = 16, ZB_NVRAM_DATASET_GP_SINKT = 17, ZB_NVRAM_DATASET_GP_CLUSTER = 18, ZB_NVRAM_APS_GROUPS_DATA = 19,
  ZB_NVRAM_DATASET_SE_CERTDB = 20, ZB_NVRAM_ZCL_WWAH_DATA = 21, ZB_NVRAM_DATASET_GP_APP_TBL = 22, ZB_NVRAM_APP_DATA3 = 27,
  ZB_NVRAM_APP_DATA4 = 28, ZB_NVRAM_KE_WHITELIST = 29, ZB_NVRAM_DATASET_ZB_DIRECT = 30, ZB_NVRAM_ZDO_DIAGNOSTICS_DATA = 31,
  ZB_NVRAM_DATASET_NUMBER, ZB_NVRAM_DATA_SET_TYPE_PAGE_HDR = 0xFFFFU
}
 

Functions

void zb_secur_setup_nwk_key (zb_uint8_t *key, zb_uint8_t i)
 Setup NWK key from the application level manually. More...
 
void zb_secur_nwk_key_switch_procedure (zb_uint8_t param)
 
void zb_secur_set_tc_rejoin_enabled (zb_bool_t enable)
 
void zb_secur_set_ignore_tc_rejoin (zb_bool_t enable)
 
void zb_secur_set_unsecure_tc_rejoin_enabled (zb_bool_t enable)
 
void zb_secur_ic_add (const zb_ieee_addr_t address, zb_uint8_t ic_type, zb_uint8_t const *ic, zb_secur_ic_add_cb_t cb)
 Add install code for the device with specified long address. More...
 
zb_ret_t zb_secur_ic_set (zb_uint8_t ic_type, const zb_uint8_t *ic)
 Set install code for the device. More...
 
void zb_secur_ic_get_list_req (zb_uint8_t param)
 Get list of the install codes. It is valid only for the TC (ZC). More...
 
void zb_secur_ic_get_by_idx_req (zb_uint8_t param)
 Get the install code by index. It is valid only for the TC (ZC). More...
 
void zb_secur_ic_remove_req (zb_uint8_t param)
 Remove the install code for the device with specified long address. It is valid only for the TC (ZC). More...
 
void zb_secur_ic_remove_all_req (zb_uint8_t param)
 
zb_ret_t zb_secur_ic_str_set (char *ic_str)
 Set install code for the device from character string. More...
 
void zb_secur_ic_str_add (zb_ieee_addr_t address, char *ic_str, zb_secur_ic_add_cb_t cb)
 Add install code for the device from character string. More...
 
void zb_set_installcode_policy (zb_bool_t allow_ic_only)
 
void zb_set_channel_mask (zb_uint32_t channel_mask)
 
void zb_set_rx_on_when_idle (zb_bool_t rx_on)
 
zb_bool_t zb_get_rx_on_when_idle (void)
 
zb_ret_t zboss_start (void)
 ZBOSS start function. More...
 
const zb_char_tzb_get_version (void)
 Get ZBOSS version. More...
 
zb_uint32_t zboss_version_get (void)
 Get ZBOSS numeric version. More...
 
zb_ret_t zboss_start_no_autostart (void)
 
void zboss_start_continue (void)
 
void zboss_main_loop (void)
 
void zboss_main_loop_iteration (void)
 
void zb_set_long_address (const zb_ieee_addr_t addr)
 
void zb_set_pan_id (zb_uint16_t pan_id)
 Set 16-bit PAN ID. More...
 
void zb_set_node_descriptor_manufacturer_code_req (zb_uint16_t manuf_code, zb_set_manufacturer_code_cb_t cb)
 
void zb_set_extended_pan_id (const zb_ext_pan_id_t ext_pan_id)
 
void zb_get_long_address (zb_ieee_addr_t addr)
 
zb_uint16_t zb_get_pan_id (void)
 
zb_uint16_t zb_get_short_address (void)
 
void zb_get_extended_pan_id (zb_ext_pan_id_t ext_pan_id)
 
zb_uint8_t zb_get_current_page (void)
 
zb_uint8_t zb_get_current_channel (void)
 
void zb_set_network_coordinator_role (zb_uint32_t channel_mask)
 
void zb_set_network_router_role (zb_uint32_t channel_mask)
 
void zb_set_network_ed_role (zb_uint32_t channel_mask)
 
void zb_set_network_coordinator_role_legacy (zb_uint32_t channel_mask)
 
void zb_set_network_router_role_legacy (zb_uint32_t channel_mask)
 
void zb_set_network_ed_role_legacy (zb_uint32_t channel_mask)
 
void zb_set_network_coordinator_role_ext (zb_channel_list_t channel_list)
 
void zb_set_network_router_role_ext (zb_channel_list_t channel_list)
 
void zb_set_network_ed_role_ext (zb_channel_list_t channel_list)
 
zb_nwk_device_type_t zb_get_network_role (void)
 
zb_uint8_t zb_get_max_children (void)
 
void zb_channel_list_init (zb_channel_list_t channel_list)
 
zb_ret_t zb_channel_list_add (zb_channel_list_t channel_list, zb_uint8_t page_num, zb_uint32_t channel_mask)
 
void zb_set_max_children (zb_uint8_t max_children)
 
void zb_set_supported_key_neg_mthd (zb_uint8_t methods_mask)
 
void zb_enable_key_neg_method (zb_uint8_t method)
 
void zb_disable_key_neg_method (zb_uint8_t method)
 
void zb_set_supported_psk_secrets (zb_uint8_t secret_mask)
 
void zb_set_supported_key_neg_mthd_direct (zb_uint16_t methods_mask)
 
void zb_set_supported_psk_secrets_direct (zb_uint8_t secret_mask)
 
void zb_enable_psk_secret (zb_uint8_t secret)
 
void zb_disable_psk_secret (zb_uint8_t secret)
 
zb_uint8_t zb_get_supported_key_neg_mtd (void)
 
zb_uint8_t zb_get_supported_psk_secrets (void)
 
zb_uint16_t zb_get_supported_key_neg_mtd_direct (void)
 
zb_uint8_t zb_get_supported_psk_secrets_direct (void)
 
void zb_set_aps_enc_for_zdo_conf_cmd (zb_bool_t val)
 
void zb_set_aps_enc_for_zdo_in_distrib_nwk (zb_bool_t val)
 
void zb_set_ed_timeout (zb_uint_t to)
 
void zb_set_keepalive_timeout (zb_uint_t to)
 
void zb_set_keepalive_mode (nwk_keepalive_supported_method_t mode)
 
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...
 
void zb_nvram_register_app1_read_cb (zb_nvram_read_app_data_t cb)
 
void zb_nvram_register_app2_read_cb (zb_nvram_read_app_data_t cb)
 
void zb_nvram_register_app3_read_cb (zb_nvram_read_app_data_t cb)
 
void zb_nvram_register_app4_read_cb (zb_nvram_read_app_data_t cb)
 
void zb_nvram_register_app1_write_cb (zb_nvram_write_app_data_t wcb, zb_nvram_get_app_data_size_t gcb)
 
void zb_nvram_register_app2_write_cb (zb_nvram_write_app_data_t wcb, zb_nvram_get_app_data_size_t gcb)
 
void zb_nvram_register_app3_write_cb (zb_nvram_write_app_data_t wcb, zb_nvram_get_app_data_size_t gcb)
 
void zb_nvram_register_app4_write_cb (zb_nvram_write_app_data_t wcb, zb_nvram_get_app_data_size_t gcb)
 
zb_ret_t zb_nvram_write_dataset (zb_nvram_dataset_types_t t)
 
void zb_nvram_erase (void)
 
void zb_set_nvram_erase_at_start (zb_bool_t erase)
 
void zb_nvram_transaction_start (void)
 
void zb_nvram_transaction_commit (void)
 
zb_ret_t zb_nvram_read_data (zb_uint8_t page, zb_uint32_t pos, zb_uint8_t *buf, zb_uint16_t len)
 
zb_ret_t zb_nvram_write_data (zb_uint8_t page, zb_uint32_t pos, zb_uint8_t *buf, zb_uint16_t len)
 
zb_ret_t zb_sleep_set_threshold (zb_uint32_t threshold_ms)
 
zb_uint32_t zb_get_sleep_threshold (void)
 
void zb_sleep_now (void)
 
void zb_tc_set_use_installcode (zb_uint8_t use_ic)
 
void zb_permit_control4_network (void)
 
zb_bool_t zb_control4_network_permitted (void)
 
void zb_set_mac_transaction_persistence_time (zb_uint16_t ms)
 Set the 'macTransactionPersistenceTime' attribute in the MAC PIB. More...
 
void zb_compatibility_workaround_enabled (zb_bool_t val)
 

The Key Negotiation Protocols Bitmask Table I.5.1-4-54

The Key Negotiation Protocols Bitmask Table I.5.1-4-54 (merged with Zigbee Direct 6.5.2.1. Zigbee Direct Key Negotiation Method TLV)

/* The application can also change key negotiation methods and PSK secrets.
* For example, we disable ZB_TLV_KEY_ECDHE_KEY_REQUEST_ZB_30.
* It means that ZC will not accept r23+ devices without DLK support */
/* That call is just for a demo here. That method is already enabled by
* zboss_use_r23_behavior() call. */

Note: These values were members of zb_tlv_key_negotiation_methods_t enum zb_tlv_key_negotiation_methods_e type but were converted to a set of macros due to MISRA violations.

#define ZB_TLV_KEY_ECDHE_KEY_REQUEST_ZB_30   0x00U /*<! Static Key Update Request */
 
#define ZB_TLV_DIRECT_KEY_ECDHE_RESERVED_MIN   0x00U /*<! 0 is reserved in zigbee direct */
 
#define ZB_TLV_KEY_ECDHE_CURVE_25519_HASH_AESMMO128   0x01U /*<! DLK with curve 25519 and hash AESMMO128 */
 
#define ZB_TLV_KEY_ECDHE_CURVE_25519_HASH_SHA256   0x02U /*<! DLK with curve 25519 and hash SHA256 */
 
#define ZB_TLV_KEY_ECDHE_RESERVED_MAX   0x03U /*<! 3-15 is reserved in r23 */
 
#define ZB_TLV_KEY_ECDHE_CURVE_P256_HASH_SHA256   0x03U /*<! ZB Direct only: curve P256, hash SHA256 */
 
#define ZB_TLV_DIRECT_KEY_ECDHE_RESERVED_MAX   0x04U /*<! reserved value for Direct */
 
typedef zb_uint8_t zb_tlv_key_negotiation_methods_t
 

bitmask for support_secrets, value for selected secret

/* Rewrite supported PSK secrets bit mask. Just to demonstrate the API */
{
zb_uint8_t supported_secrets_mask = 0;
zb_set_supported_psk_secrets(supported_secrets_mask);
}

Note: These values were members of zb_tlv_psk_secrets_t enum zb_tlv_psk_secrets_e type but were converted to a set of macros due to MISRA violations.

#define ZB_TLV_PSK_SECRET_AUTH_TOKEN   0x00U
 
#define ZB_TLV_PSK_SECRET_INSTALL_CODE   0x01U
 
#define ZB_TLV_PSK_SECRET_PAKE_PASSCODE   0x02U
 
#define ZB_TLV_PSK_SECRET_BASIC_ACCESS_KEY   0x03U
 
#define ZB_TLV_PSK_SECRET_ADMINISTRATIVE_ACCESS_KEY   0x04U
 
#define ZB_TLV_PSK_SECRET_RESERVED_MAX   0x05U /* 6-7 is reserved */
 
#define ZB_TLV_PSK_SECRET_WELL_KNOWN_KEY   0xFFU
 
typedef zb_uint8_t zb_tlv_psk_secrets_t
 

Function Documentation

§ zb_compatibility_workaround_enabled()

void zb_compatibility_workaround_enabled ( zb_bool_t  val)

Device will avoid TLVs in ZDO frames to ZC until it is sure that the coordinator has r23+ revision. The reason is that some legacy devices drop frames with TLVs instead of ignoring TLVs.

Note
Disabled by default. Warning, enabling this function may violate the specification.

§ zb_control4_network_permitted()

zb_bool_t zb_control4_network_permitted ( void  )

Return if joining Control4 Network is allowed

§ zb_permit_control4_network()

void zb_permit_control4_network ( void  )

Permit joining Control4 Network

§ zb_set_mac_transaction_persistence_time()

void zb_set_mac_transaction_persistence_time ( zb_uint16_t  ms)

Set the 'macTransactionPersistenceTime' attribute in the MAC PIB.

Parameters
ms- value in milliseconds

§ zb_tc_set_use_installcode()

void zb_tc_set_use_installcode ( zb_uint8_t  use_ic)

Set using of install codes by TC

Parameters
use_ic- enable/disable install code usage