Developing with ZBOSS
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_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)
 
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)
{
TRACE_MSG(TRACE_ZCL1, "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)
{
TRACE_MSG(TRACE_ZCL1, "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:

TRACE_MSG(TRACE_APP1, "Device STARTED OK", (FMT__0));
TRACE_MSG(TRACE_APP1, "Successfull 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
Note
: endpoint should be registered on target

Example

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

◆ zb_bdb_finding_binding_target_cancel()

void zb_bdb_finding_binding_target_cancel ( void  )

Cancel previously started finding and binding procedure on target