summaryrefslogtreecommitdiffstats
path: root/serial/error.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-15 16:59:41 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-15 16:59:41 +0000
commitceeb274a3bc8f4fda2a08c1a831a1ffbfb2f85a8 (patch)
treed56f2bda110cd0d4453bc7149588c0f7f6912622 /serial/error.c
parente5d465b5adb59f2b199819793939d781376b7d75 (diff)
serial: moving error functions to error.c
Diffstat (limited to 'serial/error.c')
-rw-r--r--serial/error.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/serial/error.c b/serial/error.c
index 55c459da..c3ec9144 100644
--- a/serial/error.c
+++ b/serial/error.c
@@ -26,3 +26,82 @@
#endif
#include "error.h"
+
+#define SERIAL_ERROR_INTERFACE "org.bluez.serial.Error"
+
+DBusHandlerResult err_connection_canceled(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE".ConnectionCanceled",
+ "Connection creation canceled"));
+}
+
+DBusHandlerResult err_connection_failed(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE".ConnectionAttemptFailed", str));
+}
+
+DBusHandlerResult err_connection_in_progress(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE".ConnectionInProgress",
+ "Connection creation in progress"));
+}
+
+DBusHandlerResult err_connection_not_in_progress(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE".ConnectionNotInProgress",
+ "Connection creation not in progress"));
+}
+
+DBusHandlerResult err_does_not_exist(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE ".DoesNotExist", str));
+}
+
+DBusHandlerResult err_failed(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE ".Failed", str));
+}
+
+DBusHandlerResult err_invalid_args(DBusConnection *conn,
+ DBusMessage *msg, const char *str)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE ".InvalidArguments", str));
+}
+
+DBusHandlerResult err_not_authorized(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE ".NotAuthorized",
+ "Owner not allowed"));
+}
+
+DBusHandlerResult err_not_supported(DBusConnection *conn,
+ DBusMessage *msg)
+{
+ return send_message_and_unref(conn,
+ dbus_message_new_error(msg,
+ SERIAL_ERROR_INTERFACE ".NotSupported",
+ "The service is not supported by the remote device"));
+}