Fix the coding style errors (bt-service)
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-audio.c
index 599dd03..9d4eca6 100755 (executable)
@@ -464,7 +464,7 @@ void _bt_add_headset_to_list(int type, int status, const char *address)
        }
 
        connected_device->device_state = status;
-       if (status == BT_STATE_CONNECTED)
+       if ((status == BT_STATE_CONNECTED) || (status == BT_STATE_CONNECTING))
                connected_device->type |= type;
        g_strlcpy(connected_device->device_address, address,
                        sizeof(connected_device->device_address));
@@ -544,19 +544,21 @@ static gboolean __bt_device_support_uuid(char *remote_address,
                                bt_audio_type_t type)
 {
        GArray *dev_list = NULL;
-       int size,i,j;
+       int size;
+       int i;
+       int j;
        bluetooth_device_info_t info;
        char bond_address[BT_ADDRESS_STRING_SIZE] = { 0 };
        gboolean ret = FALSE;
 
        BT_DBG("+");
 
-       dev_list = g_array_new (FALSE, FALSE, sizeof(gchar));
+       dev_list = g_array_new(FALSE, FALSE, sizeof(gchar));
 
        _bt_get_bonded_devices(&dev_list);
        size = (dev_list->len) / sizeof(bluetooth_device_info_t);
 
-       for (i=0; i < size; i++) {
+       for (i = 0; i < size; i++) {
                info = g_array_index(dev_list, bluetooth_device_info_t, i);
                _bt_convert_addr_type_to_string(bond_address,
                                info.device_address.addr);
@@ -661,8 +663,10 @@ int _bt_audio_connect(int request_id, int type,
                if (__bt_device_support_uuid(address, BT_AUDIO_HSP)) {
                        uuid = HFP_HS_UUID;
                        func_data->pending = BT_PENDING_CONNECT;
+                       type = BT_AUDIO_HSP;
                } else if (__bt_device_support_uuid(address, BT_AUDIO_A2DP)) {
                        uuid = A2DP_SINK_UUID;
+                       type = BT_AUDIO_A2DP;
                } else {
                        BT_ERR("No audio role supported");
                        result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;