}
}
+void Link::SetChannelTxPriority(Cid local_cid, bool high_priority) {
+ data_pipeline_manager_.SetChannelTxPriority(local_cid, high_priority);
+}
+
void Link::SetPendingDynamicChannels(std::list<Psm> psm_list,
std::list<Link::PendingDynamicChannelConnection> callback_list) {
ASSERT(psm_list.size() == callback_list.size());
virtual void SendConnectionRequest(Psm psm, Cid local_cid);
virtual void SendConnectionRequest(Psm psm, Cid local_cid,
PendingDynamicChannelConnection pending_dynamic_channel_connection);
+ void SetChannelTxPriority(Cid local_cid, bool high_priority) override;
// When a Link is established, LinkManager notifies pending dynamic channels to connect
virtual void SetPendingDynamicChannels(std::list<Psm> psm_list,
Cid DynamicChannel::HACK_GetRemoteCid() {
return impl_->GetRemoteCid();
}
+
+void DynamicChannel::HACK_SetChannelTxPriority(bool high_priority) {
+ return impl_->SetChannelTxPriority(high_priority);
+}
+
} // namespace l2cap
} // namespace bluetooth
Cid HACK_GetRemoteCid();
+ /**
+ * Used by A2dp software encoding to prioritize Tx of this channel
+ * @param high_priority
+ */
+ void HACK_SetChannelTxPriority(bool high_priority);
+
private:
std::shared_ptr<l2cap::internal::DynamicChannelImpl> impl_;
os::Handler* l2cap_handler_;
void DataPipelineManager::DetachChannel(Cid cid) {
ASSERT(sender_map_.find(cid) != sender_map_.end());
sender_map_.erase(cid);
+ scheduler_->SetChannelTxPriority(cid, false);
}
DataController* DataPipelineManager::GetDataController(Cid cid) {
sender_map_.find(cid)->second.UpdateClassicConfiguration(config);
}
+void DataPipelineManager::SetChannelTxPriority(Cid cid, bool high_priority) {
+ ASSERT(sender_map_.find(cid) != sender_map_.end());
+ scheduler_->SetChannelTxPriority(cid, high_priority);
+}
+
} // namespace internal
} // namespace l2cap
} // namespace bluetooth
virtual DataController* GetDataController(Cid cid);
virtual void OnPacketSent(Cid cid);
virtual void UpdateClassicConfiguration(Cid cid, classic::internal::ChannelConfigurationState config);
+ virtual void SetChannelTxPriority(Cid cid, bool high_priority);
virtual ~DataPipelineManager() = default;
private:
return psm_;
}
+ virtual void SetChannelTxPriority(bool high_priority) {
+ link_->SetChannelTxPriority(cid_, high_priority);
+ }
+
// TODO(cmanton) Do something a little bit better than this
bool local_initiated_{false};
virtual hci::AddressWithType GetDevice() const = 0;
// To be used by LE credit based channel data controller over LE link
- virtual void SendLeCredit(Cid local_cid, uint16_t credit) = 0;
+ virtual void SendLeCredit(Cid local_cid, uint16_t credit) {}
+
+ // Used by A2dp software encoding
+ virtual void SetChannelTxPriority(Cid local_cid, bool high_priority) {}
};
} // namespace internal
} // namespace l2cap
return channel->second->HACK_GetRemoteCid();
}
+ bool SetChannelTxPriority(uint16_t cid, bool high_priority) {
+ auto channel = channels_.find(cid);
+ if (channel == channels_.end()) {
+ LOG_ERROR("Channel is not open");
+ return false;
+ }
+ channel->second->HACK_SetChannelTxPriority(high_priority);
+ return true;
+ }
+
std::unordered_map<uint16_t, std::unique_ptr<classic::DynamicChannel>>
channels_;
std::unordered_map<uint16_t, std::unique_ptr<bluetooth::os::EnqueueBuffer<
}
bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
- LOG_INFO("UNIMPLEMENTED %s", __func__);
- return false;
+ auto psm = classic_cid_token_to_channel_map_[cid];
+ if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
+ LOG(ERROR) << __func__ << "Not registered psm: " << psm;
+ return false;
+ }
+ bool high_priority = priority == L2CAP_CHNL_PRIORITY_HIGH;
+ return classic_dynamic_channel_helper_map_[psm]->SetChannelTxPriority(
+ cid, high_priority);
}
bool L2CA_SetLeGattTimeout(const RawAddress& rem_bda, uint16_t idle_tout) {