[Adapt: FRWK] Fix various issues 07/117407/1
authorAtul Rai <a.rai@samsung.com>
Fri, 3 Mar 2017 04:56:58 +0000 (10:26 +0530)
committerAtul Rai <a.rai@samsung.com>
Fri, 3 Mar 2017 06:23:59 +0000 (11:53 +0530)
This patch fixes following issues:
1/ Add VID, PID and device_type property in device info in bt-service
2/ Set/Reset logic for BT_VCONF_STATUS in bt-service adapter
3/ Handle bonding complete pending indefenetly in some cases for BLE devices
4/ Switch context to main thread before handling any event from OAL in
bt-service.

Change-Id: I7fe886bde4e1338edf5891097adaa017bbe1ef2b
Signed-off-by: Atul Rai <a.rai@samsung.com>
13 files changed:
bt-api/bt-adapter.c
bt-api/bt-event-handler.c
bt-api/bt-rfcomm-client.c
bt-api/bt-rfcomm-server.c
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/hid/bt-service-hidhost.c
bt-service-adaptation/services/include/bt-service-common.h
bt-service-adaptation/services/include/bt-service-hidhost.h
include/bluetooth-api.h

index 0b43812..6b33a76 100644 (file)
@@ -61,6 +61,7 @@ BT_EXPORT_API int bluetooth_check_adapter(void)
 {
        int value = VCONFKEY_BT_STATUS_OFF;
 
+#if 0
 #ifndef TIZEN_TEST_EMUL
        int ret;
 
@@ -69,6 +70,7 @@ BT_EXPORT_API int bluetooth_check_adapter(void)
        if (ret != BLUETOOTH_ERROR_NONE)
                return BLUETOOTH_ADAPTER_DISABLED;
 #endif
+#endif
 
        /* check VCONFKEY_BT_STATUS */
        if (vconf_get_int(VCONFKEY_BT_STATUS, &value) != 0) {
index bed2f92..95bce78 100644 (file)
@@ -259,10 +259,12 @@ static bluetooth_device_info_t *__bt_get_device_info_in_message(GVariant *parame
        int manufacturer_data_len = 0;
        GVariant *manufacturer_var = NULL;
        const char *manufacturer_data = NULL;
+       int vid;
+       int pid;
 
-       g_variant_get(parameters, "(isunsbub@asn@ay)", &result, &address,
-                       &dev_class, &rssi, &name, &paired,
-                       &connected, &trust,  &string_var, &manufacturer_data_len, &manufacturer_var);
+       g_variant_get(parameters, "(isunsbub@asn@ayii)", &result, &address,
+                       &dev_class, &rssi, &name, &paired, &connected, &trust,
+                       &string_var, &manufacturer_data_len, &manufacturer_var, &vid, &pid);
 
        if (string_var == NULL) {
                BT_ERR("invalid parameters in signal");
@@ -286,6 +288,8 @@ static bluetooth_device_info_t *__bt_get_device_info_in_message(GVariant *parame
        dev_info->paired = paired;
        dev_info->connected = connected;
        dev_info->trust = trust;
+       dev_info->vid = vid;
+       dev_info->pid = pid;
 
        g_strlcpy(dev_info->device_name.name, name,
                BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1);
index 5ee2d61..11c4ab0 100644 (file)
@@ -672,7 +672,7 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond, g
        fd = g_io_channel_unix_get_fd(chan);
        if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
                BT_ERR_C("RFComm Client  disconnected: %d", fd);
-               goto error;
+               goto fail;
        }
 
        buffer = g_malloc0(BT_RFCOMM_BUFFER_LEN + 1);
@@ -687,7 +687,7 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond, g
                                        __is_error_by_disconnect(err)) {
                                BT_ERR("cond : %d", cond);
                                g_error_free(err);
-                               goto error;
+                               goto fail;
                        }
                        g_error_free(err);
                }
@@ -695,6 +695,11 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond, g
                return TRUE;
        }
 
+       if (len == 0) {
+               BT_ERR("Length is zero, remote end hang up");
+               goto fail;
+       }
+
        BT_DBG("fd: %d, len: %d, buffer: %s", fd, len, buffer);
 
        event_info = _bt_event_get_cb_data(BT_RFCOMM_CLIENT_EVENT);
@@ -715,7 +720,7 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond, g
        g_free(buffer);
        return TRUE;
 
-error:
+fail:
        conn_info = __find_rfcomm_conn_info_with_fd(fd);
        if (conn_info) {
                __bt_rfcomm_client_disconnected(conn_info);
index 86425b5..9a0795b 100644 (file)
@@ -823,7 +823,7 @@ static gboolean __data_received_cb(GIOChannel *chan, GIOCondition cond,
 
        if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
                BT_ERR_C("RFComm Server  disconnected: %d", client_info->sock_fd);
-               goto err;
+               goto fail;
        }
 
        buffer = g_malloc0(BT_RFCOMM_BUFFER_LEN + 1);
@@ -838,7 +838,7 @@ static gboolean __data_received_cb(GIOChannel *chan, GIOCondition cond,
                                        !g_strcmp0(err->message, "Connection reset by peer")) {
                                BT_ERR("cond : %d", cond);
                                g_error_free(err);
-                               goto err;
+                               goto fail;
                        }
                        g_error_free(err);
                }
@@ -847,7 +847,7 @@ static gboolean __data_received_cb(GIOChannel *chan, GIOCondition cond,
 
        if (len == 0) {
                BT_ERR("Length is zero, remote end hang up");
-               goto err;
+               goto fail;
        }
 
        event_info = _bt_event_get_cb_data(BT_RFCOMM_SERVER_EVENT);
@@ -868,7 +868,7 @@ static gboolean __data_received_cb(GIOChannel *chan, GIOCondition cond,
 
        return TRUE;
 
-err:
+fail:
        BT_ERR("Failure occured, remove client connection");
        server_info->conn_list = g_slist_remove(
                        server_info->conn_list, client_info);
index 5c821e6..920a1b7 100644 (file)
@@ -116,7 +116,6 @@ int _bt_stack_init(void)
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
-       __bt_post_oal_init();
        return BLUETOOTH_ERROR_NONE;
 }
 
@@ -174,7 +173,7 @@ int _bt_get_local_version(void)
 
        result =  adapter_get_version();
        if (result != OAL_STATUS_SUCCESS) {
-               BT_ERR("adapter_get_address failed: %d", result);
+               BT_ERR("adapter_get_version failed: %d", result);
                result = BLUETOOTH_ERROR_INTERNAL;
        } else
                result = BLUETOOTH_ERROR_NONE;
@@ -481,7 +480,7 @@ int _bt_set_connectable(gboolean connectable)
        BT_DBG("+");
        result =  adapter_set_connectable(connectable);
        if (result != OAL_STATUS_SUCCESS) {
-               BT_ERR("adapter_get_address failed: %d", result);
+               BT_ERR("adapter_set_connectable failed: %d", result);
                result = BLUETOOTH_ERROR_INTERNAL;
        } else
                result = BLUETOOTH_ERROR_NONE;
@@ -756,12 +755,27 @@ static int __bt_init_profiles()
 static void __bt_post_oal_init(void)
 {
        int ret;
+       int status = VCONFKEY_BT_STATUS_OFF;
 
        BT_DBG("OAL initialized, Init profiles..");
        ret = __bt_init_profiles();
        if (ret != BLUETOOTH_ERROR_NONE)
                BT_ERR("Bluetooth profile init error: %d", ret);
 
+       if (vconf_get_int(VCONFKEY_BT_STATUS, &status) != 0) {
+               BT_ERR("Fail to get the enabled value");
+       }
+
+       /* Update Bluetooth Status to OFF */
+       if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0)
+               BT_ERR("Set vconf failed\n");
+
+       if (status & VCONFKEY_BT_STATUS_ON) {
+               ret = _bt_enable_adapter();
+               if (ret != BLUETOOTH_ERROR_NONE)
+                       BT_ERR("_bt_enable_adapter failed with error: %d", ret);
+       }
+
        return;
 }
 
@@ -978,6 +992,10 @@ static void __bt_adapter_update_bt_disabled(void)
        ret = vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &power_off_status);
        BT_DBG("ret : %d, power_off_status : %d", ret, power_off_status);
 
+       /* Update Bluetooth Status to notify other modules */
+       if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0)
+               BT_ERR("Set vconf failed\n");
+
        /* TODO:Add timer function to handle any further post processing */
        g_idle_add((GSourceFunc)__bt_adapter_post_set_disabled, NULL);
 
index e4c2d2e..c0d91d1 100644 (file)
@@ -51,8 +51,9 @@ GSList *invocation_list = NULL;
 static GDBusConnection *bt_service_conn;
 static guint owner_id = 0;
 static guint owner_sig_id = 0;
-cynara *p_cynara;
-cynara_configuration *conf;
+
+static cynara *p_cynara;
+static cynara_configuration *conf;
 
 static const gchar bt_service_introspection_xml[] =
 "<node name='/org/projectx/bt_service'>"
@@ -231,7 +232,6 @@ static void __bt_service_method(GDBusConnection *connection,
                out_param1 = g_array_new(FALSE, FALSE, sizeof(gchar));
 
                sender = g_dbus_method_invocation_get_sender(invocation);
-
                if (service_type == BT_CORE_SERVICE) {
                        BT_DBG("No need to check privilege from bt-core");
                } else if (__bt_service_check_privilege(service_function,
@@ -331,7 +331,6 @@ static void __bt_service_method(GDBusConnection *connection,
                g_variant_unref(param3);
                g_variant_unref(param4);
                g_variant_unref(param5);
-//             g_free(sender);
                FN_END;
                return;
 fail:
@@ -356,7 +355,6 @@ fail:
                g_variant_unref(param3);
                g_variant_unref(param4);
                g_variant_unref(param5);
-//             g_free(sender);
        }
 
        FN_END;
@@ -1071,7 +1069,6 @@ int __bt_bluez_request(int function_name,
                                        result, sender, function_name, NULL);
                } else {
                        g_array_append_vals(*out_param1, &socket_fd, sizeof(int));
-                       g_free(sender);
                }
                break;
        }
@@ -1389,7 +1386,6 @@ int __bt_bluez_request(int function_name,
                                channel_type, data_type, sender, app_id);
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &app_id, sizeof(app_id));
-                       g_free(sender);
                        g_free(app_id);
                } else {
                        _bt_save_invocation_context(context, result, sender,
@@ -1405,7 +1401,6 @@ int __bt_bluez_request(int function_name,
                sscanf(app_handle, "health_app_%d", app_id);
                result = _bt_hdp_app_unregister(*app_id);
                if (result != BLUETOOTH_ERROR_NONE) {
-                       //g_array_append_vals(*out_param1, app_handle, (strlen(app_handle) + 1));
                        g_free(app_id);
                } else {
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
index fc27897..7524156 100644 (file)
@@ -836,7 +836,7 @@ int _bt_byte_arr_cmp_with_mask(const char *data1, const char *data2,
        return 0;
 }
 
-void _bt_copy_remote_dev(bt_remote_dev_info_t * dev_info, remote_device_t * oal_device)
+void _bt_copy_remote_dev(bt_remote_dev_info_t *dev_info, remote_device_t *oal_device)
 {
        int i;
        BT_INFO("+");
@@ -876,6 +876,13 @@ void _bt_copy_remote_dev(bt_remote_dev_info_t * dev_info, remote_device_t * oal_
                BT_DBG("[%s]", dev_info->uuids[i]);
        }
 
+       dev_info->vid = (unsigned short)oal_device->vid;
+       BT_INFO("VID [0x%.4X]", dev_info->vid);
+       dev_info->pid = (unsigned short)oal_device->pid;
+       BT_INFO("PID [0x%.4X]", dev_info->pid);
+       dev_info->device_type = (int)oal_device->type;
+       BT_INFO("device_type [0x%.4X]", dev_info->device_type);
+
        BT_INFO("-");
 }
 
@@ -957,6 +964,9 @@ void _bt_copy_remote_device(bt_remote_dev_info_t *rem_dev, bluetooth_device_info
        } else {
                dev->manufacturer_data.data_len = 0;
        }
+
+       dev->vid = rem_dev->vid;
+       dev->pid = rem_dev->pid;
        BT_DBG("-");
 }
 
@@ -1026,8 +1036,7 @@ invocation_info_t* _bt_get_request_info_data(int service_function, char *address
 
        BT_DBG("+");
 
-       if (!address)
-               return NULL;
+       retv_if(NULL == address, NULL);
 
        /* Get method invocation context */
        for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
@@ -1039,6 +1048,7 @@ invocation_info_t* _bt_get_request_info_data(int service_function, char *address
                        return req_info;
        }
 
+       BT_DBG("-");
        return NULL;
 }
 
index f11e16b..b59191a 100644 (file)
 #include "bt-service-common.h"
 #include "bt-service-event-receiver.h"
 
+typedef struct {
+       int type;
+       void *data;
+} bt_service_oal_event_data_t;
+
 _bt_service_event_handler_callback adapter_cb;
 _bt_service_event_handler_callback device_cb;
 _bt_service_event_handler_callback hid_cb;
@@ -138,9 +143,11 @@ void _bt_service_unregister_event_handler_callback(bt_service_module_t module)
        }
 }
 
-void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize len)
+static gboolean __bt_handle_oal_events(gpointer data)
 {
-       BT_INFO("event_type: [%d], data size: [%d]", event_type, len);
+       bt_service_oal_event_data_t *oal_event = data;
+       int event_type = oal_event->type;
+       gpointer event_data = oal_event->data;
 
        switch (event_type) {
        case OAL_EVENT_ADAPTER_ENABLED:
@@ -181,6 +188,7 @@ void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize l
        case OAL_EVENT_DEVICE_AUTHORIZE_REQUEST:
        case OAL_EVENT_DEVICE_TRUSTED:
        case OAL_EVENT_DEVICE_UNTRUSTED:
+       case OAL_EVENT_DEVICE_NAME:
                if (device_cb)
                        device_cb(event_type, event_data);
                break;
@@ -206,13 +214,13 @@ void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize l
                        socket_cb(event_type, event_data);
                break;
        case OAL_EVENT_AUDIO_CONNECTING:
-        case OAL_EVENT_AUDIO_DISCONNECTING:
-        case OAL_EVENT_AUDIO_CONNECTED:
-        case OAL_EVENT_AUDIO_DISCONNECTED:
-        case OAL_EVENT_AUDIO_STOPPED:
-        case OAL_EVENT_AUDIO_STARTED:
-                if (a2dp_source_cb)
-                        a2dp_source_cb(event_type,event_data);
+       case OAL_EVENT_AUDIO_DISCONNECTING:
+       case OAL_EVENT_AUDIO_CONNECTED:
+       case OAL_EVENT_AUDIO_DISCONNECTED:
+       case OAL_EVENT_AUDIO_STOPPED:
+       case OAL_EVENT_AUDIO_STARTED:
+               if (a2dp_source_cb)
+                       a2dp_source_cb(event_type,event_data);
                break;
        case OAL_EVENT_A2DP_SINK_DISCONNECTED:
        case OAL_EVENT_A2DP_SINK_CONNECTED:
@@ -271,4 +279,22 @@ void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize l
                BT_ERR("Unhandled Event: %d", event_type);
                break;
        }
+
+       if (oal_event->data)
+               g_free(oal_event->data);
+       g_free(oal_event);
+       return FALSE;
 }
+
+void _bt_service_oal_event_receiver(int event_type, gpointer event_data, gsize len)
+{
+       bt_service_oal_event_data_t *oal_event = g_new0(bt_service_oal_event_data_t, 1);
+
+       BT_INFO("event_type: [%d], data size: [%d]", event_type, len);
+
+       oal_event->type = event_type;
+       if (event_data)
+               oal_event->data = g_memdup(event_data, len);
+
+       g_idle_add(__bt_handle_oal_events, oal_event);
+}
\ No newline at end of file
index a7b6644..7b1d5f5 100644 (file)
@@ -310,8 +310,9 @@ static void __bt_device_remote_properties_callback(event_dev_properties_t *oal_d
                if (!trigger_bond_info->dev_info ||
                                !trigger_bond_info->dev_info->name ||
                                        !trigger_bond_info->dev_info->address ||
-                                               !trigger_bond_info->dev_info->uuid_count == 0) {
+                                               trigger_bond_info->dev_info->uuid_count == 0) {
                        BT_INFO("Complete data is not present, Assigning rem_info");
+                       g_free(trigger_bond_info->dev_info);
                        trigger_bond_info->dev_info = rem_info;
                }
        }
@@ -374,7 +375,7 @@ static void __bt_handle_ongoing_device_service_search(bt_remote_dev_info_t *remo
                        remote_dev_info->manufacturer_data, remote_dev_info->manufacturer_data_len,
                        TRUE, NULL, NULL);
 
-       param = g_variant_new("(isunsbub@asn@ay)",
+       param = g_variant_new("(isunsbub@asn@ayii)",
                        BLUETOOTH_ERROR_NONE,
                        remote_dev_info->address,
                        remote_dev_info->class,
@@ -385,7 +386,9 @@ static void __bt_handle_ongoing_device_service_search(bt_remote_dev_info_t *remo
                        remote_dev_info->trust,
                        uuids,
                        remote_dev_info->manufacturer_data_len,
-                       manufacturer_data);
+                       manufacturer_data,
+                       remote_dev_info->vid,
+                       remote_dev_info->pid);
        /* Send the event to application */
        _bt_send_event(BT_ADAPTER_EVENT,
                        BLUETOOTH_EVENT_SERVICE_SEARCHED,
@@ -401,6 +404,19 @@ static void __bt_device_services_callback(event_dev_services_t* uuid_list)
        int i;
        BT_DBG("+");
 
+       if (trigger_bond_info && _bt_compare_adddress(trigger_bond_info->dev_addr,
+                               (bluetooth_device_address_t *)&uuid_list->address) == TRUE) {
+               bluetooth_device_address_t *dev_addr = trigger_bond_info->dev_addr;
+
+               BT_DBG("Bonding dev addr has matched");
+               /* Bonding ongoing, Query device properties again */
+               if (BLUETOOTH_ERROR_NONE ==
+                       _bt_device_get_bonded_device_info(dev_addr))
+                       BT_DBG("_bt_device_get_bonded_device_info success");
+               else
+                       BT_ERR("_bt_device_get_bonded_device_info failed");
+       }
+
        if (service_search_info == NULL) {
                /* Send reply */
                BT_DBG("searching_info == NULL");
@@ -519,7 +535,7 @@ static void __bt_handle_ongoing_bond(bt_remote_dev_info_t *remote_dev_info)
                                remote_dev_info->manufacturer_data, remote_dev_info->manufacturer_data_len,
                                TRUE, NULL, NULL);
 
-               param = g_variant_new("(isunsbub@asn@ay)",
+               param = g_variant_new("(isunsbub@asn@ayii)",
                                BLUETOOTH_ERROR_NONE,
                                remote_dev_info->address,
                                remote_dev_info->class,
@@ -530,7 +546,9 @@ static void __bt_handle_ongoing_bond(bt_remote_dev_info_t *remote_dev_info)
                                remote_dev_info->trust,
                                uuids,
                                remote_dev_info->manufacturer_data_len,
-                               manufacturer_data);
+                               manufacturer_data,
+                               remote_dev_info->vid,
+                               remote_dev_info->pid);
                /* Send the event to application */
                _bt_send_event(BT_ADAPTER_EVENT,
                                BLUETOOTH_EVENT_BONDING_FINISHED,
@@ -800,6 +818,15 @@ static void __bt_device_event_handler(int event_type, gpointer event_data)
                __bt_device_trusted_callback(FALSE, (event_dev_trust_t*)event_data);
                break;
        }
+       case OAL_EVENT_DEVICE_NAME: {
+               remote_device_t *rem_dev = event_data;
+               gchar address[BT_ADDRESS_STR_LEN];
+
+               _bt_convert_addr_type_to_string(address, rem_dev->address.addr);
+               BT_INFO("Remote Device name Received");
+               BT_INFO("Name: %s, Address: %s", rem_dev->name, address);
+               break;
+       }
        default:
                BT_INFO("Unhandled event..");
        }
@@ -1106,7 +1133,7 @@ static void __bt_device_remote_device_found_callback(gpointer event_data, gboole
                                dev_info->manufacturer_data_len,
                                TRUE,
                                NULL, NULL);
-               param = g_variant_new("(isunsbub@asn@ay)", result,
+               param = g_variant_new("(isunsbub@asn@ayii)", result,
                                dev_info->address,
                                dev_info->class,
                                dev_info->rssi,
@@ -1116,7 +1143,9 @@ static void __bt_device_remote_device_found_callback(gpointer event_data, gboole
                                dev_info->trust,
                                uuids,
                                dev_info->manufacturer_data_len,
-                               manufacturer_data);
+                               manufacturer_data,
+                               dev_info->vid,
+                               dev_info->pid);
 
                _bt_send_event(BT_ADAPTER_EVENT,
                                BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,
index 6fd0891..0593fbc 100644 (file)
@@ -30,8 +30,8 @@
 #include "bt-request-handler.h"
 #include "bt-service-util.h"
 #include "bt-service-event.h"
-#include "bt-service-hidhost.h"
 #include "bt-service-common.h"
+#include "bt-service-hidhost.h"
 #include "bt-service-event-receiver.h"
 #include "oal-event.h"
 #include "oal-device-mgr.h"
@@ -50,25 +50,24 @@ enum {
 
 static GList *g_connected_list;
 
-static invocation_info_t* __bt_get_request_info(int service_function, char *address)
+bt_remote_dev_info_t *_bt_hid_get_device_info(const char *address)
 {
-       GSList *l;
-       invocation_info_t *req_info = NULL;
-
-       BT_DBG("+");
+       GList *node;
 
-       retv_if(NULL == address, FALSE);
+       node = g_list_first(g_connected_list);
+       while (node != NULL) {
+               bt_connected_hid_dev_info_t *hid_dev_info = node->data;
 
-       /* 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)
+               if (g_strcmp0(hid_dev_info->address, address) != 0) {
+                       node = g_list_next(node);
                        continue;
+               }
 
-               if (!strncasecmp((char *)req_info->user_data, address, BT_ADDRESS_STRING_SIZE))
-                       return req_info;
+               BT_DBG("Address match \n");
+               return hid_dev_info->dev_info;
        }
 
+       BT_DBG("");
        return NULL;
 }
 
@@ -267,7 +266,7 @@ static void __bt_hid_event_handler(int event_type, gpointer event_data)
                _bt_convert_addr_type_to_string(address, event->address.addr);
 
                /* Reply to async request for HID connect, if any */
-               req_info = __bt_get_request_info(BT_HID_CONNECT, address);
+               req_info = _bt_get_request_info_data(BT_HID_CONNECT, address);
                if (NULL != req_info) {
                        out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
                        g_array_append_vals(out_param, &device_address,
@@ -291,10 +290,10 @@ static void __bt_hid_event_handler(int event_type, gpointer event_data)
                _bt_convert_addr_type_to_string(address, event->address.addr);
 
                BT_INFO("HID device [%s] disconnected", address);
-               req_info = __bt_get_request_info(BT_HID_DISCONNECT, address);
+               req_info = _bt_get_request_info_data(BT_HID_DISCONNECT, address);
                if (NULL == req_info) {
                        BT_DBG("BT_HID_DISCONNECT request not found");
-                       req_info = __bt_get_request_info(BT_HID_CONNECT, address);
+                       req_info = _bt_get_request_info_data(BT_HID_CONNECT, address);
                        if (NULL == req_info) {
                                BT_DBG("BT_HID_CONNECT request also not found");
                                __bt_handle_hid_disconnection(address);
@@ -303,7 +302,7 @@ static void __bt_hid_event_handler(int event_type, gpointer event_data)
                                /*
                                 * HID_DISCONNECTED event is received in response to hid_connect,
                                 * Set result as BLUETOOTH_ERROR_INTERNAL
-                                * */
+                                */
                                result = BLUETOOTH_ERROR_INTERNAL;
                        }
                }
@@ -355,7 +354,9 @@ int _bt_hidhost_initialize()
        }
 
        /* Register HID event handler */
-       _bt_service_register_event_handler_callback(BT_HID_MODULE, __bt_hid_event_handler);
+       _bt_service_register_event_handler_callback(
+                       BT_HID_MODULE, __bt_hid_event_handler);
+
        return BLUETOOTH_ERROR_NONE;
 }
 
index 568b3b3..9fe27e3 100755 (executable)
@@ -294,6 +294,9 @@ typedef struct {
 #if 0 /* Should match with bt_dev_info_t in bluetooth-api.h */
        bt_remote_le_dev_info_t le_dev_info;
 #endif
+       int vid;
+       int pid;
+       int device_type;
 } bt_remote_dev_info_t;
 
 /* RFCOMM client /server will use this structure*/
index f4b70c3..292c35b 100644 (file)
 extern "C" {
 #endif
 
-       int _bt_hidhost_initialize(void);
-       void _bt_hidhost_deinitialize(void);
-       int _bt_hid_connect(bluetooth_device_address_t *device_address);
-       int _bt_hid_disconnect(bluetooth_device_address_t *device_address);
+int _bt_hidhost_initialize(void);
+void _bt_hidhost_deinitialize(void);
+int _bt_hid_connect(bluetooth_device_address_t *device_address);
+int _bt_hid_disconnect(bluetooth_device_address_t *device_address);
+
+bt_remote_dev_info_t *_bt_hid_get_device_info(const char *address);
 
 #ifdef __cplusplus
 }
index 8c94c80..2b72a68 100644 (file)
@@ -992,6 +992,8 @@ typedef struct {
        gboolean trust;                         /**< trust flag */
        gboolean is_alias_set;          /** is device alias set flag**/
        bluetooth_manufacturer_data_t manufacturer_data;        /**< manafacturer specific class */
+       int vid;
+       int pid;
 } bluetooth_device_info_t;
 
 /**