Seperate GATT unregister instance function
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-headset-connection.c
index f88ffce..e489422 100644 (file)
@@ -128,7 +128,7 @@ void _bt_get_bluetooth_device_info(char *remote_address, bluetooth_device_info_t
        GArray *dev_list = NULL;
        int size = 0;
        int i = 0;
-       bluetooth_device_info_t info;
+       bluetooth_device_info_t *info;
        char bond_address[BT_ADDRESS_STRING_SIZE] = { 0 };
 
        if (device == NULL)
@@ -139,11 +139,11 @@ void _bt_get_bluetooth_device_info(char *remote_address, bluetooth_device_info_t
        _bt_get_bonded_devices(&dev_list);
        size = (dev_list->len) / sizeof(bluetooth_device_info_t);
        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);
+               info = &g_array_index(dev_list, bluetooth_device_info_t, i);
+               _bt_convert_addr_type_to_string(bond_address, info->device_address.addr);
                if (strcmp(bond_address, remote_address) == 0) {
                        BT_INFO("Match found");
-                       memcpy(device, &info, sizeof(bluetooth_device_info_t));
+                       memcpy(device, info, sizeof(bluetooth_device_info_t));
                        g_array_free(dev_list, TRUE);
                        return;
                }
@@ -174,33 +174,33 @@ void _bt_start_timer_for_connection(char *remote_address, int connection_type)
        int size;
        int i;
        int j;
-       bluetooth_device_info_t info;
+       bluetooth_device_info_t *info;
        char bond_address[BT_ADDRESS_STRING_SIZE] = { 0 };
        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++) {
-               info = g_array_index(dev_list, bluetooth_device_info_t, i);
+               info = &g_array_index(dev_list, bluetooth_device_info_t, i);
                j = 0;
                _bt_convert_addr_type_to_string(bond_address,
-                               info.device_address.addr);
+                               info->device_address.addr);
                if (strcmp(bond_address, remote_address) != 0)
                        continue;
                BT_INFO("Device address Matched");
 
-               while (j != info.service_index) {
-                       BT_INFO("UUID %s", info.uuids[j]);
+               while (j != info->service_index) {
+                       BT_INFO("UUID %s", info->uuids[j]);
                        if (connection_type == BT_AUDIO_A2DP) {
-                               if (strcmp(info.uuids[j], A2DP_SINK_UUID) == 0) {
+                               if (strcmp(info->uuids[j], A2DP_SINK_UUID) == 0) {
                                        BT_INFO("Remote Device has A2DP Sink Support start timer");
-                                       _bt_headset_add_timer_function(BT_AUDIO_A2DP, &info);
+                                       _bt_headset_add_timer_function(BT_AUDIO_A2DP, info);
                                        goto end;
                                }
                        } else {
-                               if (strcmp(info.uuids[j], HFP_HS_UUID) == 0) {
+                               if (strcmp(info->uuids[j], HFP_HS_UUID) == 0) {
                                        BT_INFO("Remote Device has HFP Sink Support start timer");
-                                       _bt_headset_add_timer_function(BT_AUDIO_HSP, &info);
+                                       _bt_headset_add_timer_function(BT_AUDIO_HSP, info);
                                        goto end;
                                }
                        }