summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseungku kim <seungku.kim@samsung.com>2015-07-17 18:20:29 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2015-07-21 14:40:36 +0900
commita38d7ab5f4ecbc91a6c8bfcc03e04c37e11a2310 (patch)
treee2b1295672be70dd6bdfe01daf82605cfc8db4d7
parentf20df3aba791be3874ba1bd015ef70fbf706a9d5 (diff)
downloadbluetooth-submit/tizen_tv/20150721.054204.tar.gz
bluetooth-submit/tizen_tv/20150721.054204.tar.bz2
bluetooth-submit/tizen_tv/20150721.054204.zip
Change-Id: I06c832852f00f2d5de3ec117192d0911fcf53af1
-rw-r--r--include/bluetooth_private.h30
-rw-r--r--packaging/capi-network-bluetooth.spec18
-rw-r--r--src/bluetooth-audio.c370
3 files changed, 172 insertions, 246 deletions
diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h
index 768d768..8e00a43 100644
--- a/include/bluetooth_private.h
+++ b/include/bluetooth_private.h
@@ -138,36 +138,6 @@ typedef enum {
BT_GATT_ROLE_CLIENT = 0x02,
} bt_gatt_role_e;
-#ifdef TIZEN_WEARABLE
-/**
- * @internal
- */
-typedef enum {
- BT_ADAPTER_LE_ADVERTISING_CONNECTABLE = 0x00, /**< Connectable undirected advertising (ADV_IND) */
- BT_ADAPTER_LE_ADVERTISING_CONNECTABLE_DIRECT_HIGH = 0x01, /* @Deprecated since Tizen 2.4 */
- BT_ADAPTER_LE_ADVERTISING_SCANNABLE = 0x02, /**< Scannable undirected advertising (ADV_SCAN_IND) */
- BT_ADAPTER_LE_ADVERTISING_NON_CONNECTABLE = 0x03, /**< Non connectable undirected advertising (ADV_NONCOND_IND) */
- BT_ADAPTER_LE_ADVERTISING_CONNECTABLE_DIRECT_LOW = 0x04, /* @Deprecated since Tizen 2.4 */
-} bt_adapter_le_advertising_type_e;
-
-/**
- * @internal
- */
-typedef enum {
- BT_ADAPTER_LE_PACKET_DATA_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02, /**<Incomplete list of 16 bit UUIDs */
- BT_ADAPTER_LE_PACKET_DATA_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03, /**< Complete list of 16 bit UUIDs */
- BT_ADAPTER_LE_PACKET_DATA_INCOMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x06, /**< Incomplete list of 128 bit UUIDs */
- BT_ADAPTER_LE_PACKET_DATA_COMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x07, /**< Complete list of 128 bit UUID */
- BT_ADAPTER_LE_PACKET_DATA_LOCAL_NAME = 0x09, /**<local device name */
- BT_ADAPTER_LE_PACKET_DATA_TX_POWER_LEVEL = 0x0a, /**< TX-Power level*/
- BT_ADAPTER_LE_PACKET_DATA_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14, /**< List of 16-bit Service Solicitation UUIDs*/
- BT_ADAPTER_LE_PACKET_DATA_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15, /**< List of 128-bit Service Solicitation UUIDs*/
- BT_ADAPTER_LE_PACKET_DATA_SERVICE_DATA = 0x16, /**< Service data */
- BT_ADAPTER_LE_PACKET_DATA_APPEARANCE = 0x19, /**< Appearance*/
- BT_ADAPTER_LE_PACKET_DATA_MANUFACTURER_SPECIFIC_DATA = 0xff, /**< Manufacturer data */
-} bt_adapter_le_packet_data_type_e;
-#endif
-
/**
* @internal
*/
diff --git a/packaging/capi-network-bluetooth.spec b/packaging/capi-network-bluetooth.spec
index af1abdc..0e33c14 100644
--- a/packaging/capi-network-bluetooth.spec
+++ b/packaging/capi-network-bluetooth.spec
@@ -16,7 +16,7 @@ BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(bluetooth-api)
BuildRequires: pkgconfig(capi-base-common)
-%if "%{?tizen_profile_name}" == "wearable"
+%if "%{?profile}" == "wearable"
BuildRequires: pkgconfig(privacy-manager-client)
%endif
@@ -48,10 +48,10 @@ This package is C-API test application.
cp %{SOURCE1001} %{SOURCE1002} .
%build
-%if "%{?tizen_profile_name}" == "wearable"
-export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_WEARABLE"
-export FFLAGS="$FFLAGS -DTIZEN_WEARABLE"
+%if "%{?profile}" == "wearable"
+#export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
+#export CXXFLAGS="$CXXFLAGS -DTIZEN_WEARABLE"
+#export FFLAGS="$FFLAGS -DTIZEN_WEARABLE"
%endif
export CFLAGS="$CFLAGS -DBT_ENABLE_LEGACY_GATT_CLIENT"
@@ -66,7 +66,7 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
-%if "%{?tizen_profile_name}" == "wearable"
+%if "%{?profile}" == "wearable"
export CFLAGS+=" -DTELEPHONY_DISABLED"
export CXXFLAGS+=" -DTELEPHONY_DISABLED"
export FFLAGS+=" -DTELEPHONY_DISABLED"
@@ -87,10 +87,10 @@ export FFLAGS+=" -DARCH64"
%endif
%cmake \
-%if "%{?tizen_profile_name}" == "wearable"
- -DTIZEN_WEARABLE=YES \
+%if "%{?profile}" == "wearable"
+# -DTIZEN_WEARABLE=YES \
%else
-%if "%{?tizen_profile_name}" == "mobile"
+%if "%{?profile}" == "mobile"
-DTIZEN_WEARABLE=NO \
%endif
%endif
diff --git a/src/bluetooth-audio.c b/src/bluetooth-audio.c
index e2cdf63..942f48b 100644
--- a/src/bluetooth-audio.c
+++ b/src/bluetooth-audio.c
@@ -30,7 +30,11 @@ typedef struct _call_list_s {
GList *list;
} call_list_s;
-static bool is_audio_initialized = false;
+static bool is_audio_a2dp_initialized = false;
+#ifdef TIZEN_WEARABLE
+static bool is_audio_hf_initialized = false;
+#endif
+static bool is_audio_ag_initialized = false;
#if defined (TIZEN_HFP_DISABLE) && defined (TIZEN_A2DP_DISABLE)
#define BT_CHECK_AUDIO_SUPPORT() \
@@ -65,22 +69,44 @@ static bool is_audio_initialized = false;
#define BT_CHECK_A2DP_SUPPORT()
#endif
+#ifdef TIZEN_AUDIO_HF_DISABLE
+#define BT_CHECK_HF_SUPPORT() \
+ { \
+ BT_CHECK_BT_SUPPORT(); \
+ LOGE("[%s] NOT_SUPPORTED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_SUPPORTED); \
+ return BT_ERROR_NOT_SUPPORTED; \
+ }
+#else
+#define BT_CHECK_HF_SUPPORT()
+#endif
+
#define BT_CHECK_AUDIO_INIT_STATUS() \
- if (__bt_check_audio_init_status() == BT_ERROR_NOT_INITIALIZED) \
+ if (is_audio_a2dp_initialized != true && is_audio_ag_initialized != true) \
{ \
LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
return BT_ERROR_NOT_INITIALIZED; \
}
-int __bt_check_audio_init_status(void)
-{
- if (is_audio_initialized != true) {
- BT_ERR("NOT_INITIALIZED(0x%08x)", BT_ERROR_NOT_INITIALIZED);
- return BT_ERROR_NOT_INITIALIZED;
+#define BT_CHECK_A2DP_INIT_STATUS() \
+ if (is_audio_a2dp_initialized != true) \
+ { \
+ LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
+ return BT_ERROR_NOT_INITIALIZED; \
}
- return BT_ERROR_NONE;
-}
+#define BT_CHECK_HF_INIT_STATUS() \
+ if (is_audio_hf_initialized != true) \
+ { \
+ LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
+ return BT_ERROR_NOT_INITIALIZED; \
+ }
+
+#define BT_CHECK_AG_INIT_STATUS() \
+ if (is_audio_ag_initialized != true) \
+ { \
+ LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
+ return BT_ERROR_NOT_INITIALIZED; \
+ }
/*The below API is just to convert the error from Telephony API's to CAPI error codes,
* this is temporary change and changes to proper error code will be done in
@@ -125,32 +151,31 @@ int bt_audio_initialize(void)
BT_CHECK_AUDIO_SUPPORT();
BT_CHECK_INIT_STATUS();
+
error = bluetooth_audio_init(_bt_audio_event_proxy, NULL);
error = _bt_get_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
+ else
+ is_audio_a2dp_initialized = true;
#ifdef TIZEN_WEARABLE
error = bluetooth_hf_init(_bt_hf_event_proxy, NULL);
error = _bt_get_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
+ else
+ is_audio_hf_initialized = true;
#endif
#ifndef TELEPHONY_DISABLED /* B2_3G */
error = bluetooth_telephony_init((void *)_bt_telephony_event_proxy, NULL);
error = _bt_convert_telephony_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("[%s] (0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
+ else
+ is_audio_ag_initialized = true;
#endif
-
- is_audio_initialized = true;
return BT_ERROR_NONE;
}
@@ -160,34 +185,32 @@ int bt_audio_deinitialize(void)
BT_CHECK_AUDIO_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
-#ifdef TIZEN_WEARABLE
- error = bluetooth_hf_deinit();
+ error = bluetooth_audio_deinit();
error = _bt_get_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
-#endif
+ else
+ is_audio_a2dp_initialized = false;
- error = bluetooth_audio_deinit();
+#ifdef TIZEN_WEARABLE
+ error = bluetooth_hf_deinit();
error = _bt_get_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
+ else
+ is_audio_hf_initialized = false;
+#endif
#ifndef TELEPHONY_DISABLED /* B2_3G */
error = bluetooth_telephony_deinit();
error = _bt_convert_telephony_error_code(error);
- if (BT_ERROR_NONE != error) {
+ if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
- return error;
- }
+ else
+ is_audio_ag_initialized = false;
#endif
- is_audio_initialized = false;
return BT_ERROR_NONE;
}
@@ -198,23 +221,22 @@ int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type)
BT_CHECK_AUDIO_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
if (type == BT_AUDIO_PROFILE_TYPE_HSP_HFP) {
BT_CHECK_HFP_SUPPORT();
-#ifdef TELEPHONY_DISABLED
- BT_ERR("NOT SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
+ BT_CHECK_AG_INIT_STATUS();
} else if (type == BT_AUDIO_PROFILE_TYPE_A2DP) {
BT_CHECK_A2DP_SUPPORT();
+ BT_CHECK_A2DP_INIT_STATUS();
} else if (type == BT_AUDIO_PROFILE_TYPE_ALL) {
#if defined (TIZEN_HFP_DISABLE) || defined (TELEPHONY_DISABLED)
+ BT_CHECK_A2DP_INIT_STATUS();
BT_ERR("HSP NOT SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
type = BT_AUDIO_PROFILE_TYPE_A2DP;
#else
- BT_ERR("A2DP NOT SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- type = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
+ BT_CHECK_AUDIO_INIT_STATUS();
+ BT_ERR("HSP and A2DP SUPPORTED");
+ type = BT_AUDIO_PROFILE_TYPE_ALL;
#endif
}
@@ -234,9 +256,6 @@ int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type)
error = bluetooth_hf_connect(&addr_hex);
break;
#endif
- case BT_AUDIO_PROFILE_TYPE_A2DP_SINK:
- error = bluetooth_av_source_connect(&addr_hex);
- break;
case BT_AUDIO_PROFILE_TYPE_ALL:
default:
error = bluetooth_audio_connect(&addr_hex);
@@ -256,16 +275,23 @@ int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type
BT_CHECK_AUDIO_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
if (type == BT_AUDIO_PROFILE_TYPE_HSP_HFP) {
BT_CHECK_HFP_SUPPORT();
-#ifdef TELEPHONY_DISABLED
- BT_ERR("NOT SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
+ BT_CHECK_AG_INIT_STATUS();
} else if (type == BT_AUDIO_PROFILE_TYPE_A2DP) {
BT_CHECK_A2DP_SUPPORT();
+ BT_CHECK_A2DP_INIT_STATUS();
+ } else if (type == BT_AUDIO_PROFILE_TYPE_ALL) {
+#if defined (TIZEN_HFP_DISABLE) || defined (TELEPHONY_DISABLED)
+ BT_CHECK_A2DP_INIT_STATUS();
+ BT_ERR("HSP NOT SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
+ type = BT_AUDIO_PROFILE_TYPE_A2DP;
+#else
+ BT_CHECK_AUDIO_INIT_STATUS();
+ BT_ERR("HSP and A2DP SUPPORTED");
+ type = BT_AUDIO_PROFILE_TYPE_ALL;
+#endif
}
BT_CHECK_INPUT_PARAMETER(remote_address);
@@ -284,9 +310,6 @@ int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type
error = bluetooth_hf_disconnect(&addr_hex);
break;
#endif
- case BT_AUDIO_PROFILE_TYPE_A2DP_SINK:
- error = bluetooth_av_source_disconnect(&addr_hex);
- break;
case BT_AUDIO_PROFILE_TYPE_ALL:
default:
error = bluetooth_audio_disconnect(&addr_hex);
@@ -325,7 +348,7 @@ int bt_ag_notify_speaker_gain(int gain)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
error = bluetooth_telephony_set_speaker_gain((unsigned short)gain);
error = _bt_convert_telephony_error_code(error);
if (BT_ERROR_NONE != error) {
@@ -340,7 +363,7 @@ int bt_ag_get_speaker_gain(int *gain)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(gain);
error = bluetooth_telephony_get_headset_volume((unsigned int *)gain);
error = _bt_convert_telephony_error_code(error);
@@ -357,7 +380,7 @@ int bt_ag_is_nrec_enabled(bool *enabled)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(enabled);
error = bluetooth_telephony_is_nrec_enabled(&is_enabled);
@@ -380,7 +403,7 @@ int bt_ag_is_wbs_mode(bool *wbs_mode)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(wbs_mode);
error = bluetooth_telephony_is_wbs_mode(&is_wbs_mode);
@@ -401,7 +424,7 @@ int bt_ag_set_microphone_gain_changed_cb(bt_ag_microphone_gain_changed_cb callba
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_MICROPHONE_GAIN_CHANGE, callback, user_data);
return BT_ERROR_NONE;
@@ -411,7 +434,7 @@ int bt_ag_unset_microphone_gain_changed_cb(void)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_MICROPHONE_GAIN_CHANGE) == true)
_bt_unset_cb(BT_EVENT_AG_MICROPHONE_GAIN_CHANGE);
return BT_ERROR_NONE;
@@ -422,7 +445,7 @@ int bt_ag_set_speaker_gain_changed_cb(bt_ag_speaker_gain_changed_cb callback,
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_SPEAKER_GAIN_CHANGE, callback, user_data);
return BT_ERROR_NONE;
@@ -433,7 +456,7 @@ int bt_ag_unset_speaker_gain_changed_cb(void)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_SPEAKER_GAIN_CHANGE) == true)
_bt_unset_cb(BT_EVENT_AG_SPEAKER_GAIN_CHANGE);
return BT_ERROR_NONE;
@@ -445,7 +468,7 @@ int bt_ag_open_sco(void)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
error = bluetooth_telephony_audio_open();
error = _bt_convert_telephony_error_code(error);
if (error != BT_ERROR_NONE) {
@@ -460,7 +483,7 @@ int bt_ag_close_sco(void)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
error = bluetooth_telephony_audio_close();
error = _bt_convert_telephony_error_code(error);
if (error != BT_ERROR_NONE) {
@@ -473,7 +496,7 @@ int bt_ag_is_sco_opened(bool *opened)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(opened);
if (bluetooth_telephony_is_sco_connected())
*opened = true;
@@ -487,7 +510,7 @@ int bt_ag_set_sco_state_changed_cb(bt_ag_sco_state_changed_cb callback,
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_SCO_CONNECTION_STATUS, callback, user_data);
return BT_ERROR_NONE;
@@ -497,7 +520,7 @@ int bt_ag_unset_sco_state_changed_cb(void)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_SCO_CONNECTION_STATUS) == true)
_bt_unset_cb(BT_EVENT_AG_SCO_CONNECTION_STATUS);
return BT_ERROR_NONE;
@@ -509,7 +532,7 @@ int bt_ag_notify_call_event(bt_ag_call_event_e event, unsigned int call_id, cons
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_INFO("call_id [%d] / event [%d]", call_id, event);
switch(event) {
@@ -556,7 +579,7 @@ int bt_ag_notify_call_list(bt_call_list_h list)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(list);
handle = (call_list_s *)list;
call_count = g_list_length(handle->list);
@@ -574,7 +597,7 @@ int bt_ag_notify_voice_recognition_state(bool state)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (state)
error = bluetooth_telephony_start_voice_recognition();
else
@@ -591,7 +614,7 @@ int bt_ag_set_call_handling_event_cb(bt_ag_call_handling_event_cb callback,
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_CALL_HANDLING_EVENT, callback, user_data);
return BT_ERROR_NONE;
@@ -601,7 +624,7 @@ int bt_ag_unset_call_handling_event_cb(void)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_CALL_HANDLING_EVENT) == true)
_bt_unset_cb(BT_EVENT_AG_CALL_HANDLING_EVENT);
return BT_ERROR_NONE;
@@ -613,7 +636,7 @@ int bt_ag_set_multi_call_handling_event_cb(
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_MULTI_CALL_HANDLING_EVENT, callback, user_data);
return BT_ERROR_NONE;
@@ -623,7 +646,7 @@ int bt_ag_unset_multi_call_handling_event_cb(void)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_MULTI_CALL_HANDLING_EVENT) == true)
_bt_unset_cb(BT_EVENT_AG_MULTI_CALL_HANDLING_EVENT);
return BT_ERROR_NONE;
@@ -634,7 +657,7 @@ int bt_ag_set_dtmf_transmitted_cb(bt_ag_dtmf_transmitted_cb callback,
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_AG_DTMF_TRANSMITTED, callback, user_data);
return BT_ERROR_NONE;
@@ -644,7 +667,7 @@ int bt_ag_unset_dtmf_transmitted_cb(void)
{
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
if (_bt_check_cb(BT_EVENT_AG_DTMF_TRANSMITTED) == true)
_bt_unset_cb(BT_EVENT_AG_DTMF_TRANSMITTED);
return BT_ERROR_NONE;
@@ -657,6 +680,7 @@ int bt_ag_is_connected(bool *connected)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(connected);
error = bluetooth_telephony_is_connected(&is_connected);
@@ -678,7 +702,7 @@ int bt_call_list_create(bt_call_list_h *list)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(list);
if (*list != NULL) {
BT_ERR("BT_ERROR_ALREADY_DONE(0x%08x)", BT_ERROR_ALREADY_DONE);
@@ -701,7 +725,7 @@ int bt_call_list_destroy(bt_call_list_h list)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(list);
handle = (call_list_s *)list;
result = bt_call_list_reset(list);
@@ -716,7 +740,7 @@ int bt_call_list_reset(bt_call_list_h list)
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(list);
handle = (call_list_s *)list;
do {
@@ -740,7 +764,7 @@ int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state
BT_CHECK_HFP_SUPPORT();
BT_CHECK_INIT_STATUS();
- BT_CHECK_AUDIO_INIT_STATUS();
+ BT_CHECK_AG_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(list);
BT_CHECK_INPUT_PARAMETER(phone_number);
@@ -762,6 +786,10 @@ int bt_a2dp_set_content_protection(bool status)
{
int error;
+ BT_CHECK_A2DP_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_A2DP_INIT_STATUS();
+
error = bluetooth_a2dp_set_content_protection(status);
error = _bt_get_error_code(error);
if (BT_ERROR_NONE != error) {
@@ -774,7 +802,9 @@ int bt_a2dp_set_content_protection(bool status)
#ifdef TIZEN_WEARABLE
int bt_hf_initialize(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
BT_CHECK_INIT_STATUS();
@@ -785,15 +815,13 @@ int bt_hf_initialize(void)
return error;
}
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_deinitialize(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
BT_CHECK_INIT_STATUS();
@@ -804,18 +832,15 @@ int bt_hf_deinitialize(void)
return error;
}
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_notify_call_event(bt_hf_call_event_e event, char *phone_number)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error = BT_ERROR_NONE;
- BT_CHECK_INIT_STATUS();
BT_INFO("event [%d]", event);
switch(event) {
@@ -857,145 +882,117 @@ int bt_hf_notify_call_event(bt_hf_call_event_e event, char *phone_number)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
}
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_notify_speaker_gain(int gain)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
- BT_CHECK_INIT_STATUS();
error = bluetooth_hf_set_speaker_gain((unsigned int)gain);
error = _bt_get_error_code(error);
if (BT_ERROR_NONE != error)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error), error);
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_set_speaker_gain_changed_cb(bt_hf_speaker_gain_changed_cb callback, void *user_data)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(callback);
+
_bt_set_cb(BT_EVENT_HF_SPEAKER_GAIN_CHANGE, callback, user_data);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_unset_speaker_gain_changed_cb(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
if (_bt_check_cb(BT_EVENT_HF_SPEAKER_GAIN_CHANGE) == true)
_bt_unset_cb(BT_EVENT_HF_SPEAKER_GAIN_CHANGE);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_notify_voice_recognition_state(bool state)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
- BT_CHECK_INIT_STATUS();
error = bluetooth_hf_voice_recognition(state);
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;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_set_call_status_updated_event_cb(bt_hf_call_status_updated_event_cb callback, void *user_data)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_HF_CALL_STATUS_UPDATED_EVENT, callback, user_data);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_unset_call_status_updated_event_cb(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
if (_bt_check_cb(BT_EVENT_HF_CALL_STATUS_UPDATED_EVENT) == true)
_bt_unset_cb(BT_EVENT_HF_CALL_STATUS_UPDATED_EVENT);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_close_sco(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
- BT_CHECK_INIT_STATUS();
error = bluetooth_hf_audio_disconnect();
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;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_send_dtmf(char *dtmf)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
int error;
- BT_CHECK_INIT_STATUS();
error = bluetooth_hf_send_dtmf(dtmf);
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;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_is_connected(bool *connected)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
- int error;
- gboolean is_connected = false;
-
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(connected);
+ int error;
+ gboolean is_connected = false;
+
error = bluetooth_hf_is_connected(&is_connected);
error = _bt_get_error_code(error);
if (error != BT_ERROR_NONE)
@@ -1007,21 +1004,17 @@ int bt_hf_is_connected(bool *connected)
*connected = false;
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_is_sco_opened(bool *opened)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
- int error;
- unsigned int audio_connected = BLUETOOTH_HF_AUDIO_DISCONNECTED;
-
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(opened);
+ int error;
+ unsigned int audio_connected = BLUETOOTH_HF_AUDIO_DISCONNECTED;
+
error = bluetooth_hf_get_audio_connected(&audio_connected);
error = _bt_get_error_code(error);
if (error != BT_ERROR_NONE)
@@ -1033,42 +1026,34 @@ int bt_hf_is_sco_opened(bool *opened)
*opened = false;
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_get_codec_id(unsigned int *codec_id)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
- int error;
-
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(codec_id);
+ int error;
+
error = bluetooth_hf_get_codec(codec_id);
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;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_get_call_status_info_list(GSList **call_list)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+ BT_CHECK_INPUT_PARAMETER(call_list);
+
int error;
bt_hf_call_list_s *hf_call_list = NULL;
GList *l;
- BT_CHECK_INIT_STATUS();
- BT_CHECK_INPUT_PARAMETER(call_list);
-
error = bluetooth_hf_request_call_list(&hf_call_list);
error = _bt_get_error_code(error);
if (error != BT_ERROR_NONE) {
@@ -1093,115 +1078,86 @@ int bt_hf_get_call_status_info_list(GSList **call_list)
bluetooth_hf_free_call_list(hf_call_list);
return error;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
-#ifdef TIZEN_AUDIO_HF_ENABLE
static void __bt_hf_free_call_status_info(void *data)
{
bt_hf_call_status_info_s *call_info = (bt_hf_call_status_info_s*)data;
g_free(call_info->number);
g_free(call_info);
}
-#endif
int bt_hf_free_call_status_info_list(GSList *call_list)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(call_list);
g_slist_free_full(call_list, __bt_hf_free_call_status_info);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_set_sco_state_changed_cb(bt_hf_sco_state_changed_cb callback,
void *user_data)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(callback);
_bt_set_cb(BT_EVENT_HF_SCO_CONNECTION_STATUS, callback, user_data);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_unset_sco_state_changed_cb(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
if (_bt_check_cb(BT_EVENT_HF_SCO_CONNECTION_STATUS) == true)
_bt_unset_cb(BT_EVENT_HF_SCO_CONNECTION_STATUS);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_set_call_handling_event_cb(bt_hf_call_handling_event_cb callback,
void *user_data)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(callback);
+
_bt_set_cb(BT_EVENT_HF_CALL_HANDLING_EVENT, callback, user_data);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_unset_call_handling_event_cb(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
if (_bt_check_cb(BT_EVENT_HF_CALL_HANDLING_EVENT) == true)
_bt_unset_cb(BT_EVENT_HF_CALL_HANDLING_EVENT);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_set_multi_call_handling_event_cb(
bt_hf_multi_call_handling_event_cb callback,
void *user_data)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
BT_CHECK_INPUT_PARAMETER(callback);
+
_bt_set_cb(BT_EVENT_HF_MULTI_CALL_HANDLING_EVENT, callback, user_data);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
int bt_hf_unset_multi_call_handling_event_cb(void)
{
-#ifdef TIZEN_AUDIO_HF_ENABLE
BT_CHECK_INIT_STATUS();
+ BT_CHECK_HF_SUPPORT();
+
if (_bt_check_cb(BT_EVENT_HF_MULTI_CALL_HANDLING_EVENT) == true)
_bt_unset_cb(BT_EVENT_HF_MULTI_CALL_HANDLING_EVENT);
return BT_ERROR_NONE;
-#else
- BT_ERR("NOT_SUPPORTED(0x%08x)", BT_ERROR_NOT_SUPPORTED);
- return BT_ERROR_NOT_SUPPORTED;
-#endif
}
#endif