From 35d65fb0287c54e696a06692aef85b22827f571d Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Tue, 25 Aug 2020 10:24:14 -0700 Subject: [PATCH] Add main/shim/helper raw builder packet creator Bug: 166280067 Tag: #gd-refactor Test: compile & verify basic functions working Change-Id: Ie433896f12e1f3ec302f198415df5fd5900969c5 --- main/shim/helpers.h | 11 +++++++++++ main/shim/l2c_api.cc | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/main/shim/helpers.h b/main/shim/helpers.h index a2fa33fab..98811600f 100644 --- a/main/shim/helpers.h +++ b/main/shim/helpers.h @@ -17,6 +17,7 @@ #include "hci/address_with_type.h" +#include "gd/packet/raw_builder.h" #include "stack/include/bt_types.h" namespace bluetooth { @@ -64,4 +65,14 @@ inline hci::AddressWithType ToAddressWithType(const RawAddress& legacy_address, return hci::AddressWithType{address, type}; } + +inline std::unique_ptr MakeUniquePacket( + const uint8_t* data, size_t len) { + bluetooth::packet::RawBuilder builder; + std::vector bytes(data, data + len); + auto payload = std::make_unique(); + payload->AddOctets(bytes); + return payload; +} + } // namespace bluetooth diff --git a/main/shim/l2c_api.cc b/main/shim/l2c_api.cc index 459756172..73dfb91be 100644 --- a/main/shim/l2c_api.cc +++ b/main/shim/l2c_api.cc @@ -379,15 +379,6 @@ bool bluetooth::shim::L2CA_ConnectFixedChnl(uint16_t cid, return bluetooth::shim::L2CA_ConnectFixedChnl(cid, rem_bda); } -static std::unique_ptr MakeUniquePacket( - const uint8_t* data, size_t len) { - bluetooth::packet::RawBuilder builder; - std::vector bytes(data, data + len); - auto payload = std::make_unique(); - payload->AddOctets(bytes); - return payload; -} - uint16_t bluetooth::shim::L2CA_SendFixedChnlData(uint16_t cid, const RawAddress& rem_bda, BT_HDR* p_buf) { -- 2.11.0