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

Commit 1b584540 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Ifc9c95d0,I0145e752,I7076dd5c,I55b07770

* changes:
  Add ISO connection request and response
  RootCanal: Remove acl namespace
  RootCanal: Remove hci namespace
  HCI: Change CIS phy type parameters
parents f8b89222 d0e8ab6a
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3380,8 +3380,14 @@ struct CisParametersConfig {
  _reserved_ : 4,
  max_sdu_s_to_m : 12,
  _reserved_ : 4,
  phy_m_to_s : SecondaryPhyType,
  phy_s_to_m : SecondaryPhyType,
  phy_m_to_s_1_m : 1,
  phy_m_to_s_2_m : 1,
  phy_m_to_s_coded : 1,
  _reserved_ : 5,
  phy_s_to_m_1_m : 1,
  phy_s_to_m_2_m : 1,
  phy_s_to_m_coded : 1,
  _reserved_ : 5,
  rtn_m_to_s : 4,
  _reserved_ : 4,
  rtn_s_to_m : 4,
+0 −42
Original line number Diff line number Diff line
/*
 * Copyright 2017 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

#include <cstdint>

namespace test_vendor_lib {
namespace acl {

// ACL data packets are specified in the Bluetooth Core Specification Version
// 4.2, Volume 2, Part E, Section 5.4.2
static constexpr uint16_t kReservedHandle = 0xF00;

enum class PacketBoundaryFlagsType : uint8_t {
  FIRST_NON_AUTOMATICALLY_FLUSHABLE = 0,
  CONTINUING = 1,
  FIRST_AUTOMATICALLY_FLUSHABLE = 2,
  COMPLETE = 3
};

enum class BroadcastFlagsType : uint8_t {
  POINT_TO_POINT = 0,
  ACTIVE_SLAVE_BROADCAST = 1,
  PARKED_SLAVE_BROADCAST = 2,
  RESERVED = 3
};
}  // namespace acl
}  // namespace test_vendor_lib
+0 −33
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
#include <cstdint>

namespace test_vendor_lib {
namespace hci {

enum class PacketType : uint8_t {
  UNKNOWN = 0,
  COMMAND = 1,
  ACL = 2,
  SCO = 3,
  EVENT = 4,
  ISO = 5,
};

}  // namespace hci
}  // namespace test_vendor_lib
+8 −11
Original line number Diff line number Diff line
@@ -29,18 +29,15 @@ using ::bluetooth::hci::AddressType;
using ::bluetooth::hci::AddressWithType;

bool AclConnectionHandler::HasHandle(uint16_t handle) const {
  if (acl_connections_.count(handle) == 0) {
    return false;
  }
  return true;
  return acl_connections_.count(handle) != 0;
}

uint16_t AclConnectionHandler::GetUnusedHandle() {
  while (acl_connections_.count(last_handle_) == 1) {
    last_handle_ = (last_handle_ + 1) % acl::kReservedHandle;
  while (HasHandle(last_handle_)) {
    last_handle_ = (last_handle_ + 1) % kReservedHandle;
  }
  uint16_t unused_handle = last_handle_;
  last_handle_ = (last_handle_ + 1) % acl::kReservedHandle;
  last_handle_ = (last_handle_ + 1) % kReservedHandle;
  return unused_handle;
}

@@ -119,7 +116,7 @@ uint16_t AclConnectionHandler::CreateConnection(Address addr,
            Phy::Type::BR_EDR});
    return handle;
  }
  return acl::kReservedHandle;
  return kReservedHandle;
}

uint16_t AclConnectionHandler::CreateLeConnection(AddressWithType addr,
@@ -130,7 +127,7 @@ uint16_t AclConnectionHandler::CreateLeConnection(AddressWithType addr,
        handle, AclConnection{addr, own_addr, Phy::Type::LOW_ENERGY});
    return handle;
  }
  return acl::kReservedHandle;
  return kReservedHandle;
}

bool AclConnectionHandler::Disconnect(uint16_t handle) {
@@ -143,7 +140,7 @@ uint16_t AclConnectionHandler::GetHandle(AddressWithType addr) const {
      return std::get<0>(pair);
    }
  }
  return acl::kReservedHandle;
  return kReservedHandle;
}

uint16_t AclConnectionHandler::GetHandleOnlyAddress(
@@ -153,7 +150,7 @@ uint16_t AclConnectionHandler::GetHandleOnlyAddress(
      return std::get<0>(pair);
    }
  }
  return acl::kReservedHandle;
  return kReservedHandle;
}

AddressWithType AclConnectionHandler::GetAddress(uint16_t handle) const {
+2 −2
Original line number Diff line number Diff line
@@ -23,10 +23,10 @@
#include "acl_connection.h"
#include "hci/address.h"
#include "hci/address_with_type.h"
#include "include/acl.h"
#include "phy.h"

namespace test_vendor_lib {
static constexpr uint16_t kReservedHandle = 0xF00;

class AclConnectionHandler {
 public:
@@ -75,7 +75,7 @@ class AclConnectionHandler {
      bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS};

  uint16_t GetUnusedHandle();
  uint16_t last_handle_{acl::kReservedHandle - 2};
  uint16_t last_handle_{kReservedHandle - 2};
};

}  // namespace test_vendor_lib
Loading