Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 751b84a4 authored by Chris Manton's avatar Chris Manton
Browse files

Add main/shim/helper raw builder packet creator

Bug: 166280067
Tag: #gd-refactor
Test: compile & verify basic functions working
Change-Id: Ie433896f12e1f3ec302f198415df5fd5900969c5
parent 46822757
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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<bluetooth::packet::RawBuilder> MakeUniquePacket(
    const uint8_t* data, size_t len) {
  bluetooth::packet::RawBuilder builder;
  std::vector<uint8_t> bytes(data, data + len);
  auto payload = std::make_unique<bluetooth::packet::RawBuilder>();
  payload->AddOctets(bytes);
  return payload;
}

}  // namespace bluetooth
+0 −9
Original line number Diff line number Diff line
@@ -379,15 +379,6 @@ bool bluetooth::shim::L2CA_ConnectFixedChnl(uint16_t cid,
  return bluetooth::shim::L2CA_ConnectFixedChnl(cid, rem_bda);
}

static std::unique_ptr<bluetooth::packet::RawBuilder> MakeUniquePacket(
    const uint8_t* data, size_t len) {
  bluetooth::packet::RawBuilder builder;
  std::vector<uint8_t> bytes(data, data + len);
  auto payload = std::make_unique<bluetooth::packet::RawBuilder>();
  payload->AddOctets(bytes);
  return payload;
}

uint16_t bluetooth::shim::L2CA_SendFixedChnlData(uint16_t cid,
                                                 const RawAddress& rem_bda,
                                                 BT_HDR* p_buf) {