Apply tizen 3.0 based product patchsets
[platform/core/connectivity/bluetooth-agent.git] / ag-agent / bluetooth-ag-manager.c
old mode 100755 (executable)
new mode 100644 (file)
index 5b09c3d..5ba4477
@@ -124,7 +124,7 @@ static const char *agent_supported_character_set[] = {
        "\"UTF-8\"", "\"IRA\""
 };
 
-#if defined(TIZEN_WEARABLE) && defined(TIZEN_BT_HFP_AG_ENABLE)
+#if defined(TIZEN_PROFILE_WEARABLE) && defined(TIZEN_FEATURE_BT_HFP_AG)
 static const char *ag_chld_str = "0,1,2";
 #else
 static const char *ag_chld_str = "0,1,2,3";
@@ -471,8 +471,8 @@ static bt_hfp_agent_error_t __bt_hfp_modify_indicator(
 {
        bt_ag_indicators_t *hf_ind = NULL;
        int i;
-#ifdef TIZEN_MEDIA_ENHANCE
-       if(g_strcmp0(indicator_name,
+#ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
+       if (g_strcmp0(indicator_name,
                HFP_AGENT_CALLSETUP_INDICATOR) == 0)
                _bt_ag_agent_check_transport_state();
 #endif
@@ -528,6 +528,11 @@ static void __bt_hfp_handle_call_conference(void)
 
                struct telephony_call *t_call = t_call_list->data;
 
+               if (t_call == NULL) {
+                       ERR("t_call is NULL");
+                       break;
+               }
+
                if (t_call->call_status == HFP_CALL_STATUS_ACTIVE) {
                        if (t_active_call == NULL)
                                t_active_call = t_call;
@@ -535,7 +540,7 @@ static void __bt_hfp_handle_call_conference(void)
                        t_active_call_count++;
 
                        if (t_active_call_count >= 2) {
-                               if (!t_active_call->call_conference)
+                               if (t_active_call->call_conference == FALSE)
                                        t_active_call->call_conference = TRUE;
                                t_call->call_conference = TRUE;
                        }
@@ -547,22 +552,18 @@ static void __bt_hfp_handle_call_conference(void)
                        t_held_call_count++;
 
                        if (t_held_call_count >= 2) {
-                               if (!t_held_call->call_conference)
+                               if (t_held_call->call_conference == FALSE)
                                        t_held_call->call_conference = TRUE;
                                t_call->call_conference = TRUE;
                        }
                }
        }
 
-       if (t_held_call_count == 1) {
-                       if (t_held_call->call_conference)
-                               t_held_call->call_conference = FALSE;
-               }
+       if (t_held_call != NULL && t_held_call_count == 1)
+               t_held_call->call_conference = FALSE;
 
-       if (t_active_call_count == 1) {
-               if (t_active_call->call_conference)
-                       t_active_call->call_conference = FALSE;
-       }
+       if (t_active_call != NULL && t_active_call_count == 1)
+               t_active_call->call_conference = FALSE;
 }
 
 static gboolean __bt_hfp_on_call_hold_timeout(gpointer t_data)
@@ -701,9 +702,8 @@ static void __bt_hfp_set_call_status(struct telephony_call *t_call,
                        __bt_hfp_modify_indicator("call",
                                        INDICATOR_EVENT_CALL_INACTIVE);
 
-               if (org_status == HFP_CALL_STATUS_HOLD) {
+               if (org_status == HFP_CALL_STATUS_HOLD)
                        __bt_hfp_modify_indicator("callheld", INDICATOR_EVENT_CALLHELD_NONE);
-               }
 
                if ((org_status == HFP_CALL_STATUS_MO_ALERTING) ||
                        (org_status == HFP_CALL_STATUS_COMING) ||
@@ -1226,11 +1226,11 @@ void _bt_hfp_terminate_call_request(void *t_device)
        } else if ((t_alert = __bt_hfp_get_call_with_status(
                                HFP_CALL_STATUS_CREATE))
                != NULL) {
-               t_error = __bt_bt_hfp_reject_call(t_alert);
+               t_error = __bt_hfp_release_call(t_alert);
        } else if ((t_alert = __bt_hfp_get_call_with_status(
                                HFP_CALL_STATUS_MO_ALERTING))
                != NULL) {
-               t_error = __bt_bt_hfp_reject_call(t_alert);
+               t_error = __bt_hfp_release_call(t_alert);
        } else if       ((t_alert =  __bt_hfp_get_call_with_status(
                        HFP_CALL_STATUS_COMING)) != NULL) {
                t_error = __bt_bt_hfp_reject_call(t_alert);
@@ -1290,9 +1290,8 @@ void _bt_hfp_call_hold_request(const char *t_cmd, void *t_device)
 
        if (ret == TRUE)
                _bt_call_hold_response(t_device, HFP_STATE_MNGR_ERR_NONE);
-       else {
+       else
                _bt_call_hold_response(t_device, HFP_STATE_MNGR_ERR_AG_FAILURE);
-       }
 }
 
 void _bt_hfp_key_press_request(const char *t_key_press, void *t_device)
@@ -1522,7 +1521,7 @@ void _bt_hfp_release_all_calls_by_sender(const char *sender)
        GSList *temp_list = existing_call_list;
        GSList *next_list;
 
-       if(!sender)
+       if (!sender)
                return;
 
        DBG("sender [%s]", sender);
@@ -1612,7 +1611,7 @@ fail:
 static int __bt_hfp_get_phonebook_count(const char *path, uint32_t *max_size,
                                uint32_t *used)
 {
-#ifndef TIZEN_WEARABLE
+#ifndef TIZEN_PROFILE_WEARABLE
        GDBusConnection *g_conn;
        GDBusProxy *g_proxy;
        GError *err = NULL;
@@ -1791,7 +1790,7 @@ void _bt_hfp_read_phonebook_entries_list(void *t_device)
 
 static int __bt_hfp_get_phonebook_entries(int start_index, int end_index)
 {
-#ifdef TIZEN_WEARABLE
+#ifdef TIZEN_PROFILE_WEARABLE
        int count = 0;
 #else
        GDBusConnection *g_conn;
@@ -2111,7 +2110,7 @@ void _bt_hfp_get_imsi_reply(char *mcc, char *mnc, char *msin, void *t_device)
                _bt_hfp_get_imsi_rsp(t_device, mcc, mnc, msin,
                                HFP_STATE_MNGR_ERR_NONE);
        else
-               _bt_hfp_get_imsi_rsp(t_device,NULL,NULL,NULL,
+               _bt_hfp_get_imsi_rsp(t_device, NULL, NULL, NULL,
                                HFP_STATE_MNGR_ERR_NOT_ALLOWED);
 }