Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 01/13 v2] media-api: Add playback control methods to MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:37 UTC (permalink / raw)
  To: linux-bluetooth

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

This adds methods such as Play, Pause directly in MediaPlayer1, in
addition to that Track is now turn into a property to take advantage of
ObjectManager and document the interface as experimental.
---
v2: Fix removing experimental flags, add patches to mpris-player and remove
VolumeUp and VolumeDown as they don't make sense to controller to send them.

 doc/media-api.txt | 99 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 53 insertions(+), 46 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index bb5ced0..ae4b0dd 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -129,7 +129,7 @@ Media Control hierarchy
 =======================
 
 Service		org.bluez
-Interface	org.bluez.MediaControl1
+Interface	org.bluez.MediaControl1 [Deprecated]
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
 
 Methods		void Play()
@@ -178,65 +178,39 @@ Properties
 MediaPlayer1 hierarchy
 ======================
 
-Service		unique name (Target role)
-Interface	org.bluez.MediaPlayer1
-Object path	freely definable
-
 Service		org.bluez (Controller role)
-Interface	org.bluez.MediaPlayer1
+Interface	org.bluez.MediaPlayer1 [Experimental]
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
 
-Methods		dict GetTrack()
-
-			Returns known metadata of the current track.
-
-			See TrackChanged for possible values.
-
-		void Release()
-
-			This method gets called when the service daemon
-			unregisters the player which can then perform
-			cleanup tasks. There is no need to unregister the
-			player, because when this method gets called it has
-			already been unregistered.
-
-Signals		TrackChanged(dict metadata)
-
-			This signal indicates that current track has changed.
-			All available metadata for the new track shall be set
-			at once in the metadata argument. Metadata cannot be
-			updated in parts, otherwise it will be interpreted as
-			multiple track changes.
-
-			Possible values:
-
-				string Title:
+Methods		void Play()
 
-					Track title name
+			Resume playback.
 
-				string Artist:
+		void Pause()
 
-					Track artist name
+			Pause playback.
 
-				string Album:
+		void Stop()
 
-					Track album name
+			Stop playback.
 
-				string Genre:
+		void Next()
 
-					Track genre name
+			Next item.
 
-				uint32 NumberOfTracks:
+		void Previous()
 
-					Number of tracks in total
+			Previous item.
 
-				uint32 Number:
+		void FastForward()
 
-					Track number
+			Fast forward playback, this action is only stopped
+			when another method in this interface is called.
 
-				uint32 Duration:
+		void Rewind()
 
-					Track duration in milliseconds
+			Rewind playback, this action is only stopped
+			when another method in this interface is called.
 
 Properties	string Equalizer [readwrite]
 
@@ -258,8 +232,8 @@ Properties	string Equalizer [readwrite]
 		string Status [readonly]
 
 			Possible status: "playing", "stopped", "paused",
-					"forward-seek", "reverse-seek" or
-					"error"
+					"forward-seek", "reverse-seek"
+					or "error"
 
 		uint32 Position [readonly]
 
@@ -272,6 +246,39 @@ Properties	string Equalizer [readwrite]
 			possible to signal its end by setting position to the
 			maximum uint32 value.
 
+		dict Track [readonly]
+
+			Track metadata.
+
+			Possible values:
+
+				string Title:
+
+					Track title name
+
+				string Artist:
+
+					Track artist name
+
+				string Album:
+
+					Track album name
+
+				string Genre:
+
+					Track genre name
+
+				uint32 NumberOfTracks:
+
+					Number of tracks in total
+
+				uint32 Number:
+
+					Track number
+
+				uint32 Duration:
+
+					Track duration in milliseconds
 
 MediaEndpoint1 hierarchy
 ========================
-- 
1.8.0.1


^ permalink raw reply related

* Re: [PATCH BlueZ 01/13] media-api: Add playback control methods to MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:26 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

Hi,

On Thu, Jan 10, 2013 at 3:24 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This adds methods such as Play, Pause directly in MediaPlayer1, in
> addition to that Track is now turn into a property to take advantage of
> ObjectManager and document the interface as experimental.
> ---
>  doc/media-api.txt | 99 ++++++++++++++++++++++++++++++++-----------------------
>  1 file changed, 57 insertions(+), 42 deletions(-)
>
> diff --git a/doc/media-api.txt b/doc/media-api.txt
> index bb5ced0..16ed34b 100644
> --- a/doc/media-api.txt
> +++ b/doc/media-api.txt
> @@ -129,7 +129,7 @@ Media Control hierarchy
>  =======================
>
>  Service                org.bluez
> -Interface      org.bluez.MediaControl1
> +Interface      org.bluez.MediaControl1 [Deprecated]
>  Object path    [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
>
>  Methods                void Play()
> @@ -178,65 +178,47 @@ Properties
>  MediaPlayer1 hierarchy
>  ======================
>
> -Service                unique name (Target role)
> -Interface      org.bluez.MediaPlayer1
> -Object path    freely definable
> -
>  Service                org.bluez (Controller role)
> -Interface      org.bluez.MediaPlayer1
> +Interface      org.bluez.MediaPlayer1 [Experimental]
>  Object path    [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
>
> -Methods                dict GetTrack()
> -
> -                       Returns known metadata of the current track.
> -
> -                       See TrackChanged for possible values.
> -
> -               void Release()
> -
> -                       This method gets called when the service daemon
> -                       unregisters the player which can then perform
> -                       cleanup tasks. There is no need to unregister the
> -                       player, because when this method gets called it has
> -                       already been unregistered.
> +Methods                void Play()
>
> -Signals                TrackChanged(dict metadata)
> +                       Resume playback.
>
> -                       This signal indicates that current track has changed.
> -                       All available metadata for the new track shall be set
> -                       at once in the metadata argument. Metadata cannot be
> -                       updated in parts, otherwise it will be interpreted as
> -                       multiple track changes.
> +               void Pause()
>
> -                       Possible values:
> +                       Pause playback.
>
> -                               string Title:
> +               void Stop()
>
> -                                       Track title name
> +                       Stop playback.
>
> -                               string Artist:
> +               void Next()
>
> -                                       Track artist name
> +                       Next item.
>
> -                               string Album:
> +               void Previous()
>
> -                                       Track album name
> +                       Previous item.
>
> -                               string Genre:
> +               void VolumeUp()
>
> -                                       Track genre name
> +                       Adjust remote volume one step up
>
> -                               uint32 NumberOfTracks:
> +               void VolumeDown()
>
> -                                       Number of tracks in total
> +                       Adjust remote volume one step down
>
> -                               uint32 Number:
> +               void FastForward()
>
> -                                       Track number
> +                       Fast forward playback, this action is only stopped
> +                       when another method in this interface is called.
>
> -                               uint32 Duration:
> +               void Rewind()
>
> -                                       Track duration in milliseconds
> +                       Rewind playback, this action is only stopped
> +                       when another method in this interface is called.
>
>  Properties     string Equalizer [readwrite]
>
> @@ -258,8 +240,8 @@ Properties  string Equalizer [readwrite]
>                 string Status [readonly]
>
>                         Possible status: "playing", "stopped", "paused",
> -                                       "forward-seek", "reverse-seek" or
> -                                       "error"
> +                                       "forward-seek", "reverse-seek"
> +                                       or "error"
>
>                 uint32 Position [readonly]
>
> @@ -272,6 +254,39 @@ Properties string Equalizer [readwrite]
>                         possible to signal its end by setting position to the
>                         maximum uint32 value.
>
> +               dict Track [readonly]
> +
> +                       Track metadata.
> +
> +                       Possible values:
> +
> +                               string Title:
> +
> +                                       Track title name
> +
> +                               string Artist:
> +
> +                                       Track artist name
> +
> +                               string Album:
> +
> +                                       Track album name
> +
> +                               string Genre:
> +
> +                                       Track genre name
> +
> +                               uint32 NumberOfTracks:
> +
> +                                       Number of tracks in total
> +
> +                               uint32 Number:
> +
> +                                       Track number
> +
> +                               uint32 Duration:
> +
> +                                       Track duration in milliseconds
>
>  MediaEndpoint1 hierarchy
>  ========================
> --
> 1.8.0.1
>

Please ignore this series.

--
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH BlueZ 10/13] media-api: Change RegisterPlayer to use MPRIS spec
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

RegisterPlayer now expect registered paths to implement
org.mpris.MediaPlayer2.player interface accourding to MPRIS spec:

http://specifications.freedesktop.org/mpris-spec/latest/
---
 doc/media-api.txt | 70 ++++---------------------------------------------------
 1 file changed, 5 insertions(+), 65 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index d3bd915..714e87c 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -45,78 +45,18 @@ Methods		void RegisterEndpoint(object endpoint, dict properties)
 
 			Unregister sender end point.
 
-		void RegisterPlayer(object player, dict properties,
-								dict metadata)
+		void RegisterPlayer(object player, dict properties)
 
 			Register a media player object to sender, the sender
 			can register as many objects as it likes.
 
+			Object must implement at least
+			org.mpris.MediaPlayer2.Player as defined in MPRIS 2.2
+			spec.
+
 			Note: If the sender disconnects its objects are
 			automatically unregistered.
 
-			Properties:
-
-				string Equalizer:
-
-					Possible values: "off" or "on"
-
-				string Repeat:
-
-					Possible values: "off", "singletrack",
-							"alltracks" or "group"
-
-				string Shuffle:
-
-					Possible values: "off", "alltracks" or
-							"group"
-
-				string Scan:
-
-					Possible values: "off", "alltracks" or
-							"group"
-
-				string Status:
-
-					Possible values: "playing", "stopped",
-							"paused",
-							"forward-seek",
-							"reverse-seek" or
-							"error"
-
-				uint32 Position
-
-					Playback position in milliseconds
-
-			Metadata:
-
-				string Title:
-
-					Track title name
-
-				string Artist:
-
-					Track artist name
-
-				string Album:
-
-					Track album name
-
-				string Genre:
-
-					Track genre name
-
-				uint32 NumberOfTracks:
-
-					Number of tracks in total
-
-				uint32 Number:
-
-					Track number
-
-				uint32 Duration:
-
-					Track duration in milliseconds
-
 			Possible Errors: org.bluez.Error.InvalidArguments
 					 org.bluez.Error.NotSupported
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 09/13] tools: Adapt mpris-player to new API of MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

In addition fix using Manager1 interface which no longer exists
---
 tools/mpris-player.c | 482 +++++++++++++++++----------------------------------
 1 file changed, 157 insertions(+), 325 deletions(-)

diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index 90c87aa..fd26101 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -38,7 +38,7 @@
 
 static volatile sig_atomic_t __io_canceled = 0;
 static volatile sig_atomic_t __io_terminated = 0;
-static char *adapter = NULL;
+static char *adapter = "/org/bluez/hci0";
 static DBusConnection *sys = NULL;
 static DBusConnection *session = NULL;
 
@@ -114,157 +114,6 @@ static void dict_append_entry(DBusMessageIter *dict, const char *key, int type,
 	dbus_message_iter_close_container(dict, &entry);
 }
 
-static dbus_bool_t emit_properties_changed(DBusConnection *conn,
-					const char *path,
-					const char *interface,
-					const char *name,
-					int type, void *value)
-{
-	DBusMessage *signal;
-	DBusMessageIter iter, dict, entry, array;
-	dbus_bool_t result;
-
-	signal = dbus_message_new_signal(path, DBUS_INTERFACE_PROPERTIES,
-							"PropertiesChanged");
-
-	if (!signal) {
-		fprintf(stderr, "Unable to allocate new %s.PropertyChanged"
-							" signal", interface);
-		return FALSE;
-	}
-
-	dbus_message_iter_init_append(signal, &iter);
-	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface);
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
-
-	dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL,
-								&entry);
-	dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &name);
-	append_variant(&entry, type, value);
-	dbus_message_iter_close_container(&dict, &entry);
-
-	dbus_message_iter_close_container(&iter, &dict);
-
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-				DBUS_TYPE_STRING_AS_STRING, &array);
-	dbus_message_iter_close_container(&iter, &array);
-
-	result = dbus_connection_send(conn, signal, NULL);
-	dbus_message_unref(signal);
-
-	return result;
-}
-
-static int parse_property(DBusConnection *conn, const char *path,
-						const char *key,
-						DBusMessageIter *entry,
-						DBusMessageIter *properties)
-{
-	DBusMessageIter var;
-
-	printf("property %s found\n", key);
-
-	if (dbus_message_iter_get_arg_type(entry) != DBUS_TYPE_VARIANT)
-		return -EINVAL;
-
-	dbus_message_iter_recurse(entry, &var);
-
-	if (strcasecmp(key, "PlaybackStatus") == 0) {
-		const char *value;
-
-		if (dbus_message_iter_get_arg_type(&var) !=
-							DBUS_TYPE_STRING)
-			return -EINVAL;
-
-		dbus_message_iter_get_basic(&var, &value);
-
-		if (properties)
-			dict_append_entry(properties, "Status",
-						DBUS_TYPE_STRING, &value);
-		else
-			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer1", "Status",
-					DBUS_TYPE_STRING, &value);
-	} else if (strcasecmp(key, "Position") == 0) {
-		int64_t usec, msec;
-
-		if (dbus_message_iter_get_arg_type(&var) !=
-							DBUS_TYPE_INT64)
-			return -EINVAL;
-
-		dbus_message_iter_get_basic(&var, &usec);
-		msec = usec / 1000;
-
-		if (properties)
-			dict_append_entry(properties, "Position",
-						DBUS_TYPE_UINT32, &msec);
-		else
-			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer1", "Position",
-					DBUS_TYPE_UINT32, &msec);
-	} else if (strcasecmp(key, "Shuffle") == 0) {
-		dbus_bool_t value;
-		const char *str;
-
-		if (dbus_message_iter_get_arg_type(&var) !=
-							DBUS_TYPE_BOOLEAN)
-			return -EINVAL;
-
-		dbus_message_iter_get_basic(&var, &value);
-
-		str = value ? "on" : "off";
-		if (properties)
-			dict_append_entry(properties, "Shuffle",
-						DBUS_TYPE_STRING, &str);
-		else
-			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer1", "Shuffle",
-					DBUS_TYPE_STRING, &str);
-	}
-
-	return 0;
-}
-
-static int parse_properties(DBusConnection *conn, const char *path,
-						DBusMessageIter *args,
-						DBusMessageIter *properties)
-{
-	DBusMessageIter dict;
-	int ctype;
-
-	ctype = dbus_message_iter_get_arg_type(args);
-	if (ctype != DBUS_TYPE_ARRAY)
-		return -EINVAL;
-
-	dbus_message_iter_recurse(args, &dict);
-
-	while ((ctype = dbus_message_iter_get_arg_type(&dict)) !=
-							DBUS_TYPE_INVALID) {
-		DBusMessageIter entry;
-		const char *key;
-
-		if (ctype != DBUS_TYPE_DICT_ENTRY)
-			return -EINVAL;
-
-		dbus_message_iter_recurse(&dict, &entry);
-		if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_STRING)
-			return -EINVAL;
-
-		dbus_message_iter_get_basic(&entry, &key);
-		dbus_message_iter_next(&entry);
-
-		if (parse_property(conn, path, key, &entry, properties) < 0)
-			return -EINVAL;
-
-		dbus_message_iter_next(&dict);
-	}
-
-	return 0;
-}
-
 static int parse_metadata_entry(DBusMessageIter *entry, const char *key,
 						DBusMessageIter *metadata)
 {
@@ -352,7 +201,7 @@ static int parse_metadata_entry(DBusMessageIter *entry, const char *key,
 
 		dbus_message_iter_get_basic(&var, &value);
 
-		dict_append_entry(metadata, "Track", DBUS_TYPE_UINT32,
+		dict_append_entry(metadata, "TrackNumber", DBUS_TYPE_UINT32,
 								&value);
 	}
 
@@ -361,20 +210,14 @@ static int parse_metadata_entry(DBusMessageIter *entry, const char *key,
 
 static int parse_track(DBusMessageIter *args, DBusMessageIter *metadata)
 {
-	DBusMessageIter var, dict;
+	DBusMessageIter dict;
 	int ctype;
 
 	ctype = dbus_message_iter_get_arg_type(args);
-	if (ctype != DBUS_TYPE_VARIANT)
-		return -EINVAL;
-
-	dbus_message_iter_recurse(args, &var);
-
-	ctype = dbus_message_iter_get_arg_type(&var);
 	if (ctype != DBUS_TYPE_ARRAY)
 		return -EINVAL;
 
-	dbus_message_iter_recurse(&var, &dict);
+	dbus_message_iter_recurse(args, &dict);
 
 	while ((ctype = dbus_message_iter_get_arg_type(&dict)) !=
 							DBUS_TYPE_INVALID) {
@@ -400,7 +243,153 @@ static int parse_track(DBusMessageIter *args, DBusMessageIter *metadata)
 	return 0;
 }
 
-static int parse_metadata(DBusMessageIter *args, DBusMessageIter *metadata)
+static void append_track(DBusMessageIter *iter, DBusMessageIter *dict)
+{
+	DBusMessageIter value, metadata;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, "a{sv}",
+								&value);
+
+	dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
+			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &metadata);
+
+	parse_track(dict, &metadata);
+
+	dbus_message_iter_close_container(&value, &metadata);
+	dbus_message_iter_close_container(iter, &value);
+}
+
+static dbus_bool_t emit_properties_changed(DBusConnection *conn,
+					const char *path,
+					const char *interface,
+					const char *name,
+					int type, void *value)
+{
+	DBusMessage *signal;
+	DBusMessageIter iter, dict, entry, array;
+	dbus_bool_t result;
+
+	signal = dbus_message_new_signal(path, DBUS_INTERFACE_PROPERTIES,
+							"PropertiesChanged");
+
+	if (!signal) {
+		fprintf(stderr, "Unable to allocate new %s.PropertyChanged"
+							" signal", interface);
+		return FALSE;
+	}
+
+	dbus_message_iter_init_append(signal, &iter);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface);
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+	dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL,
+								&entry);
+	dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &name);
+
+	if (strcasecmp(name, "Track") == 0)
+		append_track(&entry, value);
+	else
+		append_variant(&entry, type, value);
+
+	dbus_message_iter_close_container(&dict, &entry);
+
+	dbus_message_iter_close_container(&iter, &dict);
+
+	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+				DBUS_TYPE_STRING_AS_STRING, &array);
+	dbus_message_iter_close_container(&iter, &array);
+
+	result = dbus_connection_send(conn, signal, NULL);
+	dbus_message_unref(signal);
+
+	return result;
+}
+
+static int parse_property(DBusConnection *conn, const char *path,
+						const char *key,
+						DBusMessageIter *entry,
+						DBusMessageIter *properties)
+{
+	DBusMessageIter var;
+
+	printf("property %s found\n", key);
+
+	if (dbus_message_iter_get_arg_type(entry) != DBUS_TYPE_VARIANT)
+		return -EINVAL;
+
+	dbus_message_iter_recurse(entry, &var);
+
+	if (strcasecmp(key, "PlaybackStatus") == 0) {
+		const char *value;
+
+		if (dbus_message_iter_get_arg_type(&var) !=
+							DBUS_TYPE_STRING)
+			return -EINVAL;
+
+		dbus_message_iter_get_basic(&var, &value);
+
+		if (properties)
+			dict_append_entry(properties, "Status",
+						DBUS_TYPE_STRING, &value);
+		else
+			emit_properties_changed(sys, path,
+					"org.bluez.MediaPlayer1", "Status",
+					DBUS_TYPE_STRING, &value);
+	} else if (strcasecmp(key, "Position") == 0) {
+		int64_t usec, msec;
+
+		if (dbus_message_iter_get_arg_type(&var) !=
+							DBUS_TYPE_INT64)
+			return -EINVAL;
+
+		dbus_message_iter_get_basic(&var, &usec);
+		msec = usec / 1000;
+
+		if (properties)
+			dict_append_entry(properties, "Position",
+						DBUS_TYPE_UINT32, &msec);
+		else
+			emit_properties_changed(sys, path,
+					"org.bluez.MediaPlayer1", "Position",
+					DBUS_TYPE_UINT32, &msec);
+	} else if (strcasecmp(key, "Shuffle") == 0) {
+		dbus_bool_t value;
+		const char *str;
+
+		if (dbus_message_iter_get_arg_type(&var) !=
+							DBUS_TYPE_BOOLEAN)
+			return -EINVAL;
+
+		dbus_message_iter_get_basic(&var, &value);
+
+		str = value ? "on" : "off";
+		if (properties)
+			dict_append_entry(properties, "Shuffle",
+						DBUS_TYPE_STRING, &str);
+		else
+			emit_properties_changed(sys, path,
+					"org.bluez.MediaPlayer1", "Shuffle",
+					DBUS_TYPE_STRING, &str);
+	} else if (strcasecmp(key, "Metadata") == 0) {
+		if (properties)
+			parse_track(&var, properties);
+		else
+			emit_properties_changed(sys, path,
+					"org.bluez.MediaPlayer1", "Track",
+					DBUS_TYPE_DICT_ENTRY, &var);
+	}
+
+	return 0;
+}
+
+static int parse_properties(DBusConnection *conn, const char *path,
+						DBusMessageIter *args,
+						DBusMessageIter *properties)
 {
 	DBusMessageIter dict;
 	int ctype;
@@ -426,13 +415,13 @@ static int parse_metadata(DBusMessageIter *args, DBusMessageIter *metadata)
 		dbus_message_iter_get_basic(&entry, &key);
 		dbus_message_iter_next(&entry);
 
-		if (strcasecmp(key, "Metadata") == 0)
-			return parse_track(&entry, metadata);
+		if (parse_property(conn, path, key, &entry, properties) < 0)
+			return -EINVAL;
 
 		dbus_message_iter_next(&dict);
 	}
 
-	return -EINVAL;
+	return 0;
 }
 
 static char *sender2path(const char *sender)
@@ -464,7 +453,7 @@ static void add_player(DBusConnection *conn, const char *name,
 {
 	DBusMessage *reply = get_all(conn, name);
 	DBusMessage *msg;
-	DBusMessageIter iter, args, properties, metadata;
+	DBusMessageIter iter, args, properties;
 	DBusError err;
 	char *path;
 
@@ -496,18 +485,6 @@ static void add_player(DBusConnection *conn, const char *name,
 
 	dbus_message_iter_close_container(&iter, &properties);
 
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &metadata);
-
-	dbus_message_iter_init(reply, &args);
-
-	if (parse_metadata(&args, &metadata) < 0)
-		goto done;
-
-	dbus_message_iter_close_container(&iter, &metadata);
-
 	dbus_message_unref(reply);
 
 	dbus_error_init(&err);
@@ -559,8 +536,7 @@ static void remove_player(DBusConnection *conn, const char *sender)
 static DBusHandlerResult properties_changed(DBusConnection *conn,
 							DBusMessage *msg)
 {
-	DBusMessage *signal;
-	DBusMessageIter iter, entry, metadata;
+	DBusMessageIter iter;
 	const char *iface;
 	char *path;
 
@@ -578,40 +554,9 @@ static DBusHandlerResult properties_changed(DBusConnection *conn,
 	path = sender2path(dbus_message_get_sender(msg));
 	parse_properties(conn, path, &iter, NULL);
 
-	signal = dbus_message_new_signal(path, "org.bluez.MediaPlayer1",
-							"TrackChanged");
-	if (!signal) {
-		fprintf(stderr, "Unable to allocate new PropertyChanged"
-							" signal\n");
-		goto err;
-	}
-
-	dbus_message_iter_init_append(signal, &entry);
-
-	dbus_message_iter_open_container(&entry, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &metadata);
-
-	dbus_message_iter_init(msg, &iter);
-	dbus_message_iter_next(&iter);
-
-	if (parse_metadata(&iter, &metadata) < 0)
-		goto err;
-
-	dbus_message_iter_close_container(&entry, &metadata);
-
-	dbus_connection_send(sys, signal, NULL);
-	dbus_message_unref(signal);
 	g_free(path);
 
 	return DBUS_HANDLER_RESULT_HANDLED;
-
-err:
-	if (signal)
-		dbus_message_unref(signal);
-	g_free(path);
-	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static DBusHandlerResult session_filter(DBusConnection *conn,
@@ -676,114 +621,6 @@ static DBusHandlerResult system_filter(DBusConnection *conn,
 	return DBUS_HANDLER_RESULT_HANDLED;
 }
 
-static char *get_default_adapter(DBusConnection *conn)
-{
-	DBusMessage *msg, *reply;
-	DBusError err;
-	const char *reply_path;
-	char *path;
-
-	msg = dbus_message_new_method_call("org.bluez", "/",
-					"org.bluez.Manager", "DefaultAdapter");
-
-	if (!msg) {
-		fprintf(stderr, "Can't allocate new method call\n");
-		return NULL;
-	}
-
-	dbus_error_init(&err);
-
-	reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
-
-	dbus_message_unref(msg);
-
-	if (!reply) {
-		fprintf(stderr, "Can't get default adapter\n");
-		if (dbus_error_is_set(&err)) {
-			fprintf(stderr, "%s\n", err.message);
-			dbus_error_free(&err);
-		}
-		return NULL;
-	}
-
-	if (!dbus_message_get_args(reply, &err,
-					DBUS_TYPE_OBJECT_PATH, &reply_path,
-					DBUS_TYPE_INVALID)) {
-		fprintf(stderr, "Can't get reply arguments\n");
-		if (dbus_error_is_set(&err)) {
-			fprintf(stderr, "%s\n", err.message);
-			dbus_error_free(&err);
-		}
-		dbus_message_unref(reply);
-		return NULL;
-	}
-
-	path = strdup(reply_path);
-
-	dbus_message_unref(reply);
-
-	dbus_connection_flush(conn);
-
-	return path;
-}
-
-static char *get_adapter(DBusConnection *conn, const char *adapter)
-{
-	DBusMessage *msg, *reply;
-	DBusError err;
-	const char *reply_path;
-	char *path;
-
-	if (!adapter)
-		return get_default_adapter(conn);
-
-	msg = dbus_message_new_method_call("org.bluez", "/",
-					"org.bluez.Manager", "FindAdapter");
-
-	if (!msg) {
-		fprintf(stderr, "Can't allocate new method call\n");
-		return NULL;
-	}
-
-	dbus_message_append_args(msg, DBUS_TYPE_STRING, &adapter,
-					DBUS_TYPE_INVALID);
-
-	dbus_error_init(&err);
-
-	reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
-
-	dbus_message_unref(msg);
-
-	if (!reply) {
-		fprintf(stderr, "Can't find adapter %s\n", adapter);
-		if (dbus_error_is_set(&err)) {
-			fprintf(stderr, "%s\n", err.message);
-			dbus_error_free(&err);
-		}
-		return NULL;
-	}
-
-	if (!dbus_message_get_args(reply, &err,
-					DBUS_TYPE_OBJECT_PATH, &reply_path,
-					DBUS_TYPE_INVALID)) {
-		fprintf(stderr, "Can't get reply arguments\n");
-		if (dbus_error_is_set(&err)) {
-			fprintf(stderr, "%s\n", err.message);
-			dbus_error_free(&err);
-		}
-		dbus_message_unref(reply);
-		return NULL;
-	}
-
-	path = strdup(reply_path);
-
-	dbus_message_unref(reply);
-
-	dbus_connection_flush(conn);
-
-	return path;
-}
-
 static char *get_name_owner(DBusConnection *conn, const char *name)
 {
 	DBusMessage *msg, *reply;
@@ -924,14 +761,13 @@ static struct option main_options[] = {
 int main(int argc, char *argv[])
 {
 	struct sigaction sa;
-	char *adapter_id = NULL;
 	char match[128];
 	int opt;
 
 	while ((opt = getopt_long(argc, argv, "+a,h", main_options, NULL)) != EOF) {
 		switch(opt) {
 		case '1':
-			adapter_id = optarg;
+			adapter = optarg;
 			break;
 		case 'h':
 			usage();
@@ -947,10 +783,6 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	adapter = get_adapter(sys, adapter_id);
-	if (!adapter)
-		exit(1);
-
 	if (!dbus_connection_add_filter(sys, system_filter, NULL, NULL)) {
 		fprintf(stderr, "Can't add signal filter");
 		exit(1);
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 08/13] test: Adapt simple-player to the new API of MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

---
 test/simple-player | 62 ++++++++++++++++--------------------------------------
 1 file changed, 18 insertions(+), 44 deletions(-)

diff --git a/test/simple-player b/test/simple-player
index 3bfc485..e331c52 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -22,46 +22,36 @@ class Player(dbus.service.Object):
 						"org.freedesktop.DBus.Properties")
 
 			self.properties = prop.GetAll("org.bluez.MediaPlayer1")
-			self.metadata = mp.GetTrack()
 
 			bus.add_signal_receiver(self.properties_changed,
 				path = obj,
 				dbus_interface = "org.freedesktop.DBus.Properties",
 				signal_name = "PropertiesChanged")
-
-			bus.add_signal_receiver(self.track_changed,
-				path = obj,
-				dbus_interface ="org.bluez.MediaPlayer",
-				signal_name = "TrackChanged")
 		else:
+			track = dbus.Dictionary({
+					"Title" : "Title",
+					"Artist" : "Artist",
+					"Album" : "Album",
+					"Genre" : "Genre",
+					"NumberOfTracks" : dbus.UInt32(10),
+					"TrackNumber" : dbus.UInt32(1),
+					"Duration" : dbus.UInt32(10000) },
+					signature="sv")
+
 			self.properties = dbus.Dictionary({
 					"Equalizer" : "off",
 					"Repeat" : "off",
 					"Shuffle" : "off",
 					"Scan" : "off",
 					"Status" : "playing",
-					"Position" : dbus.UInt32(0) },
+					"Position" : dbus.UInt32(0),
+					"Track" : track },
 					signature="sv")
 
-			self.metadata = dbus.Dictionary({
-					"Title" : "Title",
-					"Artist" : "Artist",
-					"Album" : "Album",
-					"Genre" : "Genre",
-					"NumberOfTracks" : dbus.UInt32(10),
-					"Track" : dbus.UInt32(1),
-					"Duration" : dbus.UInt32(10000) },
-					signature="sv")
 			handler = InputHandler(self)
 			gobject.io_add_watch(sys.stdin, gobject.IO_IN,
 							handler.handle)
 
-	@dbus.service.method("org.bluez.MediaPlayer1",
-					in_signature="", out_signature="")
-	def Release(self):
-		print("Release")
-		mainloop.quit()
-
 	@dbus.service.method("org.freedesktop.DBus.Properties",
 					in_signature="ssv", out_signature="")
 	def Set(self, interface, key, value):
@@ -79,15 +69,6 @@ class Player(dbus.service.Object):
 		"""
 		pass
 
-	@dbus.service.signal("org.bluez.MediaPlayer1", signature="a{sv}")
-	def TrackChanged(self, metadata):
-		"""TrackChanged(metadata)
-
-		Send a TrackChanged signal. 'metadata' parameter is a dictionary,
-		with values as defined in doc/media-api.txt.
-		"""
-		pass
-
 	def help(self, func):
 		help(self.__class__.__dict__[func])
 
@@ -96,14 +77,8 @@ class Player(dbus.service.Object):
 
 		self.PropertiesChanged(interface, properties, invalidated)
 
-	def track_changed(self, metadata):
-		print("track_changed(%s)" % (metadata))
-
-		self.TrackChanged(metadata)
-
 class InputHandler:
-	commands = { 'TrackChanged': '(metadata)',
-			'PropertiesChanged': '(interface, properties)',
+	commands = { 'PropertiesChanged': '(interface, properties)',
 			'help': '(cmd)' }
 	def __init__(self, player):
 		self.player = player
@@ -112,7 +87,8 @@ class InputHandler:
 			print('\t', cmd, self.commands[cmd], sep='')
 
 		print("\nUse python syntax to pass arguments to available methods.\n" \
-                "E.g.: TrackChanged({'Title': 'My title', 'Album': 'my album' })")
+                "E.g.: PropertiesChanged({'Track' : {'Title': 'My title', \
+		'Album': 'my album' }})")
 		self.prompt()
 
 	def prompt(self):
@@ -160,11 +136,9 @@ if __name__ == '__main__':
 	else:
 		player.set_object()
 
-	print('Register media player with:\n\tProperties: %s\n\tMetadata: %s' \
-					% (player.properties, player.metadata))
-
+	print('Register media player with:\n\tProperties: %s' \
+						% (player.properties))
 
-	media.RegisterPlayer(dbus.ObjectPath(path), player.properties,
-							player.metadata)
+	media.RegisterPlayer(dbus.ObjectPath(path), player.properties)
 
 	mainloop.run()
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 8/8 v2] player: Add Device property
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-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


^ permalink raw reply related

* [PATCH BlueZ 7/8 v2] player: Remove experimental flag from MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

---
 doc/media-api.txt       |  2 +-
 profiles/audio/player.c | 21 +++++++--------------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index 5a6b68c..12a2d7a 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -179,7 +179,7 @@ MediaPlayer1 hierarchy
 ======================
 
 Service		org.bluez (Controller role)
-Interface	org.bluez.MediaPlayer1 [Experimental]
+Interface	org.bluez.MediaPlayer1
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
 
 Methods		void Play()
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 0b69912..81bb7fe 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -410,20 +410,13 @@ static const GDBusSignalTable media_player_signals[] = {
 };
 
 static const GDBusPropertyTable media_player_properties[] = {
-	{ "Position", "u", get_position, NULL, NULL,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Status", "s", get_status, NULL, status_exists,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Equalizer", "s", get_setting, set_setting, setting_exists,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Repeat", "s", get_setting, set_setting, setting_exists,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Shuffle", "s", get_setting, set_setting, setting_exists,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Scan", "s", get_setting, set_setting, setting_exists,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
-	{ "Track", "a{sv}", get_track, NULL, NULL,
-					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
+	{ "Position", "u", get_position, NULL, NULL },
+	{ "Status", "s", get_status, NULL, status_exists },
+	{ "Equalizer", "s", get_setting, set_setting, setting_exists },
+	{ "Repeat", "s", get_setting, set_setting, setting_exists },
+	{ "Shuffle", "s", get_setting, set_setting, setting_exists },
+	{ "Scan", "s", get_setting, set_setting, setting_exists },
+	{ "Track", "a{sv}", get_track, NULL, NULL },
 	{ }
 };
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 07/13] media: Adapt RegisterPlayer to changes in MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

This adds support for Track being a property and the removal of
GetTrack and TrackChanged.
---
 profiles/audio/media.c | 199 +++++++++++++++++++++----------------------------
 1 file changed, 85 insertions(+), 114 deletions(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 00aa2f4..b184f01 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1181,99 +1181,6 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter)
 	return TRUE;
 }
 
-static gboolean set_player_property(struct media_player *mp, const char *key,
-							DBusMessageIter *entry)
-{
-	DBusMessageIter var;
-	const char *value, *curval;
-	GList *settings;
-
-	if (dbus_message_iter_get_arg_type(entry) != DBUS_TYPE_VARIANT)
-		return FALSE;
-
-	dbus_message_iter_recurse(entry, &var);
-
-	if (strcasecmp(key, "Status") == 0)
-		return set_status(mp, &var);
-
-	if (strcasecmp(key, "Position") == 0)
-		return set_position(mp, &var);
-
-	if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
-		return FALSE;
-
-	dbus_message_iter_get_basic(&var, &value);
-
-	curval = g_hash_table_lookup(mp->settings, key);
-	if (g_strcmp0(curval, value) == 0)
-		return TRUE;
-
-	DBG("%s=%s", key, value);
-
-	g_hash_table_replace(mp->settings, g_strdup(key), g_strdup(value));
-
-	settings = list_settings(mp);
-
-	avrcp_player_event(mp->player, AVRCP_EVENT_SETTINGS_CHANGED, settings);
-
-	g_list_free(settings);
-
-	return TRUE;
-}
-
-static gboolean parse_player_properties(struct media_player *mp,
-							DBusMessageIter *iter)
-{
-	DBusMessageIter dict;
-	int ctype;
-
-	ctype = dbus_message_iter_get_arg_type(iter);
-	if (ctype != DBUS_TYPE_ARRAY)
-		return FALSE;
-
-	dbus_message_iter_recurse(iter, &dict);
-
-	while ((ctype = dbus_message_iter_get_arg_type(&dict)) !=
-							DBUS_TYPE_INVALID) {
-		DBusMessageIter entry;
-		const char *key;
-
-		if (ctype != DBUS_TYPE_DICT_ENTRY)
-			return FALSE;
-
-		dbus_message_iter_recurse(&dict, &entry);
-		if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_STRING)
-			return FALSE;
-
-		dbus_message_iter_get_basic(&entry, &key);
-		dbus_message_iter_next(&entry);
-
-		if (set_player_property(mp, key, &entry) == FALSE)
-			return FALSE;
-
-		dbus_message_iter_next(&dict);
-	}
-
-	return TRUE;
-}
-
-static gboolean properties_changed(DBusConnection *connection, DBusMessage *msg,
-							void *user_data)
-{
-	struct media_player *mp = user_data;
-	DBusMessageIter iter;
-
-	DBG("sender=%s path=%s", mp->sender, mp->path);
-
-	dbus_message_iter_init(msg, &iter);
-
-	dbus_message_iter_next(&iter);
-
-	parse_player_properties(mp, &iter);
-
-	return TRUE;
-}
-
 static gboolean parse_player_metadata(struct media_player *mp,
 							DBusMessageIter *iter)
 {
@@ -1346,7 +1253,7 @@ static gboolean parse_player_metadata(struct media_player *mp,
 
 			dbus_message_iter_get_basic(&var, &num);
 			mp->duration = num;
-		} else if (strcasecmp(key, "Track") == 0) {
+		} else if (strcasecmp(key, "TrackNumber") == 0) {
 			if (type != DBUS_TYPE_UINT32)
 				goto parse_error;
 
@@ -1400,7 +1307,86 @@ parse_error:
 	return FALSE;
 }
 
-static gboolean track_changed(DBusConnection *connection, DBusMessage *msg,
+static gboolean set_player_property(struct media_player *mp, const char *key,
+							DBusMessageIter *entry)
+{
+	DBusMessageIter var;
+	const char *value, *curval;
+	GList *settings;
+
+	if (dbus_message_iter_get_arg_type(entry) != DBUS_TYPE_VARIANT)
+		return FALSE;
+
+	dbus_message_iter_recurse(entry, &var);
+
+	if (strcasecmp(key, "Status") == 0)
+		return set_status(mp, &var);
+
+	if (strcasecmp(key, "Position") == 0)
+		return set_position(mp, &var);
+
+	if (strcasecmp(key, "Track") == 0)
+		return parse_player_metadata(mp, &var);
+
+	if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
+		return FALSE;
+
+	dbus_message_iter_get_basic(&var, &value);
+
+	curval = g_hash_table_lookup(mp->settings, key);
+	if (g_strcmp0(curval, value) == 0)
+		return TRUE;
+
+	DBG("%s=%s", key, value);
+
+	g_hash_table_replace(mp->settings, g_strdup(key), g_strdup(value));
+
+	settings = list_settings(mp);
+
+	avrcp_player_event(mp->player, AVRCP_EVENT_SETTINGS_CHANGED, settings);
+
+	g_list_free(settings);
+
+	return TRUE;
+}
+
+static gboolean parse_player_properties(struct media_player *mp,
+							DBusMessageIter *iter)
+{
+	DBusMessageIter dict;
+	int ctype;
+
+	ctype = dbus_message_iter_get_arg_type(iter);
+	if (ctype != DBUS_TYPE_ARRAY)
+		return FALSE;
+
+	dbus_message_iter_recurse(iter, &dict);
+
+	while ((ctype = dbus_message_iter_get_arg_type(&dict)) !=
+							DBUS_TYPE_INVALID) {
+		DBusMessageIter entry;
+		const char *key;
+
+		if (ctype != DBUS_TYPE_DICT_ENTRY)
+			return FALSE;
+
+		dbus_message_iter_recurse(&dict, &entry);
+		if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_STRING)
+			return FALSE;
+
+		dbus_message_iter_get_basic(&entry, &key);
+		dbus_message_iter_next(&entry);
+
+		if (set_player_property(mp, key, &entry) == FALSE)
+			return FALSE;
+
+		dbus_message_iter_next(&dict);
+	}
+
+	return TRUE;
+}
+
+static gboolean properties_changed(DBusConnection *connection, DBusMessage *msg,
 							void *user_data)
 {
 	struct media_player *mp = user_data;
@@ -1410,11 +1396,9 @@ static gboolean track_changed(DBusConnection *connection, DBusMessage *msg,
 
 	dbus_message_iter_init(msg, &iter);
 
-	if (parse_player_metadata(mp, &iter) == FALSE) {
-		error("Unexpected signature in %s.%s signal",
-					dbus_message_get_interface(msg),
-					dbus_message_get_member(msg));
-	}
+	dbus_message_iter_next(&iter);
+
+	parse_player_properties(mp, &iter);
 
 	return TRUE;
 }
@@ -1440,11 +1424,6 @@ static struct media_player *media_player_create(struct media_adapter *adapter,
 						path, MEDIA_PLAYER_INTERFACE,
 						properties_changed,
 						mp, NULL);
-	mp->track_watch = g_dbus_add_signal_watch(conn, sender,
-						path, MEDIA_PLAYER_INTERFACE,
-						"TrackChanged",
-						track_changed,
-						mp, NULL);
 	mp->player = avrcp_register_player(adapter->btd_adapter, &player_cb,
 							mp, media_player_free);
 	if (!mp->player) {
@@ -1499,13 +1478,6 @@ static DBusMessage *register_player(DBusConnection *conn, DBusMessage *msg,
 		return btd_error_invalid_args(msg);
 	}
 
-	dbus_message_iter_next(&args);
-
-	if (parse_player_metadata(mp, &args) == FALSE) {
-		media_player_destroy(mp);
-		return btd_error_invalid_args(msg);
-	}
-
 	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
 
@@ -1539,8 +1511,7 @@ static const GDBusMethodTable media_methods[] = {
 	{ GDBUS_METHOD("UnregisterEndpoint",
 		GDBUS_ARGS({ "endpoint", "o" }), NULL, unregister_endpoint) },
 	{ GDBUS_EXPERIMENTAL_METHOD("RegisterPlayer",
-		GDBUS_ARGS({ "player", "o" }, { "properties", "a{sv}" },
-						{ "metadata", "a{sv}" }),
+		GDBUS_ARGS({ "player", "o" }, { "properties", "a{sv}" }),
 		NULL, register_player) },
 	{ GDBUS_EXPERIMENTAL_METHOD("UnregisterPlayer",
 		GDBUS_ARGS({ "player", "o" }), NULL, unregister_player) },
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 06/13] player: Add Device property
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-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 | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index c2ee60f..d3bd915 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 880745d..f8920c9 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 */
@@ -242,6 +243,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)
 {
@@ -394,6 +405,8 @@ static const GDBusPropertyTable media_player_properties[] = {
 					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
 	{ "Track", "a{sv}", get_track, NULL, NULL,
 					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
+	{ "Device", "s", get_device, NULL, NULL,
+					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
 	{ }
 };
 
@@ -419,6 +432,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);
 }
 
@@ -427,6 +441,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


^ permalink raw reply related

* [PATCH BlueZ 6/8 v2] control: Mark all members of MediaControl1 as deprecated
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

---
 profiles/audio/control.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/profiles/audio/control.c b/profiles/audio/control.c
index 642fdd5..70faab8 100644
--- a/profiles/audio/control.c
+++ b/profiles/audio/control.c
@@ -222,20 +222,23 @@ static gboolean control_property_get_connected(
 }
 
 static const GDBusMethodTable control_methods[] = {
-	{ GDBUS_METHOD("Play", NULL, NULL, control_play) },
-	{ GDBUS_METHOD("Pause", NULL, NULL, control_pause) },
-	{ GDBUS_METHOD("Stop", NULL, NULL, control_stop) },
-	{ GDBUS_METHOD("Next", NULL, NULL, control_next) },
-	{ GDBUS_METHOD("Previous", NULL, NULL, control_previous) },
-	{ GDBUS_METHOD("VolumeUp", NULL, NULL, control_volume_up) },
-	{ GDBUS_METHOD("VolumeDown", NULL, NULL, control_volume_down) },
-	{ GDBUS_METHOD("FastForward", NULL, NULL, control_fast_forward) },
-	{ GDBUS_METHOD("Rewind", NULL, NULL, control_rewind) },
+	{ GDBUS_DEPRECATED_METHOD("Play", NULL, NULL, control_play) },
+	{ GDBUS_DEPRECATED_METHOD("Pause", NULL, NULL, control_pause) },
+	{ GDBUS_DEPRECATED_METHOD("Stop", NULL, NULL, control_stop) },
+	{ GDBUS_DEPRECATED_METHOD("Next", NULL, NULL, control_next) },
+	{ GDBUS_DEPRECATED_METHOD("Previous", NULL, NULL, control_previous) },
+	{ GDBUS_DEPRECATED_METHOD("VolumeUp", NULL, NULL, control_volume_up) },
+	{ GDBUS_DEPRECATED_METHOD("VolumeDown", NULL, NULL,
+							control_volume_down) },
+	{ GDBUS_DEPRECATED_METHOD("FastForward", NULL, NULL,
+							control_fast_forward) },
+	{ GDBUS_DEPRECATED_METHOD("Rewind", NULL, NULL, control_rewind) },
 	{ }
 };
 
 static const GDBusPropertyTable control_properties[] = {
-	{ "Connected", "b", control_property_get_connected },
+	{ "Connected", "b", control_property_get_connected, NULL, NULL,
+					G_DBUS_PROPERTY_FLAG_DEPRECATED },
 	{ }
 };
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 05/13] AVRCP: Always create a controller player even for version 1.0
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

Since the buttons controls are now part of the MediaPlayer1 it can be used
even with AVRCP version 1.0.
---
 profiles/audio/avrcp.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 3366b48..d0cc346 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1952,6 +1952,9 @@ static bool ct_set_setting(struct media_player *mp, const char *key,
 	if (session == NULL)
 		return false;
 
+	if (session->version < 0x0103)
+		return false;
+
 	attr = attr_to_val(key);
 	if (attr < 0)
 		return false;
@@ -2047,24 +2050,15 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
 					void *user_data)
 {
 	struct avrcp *session = user_data;
-	struct avrcp_player *player = session->player;
-	struct media_player *mp;
 	struct avrcp_header *pdu = (void *) operands;
 	uint16_t events = 0;
 	uint8_t count;
-	const char *path;
 
 	if (pdu->params[0] != CAP_EVENTS_SUPPORTED)
 		return FALSE;
 
 	count = pdu->params[1];
 
-	path = device_get_path(session->dev->btd_dev);
-
-	mp = media_player_controller_create(path);
-	if (mp == NULL)
-		return FALSE;
-
 	for (; count > 0; count--) {
 		uint8_t event = pdu->params[1 + count];
 
@@ -2079,10 +2073,6 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
 		}
 	}
 
-	media_player_set_callbacks(mp, &ct_cbs, player);
-	player->user_data = mp;
-	player->destroy = (GDestroyNotify) media_player_destroy;
-
 	if (!(events & (1 << AVRCP_EVENT_SETTINGS_CHANGED)))
 		avrcp_list_player_attributes(session);
 
@@ -2169,6 +2159,8 @@ static void session_tg_init(struct avrcp *session)
 static void session_ct_init(struct avrcp *session)
 {
 	struct avrcp_player *player;
+	struct media_player *mp;
+	const char *path;
 
 	session->control_handlers = ct_control_handlers;
 
@@ -2179,13 +2171,22 @@ static void session_ct_init(struct avrcp *session)
 							handle_vendordep_pdu,
 							session);
 
-	if (session->version < 0x0103)
-		return;
-
 	player = g_new0(struct avrcp_player, 1);
 	player->sessions = g_slist_prepend(player->sessions, session);
 	session->player = player;
 
+	path = device_get_path(session->dev->btd_dev);
+
+	mp = media_player_controller_create(path);
+	if (mp != NULL) {
+		media_player_set_callbacks(mp, &ct_cbs, player);
+		player->user_data = mp;
+		player->destroy = (GDestroyNotify) media_player_destroy;
+	}
+
+	if (session->version < 0x0103)
+		return;
+
 	avrcp_get_capabilities(session);
 }
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 04/13] player: Fix documentation to use TrackNumber in track metadata
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

Using Track key inside a Track property would be pointless, despite the
documentation and code where also inconsistent.
---
 doc/media-api.txt       | 2 +-
 profiles/audio/avrcp.c  | 2 +-
 profiles/audio/player.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index 16ed34b..c2ee60f 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -280,7 +280,7 @@ Properties	string Equalizer [readwrite]
 
 					Number of tracks in total
 
-				uint32 Number:
+				uint32 TrackNumber:
 
 					Track number
 
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 9ca5a3a..3366b48 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -649,7 +649,7 @@ static const char *metadata_to_str(uint32_t id)
 	case AVRCP_MEDIA_ATTRIBUTE_GENRE:
 		return "Genre";
 	case AVRCP_MEDIA_ATTRIBUTE_TRACK:
-		return "Track";
+		return "TrackNumber";
 	case AVRCP_MEDIA_ATTRIBUTE_N_TRACKS:
 		return "NumberOfTracks";
 	case AVRCP_MEDIA_ATTRIBUTE_DURATION:
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 2e5c386..880745d 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -72,7 +72,7 @@ static void append_metadata(void *key, void *value, void *user_data)
 	DBusMessageIter *dict = user_data;
 
 	if (strcasecmp((char *) key, "Duration") == 0 ||
-			strcasecmp((char *) key, "Track") == 0 ||
+			strcasecmp((char *) key, "TrackNumber") == 0 ||
 			strcasecmp((char *) key, "NumberOfTracks") == 0)  {
 		uint32_t num = atoi(value);
 		dict_append_entry(dict, key, DBUS_TYPE_UINT32, &num);
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 03/13] player: Add support for button controls
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

This adds support for buttons controls in MediaPlayer1
---
 profiles/audio/avrcp.c  |  75 +++++++++++++++++++++++++++-
 profiles/audio/player.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++++
 profiles/audio/player.h |   7 +++
 3 files changed, 210 insertions(+), 1 deletion(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index a139606..9ca5a3a 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1965,8 +1965,80 @@ static bool ct_set_setting(struct media_player *mp, const char *key,
 	return true;
 }
 
+static int ct_press(struct avrcp_player *player, uint8_t op)
+{
+	int err;
+	struct avrcp *session;
+
+	session = player->sessions->data;
+	if (session == NULL)
+		return -ENOTCONN;
+
+	err = avctp_send_passthrough(session->conn, op);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static int ct_play(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_PLAY);
+}
+
+static int ct_pause(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_PAUSE);
+}
+
+static int ct_stop(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_STOP);
+}
+
+static int ct_next(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_FORWARD);
+}
+
+static int ct_previous(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_BACKWARD);
+}
+
+static int ct_fast_forward(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_FAST_FORWARD);
+}
+
+static int ct_rewind(struct media_player *mp, void *user_data)
+{
+	struct avrcp_player *player = user_data;
+
+	return ct_press(player, AVC_REWIND);
+}
+
 static const struct media_player_callback ct_cbs = {
-	.set_setting = ct_set_setting,
+	.set_setting	= ct_set_setting,
+	.play		= ct_play,
+	.pause		= ct_pause,
+	.stop		= ct_stop,
+	.next		= ct_next,
+	.previous	= ct_previous,
+	.fast_forward	= ct_fast_forward,
+	.rewind		= ct_rewind,
 };
 
 static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
@@ -1988,6 +2060,7 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
 	count = pdu->params[1];
 
 	path = device_get_path(session->dev->btd_dev);
+
 	mp = media_player_controller_create(path);
 	if (mp == NULL)
 		return FALSE;
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 9add1b8..2e5c386 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -242,7 +242,136 @@ static gboolean get_track(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static DBusMessage *media_player_play(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->play == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->play(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_pause(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->pause == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->pause(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_stop(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->stop == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->stop(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_next(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->next == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->next(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_previous(DBusConnection *conn,
+						DBusMessage *msg, void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->previous == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->previous(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_fast_forward(DBusConnection *conn,
+						DBusMessage *msg, void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->fast_forward == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->fast_forward(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *media_player_rewind(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_player *mp = data;
+	struct player_callback *cb = mp->cb;
+	int err;
+
+	if (cb->cbs->rewind == NULL)
+		return btd_error_not_supported(msg);
+
+	err = cb->cbs->rewind(mp, cb->user_data);
+	if (err < 0)
+		return btd_error_failed(msg, strerror(-err));
+
+	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
 static const GDBusMethodTable media_player_methods[] = {
+	{ GDBUS_EXPERIMENTAL_METHOD("Play", NULL, NULL, media_player_play) },
+	{ GDBUS_EXPERIMENTAL_METHOD("Pause", NULL, NULL, media_player_pause) },
+	{ GDBUS_EXPERIMENTAL_METHOD("Stop", NULL, NULL, media_player_stop) },
+	{ GDBUS_EXPERIMENTAL_METHOD("Next", NULL, NULL, media_player_next) },
+	{ GDBUS_EXPERIMENTAL_METHOD("Previous", NULL, NULL,
+						media_player_previous) },
+	{ GDBUS_EXPERIMENTAL_METHOD("FastForward", NULL, NULL,
+						media_player_fast_forward) },
+	{ GDBUS_EXPERIMENTAL_METHOD("Rewind", NULL, NULL,
+						media_player_rewind) },
 	{ }
 };
 
diff --git a/profiles/audio/player.h b/profiles/audio/player.h
index 87dfb66..212a5a6 100644
--- a/profiles/audio/player.h
+++ b/profiles/audio/player.h
@@ -28,6 +28,13 @@ struct media_player;
 struct media_player_callback {
 	bool (*set_setting) (struct media_player *mp, const char *key,
 				const char *value, void *user_data);
+	int (*play) (struct media_player *mp, void *user_data);
+	int (*pause) (struct media_player *mp, void *user_data);
+	int (*stop) (struct media_player *mp, void *user_data);
+	int (*next) (struct media_player *mp, void *user_data);
+	int (*previous) (struct media_player *mp, void *user_data);
+	int (*fast_forward) (struct media_player *mp, void *user_data);
+	int (*rewind) (struct media_player *mp, void *user_data);
 };
 
 struct media_player *media_player_controller_create(const char *path);
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 02/13] player: Remove GetTrack and TrackChanged
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1357824283-19233-1-git-send-email-luiz.dentz@gmail.com>

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

This turn track metadata into a property called "Track" of MediaPlayer1
---
 profiles/audio/player.c | 81 +++++++++++++++----------------------------------
 1 file changed, 25 insertions(+), 56 deletions(-)

diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index bffb506..9add1b8 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -82,33 +82,6 @@ static void append_metadata(void *key, void *value, void *user_data)
 	dict_append_entry(dict, key, DBUS_TYPE_STRING, &value);
 }
 
-static DBusMessage *media_player_get_track(DBusConnection *conn,
-						DBusMessage *msg, void *data)
-{
-	struct media_player *mp = data;
-	DBusMessage *reply;
-	DBusMessageIter iter, dict;
-
-	reply = dbus_message_new_method_return(msg);
-	if (!reply)
-		return NULL;
-
-	dbus_message_iter_init_append(reply, &iter);
-
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-					DBUS_TYPE_STRING_AS_STRING
-					DBUS_TYPE_VARIANT_AS_STRING
-					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
-					&dict);
-
-	g_hash_table_foreach(mp->track, append_metadata, &dict);
-
-	dbus_message_iter_close_container(&iter, &dict);
-
-	return reply;
-}
-
 static struct pending_req *find_pending(struct media_player *mp,
 							const char *key)
 {
@@ -249,16 +222,31 @@ static void set_setting(const GDBusPropertyTable *property,
 	player_set_setting(mp, id, property->name, value);
 }
 
+static gboolean get_track(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct media_player *mp = data;
+	DBusMessageIter dict;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+					DBUS_TYPE_STRING_AS_STRING
+					DBUS_TYPE_VARIANT_AS_STRING
+					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
+					&dict);
+
+	g_hash_table_foreach(mp->track, append_metadata, &dict);
+
+	dbus_message_iter_close_container(iter, &dict);
+
+	return TRUE;
+}
+
 static const GDBusMethodTable media_player_methods[] = {
-	{ GDBUS_EXPERIMENTAL_METHOD("GetTrack",
-			NULL, GDBUS_ARGS({ "metadata", "a{sv}" }),
-			media_player_get_track) },
 	{ }
 };
 
 static const GDBusSignalTable media_player_signals[] = {
-	{ GDBUS_EXPERIMENTAL_SIGNAL("TrackChanged",
-			GDBUS_ARGS({ "metadata", "a{sv}" })) },
 	{ }
 };
 
@@ -275,6 +263,8 @@ static const GDBusPropertyTable media_player_properties[] = {
 					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
 	{ "Scan", "s", get_setting, set_setting, setting_exists,
 					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
+	{ "Track", "a{sv}", get_track, NULL, NULL,
+					G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
 	{ }
 };
 
@@ -427,33 +417,12 @@ void media_player_set_status(struct media_player *mp, const char *status)
 static gboolean process_metadata_changed(void *user_data)
 {
 	struct media_player *mp = user_data;
-	DBusMessage *signal;
-	DBusMessageIter iter, dict;
 
 	mp->process_id = 0;
 
-	signal = dbus_message_new_signal(mp->path, MEDIA_PLAYER_INTERFACE,
-							"TrackChanged");
-	if (signal == NULL) {
-		error("Unable to allocate TrackChanged signal");
-		return FALSE;
-	}
-
-	dbus_message_iter_init_append(signal, &iter);
-
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-					DBUS_TYPE_STRING_AS_STRING
-					DBUS_TYPE_VARIANT_AS_STRING
-					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
-					&dict);
-
-
-	g_hash_table_foreach(mp->track, append_metadata, &dict);
-
-	dbus_message_iter_close_container(&iter, &dict);
-
-	g_dbus_send_message(btd_get_dbus_connection(), signal);
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+					mp->path, MEDIA_PLAYER_INTERFACE,
+					"Track");
 
 	return FALSE;
 }
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 01/13] media-api: Add playback control methods to MediaPlayer1
From: Luiz Augusto von Dentz @ 2013-01-10 13:24 UTC (permalink / raw)
  To: linux-bluetooth

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

This adds methods such as Play, Pause directly in MediaPlayer1, in
addition to that Track is now turn into a property to take advantage of
ObjectManager and document the interface as experimental.
---
 doc/media-api.txt | 99 ++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 57 insertions(+), 42 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index bb5ced0..16ed34b 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -129,7 +129,7 @@ Media Control hierarchy
 =======================
 
 Service		org.bluez
-Interface	org.bluez.MediaControl1
+Interface	org.bluez.MediaControl1 [Deprecated]
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
 
 Methods		void Play()
@@ -178,65 +178,47 @@ Properties
 MediaPlayer1 hierarchy
 ======================
 
-Service		unique name (Target role)
-Interface	org.bluez.MediaPlayer1
-Object path	freely definable
-
 Service		org.bluez (Controller role)
-Interface	org.bluez.MediaPlayer1
+Interface	org.bluez.MediaPlayer1 [Experimental]
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
 
-Methods		dict GetTrack()
-
-			Returns known metadata of the current track.
-
-			See TrackChanged for possible values.
-
-		void Release()
-
-			This method gets called when the service daemon
-			unregisters the player which can then perform
-			cleanup tasks. There is no need to unregister the
-			player, because when this method gets called it has
-			already been unregistered.
+Methods		void Play()
 
-Signals		TrackChanged(dict metadata)
+			Resume playback.
 
-			This signal indicates that current track has changed.
-			All available metadata for the new track shall be set
-			at once in the metadata argument. Metadata cannot be
-			updated in parts, otherwise it will be interpreted as
-			multiple track changes.
+		void Pause()
 
-			Possible values:
+			Pause playback.
 
-				string Title:
+		void Stop()
 
-					Track title name
+			Stop playback.
 
-				string Artist:
+		void Next()
 
-					Track artist name
+			Next item.
 
-				string Album:
+		void Previous()
 
-					Track album name
+			Previous item.
 
-				string Genre:
+		void VolumeUp()
 
-					Track genre name
+			Adjust remote volume one step up
 
-				uint32 NumberOfTracks:
+		void VolumeDown()
 
-					Number of tracks in total
+			Adjust remote volume one step down
 
-				uint32 Number:
+		void FastForward()
 
-					Track number
+			Fast forward playback, this action is only stopped
+			when another method in this interface is called.
 
-				uint32 Duration:
+		void Rewind()
 
-					Track duration in milliseconds
+			Rewind playback, this action is only stopped
+			when another method in this interface is called.
 
 Properties	string Equalizer [readwrite]
 
@@ -258,8 +240,8 @@ Properties	string Equalizer [readwrite]
 		string Status [readonly]
 
 			Possible status: "playing", "stopped", "paused",
-					"forward-seek", "reverse-seek" or
-					"error"
+					"forward-seek", "reverse-seek"
+					or "error"
 
 		uint32 Position [readonly]
 
@@ -272,6 +254,39 @@ Properties	string Equalizer [readwrite]
 			possible to signal its end by setting position to the
 			maximum uint32 value.
 
+		dict Track [readonly]
+
+			Track metadata.
+
+			Possible values:
+
+				string Title:
+
+					Track title name
+
+				string Artist:
+
+					Track artist name
+
+				string Album:
+
+					Track album name
+
+				string Genre:
+
+					Track genre name
+
+				uint32 NumberOfTracks:
+
+					Number of tracks in total
+
+				uint32 Number:
+
+					Track number
+
+				uint32 Duration:
+
+					Track duration in milliseconds
 
 MediaEndpoint1 hierarchy
 ========================
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 10/10] unit: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 unit/test-uuid.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/unit/test-uuid.c b/unit/test-uuid.c
index cbccc82..79ab3e6 100644
--- a/unit/test-uuid.c
+++ b/unit/test-uuid.c
@@ -28,7 +28,8 @@
 #include <glib.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
+
+#include "lib/uuid.h"
 
 struct uuid_test_data {
 	const char *str;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 09/10] attrib: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 attrib/att.c          |    2 +-
 attrib/gatt-service.c |    2 +-
 attrib/gatt.c         |    2 +-
 attrib/gattrib.c      |    4 ++--
 attrib/gatttool.c     |    2 +-
 attrib/interactive.c  |    3 +--
 attrib/utils.c        |    2 +-
 7 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/attrib/att.c b/attrib/att.c
index de11811..b26273e 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -31,10 +31,10 @@
 #include <stdlib.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 
 #include <glib.h>
 
+#include "lib/uuid.h"
 #include "att.h"
 
 const char *att_ecode2str(uint8_t status)
diff --git a/attrib/gatt-service.c b/attrib/gatt-service.c
index e8788d9..bdb12cd 100644
--- a/attrib/gatt-service.c
+++ b/attrib/gatt-service.c
@@ -27,10 +27,10 @@
 #endif
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <bluetooth/sdp.h>
 #include <adapter.h>
 
+#include "lib/uuid.h"
 #include "gattrib.h"
 #include "att.h"
 #include "gatt.h"
diff --git a/attrib/gatt.c b/attrib/gatt.c
index 38c050e..d54feac 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -29,10 +29,10 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <bluetooth/sdp.h>
 #include <bluetooth/sdp_lib.h>
 
+#include "lib/uuid.h"
 #include "att.h"
 #include "gattrib.h"
 #include "gatt.h"
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index bf40532..58f19d0 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -33,9 +33,9 @@
 #include <stdio.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
-
 #include <btio/btio.h>
+
+#include "lib/uuid.h"
 #include "log.h"
 #include "att.h"
 #include "gattrib.h"
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index e66059d..29e3261 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -34,8 +34,8 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/hci.h>
 #include <bluetooth/hci_lib.h>
-#include <bluetooth/uuid.h>
 
+#include "lib/uuid.h"
 #include "att.h"
 #include <btio/btio.h>
 #include "gattrib.h"
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 51f620a..a99ad0a 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -31,11 +31,10 @@
 #include <stdio.h>
 #include <glib.h>
 
-#include <bluetooth/uuid.h>
-
 #include <readline/readline.h>
 #include <readline/history.h>
 
+#include "lib/uuid.h"
 #include <btio/btio.h>
 #include "att.h"
 #include "gattrib.h"
diff --git a/attrib/utils.c b/attrib/utils.c
index 43244c2..f9813d1 100644
--- a/attrib/utils.c
+++ b/attrib/utils.c
@@ -31,9 +31,9 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/hci.h>
 #include <bluetooth/hci_lib.h>
-#include <bluetooth/uuid.h>
 #include <bluetooth/sdp.h>
 
+#include "lib/uuid.h"
 #include <btio/btio.h>
 #include "att.h"
 #include "gattrib.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 08/10] proximity: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/proximity/immalert.c |    2 +-
 profiles/proximity/linkloss.c |    2 +-
 profiles/proximity/monitor.c  |    2 +-
 profiles/proximity/reporter.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/profiles/proximity/immalert.c b/profiles/proximity/immalert.c
index 04557b4..06e8eb8 100644
--- a/profiles/proximity/immalert.c
+++ b/profiles/proximity/immalert.c
@@ -27,12 +27,12 @@
 #include <stdbool.h>
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <adapter.h>
 
 #include <dbus/dbus.h>
 #include <gdbus/gdbus.h>
 
+#include "lib/uuid.h"
 #include "log.h"
 #include "attrib/gattrib.h"
 #include "attrib/att.h"
diff --git a/profiles/proximity/linkloss.c b/profiles/proximity/linkloss.c
index c1c4177..cb87b12 100644
--- a/profiles/proximity/linkloss.c
+++ b/profiles/proximity/linkloss.c
@@ -27,12 +27,12 @@
 #include <stdbool.h>
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <adapter.h>
 
 #include <dbus/dbus.h>
 #include <gdbus/gdbus.h>
 
+#include "lib/uuid.h"
 #include "log.h"
 #include "attrib/att-database.h"
 #include "attrib/gattrib.h"
diff --git a/profiles/proximity/monitor.c b/profiles/proximity/monitor.c
index e502605..37b02e1 100644
--- a/profiles/proximity/monitor.c
+++ b/profiles/proximity/monitor.c
@@ -36,8 +36,8 @@
 #include <sys/stat.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 
+#include "lib/uuid.h"
 #include "dbus-common.h"
 #include "adapter.h"
 #include "device.h"
diff --git a/profiles/proximity/reporter.c b/profiles/proximity/reporter.c
index ef3ab6a..31c33ef 100644
--- a/profiles/proximity/reporter.c
+++ b/profiles/proximity/reporter.c
@@ -30,7 +30,6 @@
 #include <errno.h>
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <adapter.h>
 
 #include <dbus/dbus.h>
@@ -38,6 +37,7 @@
 
 #include "log.h"
 
+#include "lib/uuid.h"
 #include "dbus-common.h"
 #include "error.h"
 #include "device.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 07/10] time: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/time/server.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/profiles/time/server.c b/profiles/time/server.c
index ab9fbb4..518a29f 100644
--- a/profiles/time/server.c
+++ b/profiles/time/server.c
@@ -31,13 +31,12 @@
 #include <errno.h>
 #include <stdbool.h>
 
-#include <bluetooth/uuid.h>
-
 #include <adapter.h>
 #include <device.h>
 #include <profile.h>
 #include <plugin.h>
 
+#include "lib/uuid.h"
 #include "attrib/gattrib.h"
 #include "attrib/att.h"
 #include "attrib/gatt.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 06/10] alert: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/alert/server.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/alert/server.c b/profiles/alert/server.c
index 3736a0b..4536c81 100644
--- a/profiles/alert/server.c
+++ b/profiles/alert/server.c
@@ -30,9 +30,9 @@
 #include <errno.h>
 #include <gdbus/gdbus.h>
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <stdlib.h>
 
+#include "lib/uuid.h"
 #include "plugin.h"
 #include "dbus-common.h"
 #include "attrib/att.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 05/10] scanparam: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/scanparam/scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 7c21ac3..268bdc8 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -30,8 +30,8 @@
 #include <errno.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 
+#include "lib/uuid.h"
 #include "log.h"
 #include "plugin.h"
 #include "adapter.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 04/10] gatt: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/gatt/gas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/gatt/gas.c b/profiles/gatt/gas.c
index b5e0e52..429850b 100644
--- a/profiles/gatt/gas.c
+++ b/profiles/gatt/gas.c
@@ -32,9 +32,9 @@
 #include <errno.h>
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <btio/btio.h>
 
+#include "lib/uuid.h"
 #include "adapter.h"
 #include "device.h"
 #include "attrib/att.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 03/10] input: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 profiles/input/hog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 7f13abc..7f7bfd2 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -37,12 +37,12 @@
 #include "uhid_copy.h"
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 
 #include <glib.h>
 
 #include "log.h"
 
+#include "lib/uuid.h"
 #include "src/adapter.h"
 #include "src/device.h"
 #include "src/profile.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 02/10] plugins: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1357823709-8627-1-git-send-email-anderson.lizardo@openbossa.org>

These headers are not public anymore, so need to use "lib/uuid.h".
---
 plugins/gatt-example.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/gatt-example.c b/plugins/gatt-example.c
index de090e9..bd0fbff 100644
--- a/plugins/gatt-example.c
+++ b/plugins/gatt-example.c
@@ -27,10 +27,10 @@
 #endif
 
 #include <glib.h>
-#include <bluetooth/uuid.h>
 #include <errno.h>
 #include <adapter.h>
 
+#include "lib/uuid.h"
 #include "plugin.h"
 #include "hcid.h"
 #include "log.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ 01/10] core: Fix remaining references to bluetooth/uuid.h
From: Anderson Lizardo @ 2013-01-10 13:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

These headers are not public anymore, so need to use "lib/uuid.h".
---
 src/attrib-server.c |    2 +-
 src/main.c          |    2 +-
 src/storage.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 0a56942..b2360c3 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -35,10 +35,10 @@
 #include <sys/file.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 #include <bluetooth/sdp.h>
 #include <bluetooth/sdp_lib.h>
 
+#include "lib/uuid.h"
 #include <gdbus/gdbus.h>
 #include "log.h"
 #include <btio/btio.h>
diff --git a/src/main.c b/src/main.c
index bd1e9d9..b9fd369 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,7 +38,6 @@
 #include <sys/stat.h>
 
 #include <bluetooth/bluetooth.h>
-#include <bluetooth/uuid.h>
 
 #include <glib.h>
 
@@ -48,6 +47,7 @@
 
 #include "log.h"
 
+#include "lib/uuid.h"
 #include "hcid.h"
 #include "sdpd.h"
 #include "adapter.h"
diff --git a/src/storage.c b/src/storage.c
index 8b634ba..f7e4db6 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -41,8 +41,8 @@
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/sdp.h>
 #include <bluetooth/sdp_lib.h>
-#include <bluetooth/uuid.h>
 
+#include "lib/uuid.h"
 #include "textfile.h"
 #include "glib-helper.h"
 #include "storage.h"
-- 
1.7.9.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox