summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-manager.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-03-10 21:27:51 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-03-10 21:27:51 +0000
commit6508cdb8cd4ecf53c21826a878ec57d0dbb9205c (patch)
tree874e5c61c5894f1b2fa9c2908c4c4b7c503c3975 /hcid/dbus-manager.c
parent1c37ee6736011106383c591cb387c724b0ff494e (diff)
Break everything
Diffstat (limited to 'hcid/dbus-manager.c')
-rw-r--r--hcid/dbus-manager.c58
1 files changed, 20 insertions, 38 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c
index ad04f862..ffbdc943 100644
--- a/hcid/dbus-manager.c
+++ b/hcid/dbus-manager.c
@@ -127,53 +127,35 @@ static DBusMessage *handle_mgr_default_device_req(DBusMessage *msg, void *data)
}
static const struct service_data mgr_services[] = {
- { MGR_LIST_ADAPTERS, handle_mgr_list_devices_req, MGR_LIST_ADAPTERS_SIGNATURE },
- { MGR_DEFAULT_ADAPTER, handle_mgr_default_device_req, MGR_DEFAULT_ADAPTER_SIGNATURE },
- { NULL, NULL, NULL }
+ { MGR_LIST_ADAPTERS, handle_mgr_list_devices_req },
+ { MGR_DEFAULT_ADAPTER, handle_mgr_default_device_req },
+ { NULL, NULL }
};
-DBusHandlerResult msg_func_manager(DBusConnection *conn, DBusMessage *msg, void *data)
+static DBusHandlerResult handle_manager_method(DBusConnection *conn,
+ DBusMessage *msg, void *data)
{
- const struct service_data *handlers;
- DBusMessage *reply = NULL;
- const char *iface;
- const char *method;
- const char *signature;
- uint32_t err = BLUEZ_EDBUS_UNKNOWN_METHOD;
- DBusHandlerResult ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- iface = dbus_message_get_interface(msg);
- method = dbus_message_get_member(msg);
- signature = dbus_message_get_signature(msg);
+ service_handler_func_t *handler;
- info("Manager path:%s method:%s", dbus_message_get_path(msg), method);
+ handler = find_service_handler(mgr_services, msg);
- if (strcmp(iface, MANAGER_INTERFACE))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (handler)
+ return handler(conn, msg, data);
- for (handlers = mgr_services; handlers->name != NULL; handlers++) {
- if (strcmp(handlers->name, method))
- continue;
-
- if (strcmp(handlers->signature, signature) != 0)
- err = BLUEZ_EDBUS_WRONG_SIGNATURE;
- else {
- reply = handlers->handler_func(msg, data);
- err = 0;
- }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
- ret = DBUS_HANDLER_RESULT_HANDLED;
- }
+DBusHandlerResult msg_func_manager(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+ const char *iface;
- if (err)
- reply = bluez_new_failure_msg(msg, err);
+ iface = dbus_message_get_interface(msg);
- if (reply) {
- if (!dbus_connection_send (conn, reply, NULL))
- error("Can't send reply message");
+ if (!strcmp(iface, MANAGER_INTERFACE))
+ return handle_manager_method(conn, msg, data);
- dbus_message_unref(reply);
- }
+ if (!strcmp(iface, SECURITY_INTERFACE))
+ return handle_security_method(conn, msg, data);
- return ret;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}