diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2006-11-01 12:58:31 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2006-11-01 12:58:31 +0000 |
commit | 1badf196a83fb8d32e212c49b7487b08962c18f0 (patch) | |
tree | b59e058454dd96d7196733482b3facae5b24a6e5 /hcid/dbus-manager.c | |
parent | c31fef0ff07c09edb9df8b0abcab9a9e828627a1 (diff) |
More cleanup. Move common dbus stuff to common/dbus.c. hcid/dbus.c -> hcid/dbus-hci.c
Diffstat (limited to 'hcid/dbus-manager.c')
-rw-r--r-- | hcid/dbus-manager.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c index 0def0476..4833e05f 100644 --- a/hcid/dbus-manager.c +++ b/hcid/dbus-manager.c @@ -46,6 +46,8 @@ #include "dbus-service.h" #include "dbus-manager.h" +static int default_adapter_id = -1; + static DBusHandlerResult interface_version(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -70,19 +72,18 @@ static DBusHandlerResult default_adapter(DBusConnection *conn, { DBusMessage *reply; char path[MAX_PATH_LENGTH], *path_ptr = path; - int default_dev = get_default_dev_id(); if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING)) return error_invalid_arguments(conn, msg); - if (default_dev < 0) + if (default_adapter_id < 0) return error_no_such_adapter(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; - snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, default_dev); + snprintf(path, sizeof(path), "%s/hci%d", BASE_PATH, default_adapter_id); dbus_message_append_args(reply, DBUS_TYPE_STRING, &path_ptr, DBUS_TYPE_INVALID); @@ -350,3 +351,13 @@ DBusHandlerResult handle_manager_method(DBusConnection *conn, return error_unknown_method(conn, msg); } + +int get_default_adapter(void) +{ + return default_adapter_id; +} + +void set_default_adapter(int new_default) +{ + default_adapter_id = new_default; +} |