summaryrefslogtreecommitdiffstats
path: root/hcid/adapter.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-12 15:07:07 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-12 15:07:07 +0000
commit75add5651e5dbc49c9c144acceac7e2c32d9bd16 (patch)
tree98490b790c08fa7dbbb341a4ca23814f84ed0960 /hcid/adapter.c
parent48cd630295b689720a564ab8a03c0473930c63d6 (diff)
Added RemoveDevice
Diffstat (limited to 'hcid/adapter.c')
-rw-r--r--hcid/adapter.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index 850d9f2e..e2e22548 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -3420,21 +3420,32 @@ static DBusHandlerResult create_device(DBusConnection *conn,
static DBusHandlerResult remove_device(DBusConnection *conn,
DBusMessage *msg, void *data)
{
+ struct adapter *adapter = data;
DBusMessage *reply;
const char *path;
+ GSList *l;
if (!hcid_dbus_use_experimental())
return error_unknown_method(conn, msg);
- if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path,
+ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID) == FALSE)
return error_invalid_arguments(conn, msg, NULL);
+ l = g_slist_find_custom(adapter->devices, path, (GCompareFunc) strcmp);
+ if (!l)
+ return error_device_does_not_exist(conn, msg);
+
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ /* FIXME: Remove from filesystem */
+ /* FIXME: Remove linkkeys */
+
device_remove(path);
+ g_free(l->data);
+ adapter->devices = g_slist_remove(adapter->devices, l->data);
return send_message_and_unref(conn, reply);
}