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)
#include <dlog.h>
#include <stdbool.h>
-#include <system_info.h>
#include <bluetooth-api.h>
#include <bluetooth-audio-api.h>
#include <bluetooth-telephony-api.h>
#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
*/
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
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(bluetooth-api)
BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(capi-system-info)
BuildRequires: cmake
%description
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);
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;
}
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();
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);
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();
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);
#include <stdio.h>
#include <stdbool.h>
#include <bluetooth-api.h>
-#include <system_info.h>
#include "bluetooth.h"
#include "bluetooth_internal.h"
}
/* 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;
-}
#include <sys/types.h>
#include <ifaddrs.h>
#include <linux/if_link.h>
-#include <system_info.h>
#include "bluetooth.h"
#include "bluetooth_internal.h"
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:
tc_table = tc_hr_collector;
break;
case BT_UNIT_TEST_TABLE_MAIN:
-__default__:
default:
tc_table = tc_main;
break;
__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));
}
case BT_UNIT_TEST_TABLE_PBAP_CLIENT:
- if (!TIZEN_PROFILE_WEARABLE_IVI)
- goto __default__;
{
switch (test_id) {
default:
break;
}
-__default__:
default:
TC_PRT("There is no param to set\n");
need_to_set_params = false;
}
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();
break;
}
case BT_UNIT_TEST_TABLE_PBAP_CLIENT: {
- if (!TIZEN_PROFILE_WEARABLE_IVI)
- break;
switch (test_id) {
/*PBAP Test Cases */
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");