Add btd_error_busy()

This commit is contained in:
Gustavo F. Padovan 2010-12-06 17:10:46 -02:00 committed by Johan Hedberg
parent cd5f44488f
commit 27fffa4aad
6 changed files with 11 additions and 15 deletions

View File

@ -1804,9 +1804,7 @@ static DBusMessage *hs_play(DBusConnection *conn, DBusMessage *msg,
hs->pending->msg = dbus_message_ref(msg);
return NULL;
}
return g_dbus_create_error(msg, ERROR_INTERFACE
".InProgress",
"Play in Progress");
return btd_error_busy(msg);
case HEADSET_STATE_PLAYING:
return g_dbus_create_error(msg, ERROR_INTERFACE
".AlreadyConnected",

View File

@ -439,8 +439,7 @@ static DBusMessage *sink_connect(DBusConnection *conn,
"Unable to get a session");
if (sink->connect || sink->disconnect)
return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
"%s", strerror(EBUSY));
return btd_error_busy(msg);
if (sink->stream_state >= AVDTP_STATE_OPEN)
return g_dbus_create_error(msg, ERROR_INTERFACE
@ -475,8 +474,7 @@ static DBusMessage *sink_disconnect(DBusConnection *conn,
return btd_error_not_connected(msg);
if (sink->connect || sink->disconnect)
return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
"%s", strerror(EBUSY));
return btd_error_busy(msg);
if (sink->stream_state < AVDTP_STATE_OPEN) {
DBusMessage *reply = dbus_message_new_method_return(msg);

View File

@ -390,8 +390,7 @@ static DBusMessage *source_connect(DBusConnection *conn,
"Unable to get a session");
if (source->connect || source->disconnect)
return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
"%s", strerror(EBUSY));
return btd_error_busy(msg);
if (source->stream_state >= AVDTP_STATE_OPEN)
return g_dbus_create_error(msg, ERROR_INTERFACE

View File

@ -321,12 +321,6 @@ static inline DBusMessage *not_supported(DBusMessage *msg)
"Not supported");
}
static inline DBusMessage *in_progress(DBusMessage *msg)
{
return g_dbus_create_error(msg, ERROR_INTERFACE ".InProgress",
"Device connection already in progress");
}
static inline DBusMessage *already_connected(DBusMessage *msg)
{
return g_dbus_create_error(msg, ERROR_INTERFACE ".AlreadyConnected",

View File

@ -56,6 +56,12 @@ DBusMessage *btd_error_invalid_args(DBusMessage *msg)
"Invalid arguments in method call");
}
DBusMessage *btd_error_busy(DBusMessage *msg)
{
return g_dbus_create_error(msg, ERROR_INTERFACE ".InProgress",
"Operation already in progress");
}
DBusMessage *btd_error_already_exists(DBusMessage *msg)
{
return g_dbus_create_error(msg,

View File

@ -31,6 +31,7 @@ DBusHandlerResult error_common_reply(DBusConnection *conn, DBusMessage *msg,
const char *name, const char *descr);
DBusMessage *btd_error_invalid_args(DBusMessage *msg);
DBusMessage *btd_error_busy(DBusMessage *msg);
DBusMessage *btd_error_already_exists(DBusMessage *msg);
DBusMessage *btd_error_not_supported(DBusMessage *msg);
DBusMessage *btd_error_not_connected(DBusMessage *msg);