From: Deokhyun Kim Date: Thu, 11 Oct 2018 08:09:46 +0000 (+0900) Subject: Use vendor adv command only when multipled adv is supported X-Git-Tag: accepted/tizen/unified/20190801.025406~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=01fe76979e43709716f0cc4a14ad7b9e5c43c9b7 Use vendor adv command only when multipled adv is supported [Model] Lux [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Internal [Occurrence Version] N/A [Problem] Use vendor adv command only when multipled adv is supported [Cause & Measure] [Checking Method] [Team] IoT Hub [Developer] Deokhyun Kim [Solution company] Samsung [Change Type] Specification change Change-Id: If927170563471b35b67a6312af470690e06d630f Signed-off-by: Deokhyun Kim Signed-off-by: DoHyun Pyun --- diff --git a/bt-oal/bluez_hal/src/bt-hal-adapter-le.c b/bt-oal/bluez_hal/src/bt-hal-adapter-le.c index 95ac2ff..8b6af39 100644 --- a/bt-oal/bluez_hal/src/bt-hal-adapter-le.c +++ b/bt-oal/bluez_hal/src/bt-hal-adapter-le.c @@ -277,7 +277,7 @@ void _bt_hal_free_server_slot(int slot_id) memset(&le_adv_slot[slot_id], 0x00, sizeof(bt_adapter_le_adv_slot_t)); } -int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid) +int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid, gboolean use_reserved_slot) { int i; @@ -297,6 +297,14 @@ int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid) } } + /* We should consider 'use_reverved_slot' in later */ + if (le_feature_info.adv_inst_max <= 1) + i = 0; + else if (use_reserved_slot == TRUE) + i = 1; + else + i = 2; + for (i = 0; i < le_feature_info.adv_inst_max; i++) { if (le_adv_slot[i].initialized == 0) { DBG("Slot to be allocated [%d] UUID to be registered [%s]", diff --git a/bt-oal/bluez_hal/src/bt-hal-adapter-le.h b/bt-oal/bluez_hal/src/bt-hal-adapter-le.h index 1c802ad..a26c393 100644 --- a/bt-oal/bluez_hal/src/bt-hal-adapter-le.h +++ b/bt-oal/bluez_hal/src/bt-hal-adapter-le.h @@ -46,7 +46,7 @@ void _bt_hal_unregister_gatt_le_dbus_handler_cb(); gboolean _bt_hal_update_le_feature_support(const char *item, const char *value, bt_local_le_features_t *le_features); -int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid); +int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid, gboolean use_reserved_slot); int _bt_hal_get_adv_slot_adv_handle(int slot_id); diff --git a/bt-oal/bluez_hal/src/bt-hal-gatt-server.c b/bt-oal/bluez_hal/src/bt-hal-gatt-server.c index c46a45e..447da05 100644 --- a/bt-oal/bluez_hal/src/bt-hal-gatt-server.c +++ b/bt-oal/bluez_hal/src/bt-hal-gatt-server.c @@ -1726,7 +1726,7 @@ static bt_status_t gatt_server_register_app(bt_uuid_t *uuid) hal_register_server_data *user_data = g_malloc0(sizeof(hal_register_server_data)); /* Check if slot available */ - server_if = _bt_hal_get_available_adv_slot_id(uuid); + server_if = _bt_hal_get_available_adv_slot_id(uuid, FALSE); if (server_if == -1) { ERR("Allocation of server instance failed"); diff --git a/bt-service/bt-service-adapter-le.c b/bt-service/bt-service-adapter-le.c index 064894f..4264ee4 100644 --- a/bt-service/bt-service-adapter-le.c +++ b/bt-service/bt-service-adapter-le.c @@ -270,10 +270,10 @@ int __bt_get_available_adv_slot_id(const char *sender, int adv_handle, gboolean return i; } - if (le_feature_info.adv_inst_max <= 2) - i = 0; - else if (le_feature_info.adv_inst_max > 2 && use_reserved_slot == TRUE) + if (le_feature_info.adv_inst_max <= 1) i = 0; + else if (use_reserved_slot == TRUE) + i = 1; else i = 2;