summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-11-10 16:06:29 -0300
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-11-11 09:59:55 -0300
commiteeea876d77aba6b555ed0c0959951883d02eaa69 (patch)
tree6b1257a037ff2da99c5bc238cff6b86274819bbd
parent5c6426eff87049c9f8e49877f650772840907239 (diff)
Emit DeviceCreated for temporary devices.
DeviceCreated should be emitted for temporary devices since there could be meaningful information for user applications. This also affects DeviceRemoved since it now should be emitted for temporary devices too.
-rw-r--r--src/adapter.c23
-rw-r--r--src/device.c8
2 files changed, 15 insertions, 16 deletions
diff --git a/src/adapter.c b/src/adapter.c
index b874e12a..0e68359f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -953,6 +953,7 @@ struct btd_device *adapter_create_device(DBusConnection *conn,
struct btd_adapter *adapter, const char *address)
{
struct btd_device *device;
+ const char *path;
debug("adapter_create_device(%s)", address);
@@ -964,6 +965,14 @@ struct btd_device *adapter_create_device(DBusConnection *conn,
adapter->devices = g_slist_append(adapter->devices, device);
+ path = device_get_path(device);
+ g_dbus_emit_signal(conn, adapter->path,
+ ADAPTER_INTERFACE, "DeviceCreated",
+ DBUS_TYPE_OBJECT_PATH, &path,
+ DBUS_TYPE_INVALID);
+
+ adapter_update_devices(adapter);
+
return device;
}
@@ -1068,17 +1077,15 @@ void adapter_remove_device(DBusConnection *conn, struct btd_adapter *adapter,
delete_entry(&adapter->bdaddr, "profiles", dstaddr);
adapter->devices = g_slist_remove(adapter->devices, device);
- if (!device_is_temporary(device)) {
+ if (!device_is_temporary(device))
remove_bonding(conn, NULL, dstaddr, adapter);
- g_dbus_emit_signal(conn, adapter->path,
- ADAPTER_INTERFACE,
- "DeviceRemoved",
- DBUS_TYPE_OBJECT_PATH, &dev_path,
- DBUS_TYPE_INVALID);
+ g_dbus_emit_signal(conn, adapter->path,
+ ADAPTER_INTERFACE, "DeviceRemoved",
+ DBUS_TYPE_OBJECT_PATH, &dev_path,
+ DBUS_TYPE_INVALID);
- adapter_update_devices(adapter);
- }
+ adapter_update_devices(adapter);
agent = device_get_agent(device);
diff --git a/src/device.c b/src/device.c
index f8c5a3fd..20f46efc 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1071,14 +1071,6 @@ proceed:
/* Store the device's profiles in the filesystem */
store_profiles(device);
- g_dbus_emit_signal(req->conn, adapter_get_path(device->adapter),
- ADAPTER_INTERFACE, "DeviceCreated",
- DBUS_TYPE_OBJECT_PATH, &device->path,
- DBUS_TYPE_INVALID);
-
- /* Update device list */
- adapter_update_devices(device->adapter);
-
if (!req->msg)
goto cleanup;