summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-api.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-03-27 18:25:47 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-03-27 19:27:40 -0700
commit6e9217d3372b8d4fa737e485d361d09a85be64f0 (patch)
tree0dc0b65ea6c9c6286ef3060feb1d21cb171f1a47 /binding/bluetooth-api.c
parent66d4abbb3c5462ceb65148ea5ee13645d588d55e (diff)
binding: bluetooth: allow multiple paths for org.bluez.MediaPlayer1 interfaces
Previously org.bluez.MediaPlayer1 paths could only resolve to player0 but certain phones request another instance for another application (e.g. player1). This patchset changes the default media player path to last connected, and which in theory should be from the media application in use on the phone. From limited experiments not in use interfaces will be reaped shortly after going idle. Bug-AGL: SPEC-2281 Change-Id: Id4bdc89cd395d5cd3ac043394761a95b306e5c6d Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-api.c')
-rw-r--r--binding/bluetooth-api.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/binding/bluetooth-api.c b/binding/bluetooth-api.c
index 4c1165c..f849301 100644
--- a/binding/bluetooth-api.c
+++ b/binding/bluetooth-api.c
@@ -356,13 +356,14 @@ static void bluez_devices_signal_callback(
event = ns->media_event;
}
json_object_object_add(jresp, "properties", jobj);
- } else if (is_mediaplayer1_interface(path) &&
- g_str_has_suffix(path, BLUEZ_DEFAULT_PLAYER)) {
-
+ } else if (is_mediaplayer1_interface(path)) {
+ gchar *player = find_index(path, 5);
json_object_object_add(jresp, "connected",
json_object_new_boolean(TRUE));
json_object_object_add(jresp, "type",
json_object_new_string("playback"));
+ json_object_object_add(jresp, "player",
+ json_object_new_string(player));
mediaplayer1_set_path(ns, path);
event = ns->media_event;
} else {
@@ -390,10 +391,13 @@ static void bluez_devices_signal_callback(
event = ns->media_event;
} else if (is_mediaplayer1_interface(path)) {
+ gchar *player = find_index(path, 5);
json_object_object_add(jresp, "connected",
json_object_new_boolean(FALSE));
json_object_object_add(jresp, "type",
json_object_new_string("playback"));
+ json_object_object_add(jresp, "player",
+ json_object_new_string(player));
event = ns->media_event;
/* adapter removal */
} else if (split_length(path) == 4) {