| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Functions
Heart Rate Service Client

## 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_hrs_c_t *p_ble_hrs_c, const ble_evt_t *p_ble_evt)
| 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 a handles to a this 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 a handles to a this instance of hrs_c.

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

Parameters

  [in] | p_ble_hrs_c | Pointer to the heart rate client structure instance to associate.
  [in] | conn_handle | Connection handle to associated with the given Heart Rate Client Instance.
  [in] | p_peer_hrs_handles | Attribute 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 will enable to notification of the Heart Rate Measurement at the peer by writing to the CCCD of the Heart Rate Measurement Characteristic.

Parameters

  p_ble_hrs_c | Pointer to the heart rate client structure.

Return values

  NRF_SUCCESS | If the SoftDevice has been requested to write to the CCCD of the peer. Otherwise, an error code. 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 will register with the DB Discovery module. There it registers for the Heart Rate Service. Doing so will make the DB Discovery module look for the presence of a Heart Rate Service instance at the peer when a discovery is started.

Parameters

  [in] | p_ble_hrs_c | Pointer to the heart rate client structure.
  [in] | p_ble_hrs_c_init | Pointer to the heart rate initialization structure containing the initialization information.

Return values

  NRF_SUCCESS | On successful initialization. Otherwise an error code. 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_hrs_c_t * | p_ble_hrs_c,
|  | const ble_evt_t * | p_ble_evt
| ) |  |

Function for handling BLE events from the SoftDevice.

This function will handle the BLE events received from the SoftDevice. If a BLE event is relevant to the Heart Rate Client module, then it uses it to update interval variables and, if necessary, send events to the application.

Parameters

  [in] | p_ble_hrs_c | Pointer to the heart rate client structure.
  [in] | p_ble_evt | Pointer to the BLE event.

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 getting a callback event from the DB discovery modue. This function will handle an event from the database discovery module, and determine if it relates to the discovery of heart rate service at the peer. If so, it will call the application's event handler indicating that the heart rate service has been discovered at the peer. It also populates the event with the service related information before providing it to the application.

Parameters

  [in] | p_ble_hrs_c | Pointer to the heart rate client structure instance to associate.
  [in] | p_evt | Pointer to the event received from the database discovery module.