summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-bluez.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-11-07 19:08:06 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-14 03:16:58 -0800
commit76a617a9473c02e7c4624f47a62f5c60b1e77148 (patch)
tree4f776c7cb7ff1dfebbf949a920cd74434f34452b /binding/bluetooth-bluez.c
parenta5fe25e7496cf4a8369e1f34e66c9e55d2c95ed1 (diff)
binding: bluetooth: add MediaPlayer1 interface media eventsguppy_6.99.2guppy_6.99.1guppy/6.99.2guppy/6.99.16.99.26.99.1
Report back MediaPlayer1 interface events for A2DP media playback Bug-AGL: SPEC-1630 Change-Id: I777f19af2de247fe676d5bede4bacbbad8ca9844 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-bluez.c')
-rw-r--r--binding/bluetooth-bluez.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/binding/bluetooth-bluez.c b/binding/bluetooth-bluez.c
index 824843b..1c46106 100644
--- a/binding/bluetooth-bluez.c
+++ b/binding/bluetooth-bluez.c
@@ -72,6 +72,26 @@ static const struct property_info device_props[] = {
{ },
};
+static const struct property_info mediaplayer_props[] = {
+ { .name = "Position", .fmt = "u", },
+ { .name = "Status", .fmt = "s", },
+ {
+ .name = "Track",
+ .fmt = "{sv}",
+ .sub = (const struct property_info []) {
+ { .name = "Title", .fmt = "s", },
+ { .name = "Artist", .fmt = "s", },
+ { .name = "Album", .fmt = "s", },
+ { .name = "Genre", .fmt = "s", },
+ { .name = "NumberOfTracks", .fmt = "u", },
+ { .name = "TrackNumber", .fmt = "u", },
+ { .name = "Duration", .fmt = "u", },
+ { },
+ },
+ },
+ { },
+};
+
const struct property_info *bluez_get_property_info(
const char *access_type, GError **error)
{
@@ -81,6 +101,8 @@ const struct property_info *bluez_get_property_info(
pi = adapter_props;
else if (!strcmp(access_type, BLUEZ_AT_DEVICE))
pi = device_props;
+ else if (!strcmp(access_type, BLUEZ_AT_MEDIAPLAYER))
+ pi = mediaplayer_props;
else
g_set_error(error, NB_ERROR, NB_ERROR_ILLEGAL_ARGUMENT,
"illegal %s argument", access_type);
@@ -324,6 +346,7 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
gboolean is_config;
if (!strcmp(access_type, BLUEZ_AT_DEVICE) ||
+ !strcmp(access_type, BLUEZ_AT_MEDIAPLAYER) ||
!strcmp(access_type, BLUEZ_AT_ADAPTER)) {
pi = bluez_get_property_info(access_type, error);
@@ -341,6 +364,8 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
if (!strcmp(access_type, BLUEZ_AT_DEVICE))
interface2 = BLUEZ_DEVICE_INTERFACE;
+ else if (!strcmp(access_type, BLUEZ_AT_MEDIAPLAYER))
+ interface2 = BLUEZ_MEDIAPLAYER_INTERFACE;
else if (!strcmp(access_type, BLUEZ_AT_ADAPTER))
interface2 = BLUEZ_ADAPTER_INTERFACE;
else if (!strcmp(access_type, BLUEZ_AT_OBJECT))
@@ -365,6 +390,7 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
return NULL;
if (!strcmp(access_type, BLUEZ_AT_DEVICE) ||
+ !strcmp(access_type, BLUEZ_AT_MEDIAPLAYER) ||
!strcmp(access_type, BLUEZ_AT_ADAPTER)) {
jprop = json_object_new_object();
g_variant_get(reply, "(a{sv})", &array);