From 53f6b272df00f10825c70139faabe542441cf221 Mon Sep 17 00:00:00 2001 From: Amit Purwar Date: Tue, 15 Sep 2020 18:19:01 +0530 Subject: [PATCH] Enable advertising after gatt server is connected This enables advertising on gatt server after gatt server is connecteed with the remote gatt client. Advertisement slot is allocated from slot-1 when multi advertisement is supported. Change-Id: Ie6a6aee5cb21d6abfe56cfb5049428a29cf06d79 Signed-off-by: Amit Purwar --- bt-oal/bluez_hal/src/bt-hal-adapter-le.c | 4 ++-- bt-oal/bluez_hal/src/bt-hal-gatt-server.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 ba84848..b1b4b1a 100644 --- a/bt-oal/bluez_hal/src/bt-hal-adapter-le.c +++ b/bt-oal/bluez_hal/src/bt-hal-adapter-le.c @@ -365,9 +365,9 @@ int _bt_hal_get_available_adv_slot_id(bt_uuid_t *uuid, gboolean use_reserved_slo else if (use_reserved_slot == TRUE) i = 1; else - i = 2; + i = 0; - for (i = 0; i < le_feature_info.adv_inst_max; i++) { + for ( ; 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]", i, btuuid2str(uuid->uu)); 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 3b267f1..bdec0d0 100644 --- a/bt-oal/bluez_hal/src/bt-hal-gatt-server.c +++ b/bt-oal/bluez_hal/src/bt-hal-gatt-server.c @@ -3490,7 +3490,7 @@ static int bt_hal_gatts_allocate_adv_slot(struct hal_gatts_server_register_info_ /* allocate adv slot for gatt server if not assigned */ if (server_register_info->adv_slot_id < 0 ) { - adv_slot_id = _bt_hal_get_available_adv_slot_id(&server_register_info->app_uuid, FALSE); + adv_slot_id = _bt_hal_get_available_adv_slot_id(&server_register_info->app_uuid, TRUE); if (adv_slot_id < 0) { ERR("failed to get the adv_slot"); return -1; -- 2.7.4