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

Commit c6c1da3f authored by Zach Johnson's avatar Zach Johnson
Browse files

IsoPacket -> Iso, ScoPacket -> Sco

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --rhost SimpleHalTest
Change-Id: I10a058723fe42c731808d6005a9ed32c928e10c0
parent e63c7ffb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ void FuzzHciHal::injectAclData(std::vector<uint8_t> data) {
}

void FuzzHciHal::injectScoData(std::vector<uint8_t> data) {
  hci::ScoPacketView scoPacket = hci::ScoPacketView::FromBytes(data);
  hci::ScoView scoPacket = hci::ScoView::FromBytes(data);
  if (!scoPacket.IsValid()) {
    return;
  }
+4 −4
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ enum PacketStatusFlag : 2 {
  PARTIALLY_LOST = 3,
}

packet ScoPacket {
packet Sco {
  handle : 12,
  packet_status_flag : PacketStatusFlag,
  _reserved_ : 2, // BroadcastFlag
@@ -4744,7 +4744,7 @@ enum TimeStampFlag : 1 {
  PRESENT = 1,
}

packet IsoPacket {
packet Iso {
  connection_handle : 12,
  pb_flag : IsoPacketBoundaryFlag,
  ts_flag : TimeStampFlag,
@@ -4760,7 +4760,7 @@ enum IsoPacketStatusFlag : 2 {
  LOST_DATA = 2,
}

packet IsoPacketWithTimestamp : IsoPacket (ts_flag = PRESENT) {
packet IsoWithTimestamp : Iso (ts_flag = PRESENT) {
  time_stamp : 32,
  packet_sequence_number : 16,
  _size_(_payload_) : 12, // iso_sdu_length
@@ -4769,7 +4769,7 @@ packet IsoPacketWithTimestamp : IsoPacket (ts_flag = PRESENT) {
  _payload_,
}

packet IsoPacketWithoutTimestamp : IsoPacket (ts_flag = NOT_PRESENT) {
packet IsoWithoutTimestamp : Iso (ts_flag = NOT_PRESENT) {
  packet_sequence_number : 16,
  _size_(_payload_) : 12, // iso_sdu_length
  _reserved_ : 2,
+2 −2
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ void DualModeController::HandleAcl(std::shared_ptr<std::vector<uint8_t>> packet)

void DualModeController::HandleSco(std::shared_ptr<std::vector<uint8_t>> packet) {
  bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
  auto sco_packet = bluetooth::hci::ScoPacketView::Create(raw_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);
@@ -352,7 +352,7 @@ void DualModeController::HandleSco(std::shared_ptr<std::vector<uint8_t>> packet)
void DualModeController::HandleIso(
    std::shared_ptr<std::vector<uint8_t>> packet) {
  bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
  auto iso = bluetooth::hci::IsoPacketView::Create(raw_packet);
  auto iso = bluetooth::hci::IsoView::Create(raw_packet);
  link_layer_controller_.HandleIso(iso);
}

+3 −3
Original line number Diff line number Diff line
@@ -834,10 +834,10 @@ void LinkLayerController::IncomingIsoPacket(LinkLayerPacketView incoming) {
    return;
  }
  LOG_INFO("ISO packet scheduling is not implemented");
  // send_iso_(bluetooth::hci::IsoPacketWithTimestampBuilder::Create())
  // send_iso_(bluetooth::hci::IsoWithTimestampBuilder::Create())
}

void LinkLayerController::HandleIso(bluetooth::hci::IsoPacketView iso) {
void LinkLayerController::HandleIso(bluetooth::hci::IsoView iso) {
  auto cis_handle = iso.GetConnectionHandle();
  if (!connections_.HasCisHandle(cis_handle)) {
    LOG_INFO("Dropping ISO packet to unknown handle 0x%hx", cis_handle);
@@ -878,7 +878,7 @@ void LinkLayerController::HandleIso(bluetooth::hci::IsoPacketView iso) {
    payload->AddOctets1(it);
  }
  if (start_flag == model::packets::StartContinuation::START) {
    auto timestamped = bluetooth::hci::IsoPacketWithTimestampView::Create(iso);
    auto timestamped = bluetooth::hci::IsoWithTimestampView::Create(iso);
    ASSERT(timestamped.IsValid());
    uint32_t timestamp = timestamped.GetTimeStamp();
    SendLeLinkLayerPacket(model::packets::IsoStartBuilder::Create(
+2 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class LinkLayerController {
      const Address& remote);
  ErrorCode SendCommandToRemoteByHandle(
      OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle);
  ErrorCode SendScoToRemote(bluetooth::hci::ScoPacketView sco_packet);
  ErrorCode SendScoToRemote(bluetooth::hci::ScoView sco_packet);
  ErrorCode SendAclToRemote(bluetooth::hci::AclView acl_packet);

  void StartSimplePairing(const Address& address);
@@ -326,7 +326,7 @@ class LinkLayerController {
  void ReadLocalOobData();
  void ReadLocalOobExtendedData();

  void HandleIso(bluetooth::hci::IsoPacketView iso);
  void HandleIso(bluetooth::hci::IsoView iso);

 protected:
  void SendLeLinkLayerPacket(