Linux bluetooth development
 help / color / mirror / Atom feed
From: Bharat Panda <bharat.panda@samsung.com>
To: linux-bluetooth@vger.kernel.org
Cc: cpgs@samsung.com, Bharat Panda <bharat.panda@samsung.com>
Subject: [PATCH v1 1/2] audio/avrcp: Set player properties
Date: Fri, 28 Aug 2015 20:02:31 +0530	[thread overview]
Message-ID: <1440772352-7564-1-git-send-email-bharat.panda@samsung.com> (raw)

Populates player properties like player name, type, subtype
and feature bit mask in player registration.
---
 profiles/audio/media.c | 24 ++++++++++++++++++++++++
 test/simple-player     |  1 +
 2 files changed, 25 insertions(+)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index ed441d0..106b18a 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -112,6 +112,7 @@ struct media_player {
 	bool			next;
 	bool			previous;
 	bool			control;
+	char			*name;
 };
 
 static GSList *adapters = NULL;
@@ -1607,6 +1608,26 @@ static gboolean set_flag(struct media_player *mp, DBusMessageIter *iter,
 	return TRUE;
 }
 
+static gboolean set_name(struct media_player *mp, DBusMessageIter *iter)
+{
+	const char *value;
+
+	if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+		return FALSE;
+
+	dbus_message_iter_get_basic(iter, &value);
+
+	if (g_strcmp0(mp->name, value) == 0)
+		return TRUE;
+
+	if (mp->name)
+		g_free(mp->name);
+
+	mp->name = g_strdup(value);
+
+	return TRUE;
+}
+
 static gboolean set_player_property(struct media_player *mp, const char *key,
 							DBusMessageIter *entry)
 {
@@ -1647,6 +1668,9 @@ static gboolean set_player_property(struct media_player *mp, const char *key,
 	if (strcasecmp(key, "CanControl") == 0)
 		return set_flag(mp, &var, &mp->control);
 
+	if (strcasecmp(key, "Identity") == 0)
+		return set_name(mp, &var);
+
 	DBG("%s not supported, ignoring", key);
 
 	return TRUE;
diff --git a/test/simple-player b/test/simple-player
index a8ae0b1..02754c2 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -43,6 +43,7 @@ class Player(dbus.service.Object):
 
 			self.properties = dbus.Dictionary({
 					"PlaybackStatus" : "playing",
+					"Identity" : "SimplePlayer",
 					"LoopStatus" : "None",
 					"Rate" : dbus.Double(1.0),
 					"Shuffle" : dbus.Boolean(False),
-- 
1.9.1


             reply	other threads:[~2015-08-28 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 14:32 Bharat Panda [this message]
2015-08-28 14:32 ` [PATCH v1 2/2] audio/avrcp: Add GetFolderItems support Bharat Panda
2015-08-31 10:59   ` Luiz Augusto von Dentz
2015-08-31 11:32     ` Bharat Bhusan Panda
2015-08-31 11:40       ` Luiz Augusto von Dentz
2015-08-31 11:06 ` [PATCH v1 1/2] audio/avrcp: Set player properties 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=1440772352-7564-1-git-send-email-bharat.panda@samsung.com \
    --to=bharat.panda@samsung.com \
    --cc=cpgs@samsung.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