Skip to contentSkip to conversation

move audio service to use common exceptions

PATCH In review [email protected] 1 participant 2 messages Oct 28, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 move audio service to use common exceptions

This patch is for the audio service, and obviously depends on the common/ stuff :-)

Fabien

#1 lore raw

Resend: [Bluez-devel] [PATCH 3/3] move audio service to use common exceptions

Quoted 4 lines

This patch is for the audio service, and obviously depends on the common/ stuff
:-)

With patch attached this time :-)

Fabien

audio/device.c +1 -1
diff -x Entries -u -r -N utils/audio/device.c utils2/audio/device.c
@@ -45,7 +45,7 @@
 #include "logging.h"
 #include "textfile.h"
 
-#include "error.h"
+#include "common-error.h"
 #include "ipc.h"
 #include "device.h"
 #include "avdtp.h"
audio/error.c +2 -73

82 lines not on this page · raw message

audio/error.h +6 -11
diff -x Entries -u -r -N utils/audio/error.h utils2/audio/error.h
@@ -22,14 +22,9 @@
  *
  */
 
-DBusHandlerResult err_invalid_args(DBusConnection *conn,
-					DBusMessage *msg, const char *descr);
-DBusHandlerResult err_already_connected(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult err_not_connected(DBusConnection *conn, DBusMessage * msg);
-DBusHandlerResult err_not_supported(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult err_connect_failed(DBusConnection *conn,
-					DBusMessage *msg, const char *err);
-DBusHandlerResult err_does_not_exist(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult err_not_available(DBusConnection *conn, DBusMessage *msg);
-DBusHandlerResult err_failed(DBusConnection *conn,
-					DBusMessage *msg, const char *dsc);
+/**
+  This file must only contain errors that are specific to the audio service.
+  As such they will be found in the org.bluez.audio.Error namespace.
+  If errors are not specific to the audio service, they must be declared
+  in common-error.h, so that other services can use it
+*/
audio/headset.c +27 -27

200 lines not on this page · raw message

audio/manager.c +28 -27

193 lines not on this page · raw message

audio/sink.c +10 -11
diff -x Entries -u -r -N utils/audio/sink.c utils2/audio/sink.c
@@ -40,7 +40,7 @@
 #include "avdtp.h"
 #include "device.h"
 #include "a2dp.h"
-#include "error.h"
+#include "common-error.h"
 #include "sink.h"
 
 #define STREAM_SETUP_RETRY_TIMER 2000
@@ -147,7 +147,7 @@
 		dbus_connection_send_and_unref(pending->conn, reply);
 	} else {
 		debug("Stream setup failed, after XCASE connect:connect");
-		err_failed(pending->conn, pending->msg, "Stream setup failed");
+		error_failed(pending->conn, pending->msg, "Stream setup failed");
 	}
 
 	sink->connect = NULL;
@@ -182,7 +182,7 @@
 					stream_setup_retry, sink);
 		} else {
 			sink->connect = NULL;
-			err_failed(pending->conn, pending->msg, "Stream setup failed");
+			error_failed(pending->conn, pending->msg, "Stream setup failed");
 			pending_request_free(pending);
 			debug("Stream setup failed : %s", avdtp_strerror(err));
 		}
@@ -201,14 +201,14 @@
 		sink->session = avdtp_get(&dev->src, &dev->dst);
 
 	if (!sink->session)
-		return err_connect_failed(conn, msg,
+		return error_failed(conn, msg,
 						"Unable to get a session");
 
 	if (sink->connect || sink->disconnect)
-		return err_connect_failed(conn, msg, "Connect in progress");
+		return error_in_progress(conn, msg, "Device connection already in progress");
 
 	if (sink->state >= AVDTP_STATE_OPEN)
-		return err_already_connected(conn, msg);
+		return error_already_connected(conn, msg);
 
 	pending = g_new0(struct pending_request, 1);
 	pending->conn = dbus_connection_ref(conn);
@@ -223,8 +223,7 @@
 		sink->connect = NULL;
 		avdtp_unref(sink->session);
 		sink->session = NULL;
-		return err_connect_failed(conn, msg,
-						"Failed to request a stream");
+		return error_failed(conn, msg, "Failed to request a stream");
 	}
 
 	debug("stream creation in progress");
@@ -243,10 +242,10 @@
 	int err;
 
 	if (!sink->session)
-		return err_not_connected(conn, msg);
+		return error_not_connected(conn, msg);
 
 	if (sink->connect || sink->disconnect)
-		return err_failed(conn, msg, strerror(EBUSY));
+		return error_failed(conn, msg, strerror(EBUSY));
 
 	if (sink->state < AVDTP_STATE_OPEN) {
 		DBusMessage *reply = dbus_message_new_method_return(msg);
@@ -259,7 +258,7 @@
 
 	err = avdtp_close(sink->session, sink->stream);
 	if (err < 0)
-		return err_failed(conn, msg, strerror(-err));
+		return error_failed(conn, msg, strerror(-err));
 
 	pending = g_new0(struct pending_request, 1);
 	pending->conn = dbus_connection_ref(conn);