From 2e0ca45fe8cb4c7f6691164877fc8be655fdf1a5 Mon Sep 17 00:00:00 2001 From: "injun.yang" Date: Thu, 17 May 2018 18:33:56 +0900 Subject: [PATCH] Fix : Address is wrong in GATT Callback [Problem] Address is wrong in GATT read/write callback [Cause & Measure] Bluez pass IDA instead of first RPA. If rpa existed then pass it into GATT read/write callback. [Checking Method] GATT read/write in server Change-Id: Id26144ca307572ae9ff6839a033f986f21285cb9 --- src/gatt-database.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gatt-database.c b/src/gatt-database.c index 9d8511f..88b5953 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -2145,9 +2145,13 @@ static void read_setup_cb(DBusMessageIter *iter, void *user_data) #ifdef TIZEN_FEATURE_BLUEZ_MODIFY char dst_addr[18] = { 0 }; char *addr_value = dst_addr; - const bdaddr_t *bdaddr = device_get_address(op->device); - ba2str(bdaddr, dst_addr); + if (device_get_rpa_exist(op->device) == true) { + ba2str(device_get_rpa(op->device), dst_addr); + } else { + ba2str(device_get_address(op->device), dst_addr); + } + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value); dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &op->id); dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &op->offset); @@ -2198,9 +2202,13 @@ static void write_setup_cb(DBusMessageIter *iter, void *user_data) char dst_addr[18] = { 0 }; char *addr_value = dst_addr; gboolean response_needed = TRUE; - const bdaddr_t *bdaddr = device_get_address(op->device); - ba2str(bdaddr, dst_addr); + if (device_get_rpa_exist(op->device) == true) { + ba2str(device_get_rpa(op->device), dst_addr); + } else { + ba2str(device_get_address(op->device), dst_addr); + } + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value); dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &op->id); dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &op->offset); -- 2.7.4