summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-05-09 12:38:00 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-05-09 12:38:00 +0000
commita2174a2890f2601b06ed67f593d1227e41f1497e (patch)
tree1da84297ff164311f6043f3b99d5c9da3299a0e1
parent3789ae5c5cf7a872c60ea3ffbdcb7071fa63a81e (diff)
Implement IsPlaying method
-rw-r--r--audio/headset.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 56677f3f..971a68c1 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1128,6 +1128,30 @@ static DBusHandlerResult hs_stop(struct headset *hs, DBusMessage *msg)
return DBUS_HANDLER_RESULT_HANDLED;
}
+static DBusHandlerResult hs_is_playing(struct headset *hs, DBusMessage *msg)
+{
+ DBusMessage *reply;
+ dbus_bool_t playing;
+
+ assert(hs);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ if (hs->state == HEADSET_STATE_PLAYING)
+ playing = TRUE;
+ else
+ playing = FALSE;
+
+ dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &playing,
+ DBUS_TYPE_INVALID);
+
+ send_message_and_unref(connection, reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
static DBusHandlerResult hs_disconnect(struct headset *hs, DBusMessage *msg)
{
DBusMessage *reply = NULL;
@@ -1575,6 +1599,9 @@ static DBusHandlerResult hs_message(DBusConnection *conn,
if (strcmp(member, "Stop") == 0)
return hs_stop(hs, msg);
+ if (strcmp(member, "IsPlaying") == 0)
+ return hs_is_playing(hs, msg);
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}