Gatt server ReadValue parsing fix 96/188296/3
authorAbhishek Chandra <abhishek.ch@samsung.com>
Mon, 3 Sep 2018 12:19:00 +0000 (17:49 +0530)
committerAbhishek Chandra <abhishek.ch@samsung.com>
Fri, 7 Sep 2018 06:08:04 +0000 (06:08 +0000)
Gatt server ReadValue parsing was always returning
NULL as addr was always NULL when passed to
__bt_find_remote_gatt_client_info  ,To fix this
address and request id is extracted from the variant
parameter.

Change-Id: If4b19109e893662b66663013c0051111461cc9bd
Signed-off-by: Abhishek Chandra <abhishek.ch@samsung.com>
bt-oal/bluez_hal/src/bt-hal-gatt-server.c

index b90ed57..e802ef3 100644 (file)
@@ -230,7 +230,7 @@ static const gchar characteristics_introspection_xml[] =
 "  <interface name='org.bluez.GattCharacteristic1'>"
 "        <method name='ReadValue'>"
 "               <arg type='s' name='address' direction='in'/>"
-"               <arg type='y' name='id' direction='in'/>"
+"               <arg type='u' name='id' direction='in'/>"
 "               <arg type='q' name='offset' direction='in'/>"
 "               <arg type='ay' name='Value' direction='out'/>"
 "        </method>"
@@ -1069,8 +1069,13 @@ static void __bt_gatt_char_method_call(GDBusConnection *connection,
                struct gatt_client_info_t *conn_info = NULL;
                struct gatt_service_info *svc_info = NULL;
 
+               g_variant_get(parameters, "(&suq)",
+                                       &addr, &req_id, &offset);
+
+               DBG("Request id = %u, Offset = %u", req_id, offset);
                DBG("Application path = %s", object_path);
                DBG("Sender = %s", sender);
+               DBG("Address = %s", addr);
 
                /* Check if device is already in connected list */
                conn_info = __bt_find_remote_gatt_client_info(addr);
@@ -1113,7 +1118,6 @@ static void __bt_gatt_char_method_call(GDBusConnection *connection,
 
                /* Convert address to hex */
                _bt_hal_convert_addr_string_to_type(ev.bdaddr, addr);
-
                event_cb(HAL_EV_GATT_READ_REQUESTED, (void *)&ev, sizeof(ev));
                return;
        } else if (g_strcmp0(method_name, "WriteValue") == 0) {