summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-03-13 16:57:12 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-03-13 16:57:12 +0000
commitdfad08e334136022c3918d6247823e7a79ca899f (patch)
tree3fbf62e665167ede0389d552f054fbc5d7dc145d /common
parentb631c83b6e8c324d7bca97b4dbda9bb93a62d653 (diff)
Move error_unknown_method to libhelper.
Diffstat (limited to 'common')
-rw-r--r--common/error.c21
-rw-r--r--common/error.h1
2 files changed, 22 insertions, 0 deletions
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 <config.h>
#endif
+#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -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);