Add the le_scan_event_id to bt-service receiver 49/99849/2 accepted/tizen/3.0/common/20161125.101514 accepted/tizen/3.0/ivi/20161125.080347 accepted/tizen/3.0/mobile/20161125.080252 accepted/tizen/3.0/tv/20161125.080315 accepted/tizen/3.0/wearable/20161125.080332 submit/tizen_3.0/20161124.091119
authorLee Hyuk <hyuk0512.lee@samsung.com>
Thu, 24 Nov 2016 08:45:11 +0000 (17:45 +0900)
committerLee Hyuk <hyuk0512.lee@samsung.com>
Thu, 24 Nov 2016 09:03:04 +0000 (18:03 +0900)
Change-Id: I62dbbff395e84dd8897484783dbea15a8b8b331a
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("-");
 }