connection_handler_->DisconnectDevice(bdaddr);
}
+void AvrcpService::SetBipClientStatus(const RawAddress& bdaddr,
+ bool connected) {
+ LOG(INFO) << __PRETTY_FUNCTION__ << ": address=" << bdaddr.ToString()
+ << ", connected=" << connected;
+ connection_handler_->SetBipClientStatus(bdaddr, connected);
+}
+
void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state,
bool queue) {
LOG(INFO) << __PRETTY_FUNCTION__ << " track_changed=" << track_changed
return true;
}
+void AvrcpService::ServiceInterfaceImpl::SetBipClientStatus(
+ const RawAddress& bdaddr, bool connected) {
+ std::lock_guard<std::mutex> lock(service_interface_lock_);
+ CHECK(instance_ != nullptr);
+ do_in_main_thread(FROM_HERE, base::Bind(&AvrcpService::SetBipClientStatus,
+ base::Unretained(instance_), bdaddr,
+ connected));
+}
+
bool AvrcpService::ServiceInterfaceImpl::Cleanup() {
std::lock_guard<std::mutex> lock(service_interface_lock_);
void ConnectDevice(const RawAddress& bdaddr);
void DisconnectDevice(const RawAddress& bdaddr);
+ void SetBipClientStatus(const RawAddress& bdaddr, bool connected);
+
// Functions inherited from MediaCallbacks in order to receive updates
void SendMediaUpdate(bool track_changed, bool play_state,
bool queue) override;
void UnregisterBipServer() override;
bool ConnectDevice(const RawAddress& bdaddr) override;
bool DisconnectDevice(const RawAddress& bdaddr) override;
+ void SetBipClientStatus(const RawAddress& bdaddr, bool connected) override;
bool Cleanup() override;
private:
avrcp13_compatibility_(avrcp13_compatibility),
send_message_cb_(send_msg_cb),
ctrl_mtu_(ctrl_mtu),
- browse_mtu_(browse_mtu) {}
+ browse_mtu_(browse_mtu),
+ has_bip_client_(false) {}
void Device::RegisterInterfaces(MediaInterface* media_interface,
A2dpInterface* a2dp_interface,
browse_mtu_ = browse_mtu;
}
+void Device::SetBipClientStatus(bool connected) {
+ DEVICE_LOG(INFO) << __PRETTY_FUNCTION__ << ": connected = " << connected;
+ has_bip_client_ = connected;
+}
+
+bool Device::HasBipClient() const {
+ return has_bip_client_;
+}
+
+void filter_cover_art(SongInfo& s) {
+ for (auto it = s.attributes.begin(); it != s.attributes.end(); it++) {
+ if (it->attribute() == Attribute::DEFAULT_COVER_ART) {
+ s.attributes.erase(it);
+ break;
+ }
+ }
+}
+
bool Device::IsActive() const {
return address_ == a2dp_interface_->active_peer();
}
void Device::GetElementAttributesResponse(
uint8_t label, std::shared_ptr<GetElementAttributesRequest> pkt,
SongInfo info) {
- DEVICE_VLOG(2) << __func__;
-
auto get_element_attributes_pkt = pkt;
auto attributes_requested =
get_element_attributes_pkt->GetAttributesRequested();
auto response = GetElementAttributesResponseBuilder::MakeBuilder(ctrl_mtu_);
+ // Filter out DEFAULT_COVER_ART handle if this device has no client
+ if (!HasBipClient()) {
+ filter_cover_art(info);
+ }
+
last_song_info_ = info;
if (attributes_requested.size() != 0) {
}
}
+ // Filter out DEFAULT_COVER_ART handle if this device has no client
+ if (!HasBipClient()) {
+ filter_cover_art(info);
+ }
+
auto attributes_requested = pkt->GetAttributesRequested();
if (attributes_requested.size() != 0) {
for (const auto& attribute : attributes_requested) {
}
}
+ // Filter out DEFAULT_COVER_ART handle if this device has no client
+ if (item_requested.type == ListItem::SONG && !HasBipClient()) {
+ filter_cover_art(item_requested.song);
+ }
+
// TODO (apanicke): Add a helper function or allow adding a map
// of attributes to GetItemAttributesResponseBuilder
auto attributes_requested = pkt->GetAttributesRequested();
if (!builder->AddFolder(folder_item)) break;
} else if (items[i].type == ListItem::SONG) {
auto song = items[i].song;
+
+ // Filter out DEFAULT_COVER_ART handle if this device has no client
+ if (!HasBipClient()) {
+ filter_cover_art(song);
+ }
+
auto title =
song.attributes.find(Attribute::TITLE) != song.attributes.end()
? song.attributes.find(Attribute::TITLE)->value()
for (size_t i = pkt->GetStartItem();
i <= pkt->GetEndItem() && i < song_list.size(); i++) {
auto song = song_list[i];
+
+ // Filter out DEFAULT_COVER_ART handle if this device has no client
+ if (!HasBipClient()) {
+ filter_cover_art(song);
+ }
+
auto title = song.attributes.find(Attribute::TITLE) != song.attributes.end()
? song.attributes.find(Attribute::TITLE)->value()
: "No Song Info";