* @brief HRP Sensor API to destory heart rate sensor .
*/
-int bt_hrp_sensor_destroy();
+int bt_hrp_sensor_destroy(void);
/**
* @internal
* @internal
* @brief HRP collector API to destory collector.
*/
-void bt_hrp_collector_destory(bt_hrp_collector_h collector);
+int bt_hrp_collector_destory(bt_hrp_collector_h collector);
/**
* @internal
* @brief HRP collector API to start scan .
*/
-int bt_hrp_collector_start_scan();
+int bt_hrp_collector_start_scan(bt_adapter_le_scan_result_cb cb);
/**
* @internal
* @brief HRP collector API to stop scan.
*/
-int bt_hrp_collector_stop_scan();
+int bt_hrp_collector_stop_scan(void);
/**
* @internal
* @brief HRP collector API to connect to remote sensor .
*/
-int bt_hrp_collector_connect(const char *address, bool auto_connect);
+int bt_hrp_collector_connect(bt_hrp_collector_h collector);
/**
* @internal
* @brief HRP collector API to disconnect to remote sensor .
*/
-int bt_hrp_collector_disconnect(const char *address);
+int bt_hrp_collector_disconnect(bt_hrp_collector_h collector);
/**
* @internal
* @brief HRP collector API to read Body Sensor location , fills body sensor location in bsl_location
*/
-bt_body_sensor_location_e bt_hrp_get_body_sensor_location(bt_hrp_collector_h collector,
+int bt_hrp_collector_get_body_sensor_location(bt_hrp_collector_h collector,
bt_hrp_collector_bsl_read_completed_cb bsl_read_cb);
{ \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE); \
- BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_HRS); \
}
#define BT_CHECK_HRC_SUPPORT() \
{ \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_LE); \
- BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_HRC); \
}
/*======================================================================================================
int bt_hrp_sensor_set_heartrate_value(int heartrate)
{
-
BT_CHECK_HRS_SUPPORT();
BT_CHECK_INIT_STATUS();
}
-int bt_hrp_sensor_stop()
+int bt_hrp_sensor_stop(void)
{
BT_CHECK_HRS_SUPPORT();
BT_CHECK_INIT_STATUS();
}
-int bt_hrp_sensor_destroy()
+int bt_hrp_sensor_destroy(void)
{
BT_CHECK_HRS_SUPPORT();
BT_CHECK_INIT_STATUS();
BT_INFO("[HR]bt_gatt_server_destroy GATT Destroy\n");
int error_code = BT_ERROR_NOT_INITIALIZED;
+
+ if (hrp_server_info_s.hrp_sensor == NULL)
+ return BT_ERROR_NOT_INITIALIZED;
+
bt_gatt_destroy(hrp_server_info_s.hrs_descriptor);
bt_gatt_destroy(hrp_server_info_s.hrs_characteristic);
bt_gatt_destroy(hrp_server_info_s.dis_characteristic);
return error_code;
}
+ hrp_server_info_s.hrp_sensor = NULL;
+
BT_INFO("[HR]bt_gatt_server_destroy Server Deinit\n");
error_code = bt_gatt_server_deinitialize();
return error_code;
}
-void bt_hrp_collector_destory(bt_hrp_collector_h collector)
+int bt_hrp_collector_destory(bt_hrp_collector_h collector)
{
+ BT_CHECK_HRC_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(collector);
bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
g_free(collector_s);
}
+ return BT_ERROR_NONE;
}
static void __bt_hrp_le_scan_result_cb(int result,
}
-int bt_hrp_collector_stop_scan()
+int bt_hrp_collector_stop_scan(void)
{
int error_code = BT_ERROR_NONE;
+ BT_CHECK_HRC_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
error_code = bt_adapter_le_stop_scan();
BT_ERR("returns %s\n", _bt_convert_error_to_string(error_code));
}
-int bt_hrp_collector_connect(const char *address, bool auto_connect)
+int bt_hrp_collector_connect(bt_hrp_collector_h collector)
{
int error_code = BT_ERROR_NONE;
BT_CHECK_HRC_SUPPORT();
BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(collector);
+
+ bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
- error_code = bt_gatt_connect(address, auto_connect);
+ error_code = bt_gatt_connect(collector_s->remote_address, false);
if (error_code != BT_ERROR_NONE)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
return error_code;
}
-int bt_hrp_collector_disconnect(const char *address)
+int bt_hrp_collector_disconnect(bt_hrp_collector_h collector)
{
int error_code = BT_ERROR_NONE;
BT_CHECK_HRC_SUPPORT();
BT_CHECK_INIT_STATUS();
- error_code = bt_gatt_disconnect(address);
+ BT_CHECK_INPUT_PARAMETER(collector);
+
+ bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
+
+ error_code = bt_gatt_disconnect(collector_s->remote_address);
if (error_code != BT_ERROR_NONE)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
bt_hrp_collector_heart_rate_value_changed_cb callback,
bool isNotify)
{
+ BT_CHECK_HRC_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(collector);
+
int error_code = BT_ERROR_NONE;
bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
bt_gatt_h svc = NULL;
bt_gatt_h desc = NULL;
char *buf = (char *)&isNotify;
- BT_CHECK_HRC_SUPPORT();
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(collector_s);
-
if (_bt_hrp_collector_find(collector_s->remote_address) == NULL)
return BT_ERROR_NOT_INITIALIZED;
return error_code;
}
-bt_body_sensor_location_e bt_hrp_get_body_sensor_location(bt_hrp_collector_h collector,
+int bt_hrp_collector_get_body_sensor_location(bt_hrp_collector_h collector,
bt_hrp_collector_bsl_read_completed_cb bsl_read_cb)
{
int error_code = BT_ERROR_NONE;
bt_gatt_h svc = NULL;
bt_gatt_h chr = NULL;
- bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
-
BT_CHECK_HRC_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(collector_s);
+ BT_CHECK_INPUT_PARAMETER(collector);
+
+ bt_hrp_collector_s *collector_s = (bt_hrp_collector_s *)collector;
if (_bt_hrp_collector_find(collector_s->remote_address) == NULL)
return BT_ERROR_NOT_INITIALIZED;
}
case BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECT: {
TC_PRT("HR COLLECTOR CONNECT\n");
- ret = bt_hrp_collector_connect(remote_addr, true);
+ ret = bt_hrp_collector_connect(collector);
TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
}
case BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DISCONNECT: {
TC_PRT("HR COLLECTOR DISCONNECT\n");
- ret = bt_hrp_collector_disconnect(remote_addr);
+ ret = bt_hrp_collector_disconnect(collector);
TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
}
case BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_GET_BSL_LOC: {
TC_PRT("HR COLLECTOR GET BSL LOCATION\n");
if (collector) {
- ret = bt_hrp_get_body_sensor_location(collector, _bt_hrp_collector_bsl_read_completed_cb);
+ ret = bt_hrp_collector_get_body_sensor_location(collector, _bt_hrp_collector_bsl_read_completed_cb);
TC_PRT("returns %s\n", __bt_get_error_message(ret));
}
break;
}
case BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DESTROY: {
TC_PRT("HR COLLECTOR DESTROY\n");
- bt_hrp_collector_destory(collector);
+ ret = bt_hrp_collector_destory(collector);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
}
default: