Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +19 −5 Original line number Diff line number Diff line Loading @@ -337,7 +337,9 @@ void DualModeController::HandleSco(std::shared_ptr<std::vector<uint8_t>> packet) auto sco_packet = bluetooth::hci::ScoView::Create(raw_packet); if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) { uint16_t handle = sco_packet.GetHandle(); send_sco_(packet); auto sco_builder = bluetooth::hci::ScoBuilder::Create( handle, sco_packet.GetPacketStatusFlag(), sco_packet.GetData()); send_sco_(std::move(sco_builder)); std::vector<bluetooth::hci::CompletedPackets> completed_packets; bluetooth::hci::CompletedPackets cp; cp.connection_handle_ = handle; Loading Loading @@ -413,15 +415,27 @@ void DualModeController::RegisterAclChannel( void DualModeController::RegisterScoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& callback) { link_layer_controller_.RegisterScoChannel(callback); send_sco_ = callback; send_sco_ = [callback](std::shared_ptr<bluetooth::hci::ScoBuilder> sco_data) { auto bytes = std::make_shared<std::vector<uint8_t>>(); bluetooth::packet::BitInserter bit_inserter(*bytes); bytes->reserve(sco_data->size()); sco_data->Serialize(bit_inserter); callback(std::move(bytes)); }; link_layer_controller_.RegisterScoChannel(send_sco_); } void DualModeController::RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& callback) { link_layer_controller_.RegisterIsoChannel(callback); send_iso_ = callback; send_iso_ = [callback](std::shared_ptr<bluetooth::hci::IsoBuilder> iso_data) { auto bytes = std::make_shared<std::vector<uint8_t>>(); bluetooth::packet::BitInserter bit_inserter(*bytes); bytes->reserve(iso_data->size()); iso_data->Serialize(bit_inserter); callback(std::move(bytes)); }; link_layer_controller_.RegisterIsoChannel(send_iso_); } void DualModeController::Reset(CommandView command) { Loading system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +2 −2 Original line number Diff line number Diff line Loading @@ -562,8 +562,8 @@ class DualModeController : public Device { std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)> send_acl_; std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)> send_event_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_sco_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_iso_; std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)> send_sco_; std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)> send_iso_; // Maintains the commands to be registered and used in the HciHandler object. // Keys are command opcodes and values are the callbacks to handle each Loading system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +7 −4 Original line number Diff line number Diff line Loading @@ -852,8 +852,11 @@ void LinkLayerController::IncomingIsoPacket(LinkLayerPacketView incoming) { LOG_INFO("Dropping ISO packet to a disconnected handle 0x%hx", cis_handle); return; } LOG_INFO("ISO packet scheduling is not implemented"); // send_iso_(bluetooth::hci::IsoWithTimestampBuilder::Create()) send_iso_(bluetooth::hci::IsoBuilder::Create( cis_handle, bluetooth::hci::IsoPacketBoundaryFlag::COMPLETE_SDU, bluetooth::hci::TimeStampFlag::PRESENT, std::make_unique<bluetooth::packet::RawBuilder>(std::vector<uint8_t>( iso.GetPayload().begin(), iso.GetPayload().end())))); } void LinkLayerController::HandleIso(bluetooth::hci::IsoView iso) { Loading Loading @@ -1585,13 +1588,13 @@ void LinkLayerController::RegisterAclChannel( } void LinkLayerController::RegisterScoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)>& callback) { send_sco_ = callback; } void LinkLayerController::RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)>& callback) { send_iso_ = callback; } Loading system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h +6 −4 Original line number Diff line number Diff line Loading @@ -113,10 +113,12 @@ class LinkLayerController { const std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)>& send_acl); void RegisterScoChannel(const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& send_sco); void RegisterScoChannel( const std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)>& send_sco); void RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)>& send_iso); void RegisterRemoteChannel( Loading Loading @@ -420,8 +422,8 @@ class LinkLayerController { std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)> send_acl_; std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)> send_event_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_sco_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_iso_; std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)> send_sco_; std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)> send_iso_; // Callback to send packets to remote devices. std::function<void(std::shared_ptr<model::packets::LinkLayerPacketBuilder>, Loading system/vendor_libs/test_vendor_lib/model/devices/car_kit.cc +2 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,8 @@ CarKit::CarKit() : Device(kCarKitPropertiesFile) { [](std::shared_ptr<bluetooth::hci::AclBuilder>) {}); link_layer_controller_.RegisterEventChannel( [](std::shared_ptr<bluetooth::hci::EventBuilder>) {}); link_layer_controller_.RegisterScoChannel([](std::shared_ptr<std::vector<uint8_t>>) {}); link_layer_controller_.RegisterScoChannel( [](std::shared_ptr<bluetooth::hci::ScoBuilder>) {}); link_layer_controller_.RegisterRemoteChannel( [this](std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet, Phy::Type phy_type) { Loading Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc +19 −5 Original line number Diff line number Diff line Loading @@ -337,7 +337,9 @@ void DualModeController::HandleSco(std::shared_ptr<std::vector<uint8_t>> packet) auto sco_packet = bluetooth::hci::ScoView::Create(raw_packet); if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) { uint16_t handle = sco_packet.GetHandle(); send_sco_(packet); auto sco_builder = bluetooth::hci::ScoBuilder::Create( handle, sco_packet.GetPacketStatusFlag(), sco_packet.GetData()); send_sco_(std::move(sco_builder)); std::vector<bluetooth::hci::CompletedPackets> completed_packets; bluetooth::hci::CompletedPackets cp; cp.connection_handle_ = handle; Loading Loading @@ -413,15 +415,27 @@ void DualModeController::RegisterAclChannel( void DualModeController::RegisterScoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& callback) { link_layer_controller_.RegisterScoChannel(callback); send_sco_ = callback; send_sco_ = [callback](std::shared_ptr<bluetooth::hci::ScoBuilder> sco_data) { auto bytes = std::make_shared<std::vector<uint8_t>>(); bluetooth::packet::BitInserter bit_inserter(*bytes); bytes->reserve(sco_data->size()); sco_data->Serialize(bit_inserter); callback(std::move(bytes)); }; link_layer_controller_.RegisterScoChannel(send_sco_); } void DualModeController::RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& callback) { link_layer_controller_.RegisterIsoChannel(callback); send_iso_ = callback; send_iso_ = [callback](std::shared_ptr<bluetooth::hci::IsoBuilder> iso_data) { auto bytes = std::make_shared<std::vector<uint8_t>>(); bluetooth::packet::BitInserter bit_inserter(*bytes); bytes->reserve(iso_data->size()); iso_data->Serialize(bit_inserter); callback(std::move(bytes)); }; link_layer_controller_.RegisterIsoChannel(send_iso_); } void DualModeController::Reset(CommandView command) { Loading
system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h +2 −2 Original line number Diff line number Diff line Loading @@ -562,8 +562,8 @@ class DualModeController : public Device { std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)> send_acl_; std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)> send_event_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_sco_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_iso_; std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)> send_sco_; std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)> send_iso_; // Maintains the commands to be registered and used in the HciHandler object. // Keys are command opcodes and values are the callbacks to handle each Loading
system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc +7 −4 Original line number Diff line number Diff line Loading @@ -852,8 +852,11 @@ void LinkLayerController::IncomingIsoPacket(LinkLayerPacketView incoming) { LOG_INFO("Dropping ISO packet to a disconnected handle 0x%hx", cis_handle); return; } LOG_INFO("ISO packet scheduling is not implemented"); // send_iso_(bluetooth::hci::IsoWithTimestampBuilder::Create()) send_iso_(bluetooth::hci::IsoBuilder::Create( cis_handle, bluetooth::hci::IsoPacketBoundaryFlag::COMPLETE_SDU, bluetooth::hci::TimeStampFlag::PRESENT, std::make_unique<bluetooth::packet::RawBuilder>(std::vector<uint8_t>( iso.GetPayload().begin(), iso.GetPayload().end())))); } void LinkLayerController::HandleIso(bluetooth::hci::IsoView iso) { Loading Loading @@ -1585,13 +1588,13 @@ void LinkLayerController::RegisterAclChannel( } void LinkLayerController::RegisterScoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)>& callback) { send_sco_ = callback; } void LinkLayerController::RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)>& callback) { send_iso_ = callback; } Loading
system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h +6 −4 Original line number Diff line number Diff line Loading @@ -113,10 +113,12 @@ class LinkLayerController { const std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)>& send_acl); void RegisterScoChannel(const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& send_sco); void RegisterScoChannel( const std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)>& send_sco); void RegisterIsoChannel( const std::function<void(std::shared_ptr<std::vector<uint8_t>>)>& const std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)>& send_iso); void RegisterRemoteChannel( Loading Loading @@ -420,8 +422,8 @@ class LinkLayerController { std::function<void(std::shared_ptr<bluetooth::hci::AclBuilder>)> send_acl_; std::function<void(std::shared_ptr<bluetooth::hci::EventBuilder>)> send_event_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_sco_; std::function<void(std::shared_ptr<std::vector<uint8_t>>)> send_iso_; std::function<void(std::shared_ptr<bluetooth::hci::ScoBuilder>)> send_sco_; std::function<void(std::shared_ptr<bluetooth::hci::IsoBuilder>)> send_iso_; // Callback to send packets to remote devices. std::function<void(std::shared_ptr<model::packets::LinkLayerPacketBuilder>, Loading
system/vendor_libs/test_vendor_lib/model/devices/car_kit.cc +2 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,8 @@ CarKit::CarKit() : Device(kCarKitPropertiesFile) { [](std::shared_ptr<bluetooth::hci::AclBuilder>) {}); link_layer_controller_.RegisterEventChannel( [](std::shared_ptr<bluetooth::hci::EventBuilder>) {}); link_layer_controller_.RegisterScoChannel([](std::shared_ptr<std::vector<uint8_t>>) {}); link_layer_controller_.RegisterScoChannel( [](std::shared_ptr<bluetooth::hci::ScoBuilder>) {}); link_layer_controller_.RegisterRemoteChannel( [this](std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet, Phy::Type phy_type) { Loading