diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 5967180..cabe2ee 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
avrcp_set_browsed_player_rsp, session);
}
+static void avrcp_player_parse_features(struct avrcp_player *player,
+ uint8_t *features)
+{
+ struct media_player *mp = player->user_data;
+
+ if (features[7] & 0x08)
+ media_player_set_browsable(mp, true);
+
+ if (features[7] & 0x10)
+ media_player_set_searchable(mp, true);
+}
+
static void avrcp_parse_media_player_item(struct avrcp *session,
uint8_t *operands, uint16_t len)
{
uint16_t id;
uint32_t subtype;
const char *curval, *strval;
- uint64_t features[2];
char name[255];
if (len < 28)
avrcp_get_play_status(session);
}
- features[0] = bt_get_be64(&operands[8]);
- features[1] = bt_get_be64(&operands[16]);
-
- media_player_set_features(mp, features);
+ avrcp_player_parse_features(player, &operands[8]);
if (operands[26] != 0) {
memcpy(name, &operands[27], operands[26]);
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index f875ee7..7879193 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
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 */
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)
{
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 },
{ }
};
"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)
{
diff --git a/profiles/audio/player.h b/profiles/audio/player.h
index 1ac9800..e9a7d1c 100644
--- a/profiles/audio/player.h
+++ b/profiles/audio/player.h
void media_player_set_subtype(struct media_player *mp, const char *subtype);
void media_player_set_features(struct media_player *mp, uint64_t *features);
void media_player_set_name(struct media_player *mp, const char *name);
+void media_player_set_browsable(struct media_player *mp, bool enabled);
+void media_player_set_searchable(struct media_player *mp, bool enabled);
void media_player_set_folder(struct media_player *mp, const char *path,
uint32_t items);