summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-api.h
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-12-04 00:39:21 -0800
committerScott Murray <scott.murray@konsulko.com>2018-12-10 19:45:16 +0000
commitc12208f529d44410051d91c7f14513a3edf92117 (patch)
treea251d8a5e08825202651d64ba8b96cce96800542 /binding/bluetooth-api.h
parentdc504cf7676cdca0a2816750d1d287dc2350fbd0 (diff)
binding: bluetooth: add MediaTransport1 support
Bug-AGL: SPEC-1630 Change-Id: I6ad1f85d4edc00239f891edf6994db416e8a2dbd Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-api.h')
-rw-r--r--binding/bluetooth-api.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/binding/bluetooth-api.h b/binding/bluetooth-api.h
index 5fa417a..31418ae 100644
--- a/binding/bluetooth-api.h
+++ b/binding/bluetooth-api.h
@@ -34,6 +34,7 @@
#define BLUEZ_AGENTMANAGER_INTERFACE BLUEZ_SERVICE ".AgentManager1"
#define BLUEZ_DEVICE_INTERFACE BLUEZ_SERVICE ".Device1"
#define BLUEZ_MEDIAPLAYER_INTERFACE BLUEZ_SERVICE ".MediaPlayer1"
+#define BLUEZ_MEDIATRANSPORT_INTERFACE BLUEZ_SERVICE ".MediaTransport1"
#define BLUEZ_OBJECT_PATH "/"
#define BLUEZ_PATH "/org/bluez"
@@ -68,6 +69,7 @@
#define BLUEZ_AT_AGENT "agent"
#define BLUEZ_AT_AGENTMANAGER "agent-manager"
#define BLUEZ_AT_MEDIAPLAYER "mediaplayer"
+#define BLUEZ_AT_MEDIATRANSPORT "mediatransport"
#define BLUEZ_DEFAULT_ADAPTER "hci0"
#define BLUEZ_DEFAULT_PLAYER "player0"
@@ -122,6 +124,22 @@ static inline gboolean is_mediaplayer1_interface(const char *path)
return ret;
}
+static inline gboolean is_mediatransport1_interface(const char *path)
+{
+ gchar *data = NULL;
+ gboolean ret;
+
+ // Don't trigger on NowPlaying, Item, etc paths
+ if (split_length(path) != 6)
+ return FALSE;
+
+ data = find_index(path, 5);
+ ret = g_str_has_prefix(data, "fd");
+ g_free(data);
+
+ return ret;
+}
+
struct bluetooth_state *bluetooth_get_userdata(afb_req_t request);
struct call_work *call_work_create_unlocked(struct bluetooth_state *ns,
@@ -192,6 +210,14 @@ static inline gboolean mediaplayer_property_dbus2json(json_object *jprop,
jprop, key, var, is_config, error);
}
+static inline gboolean mediatransport_property_dbus2json(json_object *jprop,
+ const gchar *key, GVariant *var, gboolean *is_config,
+ GError **error)
+{
+ return bluez_property_dbus2json(BLUEZ_AT_MEDIATRANSPORT,
+ jprop, key, var, is_config, error);
+}
+
static inline GVariant *device_call(struct bluetooth_state *ns,
const char *device, const char *method,
GVariant *params, GError **error)
@@ -252,6 +278,13 @@ static inline json_object *mediaplayer_properties(struct bluetooth_state *ns,
BLUEZ_AT_MEDIAPLAYER, player, error);
}
+static inline json_object *mediatransport_properties(struct bluetooth_state *ns,
+ GError **error, const gchar *player)
+{
+ return bluez_get_properties(ns,
+ BLUEZ_AT_MEDIATRANSPORT, player, error);
+}
+
static inline json_object *object_properties(struct bluetooth_state *ns,
GError **error)
{