From: DoHyun Pyun Date: Wed, 26 Jun 2019 01:49:13 +0000 (+0900) Subject: Remove the package dependency for capi-system-info X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90a3613ccf87b7a55906b31060ab802c1a77e65d;p=platform%2Fcore%2Fapi%2Fbluetooth.git Remove the package dependency for capi-system-info Change-Id: I7c2fcc5eb076888317b9cb04156aaf8816519556 Signed-off-by: DoHyun Pyun --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8318ff5..9fe836e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "dlog glib-2.0 capi-base-common capi-system-info bluetooth-api") +SET(dependents "dlog glib-2.0 capi-base-common bluetooth-api") SET(pc_dependents "capi-base-common glib-2.0") INCLUDE(FindPkgConfig) diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 6969dd9..604e689 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -588,40 +587,9 @@ typedef void (*bt_adapter_passkey_notification_cb)(const char *remote_address, c #define BT_FEATURE_GATT_SERVER "tizen.org/feature/network.bluetooth.le.gatt.server" #define BT_FEATURE_GATT_CLIENT "tizen.org/feature/network.bluetooth.le.gatt.client" -#define BT_CHECK_SUPPORTED_FEATURE(feature_name) \ -do { \ - bool is_supported = false; \ - if (!system_info_get_platform_bool(feature_name, &is_supported)) { \ - if (is_supported == false) { \ - LOGE("[%s] NOT_SUPPORTED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_SUPPORTED); \ - return BT_ERROR_NOT_SUPPORTED; \ - } \ - } else { \ - LOGE("[%s] Fail to get the system feature: [%s]", __FUNCTION__, feature_name); \ - } \ -} while (0) - -#define BT_CHECK_SUPPORTED_FEATURES(feature_name1, feature_name2) \ -do { \ - bool is_supported = false; \ - if (!system_info_get_platform_bool(feature_name1, &is_supported)) { \ - if (is_supported == true) {\ - break; \ - } \ - } else { \ - LOGE("[%s] Fail to get the system feature: [%s]", __FUNCTION__, feature_name1); \ - } \ - if (!system_info_get_platform_bool(feature_name2, &is_supported)) { \ - if (is_supported == true) { \ - break; \ - } else {\ - LOGE("[%s] NOT_SUPPORTED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_SUPPORTED); \ - return BT_ERROR_NOT_SUPPORTED; \ - } \ - } else { \ - LOGE("[%s] Fail to get the system feature: [%s]", __FUNCTION__, feature_name2); \ - } \ -} while (0) +#define BT_CHECK_SUPPORTED_FEATURE(feature_name) + +#define BT_CHECK_SUPPORTED_FEATURES(feature_name1, feature_name2) /** * @internal @@ -1013,32 +981,6 @@ void _bt_otc_connection_state_changed(int result, bluetooth_otc_info_t *otc_info */ void _bt_otp_check_service_changed(char *address, bt_gatt_service_change_t *service_change); -typedef enum { - _PROFILE_UNKNOWN = 0, - _PROFILE_MOBILE = 0x1, - _PROFILE_WEARABLE = 0x2, - _PROFILE_TV = 0x4, - _PROFILE_IVI = 0x8, - _PROFILE_IOT = 0x10, - _PROFILE_COMMON = 0x20, -} tizen_profile_t; -extern tizen_profile_t _get_tizen_profile(); -extern tizen_profile_t profile; - -#define TIZEN_PROFILE_(x) (((__builtin_expect(profile != _PROFILE_UNKNOWN, 1)) ? \ - (profile) : _get_tizen_profile()) \ - & (x)) - -#define TIZEN_PROFILE_MOBILE TIZEN_PROFILE_(_PROFILE_MOBILE) -#define TIZEN_PROFILE_COMMON TIZEN_PROFILE_(_PROFILE_COMMON) -#define TIZEN_PROFILE_TV TIZEN_PROFILE_(_PROFILE_TV) -#define TIZEN_PROFILE_WEARABLE TIZEN_PROFILE_(_PROFILE_WEARABLE) -#define TIZEN_PROFILE_IVI TIZEN_PROFILE_(_PROFILE_IVI) - -#define TIZEN_PROFILE_WEARABLE_IVI TIZEN_PROFILE_(_PROFILE_WEARABLE | _PROFILE_IVI) - -#define TIZEN_FEATURE_ENABLE_LEGACY_GATT_CLIENT TIZEN_PROFILE_MOBILE - #ifdef __cplusplus } #endif diff --git a/packaging/capi-network-bluetooth.spec b/packaging/capi-network-bluetooth.spec index 14a364d..37bf7ad 100644 --- a/packaging/capi-network-bluetooth.spec +++ b/packaging/capi-network-bluetooth.spec @@ -15,7 +15,6 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(bluetooth-api) BuildRequires: pkgconfig(capi-base-common) -BuildRequires: pkgconfig(capi-system-info) BuildRequires: cmake %description diff --git a/src/bluetooth-audio.c b/src/bluetooth-audio.c index 9c305d2..65bd365 100644 --- a/src/bluetooth-audio.c +++ b/src/bluetooth-audio.c @@ -132,15 +132,6 @@ int bt_audio_initialize(void) else is_audio_a2dp_initialized = true; - if (TIZEN_PROFILE_WEARABLE_IVI) { - 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 */ - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); /* LCOV_EXCL_LINE */ - else /* LCOV_EXCL_LINE */ - is_audio_hf_initialized = true; /* LCOV_EXCL_LINE */ - } - #ifndef TIZEN_FEATURE_HFP_DISABLE /* B2_3G */ error = bluetooth_telephony_init((void *)_bt_telephony_event_proxy, NULL); error = _bt_convert_telephony_error_code(error); @@ -150,13 +141,6 @@ int bt_audio_initialize(void) is_audio_ag_initialized = true; #endif - /* There is no success case for 3 profiles */ - if (!is_audio_a2dp_initialized && - (!TIZEN_PROFILE_WEARABLE_IVI || !is_audio_hf_initialized) && /* LCOV_EXCL_LINE */ - !is_audio_ag_initialized) { /* LCOV_EXCL_LINE */ - return BT_ERROR_OPERATION_FAILED; - } - return BT_ERROR_NONE; } @@ -174,30 +158,12 @@ int bt_audio_deinitialize(void) is_audio_a2dp_initialized = false; - if (TIZEN_PROFILE_WEARABLE_IVI) { /* LCOV_EXCL_START */ - error = bluetooth_hf_deinit(); - error = _bt_get_error_code(error); - if (BT_ERROR_NONE != error) - BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error); - - is_audio_hf_initialized = false; /* LCOV_EXCL_STOP */ - } - -#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); - - is_audio_ag_initialized = false; -#endif - return BT_ERROR_NONE; } int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type) { - int error; + int error = BT_ERROR_NONE; bluetooth_device_address_t addr_hex = { {0,} }; BT_CHECK_AUDIO_SUPPORT(); @@ -242,11 +208,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) { - BT_CHECK_HF_INIT_STATUS(); - error = bluetooth_hf_connect(&addr_hex); - break; - } /* else: goto default */ + break; case BT_AUDIO_PROFILE_TYPE_ALL: default: error = bluetooth_audio_connect(&addr_hex); @@ -262,7 +224,7 @@ int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type) int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type) { - int error; + int error = BT_ERROR_NONE; bluetooth_device_address_t addr_hex = { {0,} }; BT_CHECK_AUDIO_SUPPORT(); @@ -301,11 +263,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) { - BT_CHECK_HF_INIT_STATUS(); - error = bluetooth_hf_disconnect(&addr_hex); - break; - } /* else goto default */ + break; case BT_AUDIO_PROFILE_TYPE_ALL: default: error = bluetooth_audio_disconnect(&addr_hex); diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index e607d88..24b2392 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "bluetooth.h" #include "bluetooth_internal.h" @@ -3274,44 +3273,3 @@ static void __bt_convert_lower_to_upper(char *origin) } /* LCOV_EXCL_STOP */ -tizen_profile_t profile = _PROFILE_UNKNOWN; -tizen_profile_t _get_tizen_profile() -{ - char *profileName = NULL; - - if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1)) - return profile; - - system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); - if (!profileName) - return _PROFILE_UNKNOWN; - - switch (*profileName) { - case 'm': - case 'M': - profile = _PROFILE_MOBILE; - break; - case 'w': - case 'W': - profile = _PROFILE_WEARABLE; - break; - case 't': - case 'T': - profile = _PROFILE_TV; - break; - case 'i': - case 'I': - if (!strncasecmp(profileName, "ivi", 3)) - profile = _PROFILE_IVI; - else if (!strncasecmp(profileName, "iot", 3)) - profile = _PROFILE_IOT; - else - profile = _PROFILE_COMMON; - break; - default: // common or unknown ==> ALL ARE COMMON. - profile = _PROFILE_COMMON; - } - free(profileName); - - return profile; -} diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c index 339d72e..c6dee28 100644 --- a/test/bt_unit_test.c +++ b/test/bt_unit_test.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "bluetooth.h" #include "bluetooth_internal.h" @@ -1299,13 +1298,9 @@ void tc_usage_print(void) tc_table = tc_pxp; break; case BT_UNIT_TEST_TABLE_HF: - if (!TIZEN_PROFILE_WEARABLE_IVI) - goto __default__; tc_table = tc_hf; break; case BT_UNIT_TEST_TABLE_PBAP_CLIENT: - if (!TIZEN_PROFILE_WEARABLE_IVI) - goto __default__; tc_table = tc_pbap_client; break; case BT_UNIT_TEST_TABLE_ETC: @@ -1336,7 +1331,6 @@ void tc_usage_print(void) tc_table = tc_hr_collector; break; case BT_UNIT_TEST_TABLE_MAIN: -__default__: default: tc_table = tc_main; break; @@ -3321,13 +3315,8 @@ 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) { - ret = bt_pbap_client_set_connection_state_changed_cb(__bt_pbap_connection_state_changed_cb, - NULL); - if (ret != BT_ERROR_NONE) - TC_PRT("returns %s\n", __bt_get_error_message(ret)); - } ret = bt_socket_set_connection_state_changed_cb( + __bt_socket_connection_state_changed_cb, NULL); if (ret != BT_ERROR_NONE) TC_PRT("returns %s\n", __bt_get_error_message(ret)); @@ -3839,8 +3828,6 @@ int test_set_params(int test_id, char *param) } case BT_UNIT_TEST_TABLE_PBAP_CLIENT: - if (!TIZEN_PROFILE_WEARABLE_IVI) - goto __default__; { switch (test_id) { default: @@ -3909,7 +3896,6 @@ int test_set_params(int test_id, char *param) break; } -__default__: default: TC_PRT("There is no param to set\n"); need_to_set_params = false; @@ -8987,8 +8973,6 @@ int test_input_callback(void *data) } case BT_UNIT_TEST_TABLE_HF: { - if (!TIZEN_PROFILE_WEARABLE_IVI) - break; switch (test_id) { case BT_UNIT_TEST_FUNCTION_HF_INITIALIZE: ret = bt_hf_initialize(); @@ -9164,8 +9148,6 @@ int test_input_callback(void *data) break; } case BT_UNIT_TEST_TABLE_PBAP_CLIENT: { - if (!TIZEN_PROFILE_WEARABLE_IVI) - break; switch (test_id) { /*PBAP Test Cases */ @@ -9803,29 +9785,6 @@ int test_input_callback(void *data) bt_adapter_disable(); break; } - case BT_UNIT_TEST_FUNCTION_CHECK_FEATURE: { - int ret; - bool is_supported = false; - - if (g_test_param.param_count > 0) { - ret = system_info_get_custom_bool( - g_test_param.params[0], &is_supported); - if (ret != 0) - TC_PRT("returns %d", ret); - TC_PRT("%s is %s", g_test_param.params[0], - is_supported ? "true" : "false"); - __bt_free_test_param(&g_test_param); - } else { - ret = system_info_get_custom_bool( - "tizen.org/feature/network.bluetooth", &is_supported); - if (ret != 0) - TC_PRT("returns %d", ret); - TC_PRT("tizen.org/feature/network.bluetooth is %s", - is_supported ? "true" : "false"); - } - - break; - } case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS: need_to_set_params = true; TC_PRT("Select the function again");