aboutsummaryrefslogtreecommitdiffstats
path: root/binding-bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'binding-bluetooth')
-rw-r--r--binding-bluetooth/bluetooth-manager.c7
-rw-r--r--binding-bluetooth/bluetooth-manager.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/binding-bluetooth/bluetooth-manager.c b/binding-bluetooth/bluetooth-manager.c
index 407518f..2ff8925 100644
--- a/binding-bluetooth/bluetooth-manager.c
+++ b/binding-bluetooth/bluetooth-manager.c
@@ -1258,7 +1258,7 @@ static void *bt_event_loop_thread()
BluetoothManage_InitFlag_Set(TRUE);
BluetoothMonitorInit();
- g_timeout_add_seconds(5, bt_autoconnect, NULL);
+ BluetoothManage.autoconnect = g_timeout_add_seconds(5, bt_autoconnect, NULL);
LOGD("g_main_loop_run\n");
g_main_loop_run(cli.clientloop);
@@ -1493,6 +1493,11 @@ int adapter_start_discovery()
return -1;
}
+ if (BluetoothManage.autoconnect > 0) {
+ LOGW("Canceling autoconnection for discovery mode\n");
+ g_source_remove(BluetoothManage.autoconnect);
+ }
+
value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
ADAPTER_PATH, ADAPTER_INTERFACE, "StartDiscovery",
NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
diff --git a/binding-bluetooth/bluetooth-manager.h b/binding-bluetooth/bluetooth-manager.h
index 54d7ff8..36222df 100644
--- a/binding-bluetooth/bluetooth-manager.h
+++ b/binding-bluetooth/bluetooth-manager.h
@@ -161,6 +161,7 @@ typedef struct {
gboolean inited;
GMutex m;
gint watch;
+ guint autoconnect;
GSList * device;
GSList * priorities;
} stBluetoothManage;