Add the le_scan_event_id to bt-service receiver 51/99851/2 accepted/tizen/common/20161124.170236 accepted/tizen/ivi/20161125.004921 accepted/tizen/mobile/20161125.004825 accepted/tizen/tv/20161125.004900 accepted/tizen/wearable/20161125.004909 submit/tizen/20161124.091209
authorLee Hyuk <hyuk0512.lee@samsung.com>
Thu, 24 Nov 2016 08:47:06 +0000 (17:47 +0900)
committerLee Hyuk <hyuk0512.lee@samsung.com>
Thu, 24 Nov 2016 09:00:42 +0000 (18:00 +0900)
Change-Id: I67ee3d615a4fc066e51fec0afdfa2755539d4e08
Signed-off-by: Lee Hyuk <hyuk0512.lee@samsung.com>
bt-service/bt-service-event-receiver.c

index cf32889..89a9509 100644 (file)
@@ -55,6 +55,7 @@ static GDBusConnection *opc_obexd_conn;
 static GList *p_cache_list = NULL;
 
 static guint event_id;
+static guint le_scan_event_id = 0;
 static guint session_reinit_timer;
 guint nap_connected_device_count = 0;
 static guint hid_connected_device_count = 0;
@@ -344,7 +345,7 @@ gboolean _bt_discovery_finished_cb(gpointer user_data)
 static gboolean __bt_le_discovery_finished_cb(gpointer user_data)
 {
        int result = BLUETOOTH_ERROR_NONE;
-       event_id = 0;
+       le_scan_event_id = 0;
        GVariant *param = NULL;
        if (_bt_get_discovering_property(DISCOVERY_ROLE_LE) == FALSE) {
                if (_bt_get_cancel_by_user() == TRUE)
@@ -668,7 +669,7 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path)
                                BLUETOOTH_EVENT_LE_DISCOVERY_STARTED,
                                param);
                        } else {
-                               ret_if(event_id > 0);
+                               ret_if(le_scan_event_id > 0);
 
                                adapter_proxy = _bt_get_adapter_proxy();
                                ret_if(adapter_proxy == NULL);
@@ -686,7 +687,7 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path)
                                if (ret)
                                        g_variant_unref(ret);
 
-                               event_id = g_timeout_add(BT_DISCOVERY_FINISHED_DELAY,
+                               le_scan_event_id = g_timeout_add(BT_DISCOVERY_FINISHED_DELAY,
                                                (GSourceFunc)__bt_le_discovery_finished_cb, NULL);
                                }
                } else if (strcasecmp(property, "Name") == 0) {
@@ -3702,6 +3703,10 @@ void _bt_deinit_service_event_receiver(void)
                g_source_remove(event_id);
        event_id = 0;
 
+       if (le_scan_event_id > 0)
+               g_source_remove(le_scan_event_id);
+       le_scan_event_id = 0;
+
        BT_DBG("-");
 }