diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-11-26 13:43:17 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-11-26 13:43:17 +0000 |
commit | 7e88afe4f8307c092172ff3c3b76c2f95ab00293 (patch) | |
tree | bdc418344c1e1f724421120bdeeeab0dd7fa3ce5 /audio | |
parent | 4392fbd3d96e2eea0d91f0eb9fd059ab38255986 (diff) |
Update services to new error codes and helper functions
Diffstat (limited to 'audio')
-rw-r--r-- | audio/Makefile.am | 2 | ||||
-rw-r--r-- | audio/error.c | 109 | ||||
-rw-r--r-- | audio/error.h | 35 | ||||
-rw-r--r-- | audio/headset.c | 52 | ||||
-rw-r--r-- | audio/manager.c | 55 | ||||
-rw-r--r-- | audio/sink.c | 19 |
6 files changed, 65 insertions, 207 deletions
diff --git a/audio/Makefile.am b/audio/Makefile.am index b04fc302..f9284b05 100644 --- a/audio/Makefile.am +++ b/audio/Makefile.am @@ -12,7 +12,7 @@ service_PROGRAMS = bluetoothd-service-audio bluetoothd_service_audio_SOURCES = main.c \ manager.h manager.c headset.h headset.c ipc.h ipc.c unix.h unix.c \ - error.h error.c device.h device.c gateway.h gateway.c \ + device.h device.c gateway.h gateway.c \ sink.c sink.h avdtp.c avdtp.h a2dp.c a2dp.h control.c control.h bluetoothd_service_audio_LDADD = $(top_builddir)/common/libhelper.a \ diff --git a/audio/error.c b/audio/error.c deleted file mode 100644 index 4e9a880b..00000000 --- a/audio/error.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2006-2007 Nokia Corporation - * Copyright (C) 2004-2007 Marcel Holtmann <marcel@holtmann.org> - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <dbus/dbus.h> - -#include "dbus.h" - -#include "error.h" -#include "logging.h" - -#define AUDIO_ERROR_INTERFACE "org.bluez.audio.Error" - -/* FIXME: Remove these once global error functions exist */ -static DBusHandlerResult error_reply(DBusConnection *conn, DBusMessage *msg, - const char *name, const char *descr) -{ - DBusMessage *derr; - - if (!conn || !msg) - return DBUS_HANDLER_RESULT_HANDLED; - - derr = dbus_message_new_error(msg, name, descr); - if (!derr) { - error("Unable to allocate new error return"); - return DBUS_HANDLER_RESULT_NEED_MEMORY; - } - - return send_message_and_unref(conn, derr); -} - -DBusHandlerResult err_invalid_args(DBusConnection *conn, - DBusMessage *msg, const char *descr) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".InvalidArguments", - descr ? descr : "Invalid arguments in method call"); -} - -DBusHandlerResult err_already_connected(DBusConnection *conn, DBusMessage *msg) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".AlreadyConnected", - "Already connected to a device"); -} - -DBusHandlerResult err_not_connected(DBusConnection *conn, DBusMessage *msg) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".NotConnected", - "Not connected to any device"); -} - -DBusHandlerResult err_not_supported(DBusConnection *conn, DBusMessage *msg) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".NotSupported", - "The service is not supported by the remote device"); -} - -DBusHandlerResult err_connect_failed(DBusConnection *conn, - DBusMessage *msg, const char *err) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".ConnectFailed", err); -} - -DBusHandlerResult err_does_not_exist(DBusConnection *conn, DBusMessage *msg) -{ - return error_reply(conn, msg, - AUDIO_ERROR_INTERFACE ".DoesNotExist", - "Does not exist"); -} - -DBusHandlerResult err_not_available(DBusConnection *conn, DBusMessage *msg) -{ - return error_reply(conn, msg, AUDIO_ERROR_INTERFACE ".NotAvailable", - "Not available"); -} - -DBusHandlerResult err_failed(DBusConnection *conn, - DBusMessage *msg, const char *dsc) -{ - return error_reply(conn, msg, AUDIO_ERROR_INTERFACE ".Failed", dsc); -} diff --git a/audio/error.h b/audio/error.h deleted file mode 100644 index 377dea5b..00000000 --- a/audio/error.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2006-2007 Nokia Corporation - * Copyright (C) 2004-2007 Marcel Holtmann <marcel@holtmann.org> - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -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); diff --git a/audio/headset.c b/audio/headset.c index 175ad861..6cb5406d 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -384,7 +384,7 @@ static gboolean finalize_stream_setup(struct device *dev) static void pending_connect_failed(struct pending_connect *c, struct device *dev) { if (c->msg) - err_connect_failed(dev->conn, c->msg, strerror(c->err)); + error_connection_attempt_failed(dev->conn, c->msg, c->err); if (c->cb) c->cb(NULL, c->cb_data); pending_connect_free(c); @@ -680,7 +680,7 @@ static void get_record_reply(DBusPendingCall *call, void *data) failed_not_supported: if (c->msg) { - err_not_supported(device->conn, c->msg); + error_not_supported(device->conn, c->msg); dbus_message_unref(c->msg); c->msg = NULL; } @@ -721,10 +721,10 @@ static void get_handles_reply(DBusPendingCall *call, void *data) if (c->msg) { if (dbus_error_has_name(&derr, "org.bluez.Error.ConnectionAttemptFailed")) - err_connect_failed(device->conn, c->msg, - strerror(EHOSTDOWN)); + error_connection_attempt_failed(device->conn, c->msg, + EHOSTDOWN); else - err_not_supported(device->conn, c->msg); + error_not_supported(device->conn, c->msg); } dbus_error_free(&derr); goto failed; @@ -738,21 +738,21 @@ static void get_handles_reply(DBusPendingCall *call, void *data) error("Unable to get args from reply: %s", derr.message); dbus_error_free(&derr); if (c->msg) - err_not_supported(device->conn, c->msg); + error_not_supported(device->conn, c->msg); goto failed; } if (!array) { error("get_handles_reply: Unable to get handle array from reply"); if (c->msg) - err_not_supported(device->conn, c->msg); + error_not_supported(device->conn, c->msg); goto failed; } if (array_len < 1) { debug("No record handles found"); if (c->msg) - err_not_supported(device->conn, c->msg); + error_not_supported(device->conn, c->msg); goto failed; } @@ -765,7 +765,7 @@ static void get_handles_reply(DBusPendingCall *call, void *data) if (!msg) { error("Unable to allocate new method call"); if (c->msg) - err_connect_failed(device->conn, c->msg, strerror(ENOMEM)); + error_out_of_memory(device->conn, c->msg); goto failed; } @@ -780,7 +780,7 @@ static void get_handles_reply(DBusPendingCall *call, void *data) if (!dbus_connection_send_with_reply(device->conn, msg, &pending, -1)) { error("Sending GetRemoteServiceRecord failed"); if (c->msg) - err_connect_failed(device->conn, c->msg, strerror(EIO)); + error_connection_attempt_failed(device->conn, c->msg, EIO); goto failed; } @@ -945,7 +945,7 @@ static DBusHandlerResult hs_stop(DBusConnection *conn, DBusMessage *msg, return DBUS_HANDLER_RESULT_NEED_MEMORY; if (hs->state < HEADSET_STATE_PLAY_IN_PROGRESS) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); headset_set_state(device, HEADSET_STATE_CONNECTED); send_message_and_unref(conn, reply); @@ -988,7 +988,7 @@ static DBusHandlerResult hs_disconnect(DBusConnection *conn, DBusMessage *msg, return DBUS_HANDLER_RESULT_NEED_MEMORY; if (hs->state == HEADSET_STATE_DISCONNECTED) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); headset_set_state(device, HEADSET_STATE_DISCONNECTED); ba2str(&device->dst, hs_address); @@ -1030,7 +1030,7 @@ static DBusHandlerResult hs_connect(DBusConnection *conn, DBusMessage *msg, int err; if (hs->state > HEADSET_STATE_DISCONNECTED) - return err_already_connected(conn, msg); + return error_already_connected(conn, msg); c = g_try_new0(struct pending_connect, 1); if (!c) { @@ -1048,7 +1048,7 @@ static DBusHandlerResult hs_connect(DBusConnection *conn, DBusMessage *msg, error: pending_connect_free(c); - return err_connect_failed(conn, msg, strerror(-err)); + return error_connection_attempt_failed(conn, msg, -err); } static gboolean ring_timer_cb(gpointer data) @@ -1069,7 +1069,7 @@ static DBusHandlerResult hs_ring(DBusConnection *conn, DBusMessage *msg, DBusMessage *reply = NULL; if (hs->state < HEADSET_STATE_CONNECTED) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -1082,7 +1082,7 @@ static DBusHandlerResult hs_ring(DBusConnection *conn, DBusMessage *msg, if (headset_send(device->headset, "\r\nRING\r\n") != G_IO_ERROR_NONE) { dbus_message_unref(reply); - return err_failed(conn, msg, "Failed"); + return error_failed(conn, msg, "Failed"); } hs->ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, device); @@ -1102,7 +1102,7 @@ static DBusHandlerResult hs_cancel_ringing(DBusConnection *conn, DBusMessage *reply = NULL; if (hs->state < HEADSET_STATE_CONNECTED) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -1131,10 +1131,10 @@ static DBusHandlerResult hs_play(DBusConnection *conn, DBusMessage *msg, int err; if (hs->state < HEADSET_STATE_CONNECTED) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); if (hs->state >= HEADSET_STATE_PLAY_IN_PROGRESS) - return err_already_connected(conn, msg); + return error_already_connected(conn, msg); c = g_try_new0(struct pending_connect, 1); if (!c) @@ -1145,7 +1145,7 @@ static DBusHandlerResult hs_play(DBusConnection *conn, DBusMessage *msg, err = sco_connect(device, c); if (err < 0) { pending_connect_free(c); - return err_failed(conn, msg, strerror(-err)); + return error_failed(conn, msg, strerror(-err)); } return DBUS_HANDLER_RESULT_HANDLED; @@ -1161,7 +1161,7 @@ static DBusHandlerResult hs_get_speaker_gain(DBusConnection *conn, dbus_uint16_t gain; if (hs->state < HEADSET_STATE_CONNECTED || hs->sp_gain < 0) - return err_not_available(conn, msg); + return error_not_available(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -1187,7 +1187,7 @@ static DBusHandlerResult hs_get_mic_gain(DBusConnection *conn, dbus_uint16_t gain; if (hs->state < HEADSET_STATE_CONNECTED || hs->mic_gain < 0) - return err_not_available(conn, msg); + return error_not_available(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -1215,20 +1215,20 @@ static DBusHandlerResult hs_set_gain(DBusConnection *conn, char str[13]; if (hs->state < HEADSET_STATE_CONNECTED) - return err_not_connected(conn, msg); + return error_not_connected(conn, msg); dbus_error_init(&derr); dbus_message_get_args(msg, &derr, DBUS_TYPE_UINT16, &gain, DBUS_TYPE_INVALID); if (dbus_error_is_set(&derr)) { - err_invalid_args(conn, msg, derr.message); + error_invalid_arguments(conn, msg, derr.message); dbus_error_free(&derr); return DBUS_HANDLER_RESULT_HANDLED; } if (gain > 15) - return err_invalid_args(conn, msg, + return error_invalid_arguments(conn, msg, "Must be less than or equal to 15"); reply = dbus_message_new_method_return(msg); @@ -1242,7 +1242,7 @@ static DBusHandlerResult hs_set_gain(DBusConnection *conn, if (headset_send(device->headset, str) != G_IO_ERROR_NONE) { dbus_message_unref(reply); - return err_failed(conn, msg, "Unable to send to headset"); + return error_failed(conn, msg, "Unable to send to headset"); } done: diff --git a/audio/manager.c b/audio/manager.c index d80fb962..507f60ac 100644 --- a/audio/manager.c +++ b/audio/manager.c @@ -327,7 +327,7 @@ static void finish_sdp(struct audio_sdp_data *data, gboolean success) if (dbus_error_is_set(&derr)) { error("Unable to get message args"); success = FALSE; - err_failed(connection, data->msg, derr.message); + error_failed(connection, data->msg, derr.message); dbus_error_free(&derr); goto done; } @@ -336,14 +336,14 @@ static void finish_sdp(struct audio_sdp_data *data, gboolean success) if (!data->records) { debug("No audio audio related service records were found"); success = FALSE; - err_not_supported(connection, data->msg); + error_not_supported(connection, data->msg); goto done; } reply = dbus_message_new_method_return(data->msg); if (!reply) { success = FALSE; - err_failed(connection, data->msg, "Out of memory"); + error_failed(connection, data->msg, "Out of memory"); goto done; } @@ -392,13 +392,14 @@ static void get_record_reply(DBusPendingCall *call, dbus_error_init(&derr); if (dbus_set_error_from_message(&derr, reply)) { + /* FIXME : forward error message as is */ error("GetRemoteServiceRecord failed: %s", derr.message); if (dbus_error_has_name(&derr, "org.bluez.Error.ConnectionAttemptFailed")) - err_connect_failed(connection, data->msg, - strerror(EHOSTDOWN)); + error_connection_attempt_failed(connection, data->msg, + EHOSTDOWN); else - err_failed(connection, data->msg, derr.message); + error_failed(connection, data->msg, derr.message); dbus_error_free(&derr); goto failed; } @@ -406,7 +407,7 @@ static void get_record_reply(DBusPendingCall *call, if (!dbus_message_get_args(reply, NULL, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &array, &array_len, DBUS_TYPE_INVALID)) { - err_failed(connection, data->msg, + error_failed(connection, data->msg, "Unable to get args from GetRecordReply"); goto failed; } @@ -452,7 +453,7 @@ static void get_next_record(struct audio_sdp_data *data) "GetRemoteServiceRecord"); if (!msg) { error("Unable to allocate new method call"); - err_connect_failed(connection, data->msg, strerror(ENOMEM)); + error_out_of_memory(connection, data->msg); finish_sdp(data, FALSE); return; } @@ -471,7 +472,7 @@ static void get_next_record(struct audio_sdp_data *data) if (!dbus_connection_send_with_reply(connection, msg, &pending, -1)) { error("Sending GetRemoteServiceRecord failed"); - err_connect_failed(connection, data->msg, strerror(EIO)); + error_connection_attempt_failed(connection, data->msg, EIO); finish_sdp(data, FALSE); return; } @@ -506,12 +507,14 @@ static void get_handles_reply(DBusPendingCall *call, dbus_error_init(&derr); if (dbus_set_error_from_message(&derr, reply)) { + /* FIXME : forward error message as is */ error("GetRemoteServiceHandles failed: %s", derr.message); if (dbus_error_has_name(&derr, "org.bluez.Error.ConnectionAttemptFailed")) - err_connect_failed(connection, data->msg, strerror(EHOSTDOWN)); + error_connection_attempt_failed(connection, data->msg, + EHOSTDOWN); else - err_failed(connection, data->msg, derr.message); + error_failed(connection, data->msg, derr.message); dbus_error_free(&derr); goto failed; } @@ -520,7 +523,7 @@ static void get_handles_reply(DBusPendingCall *call, DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &array, &array_len, DBUS_TYPE_INVALID)) { - err_failed(connection, data->msg, + error_failed(connection, data->msg, "Unable to get args from reply"); goto failed; } @@ -571,7 +574,7 @@ static DBusHandlerResult get_handles(const char *uuid, "org.bluez.Adapter", "GetRemoteServiceHandles"); if (!msg) { - err_failed(connection, data->msg, + error_failed(connection, data->msg, "Could not create a new dbus message"); goto failed; } @@ -583,7 +586,7 @@ static DBusHandlerResult get_handles(const char *uuid, DBUS_TYPE_INVALID); if (!dbus_connection_send_with_reply(connection, msg, &pending, -1)) { - err_failed(connection, data->msg, + error_failed(connection, data->msg, "Sending GetRemoteServiceHandles failed"); goto failed; } @@ -736,7 +739,7 @@ static DBusHandlerResult am_create_device(DBusConnection *conn, DBUS_TYPE_INVALID); if (dbus_error_is_set(&derr)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); dbus_error_free(&derr); return DBUS_HANDLER_RESULT_HANDLED; } @@ -826,18 +829,18 @@ static DBusHandlerResult am_remove_device(DBusConnection *conn, if (!dbus_message_get_args(msg, &derr, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); return DBUS_HANDLER_RESULT_HANDLED; } if (dbus_error_is_set(&derr)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); dbus_error_free(&derr); return DBUS_HANDLER_RESULT_HANDLED; } match = g_slist_find_custom(devices, path, device_path_cmp); if (!match) - return err_does_not_exist(connection, msg); + return error_device_does_not_exist(connection, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -907,7 +910,7 @@ static DBusHandlerResult am_find_by_addr(DBusConnection *conn, DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID); if (dbus_error_is_set(&derr)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); dbus_error_free(&derr); return DBUS_HANDLER_RESULT_HANDLED; } @@ -916,7 +919,7 @@ static DBusHandlerResult am_find_by_addr(DBusConnection *conn, device = manager_find_device(&bda, NULL, FALSE); if (!device) - return err_does_not_exist(conn, msg); + return error_device_does_not_exist(conn, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -935,12 +938,12 @@ static DBusHandlerResult am_default_device(DBusConnection *conn, DBusMessage *reply; if (!default_dev) - return err_does_not_exist(connection, msg); + return error_device_does_not_exist(connection, msg); if (default_dev->headset == NULL && dbus_message_is_method_call(msg, AUDIO_MANAGER_INTERFACE, "DefaultHeadset")) - return err_does_not_exist(connection, msg); + return error_device_does_not_exist(connection, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -966,18 +969,18 @@ static DBusHandlerResult am_change_default_device(DBusConnection *conn, if (!dbus_message_get_args(msg, &derr, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); return DBUS_HANDLER_RESULT_HANDLED; } if (dbus_error_is_set(&derr)) { - err_invalid_args(connection, msg, derr.message); + error_invalid_arguments(connection, msg, derr.message); dbus_error_free(&derr); return DBUS_HANDLER_RESULT_HANDLED; } match = g_slist_find_custom(devices, path, device_path_cmp); if (!match) - return err_does_not_exist(connection, msg); + return error_device_does_not_exist(connection, msg); reply = dbus_message_new_method_return(msg); if (!reply) @@ -999,7 +1002,7 @@ static DBusHandlerResult am_change_default_device(DBusConnection *conn, DBUS_TYPE_STRING, &device->path, DBUS_TYPE_INVALID); else - return err_does_not_exist(connection, msg); + return error_device_does_not_exist(connection, msg); default_dev = device; device_store(device, TRUE); diff --git a/audio/sink.c b/audio/sink.c index e4fedb12..b1fc5b2b 100644 --- a/audio/sink.c +++ b/audio/sink.c @@ -148,7 +148,7 @@ static gboolean stream_setup_retry(gpointer user_data) send_message_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; @@ -183,7 +183,7 @@ static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep, 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)); } @@ -202,14 +202,14 @@ static DBusHandlerResult sink_connect(DBusConnection *conn, 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); @@ -224,8 +224,7 @@ static DBusHandlerResult sink_connect(DBusConnection *conn, 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"); @@ -244,10 +243,10 @@ static DBusHandlerResult sink_disconnect(DBusConnection *conn, 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); @@ -260,7 +259,7 @@ static DBusHandlerResult sink_disconnect(DBusConnection *conn, 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); |