Initiator Node

Finding and Binding is started on an initiator node by calling the function BDB_eFbTriggerAsInitiator(). This function is called as the result of a user action on the node, such as a button-press. The initiator then remains in Finding and Binding mode for a fixed time-interval (in seconds) defined by the constant BDBC_MIN_COMMISSIONING_TIME. If Finding and Binding does not succeed within this time, the event BDB_EVENT_FB_TIMEOUT is generated and passed into the callback function APP_vBdbCallback().

Once Finding and Binding starts, the initiator node searches for target endpoints by broadcasting an Identify Query command periodically with a period (in seconds) defined through the macro BDB_FB_RESEND_IDENTIFY_QUERY_TIME.

Note: Before each broadcast attempt, the event BDB_EVENT_FB_NO_QUERY_RESPONSE is generated and passed into APP_vBdbCallback(). This event allows the application to exit the current Finding and Binding process (see below).

If the initiator receives an Identify Query response from a remote endpoint, the application must pass the ZCL event BDB_E_ZCL_EVENT_IDENTIFY_QUERY to the Base Device using the function BDB_vZclEventHandler(). This event allows the Base Device to gather information about the identifying device by sending a Simple Descriptor request to the relevant endpoint. If the requested Simple Descriptor is successfully received back, the callback function checks this descriptor for clusters that match those on the initiator. The application is notified of via a BDB_EVENT_FB_HANDLE_SIMPLE_DESC_RESP_OF_TARGET event passed into APP_vBdbCallback().

If there is at least one matching cluster, the initiator does one of the following:

  • If binding is required (indicated by the u16bdbCommissioningGroupID attribute being equal to 0xFFFF), the initiator adds the remote endpoint to the local Binding table (but should first request the IEEE/MAC address of the remote node).

  • If grouping is required (indicated by the u16bdbCommissioningGroupID attribute being equal to a 16-bit group address), the initiator requests that the target endpoint adds the group address to its Group Address table.

The application is notified of a successful binding or grouping via the following events:

  • For a binding:

    • BDB_EVENT_FB_BIND_CREATED_FOR_TARGET for success

    • BDB_EVENT_FB_ERR_BINDING_FAILED for failure

  • For a grouping:

    • BDB_EVENT_FB_GROUP_ADDED_TO_TARGET for success

    • BDB_EVENT_FB_ERR_GROUPING_FAILED for failure

At this point, the application can remotely stop identification mode (and therefore Finding and Binding) on the target node by calling the Identify cluster function eCLD_IdentifyCommandIdentifyRequestSend() to request that the identification mode period is set to zero.

A Finding and Binding process is stopped on the initiator endpoint using the function BDB_vFbExitAsInitiator(). This function is typically called in the callback function APP_vBdbCallback() as the result of a user action, such as a button-press or button-release.

Parent topic:Finding and Binding