[Adapt:Frwk] Implement get bonded device info APIs 21/78121/1
authorAtul Rai <a.rai@samsung.com>
Mon, 4 Jul 2016 10:06:19 +0000 (19:06 +0900)
committerAtul Rai <a.rai@samsung.com>
Mon, 4 Jul 2016 10:06:19 +0000 (19:06 +0900)
This patch adds code logic to support below APIs in bluetooth-frwk:
1/bluetooth_get_bonded_device_list()
2/bluetooth_get_bonded_device()

Change-Id: I4019fadd30debfee8b3f72f2b7838c0bb4a9af50
Signed-off-by: Atul Rai <a.rai@samsung.com>
bt-service-adaptation/services/adapter/bt-service-core-adapter.c
bt-service-adaptation/services/bt-request-handler.c
bt-service-adaptation/services/bt-service-common.c
bt-service-adaptation/services/bt-service-event-receiver.c
bt-service-adaptation/services/device/bt-service-core-device.c
bt-service-adaptation/services/include/bt-service-common.h
bt-service-adaptation/services/include/bt-service-core-adapter.h
bt-service-adaptation/services/include/bt-service-core-device.h

index d262e23..0ae0938 100644 (file)
@@ -280,9 +280,25 @@ int _bt_is_service_used(void)
        return result;
 }
 
+int _bt_adapter_get_bonded_devices(void)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+
+       BT_DBG("+");
+       result =  adapter_get_bonded_devices();
+       if (result != OAL_STATUS_SUCCESS) {
+               BT_ERR("adapter_get_bonded_devices failed: %d", result);
+               result = BLUETOOTH_ERROR_INTERNAL;
+       } else
+               result = BLUETOOTH_ERROR_NONE;
+
+       BT_DBG("-");
+       return result;
+}
+
 static void __bt_adapter_event_handler(int event_type, gpointer event_data)
 {
-        BT_DBG("+");
+       BT_DBG("+");
 
        switch(event_type) {
        case OAL_EVENT_OAL_INITIALISED_SUCCESS:
@@ -298,8 +314,8 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
        case OAL_EVENT_ADAPTER_INQUIRY_STARTED:
                __bt_adapter_discovery_state_change_callback(ADAPTER_DISCOVERY_STARTED);
                break;
-        case OAL_EVENT_ADAPTER_INQUIRY_FINISHED:
-                __bt_adapter_discovery_state_change_callback(ADAPTER_DISCOVERY_STOPPED);
+       case OAL_EVENT_ADAPTER_INQUIRY_FINISHED:
+               __bt_adapter_discovery_state_change_callback(ADAPTER_DISCOVERY_STOPPED);
                break;
        case OAL_EVENT_ADAPTER_PROPERTY_ADDRESS: {
                bt_address_t *bd_addr = event_data;
@@ -346,7 +362,7 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
                gboolean connectable = FALSE;
 
                BT_INFO("Adapter discoverable mode:"
-                       " BLUETOOTH_DISCOVERABLE_MODE_NON_CONNECTABLE");
+                               " BLUETOOTH_DISCOVERABLE_MODE_NON_CONNECTABLE");
                _bt_send_event(BT_ADAPTER_EVENT,
                                BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
                                g_variant_new("(b)", connectable));
@@ -356,7 +372,7 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
                gboolean connectable = TRUE;
 
                BT_INFO("Adapter discoverable mode:"
-                       " BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE");
+                               " BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE");
                _bt_send_event(BT_ADAPTER_EVENT,
                                BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
                                g_variant_new("(b)", connectable));
@@ -364,7 +380,7 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
        }
        case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE: {
                BT_INFO("Adapter discoverable mode:"
-                       " BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE");
+                               " BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE");
                break;
        }
        case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE_TIMEOUT: {
@@ -383,6 +399,25 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
                __bt_adapter_handle_pending_requests(BT_IS_SERVICE_USED, service_list, count);
                break;
        }
+       case OAL_EVENT_ADAPTER_BONDED_DEVICE_LIST: {
+               int i;
+               int count;
+               bluetooth_device_address_t *addr_list;
+
+               event_device_list_t *bonded_device_list = event_data;
+               count = bonded_device_list->num;
+
+               addr_list = g_malloc0(count * sizeof(bluetooth_device_address_t));
+               for (i = 0; i < count; i++) {
+                       memcpy(addr_list[i].addr,
+                                       bonded_device_list->devices[i].addr,
+                                       BLUETOOTH_ADDRESS_LENGTH);
+               }
+
+               __bt_adapter_handle_pending_requests(BT_GET_BONDED_DEVICES,
+                               (void *)addr_list, bonded_device_list->num);
+               break;
+       }
        default:
                BT_ERR("Unhandled event..");
                break;
@@ -470,6 +505,58 @@ static void __bt_adapter_handle_pending_requests(int service_function, void *use
                        g_array_append_vals(out_param, &used, sizeof(gboolean));
                        break;
                }
+               case BT_GET_BONDED_DEVICES: {
+                       bluetooth_device_address_t *addr_list = user_data;
+                       bonded_devices_req_info_t *bonded_devices_req_info;
+                       char address[BT_ADDRESS_STRING_SIZE];
+                       int count = size;
+                       int res = BLUETOOTH_ERROR_NONE;
+
+                       /*
+                        * BT_GET_BONDED_DEVICES is already processed for this request,
+                        * continue for next BT_GET_BONDED_DEVICES request if any
+                        */
+                       if (NULL != req_info->user_data)
+                               continue;
+
+                       BT_DBG("BT_GET_BONDED_DEVICES: count = [%d]", count);
+                       /* No bonded devices, return method invocation */
+                       if (0 == count || !addr_list)
+                               break;
+
+                       /* Save address list in user data  for futur reference. */
+                       bonded_devices_req_info = g_malloc0(sizeof(bonded_devices_req_info));
+                       if (!bonded_devices_req_info) {
+                               BT_ERR("Memory allocation failed");
+                               req_info->result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+                               g_free(addr_list);
+                               break;
+                       }
+
+                       bonded_devices_req_info->count = count;
+                       bonded_devices_req_info->addr_list = addr_list;
+                       bonded_devices_req_info->out_param = out_param;
+                       req_info->user_data = bonded_devices_req_info;
+
+                       while (bonded_devices_req_info->count > 0) {
+                               bonded_devices_req_info->count -= 1;
+                               res = _bt_device_get_bonded_device_info(
+                                               &addr_list[bonded_devices_req_info->count]);
+                               if (BLUETOOTH_ERROR_NONE == res)
+                                       return;
+                               else {
+                                       _bt_convert_addr_type_to_string((char *)address,
+                                                       addr_list[bonded_devices_req_info->count].addr);
+                                       BT_ERR("_bt_device_get_bonded_device_info Failed for [%s]", address);
+                                       if (bonded_devices_req_info->count == 0) {
+                                               g_free(bonded_devices_req_info->addr_list);
+                                               g_free(bonded_devices_req_info);
+                                               req_info->user_data = NULL;
+                                       }
+                               }
+                       }
+                       break;
+               }
                default:
                        BT_ERR("Unknown service function[%d]", service_function);
                }
index fea547c..c211111 100644 (file)
@@ -28,6 +28,7 @@
 #include "bt-service-util.h"
 
 #include "bt-service-core-adapter.h"
+#include "bt-service-core-device.h"
 
 /* For maintaining Application Sync API call requests */
 GSList *invocation_list = NULL;
@@ -387,15 +388,15 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_CANCEL_DISCOVERY:
-                result = _bt_cancel_discovery();
-                break;
+               result = _bt_cancel_discovery();
+               break;
        case BT_IS_DISCOVERYING: {
-                gboolean discovering = FALSE;
-                discovering = _bt_is_discovering();
-                g_array_append_vals(*out_param1,
-                                &discovering, sizeof(gboolean));
-                break;
-        }
+               gboolean discovering = FALSE;
+               discovering = _bt_is_discovering();
+               g_array_append_vals(*out_param1,
+                               &discovering, sizeof(gboolean));
+               break;
+       }
        case BT_GET_LOCAL_ADDRESS: {
                result = _bt_get_local_address();
 
@@ -472,6 +473,38 @@ int __bt_bluez_request(int function_name,
                }
                break;
        }
+       case BT_GET_BONDED_DEVICES: {
+               result = _bt_adapter_get_bonded_devices();
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, NULL);
+               }
+               break;
+       }
+       case BT_GET_BONDED_DEVICE: {
+               bluetooth_device_address_t address = { {0} };
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+
+               result = _bt_device_get_bonded_device_info(&address);
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       char *addr = g_malloc0(sizeof(char) * BT_ADDRESS_STRING_SIZE);
+                       if (!addr) {
+                               result = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+                               break;
+                       }
+
+                       _bt_convert_addr_type_to_string(addr, address.addr);
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, addr);
+               }
+               break;
+       }
        default:
                BT_INFO("UnSupported function [%d]", function_name);
                result = BLUETOOTH_ERROR_NOT_SUPPORT;
index cfbd74c..703e3ca 100755 (executable)
@@ -430,8 +430,9 @@ void _bt_convert_addr_type_to_string(char *address,
 
 void _bt_print_device_address_t(const bluetooth_device_address_t *addr)
 {
-       BT_DBG("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", addr->addr[0], addr->addr[1], addr->addr[2],
-                               addr->addr[3], addr->addr[4], addr->addr[5]);
+       BT_INFO("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+               addr->addr[0], addr->addr[1], addr->addr[2],
+               addr->addr[3], addr->addr[4], addr->addr[5]);
 }
 
 void _bt_divide_device_class(bluetooth_device_class_t *device_class,
@@ -868,6 +869,94 @@ void _bt_copy_remote_dev(bt_remote_dev_info_t * dev_info, remote_device_t * oal_
        BT_INFO("-");
 }
 
+static void __bt_get_service_list(bt_remote_dev_info_t *info, bluetooth_device_info_t *dev)
+{
+       int i;
+       char **uuids;
+       char **parts;
+
+       BT_DBG("+");
+
+       ret_if(info == NULL);
+       ret_if(dev == NULL);
+
+       uuids = info->uuids;
+       if(uuids == NULL) {
+               BT_ERR("No UUID's");
+               return;
+       }
+
+       dev->service_index = 0;
+       BT_DBG("Total UUID count [%d]", info->uuid_count);
+       for (i = 0; i < info->uuid_count; i++) {
+               BT_DBG("UUID count [%d]", i);
+               g_strlcpy(dev->uuids[i], uuids[i], BLUETOOTH_UUID_STRING_MAX);
+
+               parts = g_strsplit(uuids[i], "-", -1);
+
+               if (parts == NULL || parts[0] == NULL)
+                       break;
+
+               dev->service_list_array[i] = g_ascii_strtoull(parts[0], NULL, 16);
+               g_strfreev(parts);
+
+               dev->service_index++;
+       }
+
+       BT_DBG("-");
+}
+
+void _bt_copy_remote_device(bt_remote_dev_info_t *rem_dev, bluetooth_device_info_t *dev)
+{
+       BT_DBG("+");
+
+       memset(dev, 0x00, sizeof(bluetooth_device_info_t));
+       __bt_get_service_list(rem_dev, dev);
+       _bt_convert_addr_string_to_type(dev->device_address.addr, rem_dev->address);
+       _bt_divide_device_class(&dev->device_class, rem_dev->class);
+       g_strlcpy(dev->device_name.name, rem_dev->name,
+                       BLUETOOTH_DEVICE_NAME_LENGTH_MAX+1);
+       dev->rssi = rem_dev->rssi;
+       dev->trust = rem_dev->trust;
+       dev->paired = rem_dev->paired;
+       dev->connected = rem_dev->connected;
+
+       /* Fill Manufacturer data */
+       if (rem_dev->manufacturer_data_len > 0) {
+               dev->manufacturer_data.data_len = rem_dev->manufacturer_data_len;
+               memcpy(dev->manufacturer_data.data,
+                       rem_dev->manufacturer_data, rem_dev->manufacturer_data_len);
+       } else {
+               dev->manufacturer_data.data_len = 0;
+       }
+       BT_DBG("-");
+}
+
+void _bt_service_print_dev_info(bluetooth_device_info_t *dev_info)
+{
+       int i;
+
+       ret_if(dev_info == NULL);
+
+       _bt_print_device_address_t(&(dev_info->device_address));
+       BT_INFO("Device Name:[%s]", dev_info->device_name.name);
+       BT_INFO("Device Major Class:[0x%X]", dev_info->device_class.major_class);
+       BT_INFO("Device Minor Class:[0x%X]", dev_info->device_class.minor_class);
+       BT_INFO("Device Service Class:[0x%X]", dev_info->device_class.minor_class);
+       BT_INFO("Device Paired:[%s]", (dev_info->paired?"TRUE":"FALSE"));
+       BT_INFO("Device Trusted:[%s]", (dev_info->trust?"TRUE":"FALSE"));
+       BT_INFO("Device Connected:[%d]", dev_info->connected);
+       BT_INFO("Device Service index:[%d]", dev_info->service_index);
+       for (i = 0; i < dev_info->service_index; i++) {
+               BT_INFO("Device Service List:[%d]", dev_info->service_list_array[i]);
+               BT_INFO("Device UUID:[%s]", dev_info->uuids[i]);
+       }
+
+       BT_INFO("Device manufacturer data len:[%d]", dev_info->manufacturer_data.data_len);
+       for (i = 0; i < dev_info->manufacturer_data.data_len; i++)
+               BT_INFO("%2.2X", dev_info->manufacturer_data.data[i]);
+}
+
 void _bt_uuid_to_string(service_uuid_t *p_uuid, char *str)
 {
     uint32_t uuid0, uuid4;
index 1f9e36f..bf30b5d 100644 (file)
@@ -78,16 +78,19 @@ void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize l
        case OAL_EVENT_ADAPTER_PROPERTY_NAME:
        case OAL_EVENT_ADAPTER_PROPERTY_VERSION:
        case OAL_EVENT_ADAPTER_PROPERTY_SERVICES:
+       case OAL_EVENT_ADAPTER_BONDED_DEVICE_LIST:
        case OAL_EVENT_ADAPTER_MODE_NON_CONNECTABLE:
        case OAL_EVENT_ADAPTER_MODE_CONNECTABLE:
        case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE:
        case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE_TIMEOUT:
        case OAL_EVENT_ADAPTER_INQUIRY_STARTED:
        case OAL_EVENT_ADAPTER_INQUIRY_FINISHED:
-        case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY:
-        case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE:
                if (adapter_cb)
                        adapter_cb(event_type, event_data);
+               break;
+        case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY:
+        case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE:
+       case OAL_EVENT_DEVICE_PROPERTIES:
                if (device_cb)
                         device_cb(event_type, event_data);
                break;
index b128eca..966b415 100644 (file)
@@ -44,6 +44,7 @@
 #include <oal-event.h>
 #include <oal-manager.h>
 #include <oal-adapter-mgr.h>
+#include <oal-device-mgr.h>
 
 /* Forward declaration */
 static void __bt_device_event_handler(int event_type, gpointer event_data);
@@ -56,25 +57,182 @@ void _bt_device_state_handle_callback_set_request(void)
                        BT_DEVICE_MODULE, __bt_device_event_handler);
 }
 
+void __bt_device_handle_pending_requests(int result, int service_function,
+               void *user_data, unsigned int size)
+{
+       GSList *l;
+       GArray *out_param;
+       invocation_info_t *req_info = NULL;
+
+       BT_DBG("+");
+
+       /* Get method invocation context */
+       for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+               req_info = l->data;
+               if (req_info == NULL || req_info->service_function != service_function)
+                       continue;
+
+               switch (service_function) {
+               case BT_GET_BONDED_DEVICE: {
+                       char rem_addr[BT_ADDRESS_STRING_SIZE];
+                       char *address = req_info->user_data;
+                       bluetooth_device_info_t *dev_info = user_data;
+
+                       ret_if(dev_info == NULL);
+
+                       _bt_convert_addr_type_to_string(rem_addr, dev_info->device_address.addr);
+                       if (strncasecmp(address, rem_addr, BT_ADDRESS_STRING_SIZE))
+                               break;
+
+                       out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
+                       g_array_append_vals(out_param, dev_info,
+                                       sizeof(bluetooth_device_info_t));
+
+                       _bt_service_method_return(req_info->context, out_param, result);
+                       _bt_free_info_from_invocation_list(req_info);
+                       g_array_free(out_param, TRUE);
+                       break;
+               }
+               case BT_GET_BONDED_DEVICES: {
+                       char rem_addr[BT_ADDRESS_STRING_SIZE];
+                       char req_addr[BT_ADDRESS_STRING_SIZE];
+                       bluetooth_device_address_t *addr_list;
+                       bluetooth_device_info_t *dev_info = user_data;
+                       bonded_devices_req_info_t *list_info = req_info->user_data;
+
+                       ret_if (list_info == NULL);
+                       ret_if(dev_info == NULL);
+
+                       addr_list = list_info->addr_list;
+                       _bt_convert_addr_type_to_string(rem_addr, dev_info->device_address.addr);
+                       _bt_convert_addr_type_to_string(req_addr, addr_list[list_info->count].addr);
+
+                       BT_DBG("rem_addr: [%s]", rem_addr);
+                       BT_DBG("req_addr: [%s]", req_addr);
+                       if (strncasecmp(req_addr, rem_addr, BT_ADDRESS_STRING_SIZE))
+                               break;
+
+                       if (dev_info->paired == TRUE)
+                               g_array_append_vals(list_info->out_param,
+                                               dev_info, sizeof(bluetooth_device_info_t));
+
+                       if (list_info->count == 0) {
+                               BT_DBG("Device info for all the paired devices is received");
+                               /*
+                                * Device info for all the paired devices is received,
+                                * Send reply to get_bonded_devices request.
+                                */
+                               _bt_service_method_return(req_info->context,
+                                               list_info->out_param, req_info->result);
+
+                               g_free(list_info->addr_list);
+                               g_array_free(list_info->out_param, TRUE);
+                               g_free(list_info);
+                               req_info->user_data = NULL;
+                               _bt_free_info_from_invocation_list(req_info);
+                               break;
+                       }
+
+                       while (list_info->count > 0) {
+                               BT_DBG("list_info->count: %d", list_info->count);
+                               list_info->count -= 1;
+                               result = _bt_device_get_bonded_device_info(&addr_list[list_info->count]);
+                               if (BLUETOOTH_ERROR_NONE == result)
+                                       break;
+                               else if (list_info->count == 0) {
+                                       BT_DBG("Send reply to get_bonded_devices request");
+                                       /* Send reply to get_bonded_devices request */
+                                       _bt_service_method_return(req_info->context,
+                                                       list_info->out_param, req_info->result);
+
+                                       g_free(list_info->addr_list);
+                                       g_array_free(list_info->out_param, TRUE);
+                                       g_free(list_info);
+                                       req_info->user_data = NULL;
+                                       _bt_free_info_from_invocation_list(req_info);
+                               }
+                       }
+                       break;
+               }
+               default:
+                       BT_ERR("Unhandled case");
+                       break;
+               }
+       }
+       BT_INFO("-");
+}
+
+/*
+ * Remote device properties are received on all following conditions
+ * a. When Bonding in on-going
+ * b. When device properties are updated\changed for a connected device
+ *    (due to SDP or any other reason)
+ * c. When app requests for GET_BONDED_DEVICE\GET_BONDED_DEVICES info
+ */
+static void __bt_device_remote_properties_callback(event_dev_properties_t *oal_dev_props)
+{
+       bluetooth_device_info_t dev_info;
+       bt_remote_dev_info_t *rem_info = NULL;
+       int result = BLUETOOTH_ERROR_NONE;
+
+       BT_DBG("+");
+       rem_info = g_malloc0(sizeof(bt_remote_dev_info_t));
+       memset(rem_info, 0x00, sizeof(bt_remote_dev_info_t));
+       _bt_copy_remote_dev(rem_info, &(oal_dev_props->device_info));
+
+       if (oal_dev_props->adv_len > 0) {
+               int k;
+
+               rem_info->manufacturer_data_len = oal_dev_props->adv_len;
+               rem_info->manufacturer_data =
+                       g_memdup(oal_dev_props->adv_data,
+                                       oal_dev_props->adv_len);
+               BT_DBG("----Advertising Data Length: %d",
+                               rem_info->manufacturer_data_len);
+
+               for(k=0; k < rem_info->manufacturer_data_len; k++) {
+                       BT_INFO("Check data[%d] = [[0x%x]",
+                                       k, oal_dev_props->adv_data[k]);
+               }
+       } else {
+               rem_info->manufacturer_data = NULL;
+               rem_info->manufacturer_data_len = 0;
+       }
+
+       _bt_copy_remote_device(rem_info, &dev_info);
+       _bt_service_print_dev_info(&dev_info);
+
+       /* Check if app has requested for device info for already bonded devices */
+       __bt_device_handle_pending_requests(result, BT_GET_BONDED_DEVICES,
+                       (void *)&dev_info, sizeof(bluetooth_device_info_t));
+       __bt_device_handle_pending_requests(result, BT_GET_BONDED_DEVICE,
+                       (void *)&dev_info, sizeof(bluetooth_device_info_t));
+
+       BT_DBG("-");
+}
+
 static void __bt_device_event_handler(int event_type, gpointer event_data)
 {
         int eventcheck = OAL_EVENT_DEVICE_PROPERTIES;
         BT_INFO("event [%d] Event check = [%d]", event_type, eventcheck);
 
-        switch(event_type) {
-                case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY:
-                {
-                        BT_INFO("BREDR Device Found");
-                        __bt_device_remote_device_found_callback(event_data, FALSE);
-                        break;
-                }
-               case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE:
-                {
-                        BT_INFO("Dual Device Found");
-                        __bt_device_remote_device_found_callback(event_data, FALSE);
-                        break;
-                }
-               default:
+       switch(event_type) {
+       case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BREDR_ONLY: {
+               BT_INFO("BREDR Device Found");
+               __bt_device_remote_device_found_callback(event_data, FALSE);
+               break;
+       }
+       case OAL_EVENT_ADAPTER_INQUIRY_RESULT_BLE: {
+               BT_INFO("Dual Device Found");
+               __bt_device_remote_device_found_callback(event_data, FALSE);
+               break;
+       }
+       case OAL_EVENT_DEVICE_PROPERTIES: {
+               BT_INFO("Remote Device properties Received");
+               __bt_device_remote_properties_callback((event_dev_properties_t *)event_data);
+               break;
+       }
+       default:
                BT_INFO("Unhandled event..");
        }
 }
@@ -150,3 +308,23 @@ static void __bt_device_remote_device_found_callback(gpointer event_data, gboole
        }
        BT_DBG("-");
 }
+
+int _bt_device_get_bonded_device_info(bluetooth_device_address_t *addr)
+{
+       int result;
+       bt_address_t bd_addr;
+
+       BT_DBG("+");
+
+       retv_if(!addr, BLUETOOTH_ERROR_INVALID_PARAM);
+
+       memcpy(bd_addr.addr, addr, BLUETOOTH_ADDRESS_LENGTH);
+       result = device_query_attributes(&bd_addr);
+       if (result != OAL_STATUS_SUCCESS) {
+               BT_ERR("device_query_attributes error: [%d]", result);
+               return BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       BT_DBG("-");
+       return BLUETOOTH_ERROR_NONE;
+}
index d348f3e..a0cd308 100755 (executable)
@@ -310,6 +310,12 @@ typedef struct {
        char *address;
 } bt_function_data_t;
 
+typedef struct {
+       int count;
+       bluetooth_device_address_t *addr_list;
+       GArray *out_param;
+} bonded_devices_req_info_t;
+
 GDBusConnection *_bt_get_system_conn(void);
 
 GDBusConnection *_bt_get_system_gconn(void);
@@ -385,6 +391,10 @@ void _bt_uuid_to_string(service_uuid_t *p_uuid, char *str);
 
 void _bt_truncate_non_utf8_chars(char * str);
 
+void _bt_copy_remote_device(bt_remote_dev_info_t *rem_dev, bluetooth_device_info_t *dev);
+
+void _bt_service_print_dev_info(bluetooth_device_info_t *dev_info);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 58d5ead..6dc516f 100755 (executable)
@@ -69,6 +69,8 @@ int _bt_is_service_used(void);
 
 int _bt_set_connectable(gboolean connectable);
 
+int _bt_adapter_get_bonded_devices(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 400c86f..6fc9468 100755 (executable)
@@ -28,6 +28,8 @@ extern "C" {
 
 void _bt_device_state_handle_callback_set_request(void);
 
+int _bt_device_get_bonded_device_info(bluetooth_device_address_t *addr);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */