Use vendor adv command only when multipled adv is supported 81/211081/1
authorDeokhyun Kim <dukan.kim@samsung.com>
Thu, 11 Oct 2018 08:09:46 +0000 (17:09 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 30 Jul 2019 01:16:03 +0000 (10:16 +0900)
[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 <dukan.kim@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-oal/bluez_hal/src/bt-hal-adapter-le.c
bt-oal/bluez_hal/src/bt-hal-adapter-le.h
bt-oal/bluez_hal/src/bt-hal-gatt-server.c
bt-service/bt-service-adapter-le.c

index 95ac2ff..8b6af39 100644 (file)
@@ -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]",
index 1c802ad..a26c393 100644 (file)
@@ -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);
 
index c46a45e..447da05 100644 (file)
@@ -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");
index 064894f..4264ee4 100644 (file)
@@ -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;