Developing with ZBOSS for Zigbee

Macros

#define ZB_TCLK_UPDATED_SIGNAL   55U
 
#define ZB_SIGNAL_JOIN_DONE   56U
 
#define ZB_BUFFER_TEST_REQ_SIGNAL   57U
 
#define ZB_BDB_SIGNAL_TC_REJOIN_DONE   58U
 
#define ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS   59U
 
#define ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED   60U
 
#define ZB_BDB_SIGNAL_STEERING_CANCELLED   61U
 
#define ZB_BDB_SIGNAL_FORMATION_CANCELLED   62U
 
#define ZB_SIGNAL_READY_TO_SHUT   63U
 
#define ZB_SIGNAL_INTERPAN_PREINIT   64U
 
#define ZB_ZGP_SIGNAL_MODE_CHANGE   65U
 
#define ZB_ZDO_DEVICE_UNAVAILABLE   66U
 
#define ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING   67U
 
#define ZB_DEBUG_SIGNAL_TCLK_READY   68U
 

Signals passed to application signal handler

Note
If an application requires the parameters to be passed to the zboss_signal_handler, it is recommended to introduce the structure according to the pattern below:
typedef struct zb_zdo_app_my_custom_signal_s
{
zb_my_custom_data_type_t my_custom_data;
}
#define ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL   53U
 
#define ZB_TC_SWAPPED_SIGNAL   54U
 

Detailed Description

Macro Definition Documentation

◆ ZB_BDB_SIGNAL_FORMATION_CANCELLED

#define ZB_BDB_SIGNAL_FORMATION_CANCELLED   62U

BDB formation cancel request processed

When generated:

Status codes:

  • RET_INVALID_STATE: formation is not in progress
  • RET_PENDING: it is too late to cancel a formation, it will be completed soon
  • RET_IGNORE: cancellation was already requested
  • RET_OK: formation is cancelled successfully

Signal parameters:

  • none

◆ ZB_BDB_SIGNAL_STEERING_CANCELLED

#define ZB_BDB_SIGNAL_STEERING_CANCELLED   61U

BDB steering cancel request processed

When generated:

  • after the cancel request called with bdb_cancel_steering() is processed

Status codes:

  • RET_ILLEGAL_REQUEST: device is a ZC
  • RET_INVALID_STATE: steering for a node not a network is not in progress
  • RET_PENDING: it is too late to cancel a steering, it will be completed soon
  • RET_IGNORE: cancellation was already requested
  • RET_OK: steering is cancelled successfully

Signal parameters:

  • none

◆ ZB_BDB_SIGNAL_TC_REJOIN_DONE

#define ZB_BDB_SIGNAL_TC_REJOIN_DONE   58U

TC rejoin is completed

When generated:

  • Device completes TC rejoin procedure.

Status codes:

  • RET_OK: TC rejoin completed successful
  • RET_ERROR: An error of any type.

Signal parameters:

  • none
TRACE_MSG(TRACE_APP1, "TC rejoin failed, so try it again with interval", (FMT__0));
break; /* ZB_BDB_SIGNAL_TC_REJOIN_DONE */

◆ ZB_BUFFER_TEST_REQ_SIGNAL

#define ZB_BUFFER_TEST_REQ_SIGNAL   57U

Test Profile 2 Buffer Test Req received. To be used in certification tests .

Parameters
zb_buffer_test_response_t

◆ ZB_DEBUG_SIGNAL_TCLK_READY

#define ZB_DEBUG_SIGNAL_TCLK_READY   68U

When generated: Unverified aps key created, and verify_key_req has been sent or received.

Status codes:

  • RET_OK.

This signal uses during debugging to broadcast aps key by calling zb_debug_broadcast_aps_key().

Signal parameters:

◆ ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS

#define ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS   59U

Notifies the Zigbee Trust center or router application about permit join status changed.

When generated:
  • Network was just open
  • Network was just closed
Status codes:
  • RET_OK: Device information updated.
  • Does not return error status.
Signal parameters:
Signal handling:
{
zb_uint8_t *permit_duration = ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, zb_uint8_t);
TRACE_MSG(TRACE_APP1, "Permit Join Received. Duration: %hd", (FMT__D, (*permit_duration)));
break; /* ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS */
}
Signal generation:

◆ ZB_SIGNAL_INTERPAN_PREINIT

#define ZB_SIGNAL_INTERPAN_PREINIT   64U

ZBOSS interpan preinit done signal

When generated:

  • after ZBOSS preinit enough to send interpan initiated by zboss_preinit_for_interpan() is done

After receiving that signal application can use zb_intrp_data_request_with_chan_change() API

Signal parameters:

  • none

◆ ZB_SIGNAL_JOIN_DONE

#define ZB_SIGNAL_JOIN_DONE   56U

Signal indicating that device just joined/rejoined, but not authorized yet

To be used mainly for certification testing, when run-time visibility setting is required

if (status == 0)
{
TRACE_MSG(TRACE_APP1, "Joined/rejoined ok", (FMT__0));
}
break;

◆ ZB_SIGNAL_READY_TO_SHUT

#define ZB_SIGNAL_READY_TO_SHUT   63U

ZBOSS is ready to shutdown signal

When generated:

  • after ZBOSS preparations to shutdown initiated by zboss_start_shut() is done

After receiving that signal application MUST complete ZBOSS shutdown by calling zboss_complete_shut(). It is impossible to continue ZBOSS work without a restart after calling zboss_start_shut().

Signal parameters:

  • none

◆ ZB_TC_SWAPPED_SIGNAL

#define ZB_TC_SWAPPED_SIGNAL   54U

TC is swapped (signal at Joiner)

{
TRACE_MSG(TRACE_APP1, "ZB_TC_SWAPPED_SIGNAL, status %hd", (FMT__H, status));
s_tc_swapped = ZB_TRUE;
}
break;

◆ ZB_TCLK_UPDATED_SIGNAL

#define ZB_TCLK_UPDATED_SIGNAL   55U

TCLK update completed (signal at Joiner)

{
TRACE_MSG(TRACE_APP1, "ZB_TCLK_UPDATED_SIGNAL, status %hd", (FMT__H, status));
if (s_tc_swapped)
{
TRACE_MSG(TRACE_APP1, "TCLK updated after TC swap", (FMT__0));
}
break;
}

◆ ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL

#define ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL   53U

it is time to backup TC database (signal at TC)

TRACE_MSG(TRACE_APP1, "Signal ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL, status %d", (FMT__D, status));
app_backup_tc_db();
break;
static void app_backup_tc_db(void)
{
zb_uint_t portion_len;
zb_uint_t nvram_buf_pos = 0U;
zb_ret_t ret = zb_tcsw_start_backup_db();
TRACE_MSG(TRACE_APP1, "app_backup_tc_db, ret %x, need_backup %hd",
(FMT__D_H, ret, zb_tcsw_need_backup()));
do
{
portion_len = zb_tcsw_get_portion((zb_uint8_t*)g_nvram_buf + nvram_buf_pos, TCSW_PORTION_SIZE);
nvram_buf_pos += portion_len;
}
while (portion_len != 0);
}

◆ ZB_ZDO_DEVICE_UNAVAILABLE

#define ZB_ZDO_DEVICE_UNAVAILABLE   66U

Notifies an application a device unavailable.

When generated:

  • ZBOSS could not send a packet over NWK, for example: there is no ACK on the MAC layer; there is no response to a network address request;
  • ZBOSS could not send a packet over APS, for example: there is no APS-ACK to an APS packet.

Signal parameters:

◆ ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED

#define ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED   60U

Notifies the TC that Device Interview was finished

Status codes:

  • RET_OK: DDevice interview finished succeed
  • RET_ERROR: Device interview failed and the device was removed.

Signal parameters:

/* Switch ON device interview. Now ZC app receives
* ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW signal and must explicitly finish
* the interview by calling zb_tc_auth_device_after_interview() */
/* Initiate the stack start with starting the commissioning */
{
TRACE_MSG(TRACE_ERROR, "ERROR zboss_start failed", (FMT__0));
}
else
{
/* Call the main loop */
}
{
TRACE_MSG(TRACE_APP1, "ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW, short_addr 0x%x, ieee_addr " TRACE_FORMAT_64,
(FMT__D_A, dev_interview_params->short_addr, TRACE_ARG_64(dev_interview_params->long_addr)));
if (ZB_IEEE_ADDR_CMP(dev_interview_params->long_addr, g_r23_zed_ieee_addr))
{
TRACE_MSG(TRACE_APP1, "Start device interview for 0x%x", (FMT__D, dev_interview_params->short_addr));
app_start_device_interview(param, dev_interview_params->short_addr);
param = ZB_UNDEFINED_BUFFER;
}
else
{
TRACE_MSG(TRACE_APP1, "Authenticate device 0x%x without interview", (FMT__D, dev_interview_params->short_addr));
param = ZB_UNDEFINED_BUFFER;
}
break;
} /* ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW */
{
TRACE_MSG(TRACE_APP1, "ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED, status %hd", (FMT__H, status));
break;
} /* ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED */
/* To continue the device interview, the TC can send another requests.
* To close the device interview and reject the device do nothing - after apsSecurityTimeOutPeriod (10s by default)
* the device will be removed automatically.
* To close the device interview and authorize the device call zb_tc_auth_device_after_interview() .
*/
if (resp->hdr.status == ZB_ZDP_STATUS_SUCCESS)
{
zb_ieee_addr_t ieee_addr;
if (RET_OK == zb_address_ieee_by_short(resp->hdr.nwk_addr, ieee_addr))
{
{
TRACE_MSG(TRACE_APP1, "device authorized " TRACE_FORMAT_64, (FMT__A, TRACE_ARG_64(ieee_addr)));
}
}
}

◆ ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING

#define ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING   67U

ZGP Approve Commissioning signal.

When generated:

  • ZGP subsystem is ready to create new pairing but APP should check if GPD application functionality matches to continue pairing.

Status codes:

  • RET_OK.

After receiving that signal application SHALL decide whether to connect GP device or not. After that, application SHALL send acceptance status by calling zb_zgps_accept_commissioning(). It is impossible to continue GP commissioning operation without a calling zb_zgps_accept_commissioning(), and the sink will exit commissioning mode after commissioning timeout expired.

Signal parameters:

{
TRACE_MSG(TRACE_APP1, "ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING", (FMT__0));
accept_comm_cb(app_comm_params->params);
}
break;

◆ ZB_ZGP_SIGNAL_MODE_CHANGE

#define ZB_ZGP_SIGNAL_MODE_CHANGE   65U

ZGP Mode change signal.

When generated:

  • GPCB Sink change mode between operational mode and commissioning mode.

Status codes:

  • RET_OK: mode changed.
    • Does not return error status.

Signal parameters:

{
mode_change_cb(signal_params->new_mode, signal_params->reason);
}
break;
ZB_NVRAM_APP_DATA1
@ ZB_NVRAM_APP_DATA1
Definition: zboss_api.h:1424
ZB_TCLK_UPDATED_SIGNAL
#define ZB_TCLK_UPDATED_SIGNAL
Definition: zboss_api_zdo.h:871
zb_uint_t
unsigned int zb_uint_t
Unsigned int (at least 2 bytes).
Definition: zb_types.h:325
zb_zdo_mgmt_permit_joining_req_param_s::dest_addr
zb_uint16_t dest_addr
Definition: zboss_api_zdo.h:3169
zb_uint8_t
unsigned char zb_uint8_t
Project-local 1-byte unsigned int type.
Definition: zb_types.h:147
TRACE_MSG
#define TRACE_MSG(lm, fmts, args)
Put trace output.
Definition: zb_trace.h:369
ZB_SIGNAL_JOIN_DONE
#define ZB_SIGNAL_JOIN_DONE
Definition: zboss_api_zdo.h:880
zb_ret_t
zb_int32_t zb_ret_t
Return type for ZB functions returning execution status.
Definition: zb_errors.h:33
zb_buf_get_out_delayed_ext
#define zb_buf_get_out_delayed_ext(callback, arg, max_size)
Allocate OUT buffer, call a callback when the buffer is available.
Definition: zboss_api_buf.h:311
ZB_TC_SWAPPED_SIGNAL
#define ZB_TC_SWAPPED_SIGNAL
Definition: zboss_api_zdo.h:861
zb_zdo_signal_device_ready_for_interview_params_s
Device Ready For Interview signal parameters.
Definition: zboss_api_zdo.h:1377
ZB_ZGP_SIGNAL_MODE_CHANGE
#define ZB_ZGP_SIGNAL_MODE_CHANGE
Definition: zboss_api_zdo.h:1031
zboss_main_loop
void zboss_main_loop(void)
ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING
#define ZB_ZGP_SIGNAL_APPROVE_COMMISSIONING
Definition: zboss_api_zdo.h:1070
ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS
#define ZB_NWK_SIGNAL_PERMIT_JOIN_STATUS
Definition: zboss_api_zdo.h:928
ZB_BUF_GET_PARAM
#define ZB_BUF_GET_PARAM(buf, type)
Definition: zboss_api_buf.h:457
ZB_TRUE
#define ZB_TRUE
Definition: zb_types.h:350
ZB_SCHEDULE_APP_ALARM
#define ZB_SCHEDULE_APP_ALARM(func, param, timeout_bi)
Definition: zboss_api_core.h:370
zb_zdo_signal_device_ready_for_interview_params_s::long_addr
zb_ieee_addr_t long_addr
Definition: zboss_api_zdo.h:1380
ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW
#define ZB_ZDO_SIGNAL_DEVICE_READY_FOR_INTERVIEW
Definition: zboss_api_zdo.h:815
zb_address_ieee_by_short
zb_ret_t zb_address_ieee_by_short(zb_uint16_t short_addr, zb_ieee_addr_t ieee_address)
zb_zdo_app_signal_type_t
zb_uint8_t zb_zdo_app_signal_type_t
Type for signals passed to an application signal handler.
Definition: zboss_api_zdo.h:1094
ZB_ZDP_STATUS_SUCCESS
#define ZB_ZDP_STATUS_SUCCESS
Definition: zboss_api_zdo.h:41
zb_nvram_write_dataset
zb_ret_t zb_nvram_write_dataset(zb_nvram_dataset_types_t t)
ZB_BDB_SIGNAL_TC_REJOIN_DONE
#define ZB_BDB_SIGNAL_TC_REJOIN_DONE
Definition: zboss_api_zdo.h:903
zb_tc_enable_device_interview
void zb_tc_enable_device_interview(zb_bool_t enable)
zb_bdb_initiate_tc_rejoin
void zb_bdb_initiate_tc_rejoin(zb_uint8_t param)
Starts TC rejoin procedure.
ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED
#define ZB_ZDO_SIGNAL_DEVICE_INTERVIEW_FINISHED
Definition: zboss_api_zdo.h:944
zb_ieee_addr_t
zb_64bit_addr_t zb_ieee_addr_t
Long (64-bit) device address.
Definition: zb_types.h:535
zb_zdo_mgmt_permit_joining_req_param_s
Parameters for zb_zdo_mgmt_permit_joining_req.
Definition: zboss_api_zdo.h:3167
zb_zdo_mgmt_permit_joining_req
zb_uint8_t zb_zdo_mgmt_permit_joining_req(zb_uint8_t param, zb_callback_t cb)
sends Mgmt_Permit_Joining_req (See Zigbee spec 2.4.3.3.7)
RET_OK
#define RET_OK
Error codes for non-void stack functions. In general, function can return OK, BLOCKED or some error....
Definition: zb_errors.h:79
zb_zgp_signal_mode_change_params_s::reason
zb_zgp_mode_change_reason_t reason
Definition: zboss_api_zdo.h:1199
ZB_TIME_ONE_SECOND
#define ZB_TIME_ONE_SECOND
Definition: zboss_api_core.h:172
zb_zdo_mgmt_permit_joining_req_param_s::tc_significance
zb_uint8_t tc_significance
Definition: zboss_api_zdo.h:3173
zb_uint16_t
unsigned short zb_uint16_t
Project-local 2-byte unsigned int type.
Definition: zb_types.h:151
zb_zgp_signal_mode_change_params_s
ZGP mode changed parameters.
Definition: zboss_api_zdo.h:1197
ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL
#define ZB_TCSWAP_DB_BACKUP_REQUIRED_SIGNAL
Definition: zboss_api_zdo.h:854
zb_buf_free
#define zb_buf_free(buf)
Free packet buffer and put it into free list.
Definition: zboss_api_buf.h:344
zb_tc_auth_device_after_interview
zb_ret_t zb_tc_auth_device_after_interview(const zb_ieee_addr_t device_addr)
ZB_ZDO_SIGNAL_GET_PARAMS
#define ZB_ZDO_SIGNAL_GET_PARAMS(sg_p, type)
Definition: zboss_api_zdo.h:1109
ZB_NWK_BROADCAST_ROUTER_COORDINATOR
#define ZB_NWK_BROADCAST_ROUTER_COORDINATOR
Definition: zboss_api_nwk.h:86
zb_zgp_signal_approve_comm_params_s
ZGP approve commissioning parameters.
Definition: zboss_api_zdo.h:1187
zb_get_short_address
zb_uint16_t zb_get_short_address(void)
zb_zdo_mgmt_permit_joining_req_param_s::permit_duration
zb_uint8_t permit_duration
Definition: zboss_api_zdo.h:3170
zboss_start_no_autostart
zb_ret_t zboss_start_no_autostart(void)