summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Garg <ayush.garg@samsung.com>2022-09-29 13:36:43 +0530
committerAyush Garg <ayush.garg@samsung.com>2022-09-29 14:04:57 +0530
commitc859b060b3fe10cef6c595c8b8ed8098d53b5fdd (patch)
treeda2eca55c30d6d622c483e89565eb5d393f77745
parentea5ea73fd1875b463f3ff697f55dc588225d9c38 (diff)
downloadbluetooth-accepted/tizen_7.0_unified_hotfix.tar.gz
bluetooth-accepted/tizen_7.0_unified_hotfix.tar.bz2
bluetooth-accepted/tizen_7.0_unified_hotfix.zip
Applied patches - add BT_HF_EVENT_AUDIO_MUTE event for audio mute function - modify profile check routine for HFP & PBAP This patchset should be merged with the following bluetooth-frwk's patchset in order to build successfully: bluetooth-frwk Change-Id: Ifc77646b0ef4cac509c88b647d86855baa658d3e Change-Id: I3144f6091206891a67e19e81badf80737d8c5df6 Signed-off-by: shss-choi <shss.choi@samsung.com> Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
-rw-r--r--include/bluetooth_type_extension.h2
-rw-r--r--src/bluetooth-audio.c40
-rw-r--r--tests/test/bt_unit_test.c127
-rw-r--r--tests/test/bt_unit_test.h4
4 files changed, 148 insertions, 25 deletions
diff --git a/include/bluetooth_type_extension.h b/include/bluetooth_type_extension.h
index c6a6e4a..8829eac 100644
--- a/include/bluetooth_type_extension.h
+++ b/include/bluetooth_type_extension.h
@@ -68,6 +68,8 @@ typedef enum {
BT_HF_CALL_EVENT_ACCEPT_AND_RELEASE, /**< Accept and Release */
BT_HF_CALL_EVENT_ACCEPT_AND_HOLD, /**< Accept and Hold */
BT_HF_CALL_EVENT_ADD_TO_CONVERSATION, /**< Add to the conversation */
+ BT_HF_CALL_EVENT_AUDIO_MUTE_ON, /**< Audio Mute On*/
+ BT_HF_CALL_EVENT_AUDIO_MUTE_OFF, /**< Audio Mute Off*/
} bt_hf_call_event_e;
/**
diff --git a/src/bluetooth-audio.c b/src/bluetooth-audio.c
index ae78e18..6a5d39d 100644
--- a/src/bluetooth-audio.c
+++ b/src/bluetooth-audio.c
@@ -132,7 +132,7 @@ int bt_audio_initialize(void)
else
is_audio_a2dp_initialized = true;
- if (TIZEN_PROFILE_WEARABLE_IVI) {
+ if (TIZEN_PROFILE_WEARABLE_IVI || TIZEN_FEATURE_FHUB_REFERENCE) {
error = bluetooth_hf_init(_bt_hf_event_proxy, NULL); /* LCOV_EXCL_LINE */
error = _bt_get_error_code(error); /* LCOV_EXCL_LINE */
if (BT_ERROR_NONE != error) /* LCOV_EXCL_LINE */
@@ -142,12 +142,14 @@ int bt_audio_initialize(void)
}
#ifndef TIZEN_FEATURE_HFP_DISABLE /* B2_3G */
- error = bluetooth_telephony_init((void *)_bt_telephony_event_proxy, NULL);
- error = _bt_convert_telephony_error_code(error);
- if (BT_ERROR_NONE != error)
- BT_ERR("[%s] (0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
- else
- is_audio_ag_initialized = true;
+ if (!TIZEN_FEATURE_FHUB_REFERENCE) {
+ error = bluetooth_telephony_init((void *)_bt_telephony_event_proxy, NULL);
+ error = _bt_convert_telephony_error_code(error);
+ if (BT_ERROR_NONE != error)
+ BT_ERR("[%s] (0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */
+ else
+ is_audio_ag_initialized = true;
+ }
#endif
/* There is no success case for 3 profiles */
@@ -174,7 +176,7 @@ int bt_audio_deinitialize(void)
is_audio_a2dp_initialized = false;
- if (TIZEN_PROFILE_WEARABLE_IVI) { /* LCOV_EXCL_START */
+ if (TIZEN_PROFILE_WEARABLE_IVI || TIZEN_FEATURE_FHUB_REFERENCE) { /* LCOV_EXCL_START */
error = bluetooth_hf_deinit();
error = _bt_get_error_code(error);
if (BT_ERROR_NONE != error)
@@ -184,12 +186,14 @@ int bt_audio_deinitialize(void)
}
#ifndef TIZEN_FEATURE_HFP_DISABLE /* B2_3G */
- error = bluetooth_telephony_deinit();
- error = _bt_convert_telephony_error_code(error);
- if (BT_ERROR_NONE != error)
- BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
+ if (!TIZEN_FEATURE_FHUB_REFERENCE) {
+ error = bluetooth_telephony_deinit();
+ error = _bt_convert_telephony_error_code(error);
+ if (BT_ERROR_NONE != error)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- is_audio_ag_initialized = false;
+ is_audio_ag_initialized = false;
+ }
#endif
return BT_ERROR_NONE;
@@ -242,7 +246,7 @@ int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type)
error = bluetooth_av_source_connect(&addr_hex);
break;
case BT_AUDIO_PROFILE_TYPE_AG:
- if (TIZEN_PROFILE_WEARABLE_IVI) {
+ if (TIZEN_PROFILE_WEARABLE_IVI || TIZEN_FEATURE_FHUB_REFERENCE) {
BT_CHECK_HF_INIT_STATUS();
error = bluetooth_hf_connect(&addr_hex);
break;
@@ -301,7 +305,7 @@ int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type
error = bluetooth_av_source_disconnect(&addr_hex);
break;
case BT_AUDIO_PROFILE_TYPE_AG:
- if (TIZEN_PROFILE_WEARABLE_IVI) {
+ if (TIZEN_PROFILE_WEARABLE_IVI || TIZEN_FEATURE_FHUB_REFERENCE) {
BT_CHECK_HF_INIT_STATUS();
error = bluetooth_hf_disconnect(&addr_hex);
break;
@@ -1080,6 +1084,12 @@ int bt_hf_notify_call_event(bt_hf_call_event_e event, char *phone_number)
case BT_HF_CALL_EVENT_ADD_TO_CONVERSATION:
error = bluetooth_hf_join_call();
break;
+ case BT_HF_CALL_EVENT_AUDIO_MUTE_ON:
+ error = bluetooth_hf_audio_mute_on();
+ break;
+ case BT_HF_CALL_EVENT_AUDIO_MUTE_OFF:
+ error = bluetooth_hf_audio_mute_off();
+ break;
default:
error = BLUETOOTH_ERROR_INVALID_PARAM;
break;
diff --git a/tests/test/bt_unit_test.c b/tests/test/bt_unit_test.c
index 96ad6ab..0e9a21f 100644
--- a/tests/test/bt_unit_test.c
+++ b/tests/test/bt_unit_test.c
@@ -66,6 +66,7 @@ static bt_unit_test_table_e current_tc_table;
static char remote_addr[18] = "F6:FB:8F:D8:C8:7C";
static char ipsp_iface_name[17] = "";
static bool input_automated_test_delay = false;
+static char remote_phone_number[12] = "00000000000";
/* For HDP profile TEST */
static char *appid = "/org/bluez/health_app_2";
@@ -1153,6 +1154,14 @@ tc_table_t tc_hf[] = {
, BT_UNIT_TEST_FUNCTION_HF_SET_SCO_CHANGED_CB},
{"(SCO) bt_hf_unset_sco_state_changed_cb()"
, BT_UNIT_TEST_FUNCTION_HF_UNSET_SCO_CHANGED_CB},
+ {"[HF] bt_hf_set_remote_call_event_cb()"
+ , BT_UNIT_TEST_FUNCTION_HF_SET_REMOTE_CALL_EVENT_CB},
+ {"[HF] bt_hf_notify_call_event(BT_HF_CALL_EVENT_AUDIO_MUTE_ON)"
+ , BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_ON},
+ {"[HF] bt_hf_notify_call_event(BT_HF_CALL_EVENT_AUDIO_MUTE_OFF)"
+ , BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_OFF},
+ {"[HF] bt_hf_is_connected"
+ , BT_UNIT_TEST_FUNCTION_HF_IS_CONNECTED},
{"Select this menu to set parameters and then select the function again."
, BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
{NULL , 0x0000},
@@ -1409,12 +1418,12 @@ void tc_usage_print(void)
tc_table = tc_pxp;
break;
case BT_UNIT_TEST_TABLE_HF:
- if (!TIZEN_PROFILE_WEARABLE_IVI)
+ if (!TIZEN_PROFILE_WEARABLE_IVI && !TIZEN_FEATURE_FHUB_REFERENCE)
goto __default__;
tc_table = tc_hf;
break;
case BT_UNIT_TEST_TABLE_PBAP_CLIENT:
- if (!TIZEN_PROFILE_WEARABLE_IVI)
+ if (!TIZEN_PROFILE_WEARABLE_IVI && !TIZEN_FEATURE_FHUB_REFERENCE)
goto __default__;
tc_table = tc_pbap_client;
break;
@@ -3240,6 +3249,54 @@ void __bt_hf_call_status_updated_event_cb(GSList *call_info_list,
bt_hf_free_call_status_info_list(call_info_list);
}
+void __bt_hf_set_remote_call_event_cb(bt_hf_remote_call_event_e event,
+ char *phone_number, void *user_data)
+{
+ switch (event) {
+ case BT_HF_REMOTE_CALL_EVENT_IDLE:
+ TC_PRT("[remote_call_event_cb] event [IDLE]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_INCOMING:
+ TC_PRT("[remote_call_event_cb] event [INCOMING]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_DIALING:
+ TC_PRT("[remote_call_event_cb] event [DIALING]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_ALERTING:
+ TC_PRT("[remote_call_event_cb] event [ALERTING]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_CALL_TERMINATED:
+ TC_PRT("[remote_call_event_cb] event [TERMINATED]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_CALL_STARTED:
+ TC_PRT("[remote_call_event_cb] event [STARTED]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_CALL_ENDED:
+ TC_PRT("[remote_call_event_cb] event [ENDED]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_UNHELD:
+ TC_PRT("[remote_call_event_cb] event [UNHELD]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_HELD:
+ TC_PRT("[remote_call_event_cb] event [HELD]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_RINGING:
+ strncpy(remote_phone_number, phone_number, strlen(remote_phone_number));
+ TC_PRT("[remote_call_event_cb] event [RINGING]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_WAITING:
+ TC_PRT("[remote_call_event_cb] event [WAITING]");
+ break;
+ case BT_HF_REMOTE_CALL_EVENT_FAILED_TO_DIALING:
+ TC_PRT("[remote_call_event_cb] event [FAILED_TO_DIALING]");
+ break;
+ default:
+ TC_PRT("[remote_call_event_cb] event [UNKNOWN]");
+ }
+
+ TC_PRT("[remote_call_event_cb] phone_number [%s]", phone_number);
+}
+
void __bt_hf_speaker_gain_changed_cb(int gain,
void *user_data)
{
@@ -3587,7 +3644,7 @@ static void __bt_initialize_all(void)
__bt_adapter_device_discovery_state_changed_cb, NULL);
if (ret != BT_ERROR_NONE)
TC_PRT("returns %s\n", __bt_get_error_message(ret));
- if (TIZEN_PROFILE_WEARABLE_IVI) {
+ if (TIZEN_PROFILE_WEARABLE_IVI || TIZEN_FEATURE_FHUB_REFERENCE) {
ret = bt_pbap_client_set_connection_state_changed_cb(__bt_pbap_connection_state_changed_cb,
NULL);
if (ret != BT_ERROR_NONE)
@@ -4191,7 +4248,7 @@ int test_set_params(int test_id, char *param)
}
case BT_UNIT_TEST_TABLE_PBAP_CLIENT:
- if (!TIZEN_PROFILE_WEARABLE_IVI)
+ if (!TIZEN_PROFILE_WEARABLE_IVI && !TIZEN_FEATURE_FHUB_REFERENCE)
goto __default__;
{
switch (test_id) {
@@ -9975,7 +10032,7 @@ int test_input_callback(void *data)
}
case BT_UNIT_TEST_TABLE_HF: {
- if (!TIZEN_PROFILE_WEARABLE_IVI)
+ if (!TIZEN_PROFILE_WEARABLE_IVI && !TIZEN_FEATURE_FHUB_REFERENCE)
break;
switch (test_id) {
case BT_UNIT_TEST_FUNCTION_HF_INITIALIZE:
@@ -9993,7 +10050,11 @@ int test_input_callback(void *data)
TC_PRT("Success");
break;
case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_ANSWER:
- ret = bt_hf_notify_call_event(
+ if (TIZEN_FEATURE_FHUB_REFERENCE)
+ ret = bt_hf_notify_call_event(
+ BT_HF_CALL_EVENT_ANSWER, remote_phone_number);
+ else
+ ret = bt_hf_notify_call_event(
BT_HF_CALL_EVENT_ANSWER,
"9663868998");
if (ret < BT_ERROR_NONE)
@@ -10041,9 +10102,18 @@ int test_input_callback(void *data)
TC_PRT("Success");
break;
case BT_UNIT_TEST_FUNCTION_HF_NOTIFY_CALL_INIT:
- ret = bt_hf_notify_call_event(
- BT_HF_CALL_EVENT_DIAL,
- "9663868998");
+ if (TIZEN_FEATURE_FHUB_REFERENCE) {
+ if (g_test_param.param_count < 0) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ ret = bt_hf_notify_call_event(
+ BT_HF_CALL_EVENT_DIAL,
+ g_test_param.params[0]);
+ } else
+ ret = bt_hf_notify_call_event(
+ BT_HF_CALL_EVENT_DIAL,
+ "9663868998");
if (ret < BT_ERROR_NONE)
TC_PRT("failed with [0x%04x]", ret);
else if (ret == BT_ERROR_NONE)
@@ -10140,6 +10210,43 @@ int test_input_callback(void *data)
else if (ret == BT_ERROR_NONE)
TC_PRT("Success");
break;
+ case BT_UNIT_TEST_FUNCTION_HF_SET_REMOTE_CALL_EVENT_CB:
+ ret = bt_hf_set_remote_call_event_cb(
+ __bt_hf_set_remote_call_event_cb,
+ NULL);
+ if (ret < BT_ERROR_NONE)
+ TC_PRT("failed with [0x%04x]", ret);
+ else if (ret == BT_ERROR_NONE)
+ TC_PRT("Success");
+ break;
+
+ case BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_ON:
+ ret = bt_hf_notify_call_event(BT_HF_CALL_EVENT_AUDIO_MUTE_ON, NULL);
+ if (ret < BT_ERROR_NONE)
+ TC_PRT("failed with [0x%04x]", ret);
+ else if (ret == BT_ERROR_NONE)
+ TC_PRT("Success");
+ break;
+
+ case BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_OFF:
+ ret = bt_hf_notify_call_event(BT_HF_CALL_EVENT_AUDIO_MUTE_OFF, NULL);
+ if (ret < BT_ERROR_NONE)
+ TC_PRT("failed with [0x%04x]", ret);
+ else if (ret == BT_ERROR_NONE)
+ TC_PRT("Success");
+ break;
+
+ case BT_UNIT_TEST_FUNCTION_HF_IS_CONNECTED: {
+ bool hf_connected = false;
+ ret = bt_hf_is_connected(&hf_connected);
+ if (ret < BT_ERROR_NONE)
+ TC_PRT("failed with [0x%04x]", ret);
+ else if (ret == BT_ERROR_NONE) {
+ TC_PRT("Success");
+ TC_PRT("is hf conencted ? [%s]", hf_connected ? "TRUE" : "FALSE");
+ }
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
need_to_set_params = true;
TC_PRT("Select the function again");
@@ -10152,7 +10259,7 @@ int test_input_callback(void *data)
break;
}
case BT_UNIT_TEST_TABLE_PBAP_CLIENT: {
- if (!TIZEN_PROFILE_WEARABLE_IVI)
+ if (!TIZEN_PROFILE_WEARABLE_IVI && !TIZEN_FEATURE_FHUB_REFERENCE)
break;
switch (test_id) {
diff --git a/tests/test/bt_unit_test.h b/tests/test/bt_unit_test.h
index 4edecf5..e490bca 100644
--- a/tests/test/bt_unit_test.h
+++ b/tests/test/bt_unit_test.h
@@ -482,6 +482,10 @@ typedef enum {
BT_UNIT_TEST_FUNCTION_HF_GET_CODEC_ID,
BT_UNIT_TEST_FUNCTION_HF_SET_SCO_CHANGED_CB,
BT_UNIT_TEST_FUNCTION_HF_UNSET_SCO_CHANGED_CB,
+ BT_UNIT_TEST_FUNCTION_HF_SET_REMOTE_CALL_EVENT_CB,
+ BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_ON,
+ BT_UNIT_TEST_FUNCTION_HF_AUDIO_MUTE_OFF,
+ BT_UNIT_TEST_FUNCTION_HF_IS_CONNECTED,
BT_UNIT_TEST_FUNCTION_HF_NOTIFY_VENDOR_CMD,
BT_UNIT_TEST_FUNCTION_HF_SET_VENDOR_CMD_EVENT_CB,
BT_UNIT_TEST_FUNCTION_HF_UNSET_VENDOR_CMD_EVENT_CB,