14.2.3.1.5 BDB Generic
Generic functions
This set of functions are generic functions which will set or get the bdb device properties
1. Setting the channel mask for either bdbPrimaryChannelSet or bdbSecondaryChannelSet attribute can be done by using the following public API
void BDB_SetChannelMask(BDB_ChannelMaskType_t type, uint32_t channelMask);
Parameters:
- type - type of channel mask primary/secondary
- channelMask - value of channel mask
2. Following public API is used to get the either bdbPrimaryChannelSet or bdbSecondaryChannelSet attribute.
uint32_t BDB_GetChannelMask(BDB_ChannelMaskType_t type);
Parameters:
- type - type of channel mask primary/secondary
Returns:
The value of the channel mask based on the type passed
3. Setting the TCLK for BDB attribute can be done by using the following public API. This API is applicable for the router and enddevice. The bdbTCLinkKeyExchangeMethod attribute specifies the method used to establish a new link key after joining the network and can be set to one of the non-reserved values.
void BDB_SetTCLKExchangeMethod(uint8_t exchangeMethod);
Parameters:
- exchangeMethod - type of the TCLK exchange method.TC_LINKKEY_EXCHANGE_METHOD_APS_REQ_KEY(0x00) or TC_LINKKEY_EXCHANGE_METHOD_CBKE(0x01-unsupported)
4. Setting the number of key establishment attempts that can be made to establish a new link key after joining, can be done by using the following public API.
void BDB_SetTCLKRetryMaxAttempts(uint8_t attempts);
Parameters:
- Attempts - number of max retry attempts
5. Following public API is used to get the bdbNodeCommissioningCapability attribute, which defines the capabilities supported by the device like network formation, finding and binding, touchlink commission etc.
BDB_NodeCommissioningCapability_t BDB_GetCommissioningCapability(void);
Parameters:
- None
6. Following public API is used to set bdbJoinUsesInstallCodeKey attribute, to configure whether it has to block/allow the devices which is matching with the default installation code with the trust center.
void BDB_SetInstallCodeUsage (bool useInstallCode);
Parameters:
- useInstallCode - true or false
7. Following public API is used to set the bdbTrustCenterNodeJoinTimeout in seconds for the Trust Center to remove the Trust Center link key of the newly joined node that did not successfully establish a new link key.
void BDB_SetNodeJoinTimeout (uint8_t timeOutInSec);
Parameters:
- timeOutInSec - timeout in seconds
8. Following API is used to set the BDB IB attribute bdbTrustCenterRequireKeyExchange which specifies whether the Trust Center requires a joining device to exchange its initial link key with a new link key generated by the Trust Center
void BDB_SetTCRequireKeyExchange (bool requireKeyExchange);
Parameters:
- requireKeyExchange - true or false
9. Following API is used to set whether BDB should support touch link role or not
void BDB_SetToulinkRole(bool initiator);
Parameters:
- initiator - true or target - false
10. Following API is used to get the bdbNodeIsOnANetwork attribute, to know whether it is in a network or not. It will return true if it is there in network, false otherwise
bool BDB_GetBdbNodeIsOnANetwork(void);
Parameters:
- None
11. Following API is used to set the bdbNodeIsOnANetwork attribute, based on whether it is in a network or not.
void BDB_SetBdbNodeIsOnANetwork(bool onNetwork);
Parameters:
- onNetwork - true for on network, false otherwise
12. Following API sets the flag for touch link to do reset to factory new if allow is true.
void BDB_SetAllowTLResetToFN(bool allow);
Parameters:
- allow - true or false
13. Reset of the BDB component Information base/attributes to default values if the device is not in a network, by using the following public API
void BDB_ResetIB(void);
Parameters:
- None
14. Following API is used to subscribe for the events from BDB module and their callback handlers from the application.
void BDB_EventsSubscribe(const BdbEventSubscriber_t *subscriber);
Parameters:
- BdbEventSubscriber_t - It is a structure of function handlers for the events subscribed
For example, the event subscriber structure shall be filled as below and passed to the BDB_EventsSubscribe API
BdbEventSubscriber_t s_BDB_EventsCallback = { .connected = Connected, .disconnected = Disconnected, .identifyStartIndication = IdentifyStartIndication, .identifyStopIndication = IdentifyStopIndication, .updateNetworkIndication = UpdateNetworkIndication, .queryingCompleted = QeryingCompleted, .joinNetworkIndication = JoinNetworkIndication, .SteeringNetwork = NULL, .tclkProcedureOngoing = NULL, .tclkProcedureCompleted = NULL, .addingBindingLinks = NULL, .scanIndication = NULL, .touchlinkCompleted = TouchlinkCompleted, .networkFormationCompleted = NetworkFormationCompleted, .SteeringCompleted = NetworkSteeringCompleted, .findingBindingCompleted = FindingBindingCompleted, .ResetToFactoryDefaults = ResetToFactoryDefaults, .querying = Querying, .scanning = Scanning, .identifying = Identifying, .joining = Joining, .findingBindingInitiatorModeCompleted = FindingBindingInitiatorModeCompleted, }; // Subscribing to different bdb events with specified callbacks BDB_EventsSubscribe(&s_BDB_EventsCallback);