Developing with ZBOSS for Zigbee
BDB Finding and Binding

Typedefs

typedef enum zb_bdb_comm_binding_cb_state_e zb_bdb_comm_binding_cb_state_t
 
typedef zb_bool_t(* zb_bdb_comm_binding_callback_t) (zb_int16_t status, zb_ieee_addr_t addr, zb_uint8_t ep, zb_uint16_t cluster)
 BDB finding and binding callback template. More...
 

Enumerations

enum  zb_bdb_comm_binding_cb_state_e { ZB_BDB_COMM_BIND_SUCCESS = 0, ZB_BDB_COMM_BIND_FAIL = 1, ZB_BDB_COMM_BIND_ASK_USER = 2 }
 

Functions

zb_ret_t zb_bdb_finding_binding_target (zb_uint8_t endpoint)
 Starts EZ-Mode Finding and binding mechanism at the target's endpoint. More...
 
zb_ret_t zb_bdb_finding_binding_target_ext (zb_uint8_t endpoint, zb_uint16_t commissioning_time_secs)
 Starts EZ-Mode Finding and binding mechanism at the target's endpoint with a given timeout. More...
 
zb_ret_t zb_bdb_finding_binding_initiator (zb_uint8_t endpoint, zb_bdb_comm_binding_callback_t user_binding_cb)
 Start BDB finding and binding procedure on initiator. More...
 
void zb_bdb_finding_binding_target_cancel (void)
 Cancel previously started finding and binding procedure on all target endpoints.
 
void zb_bdb_finding_binding_target_cancel_ep (zb_uint8_t endpoint)
 Cancel previously started finding and binding procedure on particular target endpoint. More...
 
void zb_bdb_finding_binding_initiator_cancel (void)
 

Detailed Description

Typedef Documentation

◆ zb_bdb_comm_binding_callback_t

typedef zb_bool_t( * zb_bdb_comm_binding_callback_t) (zb_int16_t status, zb_ieee_addr_t addr, zb_uint8_t ep, zb_uint16_t cluster)

BDB finding and binding callback template.

Function is used both to interact with user application, get decision if new binding is needed or not, and to report the binding result

Parameters
status- status of the binding (ask user, success or fail)
See also
zb_bdb_comm_binding_cb_state_t
Parameters
addr- extended address of a device to bind
ep- endpoint of a device to bind
cluster- cluster ID to bind
Returns
bool - agree or disagree

Example:

static zb_bool_t finding_binding_cb(zb_int16_t status,
zb_uint16_t cluster)
{
/* Unused without trace. */
ZVUNUSED(status);
ZVUNUSED(addr);
ZVUNUSED(ep);
ZVUNUSED(cluster);
TRACE_MSG(TRACE_APP1, "finding_binding_cb status %d addr " TRACE_FORMAT_64 " ep %hd cluster %d",
(FMT__D_A_H_D, status, TRACE_ARG_64(addr), ep, cluster));
return ZB_TRUE;
}

◆ zb_bdb_comm_binding_cb_state_t

List of EZ-Mode binding callback states

Enumeration Type Documentation

◆ zb_bdb_comm_binding_cb_state_e

List of EZ-Mode binding callback states

Enumerator
ZB_BDB_COMM_BIND_SUCCESS 

Previously user applied bind finished successfully

ZB_BDB_COMM_BIND_FAIL 

Previously user applied bind failed

ZB_BDB_COMM_BIND_ASK_USER 

Ask user whether to perform binding

Function Documentation

◆ zb_bdb_finding_binding_initiator()

zb_ret_t zb_bdb_finding_binding_initiator ( zb_uint8_t  endpoint,
zb_bdb_comm_binding_callback_t  user_binding_cb 
)

Start BDB finding and binding procedure on initiator.

Summary: Finding and binding as initiator zb_bdb_finding_binding_initiator() returns RET_OK if procedure was started successfully, error code otherwise. To report procedure status, user callback is called. It may be called several times with Success status and only once with error status. If any error appears, finding and binding stops.

Parameters
endpoint- initiator endpoint
user_binding_cb- user callback, see zb_bdb_comm_binding_callback_t
Returns
bool - RET_OK or error code

Example:

Define callback:

static zb_bool_t finding_binding_cb(zb_int16_t status,
zb_uint16_t cluster)
{
/* Unused without trace. */
ZVUNUSED(status);
ZVUNUSED(addr);
ZVUNUSED(ep);
ZVUNUSED(cluster);
TRACE_MSG(TRACE_APP1, "finding_binding_cb status %d addr " TRACE_FORMAT_64 " ep %hd cluster %d",
(FMT__D_A_H_D, status, TRACE_ARG_64(addr), ep, cluster));
return ZB_TRUE;
}

Start finding and binding as initiator:

{
device_type = zb_get_device_type();
ZVUNUSED(device_type);
TRACE_MSG(TRACE_APP1, "Device (%hd) STARTED OK", (FMT__D, device_type));
TRACE_MSG(TRACE_APP1, "Successful steering, start f&b initiator", (FMT__0));
zb_bdb_finding_binding_initiator(ZB_SWITCH_ENDPOINT, finding_binding_cb);
break;
}

◆ zb_bdb_finding_binding_initiator_cancel()

void zb_bdb_finding_binding_initiator_cancel ( void  )

Cancel previously started finding and binding procedure on initiator

◆ zb_bdb_finding_binding_target()

zb_ret_t zb_bdb_finding_binding_target ( zb_uint8_t  endpoint)

Starts EZ-Mode Finding and binding mechanism at the target's endpoint.

Put device into identifying mode; default duration is 3 minutes.

Parameters
endpoint- target endpoint
Returns
RET_OK if procedure was successfully started
RET_INVALID_PARAMETER_1 - target endpoint not registered
RET_INVALID_STATE - Finding and Binding already started or device is not joined
Note
: endpoint should be registered on target

Example

TRACE_MSG(TRACE_APP1, "Successful steering, start f&b target", (FMT__0));
zb_bdb_finding_binding_target(ZB_OUTPUT_ENDPOINT);
break;

◆ zb_bdb_finding_binding_target_cancel_ep()

void zb_bdb_finding_binding_target_cancel_ep ( zb_uint8_t  endpoint)

Cancel previously started finding and binding procedure on particular target endpoint.

Parameters
endpoint- target endpoint. The ZB_ZCL_BROADCAST_ENDPOINT(0xFF) value is treated as cancel on all target endpoints

◆ zb_bdb_finding_binding_target_ext()

zb_ret_t zb_bdb_finding_binding_target_ext ( zb_uint8_t  endpoint,
zb_uint16_t  commissioning_time_secs 
)

Starts EZ-Mode Finding and binding mechanism at the target's endpoint with a given timeout.

Parameters
endpoint- target endpoint
commissioning_time_secs- time interval for device to be in identifying mode in seconds. Can't be less than 3 minutes
Returns
RET_OK on success
RET_INVALID_PARAMETER_1 - target endpoint not registered
RET_INVALID_PARAMETER_2 - commissioning_time_secs is less than ZB_BDBC_MIN_COMMISSIONING_TIME_S
RET_INVALID_STATE - Finding and Binding already started or device is not joined
zb_int16_t
signed short zb_int16_t
Project-local 2-byte signed int type.
Definition: zb_types.h:153
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_bool_t
zb_uint8_t zb_bool_t
General purpose boolean type. For C90, 'zb_bool_t' is an alias of 'zb_uint8_t'. For C99,...
Definition: zb_types.h:346
ZB_TRUE
#define ZB_TRUE
Definition: zb_types.h:350
zb_ieee_addr_t
zb_64bit_addr_t zb_ieee_addr_t
Long (64-bit) device address.
Definition: zb_types.h:535
zb_bdb_finding_binding_initiator
zb_ret_t zb_bdb_finding_binding_initiator(zb_uint8_t endpoint, zb_bdb_comm_binding_callback_t user_binding_cb)
Start BDB finding and binding procedure on initiator.
ZB_BDB_SIGNAL_STEERING
#define ZB_BDB_SIGNAL_STEERING
Definition: zboss_api_zdo.h:335
zb_bdb_finding_binding_target
zb_ret_t zb_bdb_finding_binding_target(zb_uint8_t endpoint)
Starts EZ-Mode Finding and binding mechanism at the target's endpoint.
zb_uint16_t
unsigned short zb_uint16_t
Project-local 2-byte unsigned int type.
Definition: zb_types.h:151
zb_nwk_device_type_t
zb_uint8_t zb_nwk_device_type_t
Type for network device type.
Definition: zboss_api_nwk.h:126
ZB_NWK_DEVICE_TYPE_NONE
#define ZB_NWK_DEVICE_TYPE_NONE
Definition: zboss_api_nwk.h:117
zb_get_device_type
zb_nwk_device_type_t zb_get_device_type(void)