hrs.h File Reference

Heart Rate Service API. More...

#include "gr_includes.h"
#include "custom_config.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  hrs_evt_t
 Heart Rate Service event. More...
 
struct  hrs_init_t
 Heart Rate Service Init variable. More...
 

Macros

#define HRS_CONNECTION_MAX   10
 
#define HRS_MEAS_MAX_LEN   20
 
#define HRS_MAX_BUFFERED_RR_INTERVALS   9
 
#define HRS_CHAR_MANDATORY   0x0F
 
#define HRS_CHAR_BODY_SENSOR_LOC_SUP   0x30
 
#define HRS_CHAR_ENGY_EXP_SUP   0xC0
 

Typedefs

typedef void(* hrs_evt_handler_t) (hrs_evt_t *p_evt)
 Heart Rate Service event handler type. More...
 

Enumerations

enum  hrs_sensor_loc_t {
  HRS_SENS_LOC_OTHER,
  HRS_SENS_LOC_CHEST,
  HRS_SENS_LOC_WRIST,
  HRS_SENS_LOC_FINGER,
  HRS_SENS_LOC_HAND,
  HRS_SENS_LOC_EARLOBE,
  HRS_SENS_LOC_FOOT
}
 Values for sensor location. More...
 
enum  hrs_evt_type_t {
  HRS_EVT_NOTIFICATION_ENABLED,
  HRS_EVT_NOTIFICATION_DISABLED,
  HRS_EVT_RESET_ENERGY_EXPENDED,
  HRS_EVT_READ_BODY_SEN_LOCATION
}
 Heart Rate Service event types. More...
 

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...
 
uint16_t hrs_service_start_handle_get (void)
 Provide the interface for other modules to obtain the hrs service start handle . More...
 

Detailed Description

Heart Rate Service API.

Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file hrs.h.