Functions
Functions
BLE Services » Heart Rate Service (HRS)

## Functions
void | hrs_sensor_contact_detected_update (bool is_sensor_contact_detected)
| Set the state of the Sensor Contact Detected bit. More...
void | hrs_sensor_contact_supported_set (bool is_sensor_contact_supported)
| Set the state of the Sensor Contact Supported bit. More...
void | hrs_sensor_location_set (hrs_sensor_loc_t hrs_sensor_loc)
| Set the Body Sensor Location. More...
void | hrs_energy_update (uint16_t energy)
| Update Energy measurement if Energy Expended is supported. More...
sdk_err_t | hrs_heart_rate_measurement_send (uint8_t conn_idx, uint16_t heart_rate, bool is_energy_updated)
| Send Heart Rate measurement if Notify has been enabled. More...
void | hrs_rr_interval_add (uint16_t rr_interval)
| Add an RR Interval measurement to the RR Interval buffer. More...
sdk_err_t | hrs_service_init (hrs_init_t *p_hrs_init)
| Init a Heart Rate Service instance and add in the DB. More...

## Detailed Description

## Function Documentation

## ◆ hrs_energy_update()

void hrs_energy_update | ( | uint16_t | energy | ) |

Update Energy measurement if Energy Expended is supported.

Parameters

  [in] | energy | New energy measurement.

## ◆ hrs_heart_rate_measurement_send()

sdk_err_t hrs_heart_rate_measurement_send | ( | uint8_t | conn_idx,
|  | uint16_t | heart_rate,
|  | bool | is_energy_updated
| ) |  |

Send Heart Rate measurement if Notify has been enabled.

Parameters

  [in] | conn_idx | Connection index.
  [in] | heart_rate | New heart rate measurement.
  [in] | is_energy_updated | Indicate whether update energy expended.

Returns
  Result of notify value.

## ◆ hrs_rr_interval_add()

void hrs_rr_interval_add | ( | uint16_t | rr_interval | ) |

Add an RR Interval measurement to the RR Interval buffer.

All buffered RR Interval measurements will be included in the next Heart Rate Measurement notification. The maximum number of RR Interval measurement is HRS_MAX_BUFFERED_RR_INTERVALS. If the buffer is full, the oldest measurement in the buffer will be deleted.

Parameters

  [in] | rr_interval | New RR Interval measurement (will be buffered until the next transmission of Heart Rate Measurement).

## ◆ hrs_sensor_contact_detected_update()

void hrs_sensor_contact_detected_update | ( | bool | is_sensor_contact_detected | ) |

Set the state of the Sensor Contact Detected bit.

Parameters

  [in] | is_sensor_contact_detected | True if sensor contact is detected, false otherwise.

## ◆ hrs_sensor_contact_supported_set()

void hrs_sensor_contact_supported_set | ( | bool | is_sensor_contact_supported | ) |

Set the state of the Sensor Contact Supported bit.

Parameters

  [in] | is_sensor_contact_supported | New state of the Sensor Contact Supported bit.

## ◆ hrs_sensor_location_set()

void hrs_sensor_location_set | ( | hrs_sensor_loc_t | hrs_sensor_loc | ) |

Set the Body Sensor Location.

Sets a new value of the Body Sensor Location characteristic. The new value will be sent to the client the next time the client reads the Body Sensor Location characteristic.

Parameters

  [in] | hrs_sensor_loc | New Body Sensor Location.

## ◆ hrs_service_init()

sdk_err_t hrs_service_init | ( | hrs_init_t * | p_hrs_init | ) |

Init a Heart Rate Service instance and add in the DB.

Parameters

  [in] | p_hrs_init | Pointer to a Heart Rate Init variable.

Returns
  Result of service initialization.