diff options
author | 2018-12-04 00:39:21 -0800 | |
---|---|---|
committer | 2018-12-05 15:23:40 +0000 | |
commit | f2aaebf3f8c1f9e71586a9d5f5c370d3338c07cf (patch) | |
tree | c66b75f86d5beae38ff30de45eeb47c94efa3ef8 /binding/bluetooth-api.h | |
parent | 547a7b88de739d6cf12fdc951cac106250aaca25 (diff) |
binding: bluetooth: add MediaTransport1 support
Bug-AGL: SPEC-1630 SPEC-1986
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.h | 33 |
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) { |