aboutsummaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-bluez.c
diff options
context:
space:
mode:
authorsaman <mahmoudi.saman1@gmail.com>2020-11-29 17:25:42 +0330
committerScott Murray <scott.murray@konsulko.com>2021-01-05 14:26:46 +0000
commitb4ebff5a25cf1346b9ea86379a8d25275bb64a32 (patch)
tree40d38cca5ff22f24612b2968870c97828338bd2f /binding/bluetooth-bluez.c
parent494ce56f88fc377e703896723fdd80c26aa64550 (diff)
More attention to bluez player propertieskoi_10.93.0koi_10.92.0koi/10.93.0koi/10.92.010.93.010.92.0
It is possible the bluez player does not assign to default bluez player (player0) and assign to other player such as playerN. For fixing this issue we can access to correct bluez player from "Player" property in "org.bluez.MediaControl1" interface. By reading Player property on "org.bluez.MediaControl1" interface we could access to player path and ther is not need to define a const string variable like "player0"! Bug-AGL: SPEC-3722 Signed-off-by: saman <mahmoudi.saman1@gmail.com> Change-Id: I8a5f948c511bbb61ccc67db09ad17aeb02ab5bd1
Diffstat (limited to 'binding/bluetooth-bluez.c')
-rw-r--r--binding/bluetooth-bluez.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/binding/bluetooth-bluez.c b/binding/bluetooth-bluez.c
index 18194d5..de4bc0f 100644
--- a/binding/bluetooth-bluez.c
+++ b/binding/bluetooth-bluez.c
@@ -99,6 +99,12 @@ static const struct property_info mediatransport_props[] = {
{ },
};
+static const struct property_info mediacontrol_props[] = {
+ { .name = "Connected", .fmt = "b", },
+ { .name = "Player", .fmt = "s", },
+ { },
+};
+
const struct property_info *bluez_get_property_info(
const char *access_type, GError **error)
{
@@ -112,6 +118,8 @@ const struct property_info *bluez_get_property_info(
pi = mediaplayer_props;
else if (!strcmp(access_type, BLUEZ_AT_MEDIATRANSPORT))
pi = mediatransport_props;
+ else if (!strcmp(access_type, BLUEZ_AT_MEDIACONTROL))
+ pi = mediacontrol_props;
else
g_set_error(error, NB_ERROR, NB_ERROR_ILLEGAL_ARGUMENT,
"illegal %s argument", access_type);
@@ -357,7 +365,8 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
if (!strcmp(access_type, BLUEZ_AT_DEVICE) ||
!strcmp(access_type, BLUEZ_AT_MEDIAPLAYER) ||
!strcmp(access_type, BLUEZ_AT_MEDIATRANSPORT) ||
- !strcmp(access_type, BLUEZ_AT_ADAPTER)) {
+ !strcmp(access_type, BLUEZ_AT_ADAPTER) ||
+ !strcmp(access_type, BLUEZ_AT_MEDIACONTROL)) {
pi = bluez_get_property_info(access_type, error);
if (!pi)
@@ -380,6 +389,8 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
interface2 = BLUEZ_MEDIATRANSPORT_INTERFACE;
else if (!strcmp(access_type, BLUEZ_AT_ADAPTER))
interface2 = BLUEZ_ADAPTER_INTERFACE;
+ else if (!strcmp(access_type, BLUEZ_AT_MEDIACONTROL))
+ interface2 = BLUEZ_MEDIACONTROL_INTERFACE;
else if (!strcmp(access_type, BLUEZ_AT_OBJECT))
interface2 = NULL;
else
@@ -404,7 +415,8 @@ json_object *bluez_get_properties(struct bluetooth_state *ns,
if (!strcmp(access_type, BLUEZ_AT_DEVICE) ||
!strcmp(access_type, BLUEZ_AT_MEDIAPLAYER) ||
!strcmp(access_type, BLUEZ_AT_MEDIATRANSPORT) ||
- !strcmp(access_type, BLUEZ_AT_ADAPTER)) {
+ !strcmp(access_type, BLUEZ_AT_ADAPTER) ||
+ !strcmp(access_type, BLUEZ_AT_MEDIACONTROL)) {
jprop = json_object_new_object();
g_variant_get(reply, "(a{sv})", &array);
while (g_variant_iter_loop(array, "{sv}", &key, &var)) {