RootCanal: Remove HciPacketBuilder and CommandPacketBuilder am: 676cefe5e7
am: c88020716a
Change-Id: I6c518146417931fff6e7f3dc5db3529f50542d3a
diff --git a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
index 75b87b0..f84e514 100644
--- a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
+++ b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
@@ -26,8 +26,6 @@
#include "packet/raw_builder.h"
#include "hci.h"
-#include "packets/hci/command_packet_view.h"
-#include "packets/packet_view.h"
using std::vector;
using test_vendor_lib::hci::EventCode;
@@ -35,7 +33,7 @@
namespace {
-size_t LastNonZero(test_vendor_lib::packets::PacketView<true> view) {
+size_t LastNonZero(bluetooth::packet::PacketView<true> view) {
for (size_t i = view.size() - 1; i > 0; i--) {
if (view[i] != 0) {
return i;
@@ -103,8 +101,9 @@
DualModeController::SendLinkLayerPacket(packet, phy_type);
});
-#define SET_HANDLER(opcode, method) \
- active_hci_commands_[static_cast<uint16_t>(opcode)] = [this](packets::PacketView<true> param) { method(param); };
+#define SET_HANDLER(opcode, method) \
+ active_hci_commands_[static_cast<uint16_t>(opcode)] = \
+ [this](bluetooth::packet::PacketView<true> param) { method(param); };
SET_HANDLER(OpCode::RESET, HciReset);
SET_HANDLER(OpCode::READ_BUFFER_SIZE, HciReadBufferSize);
SET_HANDLER(OpCode::HOST_BUFFER_SIZE, HciHostBufferSize);
@@ -207,7 +206,8 @@
#undef SET_HANDLER
}
-void DualModeController::HciSniffSubrating(packets::PacketView<true> args) {
+void DualModeController::HciSniffSubrating(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -277,15 +277,21 @@
}
void DualModeController::HandleCommand(std::shared_ptr<std::vector<uint8_t>> packet) {
- auto command_packet = packets::CommandPacketView::Create(packet);
- uint16_t opcode = command_packet.GetOpcode();
- hci::OpCode op = static_cast<hci::OpCode>(opcode);
+ bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
+ auto command_packet = bluetooth::hci::CommandPacketView::Create(raw_packet);
+ ASSERT(command_packet.IsValid());
+ auto op = command_packet.GetOpCode();
+ uint16_t opcode = static_cast<uint16_t>(op);
if (loopback_mode_ == hci::LoopbackMode::LOCAL &&
// Loopback exceptions.
- op != OpCode::RESET && op != OpCode::SET_CONTROLLER_TO_HOST_FLOW_CONTROL && op != OpCode::HOST_BUFFER_SIZE &&
- op != OpCode::HOST_NUM_COMPLETED_PACKETS && op != OpCode::READ_BUFFER_SIZE && op != OpCode::READ_LOOPBACK_MODE &&
- op != OpCode::WRITE_LOOPBACK_MODE) {
+ op != bluetooth::hci::OpCode::RESET &&
+ op != bluetooth::hci::OpCode::SET_CONTROLLER_TO_HOST_FLOW_CONTROL &&
+ op != bluetooth::hci::OpCode::HOST_BUFFER_SIZE &&
+ op != bluetooth::hci::OpCode::HOST_NUM_COMPLETED_PACKETS &&
+ op != bluetooth::hci::OpCode::READ_BUFFER_SIZE &&
+ op != bluetooth::hci::OpCode::READ_LOOPBACK_MODE &&
+ op != bluetooth::hci::OpCode::WRITE_LOOPBACK_MODE) {
std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
std::make_unique<bluetooth::packet::RawBuilder>();
raw_builder_ptr->AddOctets(*packet);
@@ -340,7 +346,7 @@
send_iso_ = callback;
}
-void DualModeController::HciReset(packets::PacketView<true> args) {
+void DualModeController::HciReset(bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.Reset();
if (loopback_mode_ == hci::LoopbackMode::LOCAL) {
@@ -351,7 +357,8 @@
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS));
}
-void DualModeController::HciReadBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciReadBufferSize(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadBufferSizeCompleteBuilder::Create(
@@ -364,7 +371,7 @@
}
void DualModeController::HciReadEncryptionKeySize(
- packets::PacketView<true> args) {
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -375,14 +382,16 @@
send_event_(std::move(packet));
}
-void DualModeController::HciHostBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciHostBufferSize(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::HostBufferSizeCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalVersionInformation(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalVersionInformation(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
bluetooth::hci::LocalVersionInformation local_version_information;
@@ -401,7 +410,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadRemoteVersionInformation(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteVersionInformation(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -415,7 +425,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadBdAddr(packets::PacketView<true> args) {
+void DualModeController::HciReadBdAddr(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadBdAddrCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -423,7 +434,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedCommands(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCommands(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
std::array<uint8_t, 64> supported_commands;
@@ -442,7 +454,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::ReadLocalSupportedFeaturesCompleteBuilder::Create(
@@ -451,7 +464,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedCodecs(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCodecs(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadLocalSupportedCodecsCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -459,7 +473,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalExtendedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalExtendedFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
uint8_t page_number = args.begin().extract<uint8_t>();
@@ -471,7 +486,8 @@
send_event_(std::move(pakcet));
}
-void DualModeController::HciReadRemoteExtendedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteExtendedFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -484,7 +500,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSwitchRole(packets::PacketView<true> args) {
+void DualModeController::HciSwitchRole(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
Address address = args.begin().extract<Address>();
@@ -497,7 +514,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadRemoteSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteSupportedFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -511,7 +529,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadClockOffset(packets::PacketView<true> args) {
+void DualModeController::HciReadClockOffset(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -524,7 +543,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciIoCapabilityRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciIoCapabilityRequestReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 9, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -541,7 +561,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciUserConfirmationRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciUserConfirmationRequestReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -554,7 +575,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciUserConfirmationRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciUserConfirmationRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -568,7 +590,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciUserPasskeyRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciUserPasskeyRequestReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 10, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -583,7 +606,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciUserPasskeyRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciUserPasskeyRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -596,7 +620,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRemoteOobDataRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciRemoteOobDataRequestReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 38, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -617,7 +642,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRemoteOobDataRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciRemoteOobDataRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -630,7 +656,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciIoCapabilityRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciIoCapabilityRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -646,7 +673,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteSimplePairingMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteSimplePairingMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
ASSERT(args[0] == 1 || args[0] == 0);
link_layer_controller_.WriteSimplePairingMode(args[0] == 1);
@@ -655,7 +683,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciChangeConnectionPacketType(packets::PacketView<true> args) {
+void DualModeController::HciChangeConnectionPacketType(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -669,7 +698,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLeHostSupport(packets::PacketView<true> args) {
+void DualModeController::HciWriteLeHostSupport(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WriteLeHostSupportCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
@@ -677,7 +707,7 @@
}
void DualModeController::HciWriteSecureConnectionsHostSupport(
- packets::PacketView<true> args) {
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
properties_.SetExtendedFeatures(properties_.GetExtendedFeatures(1) | 0x8, 1);
auto packet =
@@ -686,14 +716,16 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSetEventMask(packets::PacketView<true> args) {
+void DualModeController::HciSetEventMask(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::SetEventMaskCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetInquiryMode(args[0]);
auto packet = bluetooth::hci::WriteInquiryModeCompleteBuilder::Create(
@@ -701,21 +733,24 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWritePageScanType(packets::PacketView<true> args) {
+void DualModeController::HciWritePageScanType(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WritePageScanTypeCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryScanType(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanType(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WriteInquiryScanTypeCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciAuthenticationRequested(packets::PacketView<true> args) {
+void DualModeController::HciAuthenticationRequested(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
auto status = link_layer_controller_.AuthenticationRequested(handle);
@@ -725,7 +760,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSetConnectionEncryption(packets::PacketView<true> args) {
+void DualModeController::HciSetConnectionEncryption(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -738,7 +774,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciChangeConnectionLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciChangeConnectionLinkKey(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -750,7 +787,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciMasterLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciMasterLinkKey(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint8_t key_flag = args_itr.extract<uint8_t>();
@@ -762,7 +800,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteAuthenticationEnable(packets::PacketView<true> args) {
+void DualModeController::HciWriteAuthenticationEnable(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
properties_.SetAuthenticationEnable(args[0]);
auto packet =
@@ -771,7 +810,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadAuthenticationEnable(packets::PacketView<true> args) {
+void DualModeController::HciReadAuthenticationEnable(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadAuthenticationEnableCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -780,7 +820,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteClassOfDevice(packets::PacketView<true> args) {
+void DualModeController::HciWriteClassOfDevice(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
properties_.SetClassOfDevice(args[0], args[1], args[2]);
auto packet = bluetooth::hci::WriteClassOfDeviceCompleteBuilder::Create(
@@ -788,14 +829,15 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWritePageTimeout(packets::PacketView<true> args) {
+void DualModeController::HciWritePageTimeout(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WritePageTimeoutCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciHoldMode(packets::PacketView<true> args) {
+void DualModeController::HciHoldMode(bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -810,7 +852,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSniffMode(packets::PacketView<true> args) {
+void DualModeController::HciSniffMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 10, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -828,7 +871,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciExitSniffMode(packets::PacketView<true> args) {
+void DualModeController::HciExitSniffMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -840,7 +884,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciQosSetup(packets::PacketView<true> args) {
+void DualModeController::HciQosSetup(bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 20, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -860,7 +904,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteDefaultLinkPolicySettings(packets::PacketView<true> args) {
+void DualModeController::HciWriteDefaultLinkPolicySettings(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::WriteDefaultLinkPolicySettingsCompleteBuilder::Create(
@@ -868,7 +913,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciFlowSpecification(packets::PacketView<true> args) {
+void DualModeController::HciFlowSpecification(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 21, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -889,7 +935,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLinkPolicySettings(packets::PacketView<true> args) {
+void DualModeController::HciWriteLinkPolicySettings(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -904,7 +951,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLinkSupervisionTimeout(packets::PacketView<true> args) {
+void DualModeController::HciWriteLinkSupervisionTimeout(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -919,7 +967,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalName(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalName(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
std::array<uint8_t, 248> local_name;
@@ -935,7 +984,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLocalName(packets::PacketView<true> args) {
+void DualModeController::HciWriteLocalName(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 248, "%s size=%zu", __func__, args.size());
std::vector<uint8_t> clipped(args.begin(), args.begin() + LastNonZero(args) + 1);
properties_.SetName(clipped);
@@ -944,7 +994,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteExtendedInquiryResponse(packets::PacketView<true> args) {
+void DualModeController::HciWriteExtendedInquiryResponse(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 241, "%s size=%zu", __func__, args.size());
// Strip FEC byte and trailing zeros
std::vector<uint8_t> clipped(args.begin() + 1, args.begin() + LastNonZero(args) + 1);
@@ -955,7 +1006,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRefreshEncryptionKey(packets::PacketView<true> args) {
+void DualModeController::HciRefreshEncryptionKey(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
uint16_t handle = args_itr.extract<uint16_t>();
@@ -970,14 +1022,16 @@
send_event_(std::move(complete_packet));
}
-void DualModeController::HciWriteVoiceSetting(packets::PacketView<true> args) {
+void DualModeController::HciWriteVoiceSetting(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WriteVoiceSettingCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteCurrentIacLap(packets::PacketView<true> args) {
+void DualModeController::HciWriteCurrentIacLap(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
ASSERT(args.size() == 1 + (3 * args[0])); // count + 3-byte IACs
auto packet = bluetooth::hci::WriteCurrentIacLapCompleteBuilder::Create(
@@ -985,14 +1039,16 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryScanActivity(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanActivity(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::WriteInquiryScanActivityCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteScanEnable(packets::PacketView<true> args) {
+void DualModeController::HciWriteScanEnable(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetInquiryScanEnable(args[0] & 0x1);
link_layer_controller_.SetPageScanEnable(args[0] & 0x2);
@@ -1001,14 +1057,15 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSetEventFilter(packets::PacketView<true> args) {
+void DualModeController::HciSetEventFilter(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
auto packet = bluetooth::hci::SetEventFilterCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciInquiry(packets::PacketView<true> args) {
+void DualModeController::HciInquiry(bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 5, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetInquiryLAP(args[0] | (args[1], 8) | (args[2], 16));
link_layer_controller_.SetInquiryMaxResponses(args[4]);
@@ -1019,7 +1076,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciInquiryCancel(packets::PacketView<true> args) {
+void DualModeController::HciInquiryCancel(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.InquiryCancel();
auto packet = bluetooth::hci::InquiryCancelCompleteBuilder::Create(
@@ -1027,7 +1085,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciAcceptConnectionRequest(packets::PacketView<true> args) {
+void DualModeController::HciAcceptConnectionRequest(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
Address addr = args.begin().extract<Address>();
bool try_role_switch = args[6] == 0;
@@ -1038,7 +1097,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRejectConnectionRequest(packets::PacketView<true> args) {
+void DualModeController::HciRejectConnectionRequest(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
Address addr = args_itr.extract<Address>();
@@ -1049,7 +1109,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLinkKeyRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 22, "%s size=%zu", __func__, args.size());
auto args_it = args.begin();
Address addr = args_it.extract<Address>();
@@ -1060,7 +1121,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLinkKeyRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address addr = args.begin().extract<Address>();
auto status = link_layer_controller_.LinkKeyRequestNegativeReply(addr);
@@ -1070,7 +1132,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciDeleteStoredLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciDeleteStoredLinkKey(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
uint16_t deleted_keys = 0;
@@ -1090,7 +1153,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRemoteNameRequest(packets::PacketView<true> args) {
+void DualModeController::HciRemoteNameRequest(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 10, "%s size=%zu", __func__, args.size());
Address remote_addr = args.begin().extract<Address>();
@@ -1103,7 +1167,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetEventMask(packets::PacketView<true> args) {
+void DualModeController::HciLeSetEventMask(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
/*
uint64_t mask = args.begin().extract<uint64_t>();
@@ -1114,7 +1179,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciLeReadBufferSize(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
bluetooth::hci::LeBufferSize le_buffer_size;
@@ -1126,7 +1192,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadLocalSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciLeReadLocalSupportedFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::LeReadLocalSupportedFeaturesCompleteBuilder::Create(
@@ -1135,7 +1202,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetRandomAddress(packets::PacketView<true> args) {
+void DualModeController::HciLeSetRandomAddress(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
properties_.SetLeAddress(args.begin().extract<Address>());
auto packet = bluetooth::hci::LeSetRandomAddressCompleteBuilder::Create(
@@ -1143,7 +1211,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingParameters(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingParameters(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 15, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
properties_.SetLeAdvertisingParameters(
@@ -1160,7 +1229,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingData(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingData(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 32, "%s size=%zu", __func__, args.size());
properties_.SetLeAdvertisement(std::vector<uint8_t>(args.begin() + 1, args.end()));
auto packet = bluetooth::hci::LeSetAdvertisingDataCompleteBuilder::Create(
@@ -1168,7 +1238,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanResponseData(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanResponseData(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 32, "%s size=%zu", __func__, args.size());
properties_.SetLeScanResponse(std::vector<uint8_t>(args.begin() + 1, args.end()));
auto packet = bluetooth::hci::LeSetScanResponseDataCompleteBuilder::Create(
@@ -1176,7 +1247,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingEnable(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingEnable(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
auto status = link_layer_controller_.SetLeAdvertisingEnable(
args.begin().extract<uint8_t>());
@@ -1185,7 +1257,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanParameters(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanParameters(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetLeScanType(args[0]);
link_layer_controller_.SetLeScanInterval(args[1] | (args[2], 8));
@@ -1197,7 +1270,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanEnable(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanEnable(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetLeScanEnable(args[0]);
link_layer_controller_.SetLeFilterDuplicates(args[1]);
@@ -1206,7 +1280,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeCreateConnection(packets::PacketView<true> args) {
+void DualModeController::HciLeCreateConnection(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 25, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
link_layer_controller_.SetLeScanInterval(args_itr.extract<uint16_t>());
@@ -1235,7 +1310,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeConnectionUpdate(packets::PacketView<true> args) {
+void DualModeController::HciLeConnectionUpdate(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 14, "%s size=%zu", __func__, args.size());
auto status_packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
@@ -1249,7 +1325,8 @@
send_event_(std::move(complete_packet));
}
-void DualModeController::HciCreateConnection(packets::PacketView<true> args) {
+void DualModeController::HciCreateConnection(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 13, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1267,7 +1344,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciDisconnect(packets::PacketView<true> args) {
+void DualModeController::HciDisconnect(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1281,7 +1359,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeConnectionCancel(packets::PacketView<true> args) {
+void DualModeController::HciLeConnectionCancel(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.SetLeConnect(false);
auto packet = bluetooth::hci::LeCreateConnectionCancelStatusBuilder::Create(
@@ -1295,7 +1374,8 @@
*/
}
-void DualModeController::HciLeReadWhiteListSize(packets::PacketView<true> args) {
+void DualModeController::HciLeReadWhiteListSize(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::LeReadWhiteListSizeCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -1303,7 +1383,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeClearWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeClearWhiteList(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.LeWhiteListClear();
auto packet = bluetooth::hci::LeClearWhiteListCompleteBuilder::Create(
@@ -1311,7 +1392,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeAddDeviceToWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeAddDeviceToWhiteList(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
if (link_layer_controller_.LeWhiteListFull()) {
@@ -1330,7 +1412,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeRemoveDeviceFromWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeRemoveDeviceFromWhiteList(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1344,7 +1427,7 @@
}
void DualModeController::HciLeClearResolvingList(
- packets::PacketView<true> args) {
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.LeResolvingListClear();
auto packet = bluetooth::hci::LeClearResolvingListCompleteBuilder::Create(
@@ -1353,7 +1436,7 @@
}
void DualModeController::HciLeAddDeviceToResolvingList(
- packets::PacketView<true> args) {
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 39, "%s size=%zu", __func__, args.size());
if (link_layer_controller_.LeResolvingListFull()) {
@@ -1388,7 +1471,7 @@
}
void DualModeController::HciLeRemoveDeviceFromResolvingList(
- packets::PacketView<true> args) {
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1401,7 +1484,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetPrivacyMode(packets::PacketView<true> args) {
+void DualModeController::HciLeSetPrivacyMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1420,7 +1504,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadRemoteFeatures(packets::PacketView<true> args) {
+void DualModeController::HciLeReadRemoteFeatures(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
@@ -1433,7 +1518,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeRand(packets::PacketView<true> args) {
+void DualModeController::HciLeRand(bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
uint64_t random_val = 0;
for (size_t rand_bytes = 0; rand_bytes < sizeof(uint64_t); rand_bytes += sizeof(RAND_MAX)) {
@@ -1445,7 +1530,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadSupportedStates(packets::PacketView<true> args) {
+void DualModeController::HciLeReadSupportedStates(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::LeReadSupportedStatesCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -1453,7 +1539,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeVendorCap(packets::PacketView<true> args) {
+void DualModeController::HciLeVendorCap(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
vector<uint8_t> caps = properties_.GetLeVendorCap();
if (caps.size() == 0) {
@@ -1474,31 +1561,36 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeVendorMultiAdv(packets::PacketView<true> args) {
+void DualModeController::HciLeVendorMultiAdv(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
static_cast<uint16_t>(bluetooth::hci::OpCode::LE_MULTI_ADVT));
}
-void DualModeController::HciLeAdvertisingFilter(packets::PacketView<true> args) {
+void DualModeController::HciLeAdvertisingFilter(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ADV_FILTER));
}
-void DualModeController::HciLeEnergyInfo(packets::PacketView<true> args) {
+void DualModeController::HciLeEnergyInfo(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ENERGY_INFO));
}
-void DualModeController::HciLeExtendedScanParams(packets::PacketView<true> args) {
+void DualModeController::HciLeExtendedScanParams(
+ bluetooth::packet::PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
static_cast<uint16_t>(bluetooth::hci::OpCode::LE_EXTENDED_SCAN_PARAMS));
}
-void DualModeController::HciLeStartEncryption(packets::PacketView<true> args) {
+void DualModeController::HciLeStartEncryption(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 28, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1571,7 +1663,8 @@
#endif
}
-void DualModeController::HciReadLoopbackMode(packets::PacketView<true> args) {
+void DualModeController::HciReadLoopbackMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadLoopbackModeCompleteBuilder::Create(
kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
@@ -1579,7 +1672,8 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLoopbackMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteLoopbackMode(
+ bluetooth::packet::PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
loopback_mode_ = static_cast<hci::LoopbackMode>(args[0]);
// ACL channel
diff --git a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
index bd9c17d..53c1a56 100644
--- a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
+++ b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
@@ -106,315 +106,326 @@
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.1
// 7.1.1
- void HciInquiry(packets::PacketView<true> args);
+ void HciInquiry(bluetooth::packet::PacketView<true> args);
// 7.1.2
- void HciInquiryCancel(packets::PacketView<true> args);
+ void HciInquiryCancel(bluetooth::packet::PacketView<true> args);
// 7.1.5
- void HciCreateConnection(packets::PacketView<true> args);
+ void HciCreateConnection(bluetooth::packet::PacketView<true> args);
// 7.1.6
- void HciDisconnect(packets::PacketView<true> args);
+ void HciDisconnect(bluetooth::packet::PacketView<true> args);
// 7.1.8
- void HciAcceptConnectionRequest(packets::PacketView<true> args);
+ void HciAcceptConnectionRequest(bluetooth::packet::PacketView<true> args);
// 7.1.9
- void HciRejectConnectionRequest(packets::PacketView<true> args);
+ void HciRejectConnectionRequest(bluetooth::packet::PacketView<true> args);
// 7.1.10
- void HciLinkKeyRequestReply(packets::PacketView<true> args);
+ void HciLinkKeyRequestReply(bluetooth::packet::PacketView<true> args);
// 7.1.11
- void HciLinkKeyRequestNegativeReply(packets::PacketView<true> args);
+ void HciLinkKeyRequestNegativeReply(bluetooth::packet::PacketView<true> args);
// 7.1.14
- void HciChangeConnectionPacketType(packets::PacketView<true> args);
+ void HciChangeConnectionPacketType(bluetooth::packet::PacketView<true> args);
// 7.1.15
- void HciAuthenticationRequested(packets::PacketView<true> args);
+ void HciAuthenticationRequested(bluetooth::packet::PacketView<true> args);
// 7.1.16
- void HciSetConnectionEncryption(packets::PacketView<true> args);
+ void HciSetConnectionEncryption(bluetooth::packet::PacketView<true> args);
// 7.1.17
- void HciChangeConnectionLinkKey(packets::PacketView<true> args);
+ void HciChangeConnectionLinkKey(bluetooth::packet::PacketView<true> args);
// 7.1.18
- void HciMasterLinkKey(packets::PacketView<true> args);
+ void HciMasterLinkKey(bluetooth::packet::PacketView<true> args);
// 7.1.19
- void HciRemoteNameRequest(packets::PacketView<true> args);
+ void HciRemoteNameRequest(bluetooth::packet::PacketView<true> args);
// 7.2.8
- void HciSwitchRole(packets::PacketView<true> args);
+ void HciSwitchRole(bluetooth::packet::PacketView<true> args);
// 7.1.21
- void HciReadRemoteSupportedFeatures(packets::PacketView<true> args);
+ void HciReadRemoteSupportedFeatures(bluetooth::packet::PacketView<true> args);
// 7.1.22
- void HciReadRemoteExtendedFeatures(packets::PacketView<true> args);
+ void HciReadRemoteExtendedFeatures(bluetooth::packet::PacketView<true> args);
// 7.1.23
- void HciReadRemoteVersionInformation(packets::PacketView<true> args);
+ void HciReadRemoteVersionInformation(
+ bluetooth::packet::PacketView<true> args);
// 7.1.24
- void HciReadClockOffset(packets::PacketView<true> args);
+ void HciReadClockOffset(bluetooth::packet::PacketView<true> args);
// 7.1.29
- void HciIoCapabilityRequestReply(packets::PacketView<true> args);
+ void HciIoCapabilityRequestReply(bluetooth::packet::PacketView<true> args);
// 7.1.30
- void HciUserConfirmationRequestReply(packets::PacketView<true> args);
+ void HciUserConfirmationRequestReply(
+ bluetooth::packet::PacketView<true> args);
// 7.1.31
- void HciUserConfirmationRequestNegativeReply(packets::PacketView<true> args);
+ void HciUserConfirmationRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args);
// 7.1.32
- void HciUserPasskeyRequestReply(packets::PacketView<true> args);
+ void HciUserPasskeyRequestReply(bluetooth::packet::PacketView<true> args);
// 7.1.33
- void HciUserPasskeyRequestNegativeReply(packets::PacketView<true> args);
+ void HciUserPasskeyRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args);
// 7.1.34
- void HciRemoteOobDataRequestReply(packets::PacketView<true> args);
+ void HciRemoteOobDataRequestReply(bluetooth::packet::PacketView<true> args);
// 7.1.35
- void HciRemoteOobDataRequestNegativeReply(packets::PacketView<true> args);
+ void HciRemoteOobDataRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args);
// 7.1.36
- void HciIoCapabilityRequestNegativeReply(packets::PacketView<true> args);
+ void HciIoCapabilityRequestNegativeReply(
+ bluetooth::packet::PacketView<true> args);
// Link Policy Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.2
// 7.2.1
- void HciHoldMode(packets::PacketView<true> args);
+ void HciHoldMode(bluetooth::packet::PacketView<true> args);
// 7.2.2
- void HciSniffMode(packets::PacketView<true> args);
+ void HciSniffMode(bluetooth::packet::PacketView<true> args);
// 7.2.3
- void HciExitSniffMode(packets::PacketView<true> args);
+ void HciExitSniffMode(bluetooth::packet::PacketView<true> args);
// 7.2.6
- void HciQosSetup(packets::PacketView<true> args);
+ void HciQosSetup(bluetooth::packet::PacketView<true> args);
// 7.2.10
- void HciWriteLinkPolicySettings(packets::PacketView<true> args);
+ void HciWriteLinkPolicySettings(bluetooth::packet::PacketView<true> args);
// 7.2.12
- void HciWriteDefaultLinkPolicySettings(packets::PacketView<true> args);
+ void HciWriteDefaultLinkPolicySettings(
+ bluetooth::packet::PacketView<true> args);
// 7.2.13
- void HciFlowSpecification(packets::PacketView<true> args);
+ void HciFlowSpecification(bluetooth::packet::PacketView<true> args);
// 7.2.14
- void HciSniffSubrating(packets::PacketView<true> args);
+ void HciSniffSubrating(bluetooth::packet::PacketView<true> args);
// Link Controller Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.3
// 7.3.1
- void HciSetEventMask(packets::PacketView<true> args);
+ void HciSetEventMask(bluetooth::packet::PacketView<true> args);
// 7.3.2
- void HciReset(packets::PacketView<true> args);
+ void HciReset(bluetooth::packet::PacketView<true> args);
// 7.3.3
- void HciSetEventFilter(packets::PacketView<true> args);
+ void HciSetEventFilter(bluetooth::packet::PacketView<true> args);
// 7.3.10
- void HciDeleteStoredLinkKey(packets::PacketView<true> args);
+ void HciDeleteStoredLinkKey(bluetooth::packet::PacketView<true> args);
// 7.3.11
- void HciWriteLocalName(packets::PacketView<true> args);
+ void HciWriteLocalName(bluetooth::packet::PacketView<true> args);
// 7.3.12
- void HciReadLocalName(packets::PacketView<true> args);
+ void HciReadLocalName(bluetooth::packet::PacketView<true> args);
// 7.3.16
- void HciWritePageTimeout(packets::PacketView<true> args);
+ void HciWritePageTimeout(bluetooth::packet::PacketView<true> args);
// 7.3.18
- void HciWriteScanEnable(packets::PacketView<true> args);
+ void HciWriteScanEnable(bluetooth::packet::PacketView<true> args);
// 7.3.22
- void HciWriteInquiryScanActivity(packets::PacketView<true> args);
+ void HciWriteInquiryScanActivity(bluetooth::packet::PacketView<true> args);
// 7.3.23
- void HciReadAuthenticationEnable(packets::PacketView<true> args);
+ void HciReadAuthenticationEnable(bluetooth::packet::PacketView<true> args);
// 7.3.24
- void HciWriteAuthenticationEnable(packets::PacketView<true> args);
+ void HciWriteAuthenticationEnable(bluetooth::packet::PacketView<true> args);
// 7.3.26
- void HciWriteClassOfDevice(packets::PacketView<true> args);
+ void HciWriteClassOfDevice(bluetooth::packet::PacketView<true> args);
// 7.3.28
- void HciWriteVoiceSetting(packets::PacketView<true> args);
+ void HciWriteVoiceSetting(bluetooth::packet::PacketView<true> args);
// 7.3.39
- void HciHostBufferSize(packets::PacketView<true> args);
+ void HciHostBufferSize(bluetooth::packet::PacketView<true> args);
// 7.3.42
- void HciWriteLinkSupervisionTimeout(packets::PacketView<true> args);
+ void HciWriteLinkSupervisionTimeout(bluetooth::packet::PacketView<true> args);
// 7.3.45
- void HciWriteCurrentIacLap(packets::PacketView<true> args);
+ void HciWriteCurrentIacLap(bluetooth::packet::PacketView<true> args);
// 7.3.48
- void HciWriteInquiryScanType(packets::PacketView<true> args);
+ void HciWriteInquiryScanType(bluetooth::packet::PacketView<true> args);
// 7.3.50
- void HciWriteInquiryMode(packets::PacketView<true> args);
+ void HciWriteInquiryMode(bluetooth::packet::PacketView<true> args);
// 7.3.52
- void HciWritePageScanType(packets::PacketView<true> args);
+ void HciWritePageScanType(bluetooth::packet::PacketView<true> args);
// 7.3.56
- void HciWriteExtendedInquiryResponse(packets::PacketView<true> args);
+ void HciWriteExtendedInquiryResponse(
+ bluetooth::packet::PacketView<true> args);
// 7.3.57
- void HciRefreshEncryptionKey(packets::PacketView<true> args);
+ void HciRefreshEncryptionKey(bluetooth::packet::PacketView<true> args);
// 7.3.59
- void HciWriteSimplePairingMode(packets::PacketView<true> args);
+ void HciWriteSimplePairingMode(bluetooth::packet::PacketView<true> args);
// 7.3.79
- void HciWriteLeHostSupport(packets::PacketView<true> args);
+ void HciWriteLeHostSupport(bluetooth::packet::PacketView<true> args);
// 7.3.92
- void HciWriteSecureConnectionsHostSupport(packets::PacketView<true> args);
+ void HciWriteSecureConnectionsHostSupport(
+ bluetooth::packet::PacketView<true> args);
// Informational Parameters Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.4
// 7.4.5
- void HciReadBufferSize(packets::PacketView<true> args);
+ void HciReadBufferSize(bluetooth::packet::PacketView<true> args);
// 7.4.1
- void HciReadLocalVersionInformation(packets::PacketView<true> args);
+ void HciReadLocalVersionInformation(bluetooth::packet::PacketView<true> args);
// 7.4.6
- void HciReadBdAddr(packets::PacketView<true> args);
+ void HciReadBdAddr(bluetooth::packet::PacketView<true> args);
// 7.4.2
- void HciReadLocalSupportedCommands(packets::PacketView<true> args);
+ void HciReadLocalSupportedCommands(bluetooth::packet::PacketView<true> args);
// 7.4.3
- void HciReadLocalSupportedFeatures(packets::PacketView<true> args);
+ void HciReadLocalSupportedFeatures(bluetooth::packet::PacketView<true> args);
// 7.4.4
- void HciReadLocalExtendedFeatures(packets::PacketView<true> args);
+ void HciReadLocalExtendedFeatures(bluetooth::packet::PacketView<true> args);
// 7.4.8
- void HciReadLocalSupportedCodecs(packets::PacketView<true> args);
+ void HciReadLocalSupportedCodecs(bluetooth::packet::PacketView<true> args);
// Status Parameters Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.5
// 7.5.7
- void HciReadEncryptionKeySize(packets::PacketView<true> args);
+ void HciReadEncryptionKeySize(bluetooth::packet::PacketView<true> args);
// Test Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.7
// 7.7.1
- void HciReadLoopbackMode(packets::PacketView<true> args);
+ void HciReadLoopbackMode(bluetooth::packet::PacketView<true> args);
// 7.7.2
- void HciWriteLoopbackMode(packets::PacketView<true> args);
+ void HciWriteLoopbackMode(bluetooth::packet::PacketView<true> args);
// LE Controller Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8
// 7.8.1
- void HciLeSetEventMask(packets::PacketView<true> args);
+ void HciLeSetEventMask(bluetooth::packet::PacketView<true> args);
// 7.8.2
- void HciLeReadBufferSize(packets::PacketView<true> args);
+ void HciLeReadBufferSize(bluetooth::packet::PacketView<true> args);
// 7.8.3
- void HciLeReadLocalSupportedFeatures(packets::PacketView<true> args);
+ void HciLeReadLocalSupportedFeatures(
+ bluetooth::packet::PacketView<true> args);
// 7.8.4
- void HciLeSetRandomAddress(packets::PacketView<true> args);
+ void HciLeSetRandomAddress(bluetooth::packet::PacketView<true> args);
// 7.8.5
- void HciLeSetAdvertisingParameters(packets::PacketView<true> args);
+ void HciLeSetAdvertisingParameters(bluetooth::packet::PacketView<true> args);
// 7.8.7
- void HciLeSetAdvertisingData(packets::PacketView<true> args);
+ void HciLeSetAdvertisingData(bluetooth::packet::PacketView<true> args);
// 7.8.8
- void HciLeSetScanResponseData(packets::PacketView<true> args);
+ void HciLeSetScanResponseData(bluetooth::packet::PacketView<true> args);
// 7.8.9
- void HciLeSetAdvertisingEnable(packets::PacketView<true> args);
+ void HciLeSetAdvertisingEnable(bluetooth::packet::PacketView<true> args);
// 7.8.10
- void HciLeSetScanParameters(packets::PacketView<true> args);
+ void HciLeSetScanParameters(bluetooth::packet::PacketView<true> args);
// 7.8.11
- void HciLeSetScanEnable(packets::PacketView<true> args);
+ void HciLeSetScanEnable(bluetooth::packet::PacketView<true> args);
// 7.8.12
- void HciLeCreateConnection(packets::PacketView<true> args);
+ void HciLeCreateConnection(bluetooth::packet::PacketView<true> args);
// 7.8.18
- void HciLeConnectionUpdate(packets::PacketView<true> args);
+ void HciLeConnectionUpdate(bluetooth::packet::PacketView<true> args);
// 7.8.13
- void HciLeConnectionCancel(packets::PacketView<true> args);
+ void HciLeConnectionCancel(bluetooth::packet::PacketView<true> args);
// 7.8.14
- void HciLeReadWhiteListSize(packets::PacketView<true> args);
+ void HciLeReadWhiteListSize(bluetooth::packet::PacketView<true> args);
// 7.8.15
- void HciLeClearWhiteList(packets::PacketView<true> args);
+ void HciLeClearWhiteList(bluetooth::packet::PacketView<true> args);
// 7.8.16
- void HciLeAddDeviceToWhiteList(packets::PacketView<true> args);
+ void HciLeAddDeviceToWhiteList(bluetooth::packet::PacketView<true> args);
// 7.8.17
- void HciLeRemoveDeviceFromWhiteList(packets::PacketView<true> args);
+ void HciLeRemoveDeviceFromWhiteList(bluetooth::packet::PacketView<true> args);
// 7.8.21
- void HciLeReadRemoteFeatures(packets::PacketView<true> args);
+ void HciLeReadRemoteFeatures(bluetooth::packet::PacketView<true> args);
// 7.8.23
- void HciLeRand(packets::PacketView<true> args);
+ void HciLeRand(bluetooth::packet::PacketView<true> args);
// 7.8.24
- void HciLeStartEncryption(packets::PacketView<true> args);
+ void HciLeStartEncryption(bluetooth::packet::PacketView<true> args);
// 7.8.27
- void HciLeReadSupportedStates(packets::PacketView<true> args);
+ void HciLeReadSupportedStates(bluetooth::packet::PacketView<true> args);
// 7.8.38
- void HciLeAddDeviceToResolvingList(packets::PacketView<true> args);
+ void HciLeAddDeviceToResolvingList(bluetooth::packet::PacketView<true> args);
// 7.8.39
- void HciLeRemoveDeviceFromResolvingList(packets::PacketView<true> args);
+ void HciLeRemoveDeviceFromResolvingList(
+ bluetooth::packet::PacketView<true> args);
// 7.8.40
- void HciLeClearResolvingList(packets::PacketView<true> args);
+ void HciLeClearResolvingList(bluetooth::packet::PacketView<true> args);
// 7.8.77
- void HciLeSetPrivacyMode(packets::PacketView<true> args);
+ void HciLeSetPrivacyMode(bluetooth::packet::PacketView<true> args);
// Vendor-specific Commands
- void HciLeVendorSleepMode(packets::PacketView<true> args);
- void HciLeVendorCap(packets::PacketView<true> args);
- void HciLeVendorMultiAdv(packets::PacketView<true> args);
- void HciLeVendor155(packets::PacketView<true> args);
- void HciLeVendor157(packets::PacketView<true> args);
- void HciLeEnergyInfo(packets::PacketView<true> args);
- void HciLeAdvertisingFilter(packets::PacketView<true> args);
- void HciLeExtendedScanParams(packets::PacketView<true> args);
+ void HciLeVendorSleepMode(bluetooth::packet::PacketView<true> args);
+ void HciLeVendorCap(bluetooth::packet::PacketView<true> args);
+ void HciLeVendorMultiAdv(bluetooth::packet::PacketView<true> args);
+ void HciLeVendor155(bluetooth::packet::PacketView<true> args);
+ void HciLeVendor157(bluetooth::packet::PacketView<true> args);
+ void HciLeEnergyInfo(bluetooth::packet::PacketView<true> args);
+ void HciLeAdvertisingFilter(bluetooth::packet::PacketView<true> args);
+ void HciLeExtendedScanParams(bluetooth::packet::PacketView<true> args);
void SetTimerPeriod(std::chrono::milliseconds new_period);
void StartTimer();
@@ -445,7 +456,9 @@
// Maintains the commands to be registered and used in the HciHandler object.
// Keys are command opcodes and values are the callbacks to handle each
// command.
- std::unordered_map<uint16_t, std::function<void(packets::PacketView<true>)>> active_hci_commands_;
+ std::unordered_map<uint16_t,
+ std::function<void(bluetooth::packet::PacketView<true>)>>
+ active_hci_commands_;
hci::LoopbackMode loopback_mode_;
diff --git a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
index aebe621..39e5373 100644
--- a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
+++ b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
@@ -19,9 +19,6 @@
#include "hci.h"
#include "include/le_advertisement.h"
#include "os/log.h"
-#include "packets/hci/command_packet_view.h"
-#include "packets/raw_builder.h"
-
#include "packet/raw_builder.h"
using std::vector;
@@ -61,7 +58,7 @@
}
bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByAddress(
- bluetooth::hci::OpCode opcode, PacketView<true> args,
+ bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
const Address& remote) {
Address local_address = properties_.GetAddress();
@@ -104,7 +101,8 @@
}
bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode opcode, PacketView<true> args, uint16_t handle) {
+ bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
+ uint16_t handle) {
// TODO: Handle LE connections
if (!connections_.HasHandle(handle)) {
return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
diff --git a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
index cffc935..460d015 100644
--- a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
+++ b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
@@ -38,10 +38,10 @@
LinkLayerController(const DeviceProperties& properties) : properties_(properties) {}
bluetooth::hci::ErrorCode SendCommandToRemoteByAddress(
- bluetooth::hci::OpCode opcode, packets::PacketView<true> args,
+ bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
const Address& remote);
bluetooth::hci::ErrorCode SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode opcode, packets::PacketView<true> args,
+ bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
uint16_t handle);
hci::Status SendScoToRemote(bluetooth::hci::ScoPacketView sco_packet);
hci::Status SendAclToRemote(bluetooth::hci::AclPacketView acl_packet);
diff --git a/vendor_libs/test_vendor_lib/packets/Android.bp b/vendor_libs/test_vendor_lib/packets/Android.bp
index a769e14..e507c27 100644
--- a/vendor_libs/test_vendor_lib/packets/Android.bp
+++ b/vendor_libs/test_vendor_lib/packets/Android.bp
@@ -14,9 +14,6 @@
"packet_view.cc",
"raw_builder.cc",
"view.cc",
- "hci/command_packet_builder.cc",
- "hci/command_packet_view.cc",
- "hci/hci_packet_builder.cc",
],
cflags: [
"-fvisibility=hidden",
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc b/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc
deleted file mode 100644
index b422bb8..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-#include "packets/hci/command_packet_builder.h"
-
-#include "os/log.h"
-
-using std::vector;
-using test_vendor_lib::hci::OpCode;
-
-namespace test_vendor_lib {
-namespace packets {
-
-CommandPacketBuilder::CommandPacketBuilder(OpCode opcode, std::unique_ptr<BasePacketBuilder> payload)
- : opcode_(opcode), payload_(std::move(payload)) {}
-
-size_t CommandPacketBuilder::size() const {
- return sizeof(uint16_t) + sizeof(uint8_t) + payload_->size();
-}
-
-void CommandPacketBuilder::Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const {
- insert(static_cast<uint16_t>(opcode_), it);
- uint8_t payload_size = static_cast<uint8_t>(payload_->size());
-
- ASSERT_LOG(static_cast<size_t>(payload_size) == payload_->size(), "Payload too large for a command packet: %d",
- static_cast<int>(payload_->size()));
- insert(payload_size, it);
- payload_->Serialize(it);
-}
-
-} // namespace packets
-} // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h b/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h
deleted file mode 100644
index d59cf79..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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>
-#include <memory>
-#include <vector>
-
-#include "include/hci.h"
-#include "packets/hci/hci_packet_builder.h"
-#include "packets/packet_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// ACL data packets are specified in the Bluetooth Core Specification Version
-// 4.2, Volume 2, Part E, Section 5.4.2
-class CommandPacketBuilder : public HciPacketBuilder {
- public:
- virtual ~CommandPacketBuilder() override = default;
-
- static std::unique_ptr<CommandPacketBuilder> Create(hci::OpCode opcode, std::unique_ptr<BasePacketBuilder> payload);
-
- virtual size_t size() const override;
-
- virtual void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const;
-
- private:
- CommandPacketBuilder(hci::OpCode opcode, std::unique_ptr<BasePacketBuilder> payload);
- CommandPacketBuilder() = delete;
- hci::OpCode opcode_;
- std::unique_ptr<BasePacketBuilder> payload_;
-};
-
-} // namespace packets
-} // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc b/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc
deleted file mode 100644
index b0d27e6..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-#include "packets/hci/command_packet_view.h"
-
-#include "os/log.h"
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-CommandPacketView::CommandPacketView(std::shared_ptr<std::vector<uint8_t>> packet) : PacketView<true>(packet) {}
-
-CommandPacketView CommandPacketView::Create(std::shared_ptr<std::vector<uint8_t>> packet) {
- return CommandPacketView(packet);
-}
-
-uint16_t CommandPacketView::GetOpcode() const {
- return begin().extract<uint16_t>();
-}
-
-PacketView<true> CommandPacketView::GetPayload() const {
- uint8_t payload_size = (begin() + sizeof(uint16_t)).extract<uint8_t>();
- ASSERT_LOG(static_cast<uint8_t>(size() - sizeof(uint16_t) - sizeof(uint8_t)) == payload_size,
- "Malformed Command packet payload_size %d + 2 != %d", static_cast<int>(payload_size),
- static_cast<int>(size()));
- return SubViewLittleEndian(sizeof(uint16_t) + sizeof(uint8_t), size());
-}
-
-} // namespace packets
-} // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h b/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h
deleted file mode 100644
index 6355c1e..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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>
-#include <memory>
-#include <vector>
-
-#include "packets/packet_view.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Command packets are specified in the Bluetooth Core Specification Version
-// 4.2, Volume 2, Part E, Section 5.4.1
-class CommandPacketView : public PacketView<true> {
- public:
- virtual ~CommandPacketView() override = default;
-
- static CommandPacketView Create(std::shared_ptr<std::vector<uint8_t>> packet);
-
- uint16_t GetOpcode() const;
-
- PacketView<true> GetPayload() const;
-
- private:
- CommandPacketView(std::shared_ptr<std::vector<uint8_t>> packet);
- CommandPacketView() = delete;
-};
-
-} // namespace packets
-} // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc b/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc
deleted file mode 100644
index 1d5689b..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-#include "packets/hci/hci_packet_builder.h"
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-std::shared_ptr<std::vector<uint8_t>> HciPacketBuilder::ToVector() {
- std::shared_ptr<std::vector<uint8_t>> to_return = std::make_shared<std::vector<uint8_t>>();
- std::back_insert_iterator<std::vector<uint8_t>> it(*to_return);
- Serialize(it);
- return to_return;
-}
-
-} // namespace packets
-} // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h b/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h
deleted file mode 100644
index d508696..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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>
-
-#include "packets/packet_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Base packet for HCI packets specified in the Bluetooth Core Specification
-// Version 4.2, Volume 2, Part E, Section 5.4
-class HciPacketBuilder : public PacketBuilder<true> {
- public:
- virtual ~HciPacketBuilder() override = default;
-
- std::shared_ptr<std::vector<uint8_t>> ToVector();
-
- protected:
- HciPacketBuilder() = default;
-};
-
-} // namespace packets
-} // namespace test_vendor_lib