From: Sangki Park Date: Fri, 22 Dec 2017 05:59:50 +0000 (+0900) Subject: Add HFP HF APIs on bluetooth_internal X-Git-Tag: submit/tizen_4.0/20180108.000053^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c29dbc37074e7355a2023ead01fcae9099e662d;p=platform%2Fcore%2Fapi%2Fbluetooth.git Add HFP HF APIs on bluetooth_internal int bt_hf_request_call_status_info_list(void) int bt_hf_is_inband_ringtone_supported(bool *supported) Change-Id: I832acd24f74280b37b16e54082b7622a931b3cee Signed-off-by: Sangki Park --- diff --git a/include/bluetooth_internal.h b/include/bluetooth_internal.h index 9451512..d385024 100644 --- a/include/bluetooth_internal.h +++ b/include/bluetooth_internal.h @@ -2114,6 +2114,51 @@ int bt_hf_get_call_status_info_list(GSList **call_list); */ int bt_hf_free_call_status_info_list(GSList *call_list); +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_HF_MODULE + * @brief Requests the call status information list. + * @since_tizen 3.0 + * + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_NOT_ENABLED Not enabled + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * @retval #BT_ERROR_NO_DATA No data available + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio device must be connected with bt_audio_connect(). + * @pre The bt_hf_set_call_status_updated_event_cb() should be set to receive + * the event of call status update. + * @post This function invokes bt_hf_call_status_updated_event_cb(). + * + * @see bt_audio_connect() + * @see bt_hf_set_call_status_updated_event_cb() + * @see bt_hf_unset_call_status_updated_event_cb() + * @see bt_hf_call_status_updated_event_cb() + */ +int bt_hf_request_call_status_info_list(void); + +/** + * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_HF_MODULE + * @brief Checks whether the remote AG device supports inband ringtone or not. + * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif + * + * @param[out] supported Inband support: (@c true = supported, @c false = not supported) + * @return 0 on success, otherwise a negative error value. + * @retval #BT_ERROR_NONE Successful + * @retval #BT_ERROR_NOT_INITIALIZED Not initialized + * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #BT_ERROR_NOT_ENABLED Not enabled + * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected + * @retval #BT_ERROR_OPERATION_FAILED Operation failed + * @retval #BT_ERROR_NOT_SUPPORTED Not supported + * + * @pre The Bluetooth audio device must be connected with bt_audio_connect(). + * @see bt_audio_connect() + */ +int bt_hf_is_inband_ringtone_supported(bool *supported); + /** * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_A2DP_MODULE * @brief Sets copy protection. streaming application that needs to have the copy protection for the streaming data, shall invoke this API. diff --git a/src/bluetooth-audio.c b/src/bluetooth-audio.c index a5401a3..2b74fda 100644 --- a/src/bluetooth-audio.c +++ b/src/bluetooth-audio.c @@ -1207,6 +1207,22 @@ int bt_hf_get_call_status_info_list(GSList **call_list) return error; } +int bt_hf_request_call_status_info_list(void) +{ + BT_CHECK_HF_SUPPORT(); + BT_CHECK_INIT_STATUS(); + BT_CHECK_HF_INIT_STATUS(); + + int error; + + error = bluetooth_hf_request_call_list_async(); + error = _bt_get_error_code(error); + if (error != BT_ERROR_NONE) + BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); + + return error; +} + int bt_hf_is_inband_ringtone_supported(bool *supported) { BT_CHECK_HF_SUPPORT(); diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index 5f08b73..1dca483 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -1044,6 +1044,8 @@ tc_table_t tc_hf[] = { , BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_TERM}, {"(CALL Status) bt_hf_get_call_status_info_list" , BT_UNIT_TEST_FUNCTION_HF_GET_CALL_STATUS_INFO_LIST}, + {"(CALL Status) bt_hf_request_call_status_info_list" + , BT_UNIT_TEST_FUNCTION_HF_REQUEST_CALL_STATUS_INFO_LIST}, {"(CALL Status) bt_hf_set_call_handling_event_cb()" , BT_UNIT_TEST_FUNCTION_HF_SET_CALL_EVENT_CB}, {"(CALL Status) bt_hf_unset_call_handling_event_cb" @@ -10661,6 +10663,11 @@ int test_input_callback(void *data) } break; } + case BT_UNIT_TEST_FUNCTION_HF_REQUEST_CALL_STATUS_INFO_LIST: { + ret = bt_hf_request_call_status_info_list(); + TC_PRT("returns %s\n", __bt_get_error_message(ret)); + break; + } case BT_UNIT_TEST_FUNCTION_HF_SET_SCO_CHANGED_CB: ret = bt_hf_set_sco_state_changed_cb( __bt_hf_sco_state_changed_cb, NULL); diff --git a/test/bt_unit_test.h b/test/bt_unit_test.h index 887e3e9..1eed23b 100644 --- a/test/bt_unit_test.h +++ b/test/bt_unit_test.h @@ -413,6 +413,7 @@ BT_UNIT_TEST_FUNCTION_ADAPTER_LE_REGISTER_SCAN_FILTER_MANUFACTURER_DATA, BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_TERM, BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_WITH_PARAM, BT_UNIT_TEST_FUNCTION_HF_GET_CALL_STATUS_INFO_LIST, + BT_UNIT_TEST_FUNCTION_HF_REQUEST_CALL_STATUS_INFO_LIST, BT_UNIT_TEST_FUNCTION_HF_SET_CALL_EVENT_CB, BT_UNIT_TEST_FUNCTION_HF_UNSET_CALL_EVENT_CB, BT_UNIT_TEST_FUNCTION_HF_SET_CALL_STATUS_UPDATED_EVENT_CB,