nRF5 SDK v17.1.0
Functions

Functions

uint32_t ble_hrs_c_init (ble_hrs_c_t *p_ble_hrs_c, ble_hrs_c_init_t *p_ble_hrs_c_init)
 Function for initializing the Heart Rate Client module. More...
 
void ble_hrs_c_on_ble_evt (ble_evt_t const *p_ble_evt, void *p_context)
 Function for handling BLE events from the SoftDevice. More...
 
uint32_t ble_hrs_c_hrm_notif_enable (ble_hrs_c_t *p_ble_hrs_c)
 Function for requesting the peer to start sending notification of Heart Rate Measurement. More...
 
void ble_hrs_on_db_disc_evt (ble_hrs_c_t *p_ble_hrs_c, const ble_db_discovery_evt_t *p_evt)
 Function for handling events from the Database Discovery module. More...
 
uint32_t ble_hrs_c_handles_assign (ble_hrs_c_t *p_ble_hrs_c, uint16_t conn_handle, const hrs_db_t *p_peer_hrs_handles)
 Function for assigning handles to an instance of hrs_c. More...
 

Detailed Description

Function Documentation

uint32_t ble_hrs_c_handles_assign ( ble_hrs_c_t p_ble_hrs_c,
uint16_t  conn_handle,
const hrs_db_t p_peer_hrs_handles 
)

Function for assigning handles to an instance of hrs_c.

Call this function when a link has been established with a peer to associate the link to this instance of the module. This association makes it possible to handle several links and associate each link to a particular instance of this module. The connection handle and attribute handles are provided from the discovery event BLE_HRS_C_EVT_DISCOVERY_COMPLETE.

Parameters
[in]p_ble_hrs_cPointer to the Heart Rate Client structure instance for associating the link.
[in]conn_handleConnection handle to associate with the given Heart Rate Client Instance.
[in]p_peer_hrs_handlesAttribute handles for the HRS server you want this HRS_C client to interact with.
uint32_t ble_hrs_c_hrm_notif_enable ( ble_hrs_c_t p_ble_hrs_c)

Function for requesting the peer to start sending notification of Heart Rate Measurement.

This function enables notification of the Heart Rate Measurement at the peer by writing to the CCCD of the Heart Rate Measurement characteristic.

Parameters
p_ble_hrs_cPointer to the Heart Rate Client structure.
Return values
NRF_SUCCESSIf the SoftDevice is requested to write to the CCCD of the peer.
err_codeOtherwise, this function propagates the error code returned by the SoftDevice API sd_ble_gattc_write.
uint32_t ble_hrs_c_init ( ble_hrs_c_t p_ble_hrs_c,
ble_hrs_c_init_t p_ble_hrs_c_init 
)

Function for initializing the Heart Rate Client module.

This function registers with the Database Discovery module for the Heart Rate Service. The module looks for the presence of a Heart Rate Service instance at the peer when a discovery is started.

Parameters
[in]p_ble_hrs_cPointer to the Heart Rate Client structure.
[in]p_ble_hrs_c_initPointer to the Heart Rate initialization structure that contains the initialization information.
Return values
NRF_SUCCESSOn successful initialization.
err_codeOtherwise, this function propagates the error code returned by the Database Discovery module API ble_db_discovery_evt_register.
void ble_hrs_c_on_ble_evt ( ble_evt_t const *  p_ble_evt,
void *  p_context 
)

Function for handling BLE events from the SoftDevice.

This function handles the BLE events received from the SoftDevice. If a BLE event is relevant to the Heart Rate Client module, the function uses the event's data to update interval variables and, if necessary, send events to the application.

Parameters
[in]p_ble_evtPointer to the BLE event.
[in]p_contextPointer to the Heart Rate Client structure.
void ble_hrs_on_db_disc_evt ( ble_hrs_c_t p_ble_hrs_c,
const ble_db_discovery_evt_t p_evt 
)

Function for handling events from the Database Discovery module.

Call this function when you get a callback event from the Database Discovery module. This function handles an event from the Database Discovery module and determines whether it relates to the discovery of Heart Rate Service at the peer. If it does, the function calls the application's event handler to indicate that the Heart Rate Service was discovered at the peer. The function also populates the event with service-related information before providing it to the application.

Parameters
[in]p_ble_hrs_cPointer to the Heart Rate Client structure instance for associating the link.
[in]p_evtPointer to the event received from the Database Discovery module.

Documentation feedback | Developer Zone | Subscribe | Updated