HRS Exported Functions
- group HRS_Exported_Functions
-
Functions
-
uint8_t hrs_add_service(void *p_func)
-
Add heart rate service to the Bluetooth Host.
Example usage
void profile_init() { server_init(service_num); hrs_id = hrs_add_service(app_handle_profile_message); }
- Parameters:
-
p_func -- [in] Callback when service attribute was read, written, or CCCD updated.
- Return values:
0xFF -- Operation failure.
others -- Service ID assigned by Bluetooth Host.
- Returns:
-
Service ID generated by the Bluetooth Host: T_SERVER_ID.
-
bool hrs_set_parameter(T_HRS_PARAM_TYPE param_type, uint8_t len, void *p_value)
-
Set a heart rate service parameter.
This function can be called with a HRS parameter type T_HRS_PARAM_TYPE and it will set the HRS parameter. The 'p_value' field must point to an appropriate data type that meets the requirements for the corresponding parameter type. (For example: if required data length for parameter type is 1 octets, p_value should be cast to a pointer of uint8_t.)
Example usage
void test(void) { T_HEART_RATE_MEASUREMENT_VALUE_FLAG flag; flag.heart_rate_value_format_bit = 1; flag.sensor_contact_status_bits = 3; if (p_parse_value->param_count >= 1) { flag.sensor_contact_status_bits = p_parse_value->dw_param[1]; } flag.energy_expended_status_bit = 1; flag.rr_interval_bit = 1; flag.rfu = 0; hrs_set_parameter(HRS_HEART_RATE_MEASUREMENT_PARAM_FLAG, 1, &flag); }
- Parameters:
param_type -- [in] Health rate service parameter type: T_HRS_PARAM_TYPE.
len -- [in] Length of data to write.
p_value -- [in] Pointer to data to write.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
bool hrs_heart_rate_measurement_value_notify(uint8_t conn_id, T_SERVER_ID service_id)
-
Send heart rate measurement value notification data. Applications shall call hrs_set_parameter to set heart rate measurement value first, and the call this api to send the notification value.
Example usage
void test(void) { bool result = hrs_heart_rate_measurement_value_notify(conn_id, service_id); }
- Parameters:
conn_id -- [in] Connection ID.
service_id -- [in] Service ID.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
uint8_t hrs_add_service(void *p_func)