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

Commit 7ecd747d authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Upgrade the LinkLayer in RootCanal to PDL"

parents cfb36495 b998e350
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ cc_binary {
        "-Werror",
        "-DHAS_NO_BDROID_BUILDCFG",
    ],
    generated_headers: [
        "RootCanalGeneratedPackets_h",
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
        "android.hardware.bluetooth-hci",
@@ -79,6 +82,9 @@ cc_library_shared {
        "-Werror",
        "-DHAS_NO_BDROID_BUILDCFG",
    ],
    generated_headers: [
        "RootCanalGeneratedPackets_h",
    ],
    static_libs: [
        "android.hardware.bluetooth-async",
        "android.hardware.bluetooth-hci",
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@

#include <string>

namespace bluetooth {
namespace types {

/** Bluetooth Class of Device */
class ClassOfDevice final {
 public:
@@ -52,3 +55,8 @@ inline std::ostream& operator<<(std::ostream& os, const ClassOfDevice& c) {
  os << c.ToString();
  return os;
}

}  // namespace types
}  // namespace bluetooth

using ::bluetooth::types::ClassOfDevice;  // TODO, remove
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ cc_library_static {
        "model/setup/test_channel_transport.cc",
        "model/setup/test_command_handler.cc",
        "model/setup/test_model.cc",
        ":BluetoothPacketSources",
    ],
    cflags: [
        "-fvisibility=hidden",
@@ -47,6 +48,9 @@ cc_library_static {
        "include",
        ".",
    ],
    generated_headers: [
        "RootCanalGeneratedPackets_h",
    ],
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
@@ -120,6 +124,9 @@ cc_test_host {
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
    ],
    generated_headers: [
        "RootCanalGeneratedPackets_h",
    ],
    shared_libs: [
        "liblog",
    ],
@@ -128,3 +135,17 @@ cc_test_host {
        "libbt-rootcanal",
    ],
}

genrule {
    name: "RootCanalGeneratedPackets_h",
    tools: [
        "bluetooth_packetgen",
    ],
    cmd: "$(location bluetooth_packetgen) --root_namespace=model --include=packages/modules/Bluetooth/system/vendor_libs/test_vendor_lib --out=$(genDir) $(in)",
    srcs: [
        "packets/link_layer_packets.pdl",
    ],
    out: [
        "packets/link_layer_packets.h",
    ],
}
+0 −50
Original line number Diff line number Diff line
/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

namespace test_vendor_lib {
class Link {
 public:
  static constexpr size_t kSizeBytes = sizeof(uint32_t);
  static constexpr size_t kTypeBytes = sizeof(uint8_t);

  enum class PacketType : uint8_t {
    UNKNOWN,
    ACL,
    COMMAND,
    DISCONNECT,
    ENCRYPT_CONNECTION,
    ENCRYPT_CONNECTION_RESPONSE,
    EVENT,
    INQUIRY,
    INQUIRY_RESPONSE,
    IO_CAPABILITY_REQUEST,
    IO_CAPABILITY_RESPONSE,
    IO_CAPABILITY_NEGATIVE_RESPONSE,
    LE_ADVERTISEMENT,
    LE_CONNECT,
    LE_CONNECT_COMPLETE,
    LE_SCAN,
    LE_SCAN_RESPONSE,
    PAGE,
    PAGE_RESPONSE,
    PAGE_REJECT,
    RESPONSE,
    SCO,
  };
};
}  // namespace test_vendor_lib
+4 −2
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ std::string DualModeController::GetTypeString() const {
  return "Simulated Bluetooth Controller";
}

void DualModeController::IncomingPacket(packets::LinkLayerPacketView incoming) {
void DualModeController::IncomingPacket(
    model::packets::LinkLayerPacketView incoming) {
  link_layer_controller_.IncomingPacket(incoming);
}

@@ -111,7 +112,8 @@ DualModeController::DualModeController(const std::string& properties_filename, u
  properties_.SetAddress(public_address);

  link_layer_controller_.RegisterRemoteChannel(
      [this](std::shared_ptr<packets::LinkLayerPacketBuilder> packet, Phy::Type phy_type) {
      [this](std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet,
             Phy::Type phy_type) {
        DualModeController::SendLinkLayerPacket(packet, phy_type);
      });

Loading