Enable advertising after gatt server is connected 77/244177/2
authorAmit Purwar <amit.purwar@samsung.com>
Tue, 15 Sep 2020 12:49:01 +0000 (18:19 +0530)
committerAmit Purwar <amit.purwar@samsung.com>
Tue, 15 Sep 2020 13:57:39 +0000 (19:27 +0530)
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 <amit.purwar@samsung.com>
bt-oal/bluez_hal/src/bt-hal-adapter-le.c
bt-oal/bluez_hal/src/bt-hal-gatt-server.c

index ba84848..b1b4b1a 100644 (file)
@@ -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));
index 3b267f1..bdec0d0 100644 (file)
@@ -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;