Use vendor adv command only when multipled adv is supported
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / src / bt-hal-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]",