Merge "[GATT Client] Delivery ATT error code to higher layer" into tizen accepted/tizen/unified/20170721.201846 submit/tizen/20170721.013619
authorPyun DoHyun <dh79.pyun@samsung.com>
Fri, 21 Jul 2017 01:35:19 +0000 (01:35 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 21 Jul 2017 01:35:20 +0000 (01:35 +0000)
bt-service/bt-service-adapter.c

index 5c4603d..569afe2 100644 (file)
@@ -68,6 +68,7 @@ typedef struct {
 static bt_service_alarm_mgr_t alarm_mgr = {0, };
 
 static gboolean is_discovering;
+static gboolean discovery_req;
 static gboolean cancel_by_user;
 static bt_status_t adapter_status = BT_DEACTIVATED;
 static bt_le_status_t adapter_le_status = BT_LE_DEACTIVATED;
@@ -410,6 +411,7 @@ static int __bt_get_bonded_device_info(gchar *device_path,
 void _bt_set_discovery_status(gboolean mode)
 {
        is_discovering = mode;
+       discovery_req = FALSE;
 }
 
 void _bt_set_cancel_by_user(gboolean value)
@@ -2074,7 +2076,7 @@ int _bt_start_discovery(void)
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
-       is_discovering = TRUE;
+       discovery_req = TRUE;
        cancel_by_user = FALSE;
        /* discovery status will be change in event */
        g_variant_unref(result);
@@ -2122,7 +2124,7 @@ int _bt_start_custom_discovery(bt_discovery_role_type_t role)
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
-       is_discovering = TRUE;
+       discovery_req = TRUE;
        cancel_by_user = FALSE;
        /* discovery status will be change in event */
        g_variant_unref(result);
@@ -2167,6 +2169,7 @@ int _bt_cancel_discovery(void)
                return ret;
        }
 
+       discovery_req = FALSE;
        cancel_by_user = TRUE;
        /* discovery status will be change in event */
        g_variant_unref(result);
@@ -2175,7 +2178,7 @@ int _bt_cancel_discovery(void)
 
 gboolean _bt_is_discovering(void)
 {
-       return is_discovering;
+       return (is_discovering || discovery_req);
 }
 
 gboolean _bt_is_connectable(void)