summaryrefslogtreecommitdiffstats
path: root/input/error.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-19 14:58:44 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-19 14:58:44 +0000
commitf2c6a6f2debcccfb51d239834c3cf91a2c3a6c40 (patch)
tree2a83d19fc07684f6713dd901f46f04858a78bc3d /input/error.c
parent0ac929228aa1eb823f37776e2bbb84855417c66e (diff)
Moving input functions to the right files
Diffstat (limited to 'input/error.c')
-rw-r--r--input/error.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/input/error.c b/input/error.c
index 55c459da..658bdeff 100644
--- a/input/error.c
+++ b/input/error.c
@@ -25,4 +25,68 @@
#include <config.h>
#endif
+#include <stdlib.h>
+#include <dbus.h>
+
#include "error.h"
+
+#define INPUT_ERROR_INTERFACE "org.bluez.input.Error"
+
+DBusHandlerResult err_unknown_device(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE ".UnknownDevice",
+ "Invalid device"));
+}
+
+DBusHandlerResult err_generic(DBusConnection *conn, DBusMessage *msg,
+ const char *name, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg, name, str));
+
+}
+
+DBusHandlerResult err_failed(DBusConnection *conn, DBusMessage *msg,
+ const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE ".Failed", str));
+}
+
+DBusHandlerResult err_connection_failed(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE".ConnectionAttemptFailed",
+ str));
+}
+
+DBusHandlerResult err_already_exists(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE ".AlreadyExists", str));
+}
+
+DBusHandlerResult err_does_not_exist(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE ".DoesNotExist", str));
+}
+
+DBusHandlerResult err_not_supported(DBusConnection *conn, DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ INPUT_ERROR_INTERFACE ".NotSupported",
+ "The service is not supported by the remote device"));
+}
+