Fix the coding rule
[platform/core/connectivity/bluetooth-agent.git] / hf-agent / bluetooth-hf-agent.c
index 6662f76..bf9b365 100755 (executable)
@@ -483,7 +483,7 @@ static void __hf_agent_method(GDBusConnection *connection,
                                g_variant_new("(i)", sco_audio_connected));
        } else if (g_strcmp0(method_name, "IsHfConnected") == 0) {
                DBG("Going to call IsHfConnected");
-               INFO("is_hf_connected : %s", is_hf_connected ? "Connected":"Disconnected");
+               INFO("is_hf_connected : %s", is_hf_connected ? "Connected" : "Disconnected");
 
                g_dbus_method_invocation_return_value(context,
                                g_variant_new("(b)", is_hf_connected));
@@ -1064,7 +1064,8 @@ static int __bt_hf_agent_handle_ccwa(bt_hf_agent_info_t *bt_hf_info,
        }
 
        if ((ccwa = strstr(buf, "\r\n+CCWA"))) {
-               snprintf(fmt_str, sizeof(fmt_str), "\r\n+CCWA: \"%%%ds", sizeof(number) - 1);
+               snprintf(fmt_str, sizeof(fmt_str), "\r\n+CCWA: \"%%%ds",
+                                                                       (int)(sizeof(number) - 1));
                if (sscanf(ccwa, fmt_str, number) == 1) {
                        sep = strchr(number, '"');
                        sep[0] = '\0';
@@ -1090,7 +1091,8 @@ static int __bt_hf_agent_handle_ccwa(bt_hf_agent_info_t *bt_hf_info,
        return 0;
 }
 
-static GSList *__bt_hf_prepare_call_list(const char *buf) {
+static GSList *__bt_hf_prepare_call_list(const char *buf)
+{
        GSList *call_list = NULL;
        char *str = NULL;
        char *ptr = NULL;
@@ -1493,7 +1495,8 @@ static int __bt_hf_agent_handler_ciev(bt_hf_agent_info_t *bt_hf_info, const char
 
        DBG("++++++++ __bt_hf_agent_handler_ciev +++++++++");
 
-       snprintf(fmt_str, sizeof(fmt_str), "\r\n+CIEV:%%%ds\r\n", sizeof(indicator) - 1);
+       snprintf(fmt_str, sizeof(fmt_str), "\r\n+CIEV:%%%ds\r\n",
+                                                               (int)(sizeof(indicator) - 1));
        if (sscanf(buf, fmt_str, indicator) == 1) {
                sep = strchr(indicator, ',');
                sep[0] = '\0';
@@ -1601,7 +1604,8 @@ static int __bt_hf_agent_handler_xsat(bt_hf_agent_info_t *bt_hf_info,
        char fmt_str[BT_HF_CMD_BUF_SIZE];
 
        DBG("+++++++++ __bt_hf_agent_handler_xsat +++++++++");
-       snprintf(fmt_str, sizeof(fmt_str), "\r\n+XSAT:%%d,%%%ds\r\n", sizeof(msg) - 1);
+       snprintf(fmt_str, sizeof(fmt_str), "\r\n+XSAT:%%d,%%%ds\r\n",
+                                                                               (int)(sizeof(msg) - 1));
        if (sscanf(buf, fmt_str, &app_id, msg)) {
                if (app_id == 2 && strstr(msg, "READTXPOWER")) {
                        char cmd_buf[BT_HF_CMD_BUF_SIZE * 2] = {0, };
@@ -2366,21 +2370,21 @@ static gboolean __bt_hf_agent_sco_accept_cb(GIOChannel *chan, GIOCondition cond,
 void _bt_convert_addr_string_to_type_rev(unsigned char *addr,
                                        const char *address)
 {
-        int i;
-        char *ptr = NULL;
+       int i;
+       char *ptr = NULL;
 
        ret_if(address == NULL);
        ret_if(addr == NULL);
 
-        for (i = 0; i < 6; i++) {
-                addr[5 - i] = strtol(address, &ptr, 16);
-                if (ptr[0] != '\0') {
-                        if (ptr[0] != ':')
-                                return;
+       for (i = 0; i < 6; i++) {
+               addr[5 - i] = strtol(address, &ptr, 16);
+               if (ptr[0] != '\0') {
+                       if (ptr[0] != ':')
+                               return;
 
-                        address = ptr + 1;
-                }
-        }
+                       address = ptr + 1;
+               }
+       }
 }
 
 static gboolean __bt_hf_agent_sco_accept(bt_hf_agent_info_t *bt_hf_info)
@@ -2547,13 +2551,16 @@ static gboolean __bt_establish_service_level_conn(bt_hf_agent_info_t *bt_hf_info
                        BT_HF_FEATURE_CLI_PRESENTATION |
                        BT_HF_FEATURE_VOICE_RECOGNITION |
                        BT_HF_FEATURE_REMOTE_VOLUME_CONTROL |
-                       BT_HF_FEATURE_ENHANCED_CALL_STATUS |
-                       BT_HF_FEATURE_CODEC_NEGOTIATION;
+                       BT_HF_FEATURE_ENHANCED_CALL_STATUS;
+
+#ifdef TIZEN_WEARABLE
+       feature = feature | BT_HF_FEATURE_CODEC_NEGOTIATION;
+#endif
 
        snprintf(cmd_buf, sizeof(cmd_buf), BT_HF_FEATURES, feature);
        ret = __bt_hf_send_and_read(bt_hf_info, cmd_buf, buf,
                                strlen(cmd_buf));
-       if (!ret )
+       if (!ret)
                return FALSE;
 
        buf_ptr = strstr(buf, "\r\n+BRSF:");
@@ -2564,6 +2571,7 @@ static gboolean __bt_establish_service_level_conn(bt_hf_agent_info_t *bt_hf_info
                return FALSE;
        INFO("Gateway supported features are 0x%X", bt_hf_info->ag_features);
 
+#ifdef TIZEN_WEARABLE
        if (bt_hf_info->ag_features & BT_AG_FEATURE_CODEC_NEGOTIATION) {
                ret = _hf_agent_codec_setup(bt_hf_info->remote_addr, BT_HF_CODEC_ID_MSBC);
                if (ret != BT_HF_AGENT_ERROR_NONE)
@@ -2572,7 +2580,9 @@ static gboolean __bt_establish_service_level_conn(bt_hf_agent_info_t *bt_hf_info
                ret = __bt_hf_send_available_codec(bt_hf_info, 0);
                if (!ret)
                        return FALSE;
-       } else {
+       } else
+#endif
+       {
                /* Default codec is NB */
                ret = _hf_agent_codec_setup(bt_hf_info->remote_addr, BT_HF_CODEC_ID_CVSD);
                if (ret != BT_HF_AGENT_ERROR_NONE)
@@ -3318,7 +3328,6 @@ static int bt_hf_agent_send_at_cmd(GDBusMethodInvocation *context, char *atcmd)
 
 static uint32_t __bt_hf_agent_get_hf_features(void)
 {
-
        uint32_t hf_features = BT_HF_FEATURE_EC_ANDOR_NR |
                        BT_HF_FEATURE_CALL_WAITING_AND_3WAY |
                        BT_HF_FEATURE_CLI_PRESENTATION |
@@ -3327,6 +3336,10 @@ static uint32_t __bt_hf_agent_get_hf_features(void)
                        BT_HF_FEATURE_ENHANCED_CALL_STATUS |
                        BT_HF_FEATURE_CODEC_NEGOTIATION;
 
+#ifdef TIZEN_WEARABLE
+       hf_features = hf_features | BT_HF_FEATURE_CODEC_NEGOTIATION;
+#endif
+
        hf_ver = HFP_VERSION_1_6;
 
        return hf_features;