Check advertsing state 92/90992/1 accepted/tizen/3.0/ivi/20161011.053534 accepted/tizen/3.0/mobile/20161015.032740 accepted/tizen/3.0/tv/20161016.003502 accepted/tizen/3.0/wearable/20161015.081930 accepted/tizen/common/20161005.165617 accepted/tizen/ivi/20161006.075751 accepted/tizen/mobile/20161006.075708 accepted/tizen/tv/20161006.075723 accepted/tizen/wearable/20161006.075736 submit/tizen/20161005.091935 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000000 submit/tizen_3.0_ivi/20161010.000010 submit/tizen_3.0_mobile/20161015.000001 submit/tizen_3.0_tv/20161015.000000 submit/tizen_3.0_wearable/20161015.000001
authorTaejin Woo <tt.woo@samsung.com>
Wed, 5 Oct 2016 08:46:56 +0000 (17:46 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Wed, 5 Oct 2016 08:46:56 +0000 (17:46 +0900)
Change-Id: I4e9156bf035a14fb8c5804a07552141d86216cd4
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
src/bluetooth-adapter.c

index 4a02d01f604066a4cf4b3abd739b8dcfdf46f0c3..b94441f825e3fc3f1fcc98579ea5935e080a308d 100644 (file)
@@ -1598,6 +1598,8 @@ int bt_adapter_le_destroy_advertiser(bt_advertiser_h advertiser)
 {
        int ret = BT_ERROR_NONE;
        int error_code;
+       gboolean is_advertising = FALSE;
+
        bt_advertiser_s *__adv = (bt_advertiser_s *)advertiser;
 
        BT_CHECK_LE_SUPPORT();
@@ -1606,11 +1608,17 @@ int bt_adapter_le_destroy_advertiser(bt_advertiser_h advertiser)
 
        _bt_unset_cb(BT_EVENT_ADVERTISING_STATE_CHANGED);
 
-       error_code = bluetooth_set_advertising(__adv->handle, FALSE);
-       ret = _bt_get_error_code(error_code);
-       if (ret != BT_ERROR_NONE)
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
-                                               ret); /* LCOV_EXCL_LINE */
+       /* This operation is not related to the result */
+       error_code = bluetooth_is_advertising(&is_advertising);
+
+       if (is_advertising == TRUE) {
+               error_code = bluetooth_set_advertising(__adv->handle, FALSE);
+
+               ret = _bt_get_error_code(error_code);
+               if (ret != BT_ERROR_NONE)
+                       BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret),
+                                                       ret); /* LCOV_EXCL_LINE */
+       }
 
        advertiser_list = g_slist_remove(advertiser_list, __adv);