Fix the issue that previously set scan resp data was not removed 25/292925/1 accepted/tizen/unified/20230601.163001
authorWootak Jung <wootak.jung@samsung.com>
Wed, 17 May 2023 05:42:00 +0000 (14:42 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 17 May 2023 06:00:08 +0000 (15:00 +0900)
reproduction steps:
1. create 1st advertiser and fill scan resp data
2. start advertising by 1st advertiser
3. stop 1st advertiser
4. create 2nd advertiser and don't fill scan resp data
5. start advertising by 2nd advertiser
6. 1st scan resp data was not removed

Change-Id: Icb144e25fd67f3aa5bd488ee3a1f05c99d152501
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-oal/bluez_hal/src/bt-hal-adapter-le.c

index 0c60734ae32deecaa8309eb9ea4aa8c37d80c17c..dc1ea5e2deb20d15231cdf07d732d50eab246dd0 100644 (file)
@@ -929,6 +929,17 @@ int _bt_hal_set_advertising_data(btgatt_adv_param_setup_t adv_param_setup)
                                g_variant_new("(@ayi)", temp, slot_id),
                                G_DBUS_CALL_FLAGS_NONE,
                                -1, NULL, &error);
+
+               builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+               temp = g_variant_new("ay", builder);
+               g_variant_builder_unref(builder);
+
+               /* If there is no scan response data, explicitly set the empty value.
+                * Oherwise, previously set (stopped) scan resp may be used */
+               ret = g_dbus_proxy_call_sync(proxy, "SetScanRespData",
+                               g_variant_new("(@ayi)", temp, slot_id),
+                               G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, &error);
        } else {
                /* Set Scan response data to stack */
                ret = g_dbus_proxy_call_sync(proxy, "SetScanRespData",
@@ -943,7 +954,7 @@ int _bt_hal_set_advertising_data(btgatt_adv_param_setup_t adv_param_setup)
                return BT_STATUS_FAIL;
        }
 
-       INFO("Request of SetAdvertisingData or SetScanRespData is success");
+       INFO("Request of %s is success", adv_param_setup.set_scan_rsp ? "SetScanRespData" : "SetAdvertisingData");
 
        if (ret)
                g_variant_unref(ret);