From e859a33e2b82d9bb2d495854926a37ac895ef66e Mon Sep 17 00:00:00 2001 From: dh79pyun Date: Thu, 27 Jan 2022 09:44:26 +0900 Subject: [PATCH] Store EIR Manufacturer specific data into the device information Change-Id: Ia3d9d62db972f394d30b9db934bbceee6977098f Signed-off-by: dh79pyun --- bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c | 4 +++- bt-oal/common/oal-common.c | 1 + bt-oal/include/oal-manager.h | 2 +- bt-oal/oal-device-mgr.c | 16 ++++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c b/bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c index a42671d..4b6037b 100644 --- a/bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c +++ b/bt-oal/bluez_hal/src/bt-hal-device-dbus-handler.c @@ -937,6 +937,8 @@ static gboolean __bt_device_bonded_device_info_cb(gpointer user_data) data_len = g_variant_get_uint16(value); DBG("LegacyManufacturerDataLen [%d]", data_len); } else if (!g_strcmp0(key, "LegacyManufacturerData")) { + DBG("LegacyManufacturerData"); + manufacturer_data = g_byte_array_new(); g_variant_get(value, "ay", &char_value_iter); while (g_variant_iter_loop(char_value_iter, "y", &char_value)) @@ -947,7 +949,7 @@ static gboolean __bt_device_bonded_device_info_cb(gpointer user_data) if (manufacturer_data) { if (manufacturer_data->len > 0) { size += __bt_insert_hal_properties( - buf + size, HAL_PROP_DEVICE_BLE_ADV_DATA, + buf + size, HAL_PROP_DEVICE_MANUFACTURER_DATA, manufacturer_data->len, manufacturer_data->data); ev->num_props++; } diff --git a/bt-oal/common/oal-common.c b/bt-oal/common/oal-common.c index 4119ac8..4800357 100644 --- a/bt-oal/common/oal-common.c +++ b/bt-oal/common/oal-common.c @@ -127,6 +127,7 @@ void parse_device_properties(int num_properties, bt_property_t *properties, dev_info->type = dev_type - 1;//OAL enum starts with 0 and Bluedroid with 1 break; } + case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA: case BT_PROPERTY_REMOTE_BLE_ADV_DATA: { if (adv_info) { adv_info->adv_data = properties[i].val; diff --git a/bt-oal/include/oal-manager.h b/bt-oal/include/oal-manager.h index 8a1ab7d..abcbb7f 100755 --- a/bt-oal/include/oal-manager.h +++ b/bt-oal/include/oal-manager.h @@ -44,7 +44,7 @@ extern "C" { #define BLUETOOTH_UUID_STRING_MAX 50 -#define BT_DEVICE_MANUFACTURER_DATA_LEN_MAX 31 /***/ +#define BT_DEVICE_MANUFACTURER_DATA_LEN_MAX 62 /***/ typedef void (*oal_event_callback)(int event, gpointer event_data, gsize size); diff --git a/bt-oal/oal-device-mgr.c b/bt-oal/oal-device-mgr.c index d0d9d35..c192336 100755 --- a/bt-oal/oal-device-mgr.c +++ b/bt-oal/oal-device-mgr.c @@ -705,9 +705,25 @@ void cb_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr, memcpy(&dev_props_event->device_info, dev_info, sizeof(remote_device_t)); } else { + int i; + BT_DBG("BREDR type Device"); + + /* Legacy Manufacturer data */ + if (adv_info.len > 0) { + dev_props_event->adv_len = adv_info.len; + if (dev_props_event->adv_len > 0) + memcpy(dev_props_event->adv_data, + adv_info.adv_data, adv_info.len); + + for (i = 0; i < dev_props_event->adv_len; i++) + BT_DBG("Adv Data[%d] = [0x%x]", + i, dev_props_event->adv_data[i]); + } + memcpy(&dev_props_event->device_info, dev_info, sizeof(remote_device_t)); + } event_data = dev_props_event; -- 2.7.4