Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 8/8 v2] player: Add Device property
Date: Fri,  4 Jan 2013 14:39:57 +0200	[thread overview]
Message-ID: <1357303197-19673-8-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1357303197-19673-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Device property indicates which device object the player belongs to.
---
 doc/media-api.txt       |  4 ++++
 profiles/audio/player.c | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index 12a2d7a..e2cafd1 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -288,6 +288,10 @@ Properties	string Equalizer [readwrite]
 
 					Track duration in milliseconds
 
+		object Device [readonly]
+
+			Device object path.
+
 MediaEndpoint1 hierarchy
 ========================
 
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 81bb7fe..bac5649 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -56,6 +56,7 @@ struct pending_req {
 };
 
 struct media_player {
+	char			*device;	/* Device path */
 	char			*path;		/* Player object path */
 	GHashTable		*settings;	/* Player settings */
 	GHashTable		*track;		/* Player current track */
@@ -239,6 +240,16 @@ static gboolean get_track(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean get_device(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct media_player *mp = data;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &mp->device);
+
+	return TRUE;
+}
+
 static DBusMessage *media_player_play(DBusConnection *conn, DBusMessage *msg,
 								void *data)
 {
@@ -417,6 +428,7 @@ static const GDBusPropertyTable media_player_properties[] = {
 	{ "Shuffle", "s", get_setting, set_setting, setting_exists },
 	{ "Scan", "s", get_setting, set_setting, setting_exists },
 	{ "Track", "a{sv}", get_track, NULL, NULL },
+	{ "Device", "s", get_device, NULL, NULL },
 	{ }
 };
 
@@ -442,6 +454,7 @@ void media_player_destroy(struct media_player *mp)
 	g_free(mp->cb);
 	g_free(mp->status);
 	g_free(mp->path);
+	g_free(mp->device);
 	g_free(mp);
 }
 
@@ -450,6 +463,7 @@ struct media_player *media_player_controller_create(const char *path)
 	struct media_player *mp;
 
 	mp = g_new0(struct media_player, 1);
+	mp->device = g_strdup(path);
 	mp->path = g_strdup_printf("%s/player1", path);
 	mp->settings = g_hash_table_new_full(g_str_hash, g_str_equal,
 							g_free, g_free);
-- 
1.8.0.1


  parent reply	other threads:[~2013-01-04 12:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 12:39 [PATCH BlueZ 1/8 v2] media-api: Add playback control methods to MediaPlayer1 Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 2/8 v2] player: Remove GetTrack and TrackChanged Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 3/8 v2] player: Add support for button controls Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 4/8 v2] player: Fix documentation to use TrackNumber in track metadata Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 5/8 v2] AVRCP: Always create a controller player even for version 1.0 Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 6/8 v2] control: Mark all members of MediaControl1 as deprecated Luiz Augusto von Dentz
2013-01-04 12:39 ` [PATCH BlueZ 7/8 v2] player: Remove experimental flag from MediaPlayer1 Luiz Augusto von Dentz
2013-01-04 12:39 ` Luiz Augusto von Dentz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-10 13:24 [PATCH BlueZ 01/13] media-api: Add playback control methods to MediaPlayer1 Luiz Augusto von Dentz
2013-01-10 13:24 ` [PATCH BlueZ 8/8 v2] player: Add Device property Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357303197-19673-8-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox