diff --git a/src/adapter.c b/src/adapter.c
index 8ff4e3d..28063ad 100644
--- a/src/adapter.c
+++ b/src/adapter.c
#define check_address(address) bachk(address)
#define OFF_TIMER 3
-#define AUTO_TIMER 60
static DBusConnection *connection = NULL;
static GSList *adapter_drivers = NULL;
g_slist_foreach(adapter->devices, set_auto_connect, NULL);
- adapter->auto_timeout_id = g_timeout_add_seconds(AUTO_TIMER,
+ adapter->auto_timeout_id = g_timeout_add_seconds(main_opts.autoto,
disable_auto, adapter);
}
diff --git a/src/hcid.h b/src/hcid.h
index ef25c79..e993a16 100644
--- a/src/hcid.h
+++ b/src/hcid.h
char *name;
uint32_t class;
uint16_t pageto;
+ uint16_t autoto;
uint32_t discovto;
uint32_t pairto;
uint16_t link_mode;
diff --git a/src/main.c b/src/main.c
index 06becfe..5a953c3 100644
--- a/src/main.c
+++ b/src/main.c
#define LAST_ADAPTER_EXIT_TIMEOUT 30
#define DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */
+#define DEFAULT_AUTO_CONNECT_TIMEOUT 60 /* 60 seconds */
struct main_opts main_opts;
main_opts.flags |= 1 << HCID_SET_PAGETO;
}
+ val = g_key_file_get_integer(config, "General", "AutoConnectTimeout",
+ &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else {
+ DBG("auto_to=%d", val);
+ main_opts.autoto = val;
+ }
+
str = g_key_file_get_string(config, "General", "Name", &err);
if (err) {
DBG("%s", err->message);
main_opts.mode = MODE_CONNECTABLE;
main_opts.name = g_strdup("BlueZ");
main_opts.discovto = DEFAULT_DISCOVERABLE_TIMEOUT;
+ main_opts.autoto = DEFAULT_AUTO_CONNECT_TIMEOUT;
main_opts.remember_powered = TRUE;
main_opts.reverse_sdp = TRUE;
main_opts.name_resolv = TRUE;
diff --git a/src/main.conf b/src/main.conf
index a9e2060..321f622 100644
--- a/src/main.conf
+++ b/src/main.conf
# The value is in seconds. Defaults is 30.
DiscoverSchedulerInterval = 30
+# Automatic connection for bonded devices driven by platform/user events.
+# If a platform plugin uses this mechanism, automatic connections will be
+# enabled during the interval defined below. Initially, this feature
+# intends to be used to establish connections to ATT channels.
+AutoConnectTimeout = 60
+
# What value should be assumed for the adapter Powered property when
# SetProperty(Powered, ...) hasn't been called yet. Defaults to true
InitiallyPowered = true