HTS Exported Functions
- group HTS_Exported_Functions
-
Functions
-
uint8_t hts_add_service(void *p_func)
-
Add Health Thermometer Service to the Bluetooth Host.
Example usage
void profile_init() { server_init(service_num); hts_id = hts_add_service(app_handle_profile_message); }
- Parameters:
-
p_func -- [in] Callback when service attribute was read, write or CCCD update.
- Return values:
0xFF -- Operation failure.
others -- Service ID assigned by Bluetooth Host.
- Returns:
-
Service ID generated by the Bluetooth Host: T_SERVER_ID.
-
bool hts_set_parameter(T_HTS_PARAM_TYPE param_type, uint8_t len, void *p_value)
-
Set a Health Thermometer Service parameter.
This function can be called with a HTS parameter type T_HTS_PARAM_TYPE and it will set the HTS 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) { uint8_t hts_flag = HTS_FLAG_MEASUREMENT_UINT_BIT | HTS_FLAG_MEASUREMENT_TIMESTAMP_PRESENT_BIT | HTS_FLAG_MEASUREMENT_TYPE_PRESNET_BIT; T_HTS_TEMPERATURE_TYPE temperature_type = HTS_TEMPERATURE_TYPE_ARMPIT; hts_measure_time_stamp.seconds += hts_measurement_interval; hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPPARAM_FLAG, sizeof(hts_flag), &hts_flag); hts_set_parameter(HTS_PARAM_MEASUREMENT_TIME_STAMP, sizeof(hts_measure_time_stamp), &hts_measure_time_stamp); hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPERATURE_TYPE, 1, &temperature_type); }
- Parameters:
param_type -- [in] Health Thermometer Service parameter type: T_HTS_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 hts_measurement_value_indicate(uint8_t conn_id, uint8_t service_id)
-
Send measurement value indication data. Applications shall call hts_set_parameter to set intermediate temperature value first, and then call this API to send the indication value.
Example usage
void test(void) { uint8_t hts_flag = HTS_FLAG_MEASUREMENT_UINT_BIT | HTS_FLAG_MEASUREMENT_TIMESTAMP_PRESENT_BIT | HTS_FLAG_MEASUREMENT_TYPE_PRESNET_BIT; T_HTS_TEMPERATURE_TYPE temperature_type = HTS_TEMPERATURE_TYPE_ARMPIT; hts_measure_time_stamp.seconds += hts_measurement_interval; hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPPARAM_FLAG, sizeof(hts_flag), &hts_flag); hts_set_parameter(HTS_PARAM_MEASUREMENT_TIME_STAMP, sizeof(hts_measure_time_stamp), &hts_measure_time_stamp); hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPERATURE_TYPE, 1, &temperature_type); bool ret = hts_measurement_value_indicate(conn_id, hts_id); }
- Parameters:
conn_id -- [in] Connection ID.
service_id -- [in] Service ID.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
bool hts_intermediate_temperature_value_notify(uint8_t conn_id, uint8_t service_id)
-
Send intermediate temperature notification data. Applications shall call hts_set_parameter to set intermediate temperature value first, and then call this API to send the notification value.
Example usage
void test(void) { uint8_t hts_flag = HTS_FLAG_MEASUREMENT_UINT_BIT | HTS_FLAG_MEASUREMENT_TIMESTAMP_PRESENT_BIT | HTS_FLAG_MEASUREMENT_TYPE_PRESNET_BIT; T_HTS_TEMPERATURE_TYPE temperature_type = HTS_TEMPERATURE_TYPE_ARMPIT; hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPPARAM_FLAG, sizeof(hts_flag), &hts_flag); hts_set_parameter(HTS_PARAM_MEASUREMENT_TIME_STAMP, sizeof(hts_measure_time_stamp), &hts_measure_time_stamp); hts_set_parameter(HTS_PARAM_MEASUREMENT_TEMPERATURE_TYPE, 1, &temperature_type); bool ret = hts_intermediate_temperature_value_notify(conn_id, hts_id); }
- Parameters:
conn_id -- [in] Connection ID.
service_id -- [in] Service ID.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
bool hts_measurement_interval_notify(uint8_t conn_id, uint8_t service_id, uint16_t seconds)
-
Send measurement interval notification data.
Example usage
void test(void) { bool ret = hts_measurement_interval_notify(conn_id, hts_id, interval); }
- Parameters:
conn_id -- [in] Connection ID.
service_id -- [in] Service ID.
seconds -- [in] Measurement interval.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
uint8_t hts_add_service(void *p_func)