bool connectable;
guint disconn_timer;
guint discov_timer;
+ guint temporary_timer; /* Temporary/disappear timer */
struct browse_req *browse; /* service discover request */
struct bonding_req *bonding;
struct authentication_req *authr; /* authentication request */
if (device->discov_timer)
g_source_remove(device->discov_timer);
+ if (device->temporary_timer)
+ g_source_remove(device->temporary_timer);
+
if (device->connect)
dbus_message_unref(device->connect);
store_device_info(device);
}
+static gboolean device_disappeared(gpointer user_data)
+{
+ struct btd_device *dev = user_data;
+
+ dev->temporary_timer = 0;
+
+ btd_adapter_remove_device(dev->adapter, dev);
+
+ return FALSE;
+}
+
void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type)
{
if (bdaddr_type == BDADDR_BREDR)
device->bredr_seen = time(NULL);
else
device->le_seen = time(NULL);
+
+ if (!device_is_temporary(device))
+ return;
+
+ /* Restart temporary timer */
+ if (device->temporary_timer)
+ g_source_remove(device->temporary_timer);
+
+ device->temporary_timer = g_timeout_add_seconds(main_opts.tmpto,
+ device_disappeared,
+ device);
}
/* It is possible that we have two device objects for the same device in
device->temporary = temporary;
+ if (device->temporary_timer) {
+ g_source_remove(device->temporary_timer);
+ device->temporary_timer = 0;
+ }
+
if (temporary) {
if (device->bredr)
adapter_whitelist_remove(device->adapter, device);
adapter_connect_list_remove(device->adapter, device);
+ device->temporary_timer = g_timeout_add_seconds(main_opts.tmpto,
+ device_disappeared,
+ device);
return;
}
#define DEFAULT_PAIRABLE_TIMEOUT 0 /* disabled */
#define DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */
+#define DEFAULT_TEMPORARY_TIMEOUT 30 /* 30 seconds */
#define SHUTDOWN_GRACE_SECONDS 10
"FastConnectable",
"Privacy",
"JustWorksRepairing",
+ "TemporaryTimeout",
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
"EnableLEPrivacy",
"PinCode",
g_free(str);
}
+ val = g_key_file_get_integer(config, "General",
+ "TemporaryTimeout", &err);
+ if (err) {
+ DBG("%s", err->message);
+ g_clear_error(&err);
+ } else {
+ DBG("tmpto=%d", val);
+ main_opts.tmpto = val;
+ }
+
str = g_key_file_get_string(config, "General", "Name", &err);
if (err) {
DBG("%s", err->message);
main_opts.class = 0x000000;
main_opts.pairto = DEFAULT_PAIRABLE_TIMEOUT;
main_opts.discovto = DEFAULT_DISCOVERABLE_TIMEOUT;
+ main_opts.tmpto = DEFAULT_TEMPORARY_TIMEOUT;
main_opts.reverse_discovery = TRUE;
main_opts.name_resolv = TRUE;
main_opts.debug_keys = FALSE;
# Defaults to "never"
#JustWorksRepairing = never
+# How long to keep temporary devices around
+# The value is in seconds. Default is 30.
+# 0 = disable timer, i.e. never keep temporary devices
+#TemporaryTimeout = 30
+
[Controller]
# The following values are used to load default adapter parameters. BlueZ loads
# the values into the kernel before the adapter is powered if the kernel