diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-02-15 16:02:47 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-02-15 16:34:40 +0200 |
commit | 771594ef67d52f8d7ed2a65efed504b9b604cf9e (patch) | |
tree | f8dc3ee0aa0efd94e8ad7ccf9da05bfbd8125ae1 /profiles/audio/player.c | |
parent | 7508d96899005e510ccef6e2621d6913367c24a9 (diff) | |
download | bluez-771594ef67d52f8d7ed2a65efed504b9b604cf9e.tar.gz |
AVRCP: Parse browsing and searching features bits
This parses browsing and searching features bits and set the respective
property.
Diffstat (limited to 'profiles/audio/player.c')
-rw-r--r-- | profiles/audio/player.c | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/profiles/audio/player.c b/profiles/audio/player.c index f875ee71c..78791933c 100644 --- a/profiles/audio/player.c +++ b/profiles/audio/player.c @@ -67,7 +67,9 @@ struct media_player { char *name; /* Player name */ char *type; /* Player type */ char *subtype; /* Player subtype */ - uint64_t features[2]; /* Player features */ + bool browsable; /* Player browsing feature */ + bool searchable; /* Player searching feature */ + uint8_t *features; /* Player features */ struct media_folder *folder; /* Player currenct folder */ char *path; /* Player object path */ GHashTable *settings; /* Player settings */ @@ -350,6 +352,57 @@ static gboolean get_subtype(const GDBusPropertyTable *property, return TRUE; } +static gboolean browsable_exists(const GDBusPropertyTable *property, void *data) +{ + struct media_player *mp = data; + + return mp->folder != NULL; +} + +static gboolean get_browsable(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_player *mp = data; + dbus_bool_t value; + + if (mp->folder == NULL) + return FALSE; + + DBG("%s", mp->browsable ? "true" : "false"); + + value = mp->browsable; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value); + + return TRUE; +} + +static gboolean searchable_exists(const GDBusPropertyTable *property, + void *data) +{ + struct media_player *mp = data; + + return mp->folder != NULL; +} + +static gboolean get_searchable(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct media_player *mp = data; + dbus_bool_t value; + + if (mp->folder == NULL) + return FALSE; + + DBG("%s", mp->searchable ? "true" : "false"); + + value = mp->searchable; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value); + + return TRUE; +} + static DBusMessage *media_player_play(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -510,6 +563,10 @@ static const GDBusPropertyTable media_player_properties[] = { G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { "Device", "s", get_device, NULL, NULL, G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "Browsable", "b", get_browsable, NULL, browsable_exists, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, + { "Searchable", "b", get_searchable, NULL, searchable_exists, + G_DBUS_PROPERTY_FLAG_EXPERIMENTAL }, { } }; @@ -843,6 +900,20 @@ void media_player_set_name(struct media_player *mp, const char *name) "Name"); } +void media_player_set_browsable(struct media_player *mp, bool enabled) +{ + DBG("%s", enabled ? "true" : "false"); + + mp->browsable = enabled; +} + +void media_player_set_searchable(struct media_player *mp, bool enabled) +{ + DBG("%s", enabled ? "true" : "false"); + + mp->searchable = enabled; +} + void media_player_set_folder(struct media_player *mp, const char *path, uint32_t items) { |