From dfad08e334136022c3918d6247823e7a79ca899f Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 13 Mar 2008 16:57:12 +0000 Subject: Move error_unknown_method to libhelper. --- common/error.c | 21 +++++++++++++++++++++ common/error.h | 1 + 2 files changed, 22 insertions(+) (limited to 'common') diff --git a/common/error.c b/common/error.c index daabe48d..58999393 100644 --- a/common/error.c +++ b/common/error.c @@ -27,6 +27,7 @@ #include #endif +#include #include #include @@ -240,3 +241,23 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg, return dbus_connection_send_and_unref(conn, derr); } + +/** + org.bluez.Error.UnknownMethod: + + Used in experimental code. +*/ +DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg) +{ + char error[128]; + const char *signature = dbus_message_get_signature(msg); + const char *method = dbus_message_get_member(msg); + const char *interface = dbus_message_get_interface(msg); + + snprintf(error, 128, "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist", + method, signature, interface); + + return send_message_and_unref(conn, + dbus_message_new_error(msg, ERROR_INTERFACE ".UnknownMethod", + error)); +} diff --git a/common/error.h b/common/error.h index 03d0c182..44b6f417 100644 --- a/common/error.h +++ b/common/error.h @@ -74,3 +74,4 @@ DBusHandlerResult error_failed_errno(DBusConnection *conn, DBusMessage *msg, DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg, const char *name, const char *descr); +DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg); -- cgit