diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-11-26 13:43:17 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-11-26 13:43:17 +0000 |
commit | 7e88afe4f8307c092172ff3c3b76c2f95ab00293 (patch) | |
tree | bdc418344c1e1f724421120bdeeeab0dd7fa3ce5 /hcid/dbus-error.c | |
parent | 4392fbd3d96e2eea0d91f0eb9fd059ab38255986 (diff) |
Update services to new error codes and helper functions
Diffstat (limited to 'hcid/dbus-error.c')
-rw-r--r-- | hcid/dbus-error.c | 110 |
1 files changed, 1 insertions, 109 deletions
diff --git a/hcid/dbus-error.c b/hcid/dbus-error.c index af67f831..26a0ffa6 100644 --- a/hcid/dbus-error.c +++ b/hcid/dbus-error.c @@ -37,14 +37,7 @@ #include "dbus.h" #include "dbus-common.h" #include "dbus-error.h" - -DBusHandlerResult error_failed(DBusConnection *conn, DBusMessage *msg, int err) -{ - const char *str = strerror(err); - - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".Failed", str)); -} +#include "error.h" DBusHandlerResult error_not_ready(DBusConnection *conn, DBusMessage *msg) { @@ -52,13 +45,6 @@ DBusHandlerResult error_not_ready(DBusConnection *conn, DBusMessage *msg) dbus_message_new_error(msg, ERROR_INTERFACE ".NotReady", "Adapter is not ready")); } -DBusHandlerResult error_invalid_arguments(DBusConnection *conn, DBusMessage *msg) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".InvalidArguments", - "Invalid arguments")); -} - DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg) { char error[128]; @@ -88,13 +74,6 @@ DBusHandlerResult error_rejected(DBusConnection *conn, DBusMessage *msg) "Rejected")); } -DBusHandlerResult error_out_of_memory(DBusConnection *conn, DBusMessage *msg) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".OutOfMemory", - "Out of memory")); -} - DBusHandlerResult error_no_such_adapter(DBusConnection *conn, DBusMessage *msg) { return send_message_and_unref(conn, @@ -109,20 +88,6 @@ DBusHandlerResult error_no_such_service(DBusConnection *conn, DBusMessage *msg) "No such service")); } -DBusHandlerResult error_not_available(DBusConnection *conn, DBusMessage *msg) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".NotAvailable", - "Not available")); -} - -DBusHandlerResult error_not_supported(DBusConnection *conn, DBusMessage *msg) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".NotSupported", - "Not supported")); -} - DBusHandlerResult error_request_deferred(DBusConnection *conn, DBusMessage *msg) { return send_message_and_unref(conn, @@ -130,13 +95,6 @@ DBusHandlerResult error_request_deferred(DBusConnection *conn, DBusMessage *msg) "Request Deferred")); } -DBusHandlerResult error_not_connected(DBusConnection *conn, DBusMessage *msg) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".NotConnected", - "Not connected")); -} - DBusHandlerResult error_unsupported_major_class(DBusConnection *conn, DBusMessage *msg) { return send_message_and_unref(conn, @@ -144,48 +102,12 @@ DBusHandlerResult error_unsupported_major_class(DBusConnection *conn, DBusMessag "Unsupported Major Class")); } -DBusHandlerResult error_connection_attempt_failed(DBusConnection *conn, DBusMessage *msg, int err) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".ConnectionAttemptFailed", - err ? strerror(err) : "Connection attempt failed")); -} - -static DBusHandlerResult error_already_exists(DBusConnection *conn, DBusMessage *msg, const char *str) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".AlreadyExists", str)); -} - -DBusHandlerResult error_does_not_exist(DBusConnection *conn, DBusMessage *msg, const char *str) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".DoesNotExist", str)); -} - -static DBusHandlerResult error_in_progress(DBusConnection *conn, DBusMessage *msg, const char *str) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".InProgress", str)); -} - -DBusHandlerResult error_canceled(DBusConnection *conn, DBusMessage *msg, const char *str) -{ - return send_message_and_unref(conn, - dbus_message_new_error(msg, ERROR_INTERFACE ".Canceled", str)); -} - DBusHandlerResult error_not_in_progress(DBusConnection *conn, DBusMessage *msg, const char *str) { return send_message_and_unref(conn, dbus_message_new_error(msg, ERROR_INTERFACE ".NotInProgress", str)); } -DBusHandlerResult error_connect_canceled(DBusConnection *conn, DBusMessage *msg) -{ - return error_canceled(conn, msg, "Connection creation was canceled"); -} - DBusHandlerResult error_bonding_already_exists(DBusConnection *conn, DBusMessage *msg) { return error_already_exists(conn, msg, "Bonding already exists"); @@ -218,16 +140,6 @@ DBusHandlerResult error_discover_in_progress(DBusConnection *conn, DBusMessage * return error_in_progress(conn, msg, "Discover in progress"); } -DBusHandlerResult error_connect_in_progress(DBusConnection *conn, DBusMessage *msg) -{ - return error_in_progress(conn, msg, "Connection creation in progress"); -} - -DBusHandlerResult error_connect_not_in_progress(DBusConnection *conn, DBusMessage *msg) -{ - return error_not_in_progress(conn, msg, "Connection creation not in progress"); -} - DBusHandlerResult error_record_does_not_exist(DBusConnection *conn, DBusMessage *msg) { return error_does_not_exist(conn, msg, "Record does not exist"); @@ -253,16 +165,6 @@ DBusHandlerResult error_auth_agent_does_not_exist(DBusConnection *conn, DBusMess return error_does_not_exist(conn, msg, "Authorization agent does not exist"); } -DBusHandlerResult error_binding_does_not_exist(DBusConnection *conn, DBusMessage *msg) -{ - return error_does_not_exist(conn, msg, "Binding does not exist"); -} - -DBusHandlerResult error_service_already_exists(DBusConnection *conn, DBusMessage *msg) -{ - return error_already_exists(conn, msg, "Service already exists"); -} - DBusHandlerResult error_service_does_not_exist(DBusConnection *conn, DBusMessage *msg) { return error_does_not_exist(conn, msg, "Service does not exist"); @@ -278,16 +180,6 @@ DBusHandlerResult error_audit_already_exists(DBusConnection *conn, DBusMessage * return error_already_exists(conn, msg, "Audit already performed"); } -DBusHandlerResult error_trusted_device_already_exists(DBusConnection *conn, DBusMessage *msg) -{ - return error_already_exists(conn, msg, "Trusted device already exists"); -} - -DBusHandlerResult error_trusted_device_does_not_exists(DBusConnection *conn, DBusMessage *msg) -{ - return error_does_not_exist(conn, msg, "Trusted device does not exist"); -} - DBusHandlerResult error_disconnect_in_progress(DBusConnection *conn, DBusMessage *msg) { return error_in_progress(conn, msg, "Disconnection in progress"); |