RootCanal: use classes in bluetooth hci namespace
Bug: 140386699
Test: run_cert.sh
Change-Id: I23d0729d168ffd2f6459a7a6a2d434f3e422148e
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 bb3ba63..95bb202 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
@@ -25,6 +25,8 @@
#include "os/log.h"
#include "packet/raw_builder.h"
+using bluetooth::hci::ErrorCode;
+using bluetooth::hci::LoopbackMode;
using bluetooth::hci::OpCode;
using std::vector;
@@ -77,7 +79,7 @@
raw_builder_ptr->AddOctets1(kNumCommandPackets);
raw_builder_ptr->AddOctets2(command_opcode);
raw_builder_ptr->AddOctets1(
- static_cast<uint8_t>(bluetooth::hci::ErrorCode::UNKNOWN_HCI_COMMAND));
+ static_cast<uint8_t>(ErrorCode::UNKNOWN_HCI_COMMAND));
auto packet = bluetooth::hci::EventPacketBuilder::Create(
bluetooth::hci::EventCode::COMMAND_COMPLETE, std::move(raw_builder_ptr));
@@ -86,7 +88,7 @@
DualModeController::DualModeController(const std::string& properties_filename, uint16_t num_keys)
: Device(properties_filename), security_manager_(num_keys) {
- loopback_mode_ = bluetooth::hci::LoopbackMode::NO_LOOPBACK;
+ loopback_mode_ = LoopbackMode::NO_LOOPBACK;
Address public_address;
ASSERT(Address::FromString("3C:5A:B4:04:05:06", public_address));
@@ -100,7 +102,7 @@
#define SET_HANDLER(opcode, method) \
active_hci_commands_[static_cast<uint16_t>(opcode)] = \
- [this](bluetooth::packet::PacketView<true> param) { method(param); };
+ [this](PacketView<true> param) { method(param); };
SET_HANDLER(OpCode::RESET, HciReset);
SET_HANDLER(OpCode::READ_BUFFER_SIZE, HciReadBufferSize);
SET_HANDLER(OpCode::HOST_BUFFER_SIZE, HciHostBufferSize);
@@ -203,14 +205,13 @@
#undef SET_HANDLER
}
-void DualModeController::HciSniffSubrating(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSniffSubrating(PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
auto packet = bluetooth::hci::SniffSubratingCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, handle);
+ kNumCommandPackets, ErrorCode::SUCCESS, handle);
send_event_(std::move(packet));
}
@@ -233,7 +234,7 @@
bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
auto acl_packet = bluetooth::hci::AclPacketView::Create(raw_packet);
ASSERT(acl_packet.IsValid());
- if (loopback_mode_ == bluetooth::hci::LoopbackMode::ENABLE_LOCAL) {
+ if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
uint16_t handle = acl_packet.GetHandle();
std::vector<bluetooth::hci::CompletedPackets> completed_packets;
@@ -253,7 +254,7 @@
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);
- if (loopback_mode_ == bluetooth::hci::LoopbackMode::ENABLE_LOCAL) {
+ if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
uint16_t handle = sco_packet.GetHandle();
send_sco_(packet);
std::vector<bluetooth::hci::CompletedPackets> completed_packets;
@@ -280,15 +281,14 @@
auto op = command_packet.GetOpCode();
uint16_t opcode = static_cast<uint16_t>(op);
- if (loopback_mode_ == bluetooth::hci::LoopbackMode::ENABLE_LOCAL &&
+ if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL &&
// Loopback exceptions.
- 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) {
+ 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) {
std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
std::make_unique<bluetooth::packet::RawBuilder>();
raw_builder_ptr->AddOctets(*packet);
@@ -343,23 +343,22 @@
send_iso_ = callback;
}
-void DualModeController::HciReset(bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReset(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.Reset();
- if (loopback_mode_ == bluetooth::hci::LoopbackMode::ENABLE_LOCAL) {
- loopback_mode_ = bluetooth::hci::LoopbackMode::NO_LOOPBACK;
+ if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
+ loopback_mode_ = LoopbackMode::NO_LOOPBACK;
}
- send_event_(bluetooth::hci::ResetCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS));
+ send_event_(bluetooth::hci::ResetCompleteBuilder::Create(kNumCommandPackets,
+ ErrorCode::SUCCESS));
}
-void DualModeController::HciReadBufferSize(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadBufferSize(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet = bluetooth::hci::ReadBufferSizeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+ kNumCommandPackets, ErrorCode::SUCCESS,
properties_.GetAclDataPacketSize(),
properties_.GetSynchronousDataPacketSize(),
properties_.GetTotalNumAclDataPackets(),
@@ -367,28 +366,25 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadEncryptionKeySize(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadEncryptionKeySize(PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
auto packet = bluetooth::hci::ReadEncryptionKeySizeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, handle,
+ kNumCommandPackets, ErrorCode::SUCCESS, handle,
properties_.GetEncryptionKeySize());
send_event_(std::move(packet));
}
-void DualModeController::HciHostBufferSize(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciHostBufferSize(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalVersionInformation(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalVersionInformation(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
bluetooth::hci::LocalVersionInformation local_version_information;
@@ -402,19 +398,18 @@
local_version_information.lmp_subversion_ = properties_.GetLmpPalSubversion();
auto packet =
bluetooth::hci::ReadLocalVersionInformationCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
- local_version_information);
+ kNumCommandPackets, ErrorCode::SUCCESS, local_version_information);
send_event_(std::move(packet));
}
void DualModeController::HciReadRemoteVersionInformation(
- bluetooth::packet::PacketView<true> args) {
+ 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_.SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode::READ_REMOTE_VERSION_INFORMATION, args, handle);
+ OpCode::READ_REMOTE_VERSION_INFORMATION, args, handle);
auto packet =
bluetooth::hci::ReadRemoteVersionInformationStatusBuilder::Create(
@@ -422,17 +417,14 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadBdAddr(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadBdAddr(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,
- properties_.GetAddress());
+ kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetAddress());
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedCommands(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCommands(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
std::array<uint8_t, 64> supported_commands;
@@ -446,59 +438,53 @@
auto packet =
bluetooth::hci::ReadLocalSupportedCommandsCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
- supported_commands);
+ kNumCommandPackets, ErrorCode::SUCCESS, supported_commands);
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedFeatures(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedFeatures(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::ReadLocalSupportedFeaturesCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+ kNumCommandPackets, ErrorCode::SUCCESS,
properties_.GetSupportedFeatures());
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalSupportedCodecs(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCodecs(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,
- properties_.GetSupportedCodecs(), properties_.GetVendorSpecificCodecs());
+ kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetSupportedCodecs(),
+ properties_.GetVendorSpecificCodecs());
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalExtendedFeatures(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalExtendedFeatures(PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
uint8_t page_number = args.begin().extract<uint8_t>();
auto pakcet =
bluetooth::hci::ReadLocalExtendedFeaturesCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, page_number,
+ kNumCommandPackets, ErrorCode::SUCCESS, page_number,
properties_.GetExtendedFeaturesMaximumPageNumber(),
properties_.GetExtendedFeatures(page_number));
send_event_(std::move(pakcet));
}
-void DualModeController::HciReadRemoteExtendedFeatures(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadRemoteExtendedFeatures(PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
uint16_t handle = args.begin().extract<uint16_t>();
auto status = link_layer_controller_.SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES, args, handle);
+ OpCode::READ_REMOTE_EXTENDED_FEATURES, args, handle);
auto packet = bluetooth::hci::ReadRemoteExtendedFeaturesStatusBuilder::Create(
status, kNumCommandPackets);
send_event_(std::move(packet));
}
-void DualModeController::HciSwitchRole(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSwitchRole(PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
Address address = args.begin().extract<Address>();
@@ -511,14 +497,13 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadRemoteSupportedFeatures(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadRemoteSupportedFeatures(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_.SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode::READ_REMOTE_SUPPORTED_FEATURES, args, handle);
+ OpCode::READ_REMOTE_SUPPORTED_FEATURES, args, handle);
auto packet =
bluetooth::hci::ReadRemoteSupportedFeaturesStatusBuilder::Create(
@@ -526,22 +511,20 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadClockOffset(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadClockOffset(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_.SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode::READ_CLOCK_OFFSET, args, handle);
+ OpCode::READ_CLOCK_OFFSET, args, handle);
auto packet = bluetooth::hci::ReadClockOffsetStatusBuilder::Create(
status, kNumCommandPackets);
send_event_(std::move(packet));
}
-void DualModeController::HciIoCapabilityRequestReply(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciIoCapabilityRequestReply(PacketView<true> args) {
ASSERT_LOG(args.size() == 9, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -559,7 +542,7 @@
}
void DualModeController::HciUserConfirmationRequestReply(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -573,7 +556,7 @@
}
void DualModeController::HciUserConfirmationRequestNegativeReply(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -587,8 +570,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciUserPasskeyRequestReply(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciUserPasskeyRequestReply(PacketView<true> args) {
ASSERT_LOG(args.size() == 10, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -604,7 +586,7 @@
}
void DualModeController::HciUserPasskeyRequestNegativeReply(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -617,8 +599,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRemoteOobDataRequestReply(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciRemoteOobDataRequestReply(PacketView<true> args) {
ASSERT_LOG(args.size() == 38, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -640,7 +621,7 @@
}
void DualModeController::HciRemoteOobDataRequestNegativeReply(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 6, "%s size=%zu", __func__, args.size());
Address peer = args.begin().extract<Address>();
@@ -654,13 +635,12 @@
}
void DualModeController::HciIoCapabilityRequestNegativeReply(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
Address peer = args_itr.extract<Address>();
- bluetooth::hci::ErrorCode reason =
- args_itr.extract<bluetooth::hci::ErrorCode>();
+ ErrorCode reason = args_itr.extract<ErrorCode>();
auto status =
link_layer_controller_.IoCapabilityRequestNegativeReply(peer, reason);
@@ -671,18 +651,16 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteSimplePairingMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteSimplePairingMode(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);
auto packet = bluetooth::hci::WriteSimplePairingModeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciChangeConnectionPacketType(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciChangeConnectionPacketType(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>();
@@ -696,59 +674,53 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLeHostSupport(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteLeHostSupport(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
void DualModeController::HciWriteSecureConnectionsHostSupport(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
properties_.SetExtendedFeatures(properties_.GetExtendedFeatures(1) | 0x8, 1);
auto packet =
bluetooth::hci::WriteSecureConnectionsHostSupportCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciSetEventMask(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSetEventMask(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteInquiryMode(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(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWritePageScanType(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWritePageScanType(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryScanType(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanType(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciAuthenticationRequested(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciAuthenticationRequested(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);
@@ -758,8 +730,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSetConnectionEncryption(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSetConnectionEncryption(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>();
@@ -772,8 +743,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciChangeConnectionLinkKey(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciChangeConnectionLinkKey(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>();
@@ -785,8 +755,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciMasterLinkKey(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciMasterLinkKey(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>();
@@ -798,44 +767,40 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteAuthenticationEnable(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteAuthenticationEnable(PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
properties_.SetAuthenticationEnable(args[0]);
auto packet =
bluetooth::hci::WriteAuthenticationEnableCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciReadAuthenticationEnable(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadAuthenticationEnable(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,
+ kNumCommandPackets, ErrorCode::SUCCESS,
static_cast<bluetooth::hci::AuthenticationEnable>(
properties_.GetAuthenticationEnable()));
send_event_(std::move(packet));
}
-void DualModeController::HciWriteClassOfDevice(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteClassOfDevice(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(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWritePageTimeout(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWritePageTimeout(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciHoldMode(bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciHoldMode(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>();
@@ -850,8 +815,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciSniffMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSniffMode(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>();
@@ -869,8 +833,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciExitSniffMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciExitSniffMode(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>();
@@ -882,7 +845,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciQosSetup(bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciQosSetup(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>();
@@ -903,16 +866,15 @@
}
void DualModeController::HciWriteDefaultLinkPolicySettings(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 2, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::WriteDefaultLinkPolicySettingsCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciFlowSpecification(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciFlowSpecification(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>();
@@ -933,8 +895,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLinkPolicySettings(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteLinkPolicySettings(PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -949,8 +910,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLinkSupervisionTimeout(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteLinkSupervisionTimeout(PacketView<true> args) {
ASSERT_LOG(args.size() == 4, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -965,8 +925,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciReadLocalName(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLocalName(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
std::array<uint8_t, 248> local_name;
@@ -978,113 +937,104 @@
std::copy_n(properties_.GetName().begin(), len, local_name.begin());
auto packet = bluetooth::hci::ReadLocalNameCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, local_name);
+ kNumCommandPackets, ErrorCode::SUCCESS, local_name);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLocalName(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteLocalName(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);
auto packet = bluetooth::hci::WriteLocalNameCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
void DualModeController::HciWriteExtendedInquiryResponse(
- bluetooth::packet::PacketView<true> args) {
+ 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);
properties_.SetExtendedInquiryData(clipped);
auto packet =
bluetooth::hci::WriteExtendedInquiryResponseCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciRefreshEncryptionKey(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciRefreshEncryptionKey(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>();
auto status_packet =
bluetooth::hci::RefreshEncryptionKeyStatusBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+ ErrorCode::SUCCESS, kNumCommandPackets);
send_event_(std::move(status_packet));
// TODO: Support this in the link layer
auto complete_packet =
bluetooth::hci::EncryptionKeyRefreshCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle);
+ ErrorCode::SUCCESS, handle);
send_event_(std::move(complete_packet));
}
-void DualModeController::HciWriteVoiceSetting(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteVoiceSetting(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteCurrentIacLap(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteCurrentIacLap(PacketView<true> args) {
ASSERT(args.size() > 0);
ASSERT(args.size() == 1 + (3 * args[0])); // count + 3-byte IACs
auto packet = bluetooth::hci::WriteCurrentIacLapCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteInquiryScanActivity(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanActivity(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);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciWriteScanEnable(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteScanEnable(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);
auto packet = bluetooth::hci::WriteScanEnableCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciSetEventFilter(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciSetEventFilter(PacketView<true> args) {
ASSERT(args.size() > 0);
auto packet = bluetooth::hci::SetEventFilterCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciInquiry(bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciInquiry(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]);
link_layer_controller_.StartInquiry(std::chrono::milliseconds(args[3] * 1280));
auto packet = bluetooth::hci::InquiryStatusBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+ ErrorCode::SUCCESS, kNumCommandPackets);
send_event_(std::move(packet));
}
-void DualModeController::HciInquiryCancel(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciInquiryCancel(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.InquiryCancel();
auto packet = bluetooth::hci::InquiryCancelCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciAcceptConnectionRequest(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciAcceptConnectionRequest(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;
@@ -1095,8 +1045,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciRejectConnectionRequest(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciRejectConnectionRequest(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>();
@@ -1107,8 +1056,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLinkKeyRequestReply(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestReply(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>();
@@ -1119,8 +1067,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLinkKeyRequestNegativeReply(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestNegativeReply(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);
@@ -1130,8 +1077,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciDeleteStoredLinkKey(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciDeleteStoredLinkKey(PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
uint16_t deleted_keys = 0;
@@ -1146,39 +1092,36 @@
}
auto packet = bluetooth::hci::DeleteStoredLinkKeyCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, deleted_keys);
+ kNumCommandPackets, ErrorCode::SUCCESS, deleted_keys);
send_event_(std::move(packet));
}
-void DualModeController::HciRemoteNameRequest(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciRemoteNameRequest(PacketView<true> args) {
ASSERT_LOG(args.size() == 10, "%s size=%zu", __func__, args.size());
Address remote_addr = args.begin().extract<Address>();
auto status = link_layer_controller_.SendCommandToRemoteByAddress(
- bluetooth::hci::OpCode::REMOTE_NAME_REQUEST, args, remote_addr);
+ OpCode::REMOTE_NAME_REQUEST, args, remote_addr);
auto packet = bluetooth::hci::RemoteNameRequestStatusBuilder::Create(
status, kNumCommandPackets);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetEventMask(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetEventMask(PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
/*
uint64_t mask = args.begin().extract<uint64_t>();
link_layer_controller_.SetLeEventMask(mask);
*/
auto packet = bluetooth::hci::LeSetEventMaskCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadBufferSize(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeReadBufferSize(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
bluetooth::hci::LeBufferSize le_buffer_size;
@@ -1186,31 +1129,29 @@
le_buffer_size.total_num_le_packets_ = properties_.GetTotalNumLeDataPackets();
auto packet = bluetooth::hci::LeReadBufferSizeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, le_buffer_size);
+ kNumCommandPackets, ErrorCode::SUCCESS, le_buffer_size);
send_event_(std::move(packet));
}
void DualModeController::HciLeReadLocalSupportedFeatures(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
auto packet =
bluetooth::hci::LeReadLocalSupportedFeaturesCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+ kNumCommandPackets, ErrorCode::SUCCESS,
properties_.GetLeSupportedFeatures());
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetRandomAddress(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetRandomAddress(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(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingParameters(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingParameters(PacketView<true> args) {
ASSERT_LOG(args.size() == 15, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
properties_.SetLeAdvertisingParameters(
@@ -1223,30 +1164,27 @@
auto packet =
bluetooth::hci::LeSetAdvertisingParametersCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingData(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingData(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(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanResponseData(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetScanResponseData(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(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetAdvertisingEnable(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingEnable(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>());
@@ -1255,8 +1193,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanParameters(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetScanParameters(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));
@@ -1264,22 +1201,20 @@
link_layer_controller_.SetLeAddressType(args[5]);
link_layer_controller_.SetLeScanFilterPolicy(args[6]);
auto packet = bluetooth::hci::LeSetScanParametersCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetScanEnable(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetScanEnable(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]);
auto packet = bluetooth::hci::LeSetScanEnableCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeCreateConnection(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeCreateConnection(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>());
@@ -1308,23 +1243,20 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeConnectionUpdate(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeConnectionUpdate(PacketView<true> args) {
ASSERT_LOG(args.size() == 14, "%s size=%zu", __func__, args.size());
auto status_packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
- bluetooth::hci::ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR,
- kNumCommandPackets);
+ ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR, kNumCommandPackets);
send_event_(std::move(status_packet));
auto complete_packet =
bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4);
+ ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4);
send_event_(std::move(complete_packet));
}
-void DualModeController::HciCreateConnection(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciCreateConnection(PacketView<true> args) {
ASSERT_LOG(args.size() == 13, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1342,8 +1274,7 @@
send_event_(std::move(packet));
}
-void DualModeController::HciDisconnect(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciDisconnect(PacketView<true> args) {
ASSERT_LOG(args.size() == 3, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1357,47 +1288,41 @@
send_event_(std::move(packet));
}
-void DualModeController::HciLeConnectionCancel(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeConnectionCancel(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(
- bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+ ErrorCode::SUCCESS, kNumCommandPackets);
send_event_(std::move(packet));
/* For testing Jakub's patch: Figure out a neat way to call this without
recompiling. I'm thinking about a bad device. */
/*
SendCommandCompleteOnlyStatus(OpCode::LE_CREATE_CONNECTION_CANCEL,
- bluetooth::hci::ErrorCode::COMMAND_DISALLOWED);
+ ErrorCode::COMMAND_DISALLOWED);
*/
}
-void DualModeController::HciLeReadWhiteListSize(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeReadWhiteListSize(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,
- properties_.GetLeWhiteListSize());
+ kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetLeWhiteListSize());
send_event_(std::move(packet));
}
-void DualModeController::HciLeClearWhiteList(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeClearWhiteList(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.LeWhiteListClear();
auto packet = bluetooth::hci::LeClearWhiteListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeAddDeviceToWhiteList(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeAddDeviceToWhiteList(PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
if (link_layer_controller_.LeWhiteListFull()) {
auto packet = bluetooth::hci::LeAddDeviceToWhiteListCompleteBuilder::Create(
- kNumCommandPackets,
- bluetooth::hci::ErrorCode::MEMORY_CAPACITY_EXCEEDED);
+ kNumCommandPackets, ErrorCode::MEMORY_CAPACITY_EXCEEDED);
send_event_(std::move(packet));
return;
}
@@ -1406,12 +1331,11 @@
Address address = args_itr.extract<Address>();
link_layer_controller_.LeWhiteListAddDevice(address, addr_type);
auto packet = bluetooth::hci::LeAddDeviceToWhiteListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeRemoveDeviceFromWhiteList(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeRemoveDeviceFromWhiteList(PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1420,28 +1344,25 @@
link_layer_controller_.LeWhiteListRemoveDevice(address, addr_type);
auto packet =
bluetooth::hci::LeRemoveDeviceFromWhiteListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeClearResolvingList(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeClearResolvingList(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
link_layer_controller_.LeResolvingListClear();
auto packet = bluetooth::hci::LeClearResolvingListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeAddDeviceToResolvingList(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeAddDeviceToResolvingList(PacketView<true> args) {
ASSERT_LOG(args.size() == 39, "%s size=%zu", __func__, args.size());
if (link_layer_controller_.LeResolvingListFull()) {
auto packet =
bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create(
- kNumCommandPackets,
- bluetooth::hci::ErrorCode::MEMORY_CAPACITY_EXCEEDED);
+ kNumCommandPackets, ErrorCode::MEMORY_CAPACITY_EXCEEDED);
send_event_(std::move(packet));
return;
}
@@ -1464,12 +1385,12 @@
localIrk);
auto packet =
bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
void DualModeController::HciLeRemoveDeviceFromResolvingList(
- bluetooth::packet::PacketView<true> args) {
+ PacketView<true> args) {
ASSERT_LOG(args.size() == 7, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1478,12 +1399,11 @@
link_layer_controller_.LeResolvingListRemoveDevice(address, addr_type);
auto packet =
bluetooth::hci::LeRemoveDeviceFromResolvingListCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeSetPrivacyMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeSetPrivacyMode(PacketView<true> args) {
ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1498,25 +1418,24 @@
}
auto packet = bluetooth::hci::LeSetPrivacyModeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadRemoteFeatures(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeReadRemoteFeatures(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_.SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode::LE_READ_REMOTE_FEATURES, args, handle);
+ OpCode::LE_READ_REMOTE_FEATURES, args, handle);
auto packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
status, kNumCommandPackets);
send_event_(std::move(packet));
}
-void DualModeController::HciLeRand(bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeRand(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)) {
@@ -1524,71 +1443,63 @@
}
auto packet = bluetooth::hci::LeRandCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, random_val);
+ kNumCommandPackets, ErrorCode::SUCCESS, random_val);
send_event_(std::move(packet));
}
-void DualModeController::HciLeReadSupportedStates(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeReadSupportedStates(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,
+ kNumCommandPackets, ErrorCode::SUCCESS,
properties_.GetLeSupportedStates());
send_event_(std::move(packet));
}
-void DualModeController::HciLeVendorCap(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeVendorCap(PacketView<true> args) {
ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
vector<uint8_t> caps = properties_.GetLeVendorCap();
if (caps.size() == 0) {
- SendCommandCompleteUnknownOpCodeEvent(static_cast<uint16_t>(
- bluetooth::hci::OpCode::LE_GET_VENDOR_CAPABILITIES));
+ SendCommandCompleteUnknownOpCodeEvent(
+ static_cast<uint16_t>(OpCode::LE_GET_VENDOR_CAPABILITIES));
return;
}
std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
std::make_unique<bluetooth::packet::RawBuilder>();
- raw_builder_ptr->AddOctets1(
- static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS));
+ raw_builder_ptr->AddOctets1(static_cast<uint8_t>(ErrorCode::SUCCESS));
raw_builder_ptr->AddOctets(properties_.GetLeVendorCap());
auto packet = bluetooth::hci::CommandCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::OpCode::LE_GET_VENDOR_CAPABILITIES,
+ kNumCommandPackets, OpCode::LE_GET_VENDOR_CAPABILITIES,
std::move(raw_builder_ptr));
send_event_(std::move(packet));
}
-void DualModeController::HciLeVendorMultiAdv(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeVendorMultiAdv(PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
- static_cast<uint16_t>(bluetooth::hci::OpCode::LE_MULTI_ADVT));
+ static_cast<uint16_t>(OpCode::LE_MULTI_ADVT));
}
-void DualModeController::HciLeAdvertisingFilter(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeAdvertisingFilter(PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
- static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ADV_FILTER));
+ static_cast<uint16_t>(OpCode::LE_ADV_FILTER));
}
-void DualModeController::HciLeEnergyInfo(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeEnergyInfo(PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
- static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ENERGY_INFO));
+ static_cast<uint16_t>(OpCode::LE_ENERGY_INFO));
}
-void DualModeController::HciLeExtendedScanParams(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeExtendedScanParams(PacketView<true> args) {
ASSERT(args.size() > 0);
SendCommandCompleteUnknownOpCodeEvent(
- static_cast<uint16_t>(bluetooth::hci::OpCode::LE_EXTENDED_SCAN_PARAMS));
+ static_cast<uint16_t>(OpCode::LE_EXTENDED_SCAN_PARAMS));
}
-void DualModeController::HciLeStartEncryption(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciLeStartEncryption(PacketView<true> args) {
ASSERT_LOG(args.size() == 28, "%s size=%zu", __func__, args.size());
auto args_itr = args.begin();
@@ -1600,12 +1511,11 @@
// long_term_key.push_back(args_itr.extract<uint18_t>();
// }
auto status_packet = bluetooth::hci::LeStartEncryptionStatusBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+ ErrorCode::SUCCESS, kNumCommandPackets);
send_event_(std::move(status_packet));
auto complete_packet = bluetooth::hci::EncryptionChangeBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
- bluetooth::hci::EncryptionEnabled::OFF);
+ ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::OFF);
send_event_(std::move(complete_packet));
#if 0
@@ -1661,33 +1571,31 @@
#endif
}
-void DualModeController::HciReadLoopbackMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciReadLoopbackMode(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,
- static_cast<bluetooth::hci::LoopbackMode>(loopback_mode_));
+ kNumCommandPackets, ErrorCode::SUCCESS,
+ static_cast<LoopbackMode>(loopback_mode_));
send_event_(std::move(packet));
}
-void DualModeController::HciWriteLoopbackMode(
- bluetooth::packet::PacketView<true> args) {
+void DualModeController::HciWriteLoopbackMode(PacketView<true> args) {
ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
- loopback_mode_ = static_cast<bluetooth::hci::LoopbackMode>(args[0]);
+ loopback_mode_ = static_cast<LoopbackMode>(args[0]);
// ACL channel
uint16_t acl_handle = 0x123;
auto packet_acl = bluetooth::hci::ConnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, acl_handle, properties_.GetAddress(),
+ ErrorCode::SUCCESS, acl_handle, properties_.GetAddress(),
bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet_acl));
// SCO channel
uint16_t sco_handle = 0x345;
auto packet_sco = bluetooth::hci::ConnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, sco_handle, properties_.GetAddress(),
+ ErrorCode::SUCCESS, sco_handle, properties_.GetAddress(),
bluetooth::hci::LinkType::SCO, bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet_sco));
auto packet = bluetooth::hci::WriteLoopbackModeCompleteBuilder::Create(
- kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+ kNumCommandPackets, ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
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 d7c41e5..b024cbb 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
@@ -34,6 +34,7 @@
namespace test_vendor_lib {
using ::bluetooth::hci::Address;
+using ::bluetooth::packet::PacketView;
// Emulates a dual mode BR/EDR + LE controller by maintaining the link layer
// state machine detailed in the Bluetooth Core Specification Version 4.2,
@@ -106,326 +107,315 @@
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.1
// 7.1.1
- void HciInquiry(bluetooth::packet::PacketView<true> args);
+ void HciInquiry(PacketView<true> args);
// 7.1.2
- void HciInquiryCancel(bluetooth::packet::PacketView<true> args);
+ void HciInquiryCancel(PacketView<true> args);
// 7.1.5
- void HciCreateConnection(bluetooth::packet::PacketView<true> args);
+ void HciCreateConnection(PacketView<true> args);
// 7.1.6
- void HciDisconnect(bluetooth::packet::PacketView<true> args);
+ void HciDisconnect(PacketView<true> args);
// 7.1.8
- void HciAcceptConnectionRequest(bluetooth::packet::PacketView<true> args);
+ void HciAcceptConnectionRequest(PacketView<true> args);
// 7.1.9
- void HciRejectConnectionRequest(bluetooth::packet::PacketView<true> args);
+ void HciRejectConnectionRequest(PacketView<true> args);
// 7.1.10
- void HciLinkKeyRequestReply(bluetooth::packet::PacketView<true> args);
+ void HciLinkKeyRequestReply(PacketView<true> args);
// 7.1.11
- void HciLinkKeyRequestNegativeReply(bluetooth::packet::PacketView<true> args);
+ void HciLinkKeyRequestNegativeReply(PacketView<true> args);
// 7.1.14
- void HciChangeConnectionPacketType(bluetooth::packet::PacketView<true> args);
+ void HciChangeConnectionPacketType(PacketView<true> args);
// 7.1.15
- void HciAuthenticationRequested(bluetooth::packet::PacketView<true> args);
+ void HciAuthenticationRequested(PacketView<true> args);
// 7.1.16
- void HciSetConnectionEncryption(bluetooth::packet::PacketView<true> args);
+ void HciSetConnectionEncryption(PacketView<true> args);
// 7.1.17
- void HciChangeConnectionLinkKey(bluetooth::packet::PacketView<true> args);
+ void HciChangeConnectionLinkKey(PacketView<true> args);
// 7.1.18
- void HciMasterLinkKey(bluetooth::packet::PacketView<true> args);
+ void HciMasterLinkKey(PacketView<true> args);
// 7.1.19
- void HciRemoteNameRequest(bluetooth::packet::PacketView<true> args);
+ void HciRemoteNameRequest(PacketView<true> args);
// 7.2.8
- void HciSwitchRole(bluetooth::packet::PacketView<true> args);
+ void HciSwitchRole(PacketView<true> args);
// 7.1.21
- void HciReadRemoteSupportedFeatures(bluetooth::packet::PacketView<true> args);
+ void HciReadRemoteSupportedFeatures(PacketView<true> args);
// 7.1.22
- void HciReadRemoteExtendedFeatures(bluetooth::packet::PacketView<true> args);
+ void HciReadRemoteExtendedFeatures(PacketView<true> args);
// 7.1.23
- void HciReadRemoteVersionInformation(
- bluetooth::packet::PacketView<true> args);
+ void HciReadRemoteVersionInformation(PacketView<true> args);
// 7.1.24
- void HciReadClockOffset(bluetooth::packet::PacketView<true> args);
+ void HciReadClockOffset(PacketView<true> args);
// 7.1.29
- void HciIoCapabilityRequestReply(bluetooth::packet::PacketView<true> args);
+ void HciIoCapabilityRequestReply(PacketView<true> args);
// 7.1.30
- void HciUserConfirmationRequestReply(
- bluetooth::packet::PacketView<true> args);
+ void HciUserConfirmationRequestReply(PacketView<true> args);
// 7.1.31
- void HciUserConfirmationRequestNegativeReply(
- bluetooth::packet::PacketView<true> args);
+ void HciUserConfirmationRequestNegativeReply(PacketView<true> args);
// 7.1.32
- void HciUserPasskeyRequestReply(bluetooth::packet::PacketView<true> args);
+ void HciUserPasskeyRequestReply(PacketView<true> args);
// 7.1.33
- void HciUserPasskeyRequestNegativeReply(
- bluetooth::packet::PacketView<true> args);
+ void HciUserPasskeyRequestNegativeReply(PacketView<true> args);
// 7.1.34
- void HciRemoteOobDataRequestReply(bluetooth::packet::PacketView<true> args);
+ void HciRemoteOobDataRequestReply(PacketView<true> args);
// 7.1.35
- void HciRemoteOobDataRequestNegativeReply(
- bluetooth::packet::PacketView<true> args);
+ void HciRemoteOobDataRequestNegativeReply(PacketView<true> args);
// 7.1.36
- void HciIoCapabilityRequestNegativeReply(
- bluetooth::packet::PacketView<true> args);
+ void HciIoCapabilityRequestNegativeReply(PacketView<true> args);
// Link Policy Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.2
// 7.2.1
- void HciHoldMode(bluetooth::packet::PacketView<true> args);
+ void HciHoldMode(PacketView<true> args);
// 7.2.2
- void HciSniffMode(bluetooth::packet::PacketView<true> args);
+ void HciSniffMode(PacketView<true> args);
// 7.2.3
- void HciExitSniffMode(bluetooth::packet::PacketView<true> args);
+ void HciExitSniffMode(PacketView<true> args);
// 7.2.6
- void HciQosSetup(bluetooth::packet::PacketView<true> args);
+ void HciQosSetup(PacketView<true> args);
// 7.2.10
- void HciWriteLinkPolicySettings(bluetooth::packet::PacketView<true> args);
+ void HciWriteLinkPolicySettings(PacketView<true> args);
// 7.2.12
- void HciWriteDefaultLinkPolicySettings(
- bluetooth::packet::PacketView<true> args);
+ void HciWriteDefaultLinkPolicySettings(PacketView<true> args);
// 7.2.13
- void HciFlowSpecification(bluetooth::packet::PacketView<true> args);
+ void HciFlowSpecification(PacketView<true> args);
// 7.2.14
- void HciSniffSubrating(bluetooth::packet::PacketView<true> args);
+ void HciSniffSubrating(PacketView<true> args);
// Link Controller Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.3
// 7.3.1
- void HciSetEventMask(bluetooth::packet::PacketView<true> args);
+ void HciSetEventMask(PacketView<true> args);
// 7.3.2
- void HciReset(bluetooth::packet::PacketView<true> args);
+ void HciReset(PacketView<true> args);
// 7.3.3
- void HciSetEventFilter(bluetooth::packet::PacketView<true> args);
+ void HciSetEventFilter(PacketView<true> args);
// 7.3.10
- void HciDeleteStoredLinkKey(bluetooth::packet::PacketView<true> args);
+ void HciDeleteStoredLinkKey(PacketView<true> args);
// 7.3.11
- void HciWriteLocalName(bluetooth::packet::PacketView<true> args);
+ void HciWriteLocalName(PacketView<true> args);
// 7.3.12
- void HciReadLocalName(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalName(PacketView<true> args);
// 7.3.16
- void HciWritePageTimeout(bluetooth::packet::PacketView<true> args);
+ void HciWritePageTimeout(PacketView<true> args);
// 7.3.18
- void HciWriteScanEnable(bluetooth::packet::PacketView<true> args);
+ void HciWriteScanEnable(PacketView<true> args);
// 7.3.22
- void HciWriteInquiryScanActivity(bluetooth::packet::PacketView<true> args);
+ void HciWriteInquiryScanActivity(PacketView<true> args);
// 7.3.23
- void HciReadAuthenticationEnable(bluetooth::packet::PacketView<true> args);
+ void HciReadAuthenticationEnable(PacketView<true> args);
// 7.3.24
- void HciWriteAuthenticationEnable(bluetooth::packet::PacketView<true> args);
+ void HciWriteAuthenticationEnable(PacketView<true> args);
// 7.3.26
- void HciWriteClassOfDevice(bluetooth::packet::PacketView<true> args);
+ void HciWriteClassOfDevice(PacketView<true> args);
// 7.3.28
- void HciWriteVoiceSetting(bluetooth::packet::PacketView<true> args);
+ void HciWriteVoiceSetting(PacketView<true> args);
// 7.3.39
- void HciHostBufferSize(bluetooth::packet::PacketView<true> args);
+ void HciHostBufferSize(PacketView<true> args);
// 7.3.42
- void HciWriteLinkSupervisionTimeout(bluetooth::packet::PacketView<true> args);
+ void HciWriteLinkSupervisionTimeout(PacketView<true> args);
// 7.3.45
- void HciWriteCurrentIacLap(bluetooth::packet::PacketView<true> args);
+ void HciWriteCurrentIacLap(PacketView<true> args);
// 7.3.48
- void HciWriteInquiryScanType(bluetooth::packet::PacketView<true> args);
+ void HciWriteInquiryScanType(PacketView<true> args);
// 7.3.50
- void HciWriteInquiryMode(bluetooth::packet::PacketView<true> args);
+ void HciWriteInquiryMode(PacketView<true> args);
// 7.3.52
- void HciWritePageScanType(bluetooth::packet::PacketView<true> args);
+ void HciWritePageScanType(PacketView<true> args);
// 7.3.56
- void HciWriteExtendedInquiryResponse(
- bluetooth::packet::PacketView<true> args);
+ void HciWriteExtendedInquiryResponse(PacketView<true> args);
// 7.3.57
- void HciRefreshEncryptionKey(bluetooth::packet::PacketView<true> args);
+ void HciRefreshEncryptionKey(PacketView<true> args);
// 7.3.59
- void HciWriteSimplePairingMode(bluetooth::packet::PacketView<true> args);
+ void HciWriteSimplePairingMode(PacketView<true> args);
// 7.3.79
- void HciWriteLeHostSupport(bluetooth::packet::PacketView<true> args);
+ void HciWriteLeHostSupport(PacketView<true> args);
// 7.3.92
- void HciWriteSecureConnectionsHostSupport(
- bluetooth::packet::PacketView<true> args);
+ void HciWriteSecureConnectionsHostSupport(PacketView<true> args);
// Informational Parameters Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.4
// 7.4.5
- void HciReadBufferSize(bluetooth::packet::PacketView<true> args);
+ void HciReadBufferSize(PacketView<true> args);
// 7.4.1
- void HciReadLocalVersionInformation(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalVersionInformation(PacketView<true> args);
// 7.4.6
- void HciReadBdAddr(bluetooth::packet::PacketView<true> args);
+ void HciReadBdAddr(PacketView<true> args);
// 7.4.2
- void HciReadLocalSupportedCommands(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalSupportedCommands(PacketView<true> args);
// 7.4.3
- void HciReadLocalSupportedFeatures(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalSupportedFeatures(PacketView<true> args);
// 7.4.4
- void HciReadLocalExtendedFeatures(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalExtendedFeatures(PacketView<true> args);
// 7.4.8
- void HciReadLocalSupportedCodecs(bluetooth::packet::PacketView<true> args);
+ void HciReadLocalSupportedCodecs(PacketView<true> args);
// Status Parameters Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.5
// 7.5.7
- void HciReadEncryptionKeySize(bluetooth::packet::PacketView<true> args);
+ void HciReadEncryptionKeySize(PacketView<true> args);
// Test Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.7
// 7.7.1
- void HciReadLoopbackMode(bluetooth::packet::PacketView<true> args);
+ void HciReadLoopbackMode(PacketView<true> args);
// 7.7.2
- void HciWriteLoopbackMode(bluetooth::packet::PacketView<true> args);
+ void HciWriteLoopbackMode(PacketView<true> args);
// LE Controller Commands
// Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8
// 7.8.1
- void HciLeSetEventMask(bluetooth::packet::PacketView<true> args);
+ void HciLeSetEventMask(PacketView<true> args);
// 7.8.2
- void HciLeReadBufferSize(bluetooth::packet::PacketView<true> args);
+ void HciLeReadBufferSize(PacketView<true> args);
// 7.8.3
- void HciLeReadLocalSupportedFeatures(
- bluetooth::packet::PacketView<true> args);
+ void HciLeReadLocalSupportedFeatures(PacketView<true> args);
// 7.8.4
- void HciLeSetRandomAddress(bluetooth::packet::PacketView<true> args);
+ void HciLeSetRandomAddress(PacketView<true> args);
// 7.8.5
- void HciLeSetAdvertisingParameters(bluetooth::packet::PacketView<true> args);
+ void HciLeSetAdvertisingParameters(PacketView<true> args);
// 7.8.7
- void HciLeSetAdvertisingData(bluetooth::packet::PacketView<true> args);
+ void HciLeSetAdvertisingData(PacketView<true> args);
// 7.8.8
- void HciLeSetScanResponseData(bluetooth::packet::PacketView<true> args);
+ void HciLeSetScanResponseData(PacketView<true> args);
// 7.8.9
- void HciLeSetAdvertisingEnable(bluetooth::packet::PacketView<true> args);
+ void HciLeSetAdvertisingEnable(PacketView<true> args);
// 7.8.10
- void HciLeSetScanParameters(bluetooth::packet::PacketView<true> args);
+ void HciLeSetScanParameters(PacketView<true> args);
// 7.8.11
- void HciLeSetScanEnable(bluetooth::packet::PacketView<true> args);
+ void HciLeSetScanEnable(PacketView<true> args);
// 7.8.12
- void HciLeCreateConnection(bluetooth::packet::PacketView<true> args);
+ void HciLeCreateConnection(PacketView<true> args);
// 7.8.18
- void HciLeConnectionUpdate(bluetooth::packet::PacketView<true> args);
+ void HciLeConnectionUpdate(PacketView<true> args);
// 7.8.13
- void HciLeConnectionCancel(bluetooth::packet::PacketView<true> args);
+ void HciLeConnectionCancel(PacketView<true> args);
// 7.8.14
- void HciLeReadWhiteListSize(bluetooth::packet::PacketView<true> args);
+ void HciLeReadWhiteListSize(PacketView<true> args);
// 7.8.15
- void HciLeClearWhiteList(bluetooth::packet::PacketView<true> args);
+ void HciLeClearWhiteList(PacketView<true> args);
// 7.8.16
- void HciLeAddDeviceToWhiteList(bluetooth::packet::PacketView<true> args);
+ void HciLeAddDeviceToWhiteList(PacketView<true> args);
// 7.8.17
- void HciLeRemoveDeviceFromWhiteList(bluetooth::packet::PacketView<true> args);
+ void HciLeRemoveDeviceFromWhiteList(PacketView<true> args);
// 7.8.21
- void HciLeReadRemoteFeatures(bluetooth::packet::PacketView<true> args);
+ void HciLeReadRemoteFeatures(PacketView<true> args);
// 7.8.23
- void HciLeRand(bluetooth::packet::PacketView<true> args);
+ void HciLeRand(PacketView<true> args);
// 7.8.24
- void HciLeStartEncryption(bluetooth::packet::PacketView<true> args);
+ void HciLeStartEncryption(PacketView<true> args);
// 7.8.27
- void HciLeReadSupportedStates(bluetooth::packet::PacketView<true> args);
+ void HciLeReadSupportedStates(PacketView<true> args);
// 7.8.38
- void HciLeAddDeviceToResolvingList(bluetooth::packet::PacketView<true> args);
+ void HciLeAddDeviceToResolvingList(PacketView<true> args);
// 7.8.39
- void HciLeRemoveDeviceFromResolvingList(
- bluetooth::packet::PacketView<true> args);
+ void HciLeRemoveDeviceFromResolvingList(PacketView<true> args);
// 7.8.40
- void HciLeClearResolvingList(bluetooth::packet::PacketView<true> args);
+ void HciLeClearResolvingList(PacketView<true> args);
// 7.8.77
- void HciLeSetPrivacyMode(bluetooth::packet::PacketView<true> args);
+ void HciLeSetPrivacyMode(PacketView<true> args);
// Vendor-specific Commands
- 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 HciLeVendorSleepMode(PacketView<true> args);
+ void HciLeVendorCap(PacketView<true> args);
+ void HciLeVendorMultiAdv(PacketView<true> args);
+ void HciLeVendor155(PacketView<true> args);
+ void HciLeVendor157(PacketView<true> args);
+ void HciLeEnergyInfo(PacketView<true> args);
+ void HciLeAdvertisingFilter(PacketView<true> args);
+ void HciLeExtendedScanParams(PacketView<true> args);
void SetTimerPeriod(std::chrono::milliseconds new_period);
void StartTimer();
@@ -453,8 +443,7 @@
// 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(bluetooth::packet::PacketView<true>)>>
+ std::unordered_map<uint16_t, std::function<void(PacketView<true>)>>
active_hci_commands_;
bluetooth::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 d5f3ba7..8f0975d 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
@@ -55,65 +55,64 @@
});
}
-bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByAddress(
- bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
+ErrorCode LinkLayerController::SendCommandToRemoteByAddress(
+ OpCode opcode, bluetooth::packet::PacketView<true> args,
const Address& remote) {
Address local_address = properties_.GetAddress();
switch (opcode) {
- case (bluetooth::hci::OpCode::REMOTE_NAME_REQUEST):
+ case (OpCode::REMOTE_NAME_REQUEST):
// LMP features get requested with remote name requests.
SendLinkLayerPacket(model::packets::ReadRemoteLmpFeaturesBuilder::Create(
local_address, remote));
SendLinkLayerPacket(model::packets::RemoteNameRequestBuilder::Create(
local_address, remote));
break;
- case (bluetooth::hci::OpCode::READ_REMOTE_SUPPORTED_FEATURES):
+ case (OpCode::READ_REMOTE_SUPPORTED_FEATURES):
SendLinkLayerPacket(
model::packets::ReadRemoteSupportedFeaturesBuilder::Create(
local_address, remote));
break;
- case (bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES): {
+ case (OpCode::READ_REMOTE_EXTENDED_FEATURES): {
uint8_t page_number =
(args.begin() + 2).extract<uint8_t>(); // skip the handle
SendLinkLayerPacket(
model::packets::ReadRemoteExtendedFeaturesBuilder::Create(
local_address, remote, page_number));
} break;
- case (bluetooth::hci::OpCode::READ_REMOTE_VERSION_INFORMATION):
+ case (OpCode::READ_REMOTE_VERSION_INFORMATION):
SendLinkLayerPacket(
model::packets::ReadRemoteVersionInformationBuilder::Create(
local_address, remote));
break;
- case (bluetooth::hci::OpCode::READ_CLOCK_OFFSET):
+ case (OpCode::READ_CLOCK_OFFSET):
SendLinkLayerPacket(model::packets::ReadClockOffsetBuilder::Create(
local_address, remote));
break;
default:
LOG_INFO("Dropping unhandled command 0x%04x",
static_cast<uint16_t>(opcode));
- return bluetooth::hci::ErrorCode::UNKNOWN_HCI_COMMAND;
+ return ErrorCode::UNKNOWN_HCI_COMMAND;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
- uint16_t handle) {
+ErrorCode LinkLayerController::SendCommandToRemoteByHandle(
+ OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle) {
// TODO: Handle LE connections
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
return SendCommandToRemoteByAddress(opcode, args,
connections_.GetAddress(handle));
}
-bluetooth::hci::ErrorCode LinkLayerController::SendAclToRemote(
+ErrorCode LinkLayerController::SendAclToRemote(
bluetooth::hci::AclPacketView acl_packet) {
uint16_t handle = acl_packet.GetHandle();
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
Address my_address = properties_.GetAddress();
@@ -154,7 +153,7 @@
my_address, destination, std::move(raw_builder_ptr));
SendLinkLayerPacket(std::move(acl));
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::IncomingPacket(
@@ -321,8 +320,7 @@
ASSERT(view.IsValid());
send_event_(bluetooth::hci::RemoteNameRequestCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, packet.GetSourceAddress(),
- view.GetName()));
+ ErrorCode::SUCCESS, packet.GetSourceAddress(), view.GetName()));
}
void LinkLayerController::IncomingReadRemoteLmpFeatures(
@@ -360,7 +358,7 @@
uint16_t handle = connections_.GetHandle(source);
send_event_(
bluetooth::hci::ReadRemoteSupportedFeaturesCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetFeatures()));
+ ErrorCode::SUCCESS, handle, view.GetFeatures()));
} else {
LOG_INFO("Discarding response from a disconnected device %s",
source.ToString().c_str());
@@ -372,10 +370,9 @@
auto view = model::packets::ReadRemoteExtendedFeaturesView::Create(packet);
ASSERT(view.IsValid());
uint8_t page_number = view.GetPageNumber();
- uint8_t error_code = static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS);
+ uint8_t error_code = static_cast<uint8_t>(ErrorCode::SUCCESS);
if (page_number > properties_.GetExtendedFeaturesMaximumPageNumber()) {
- error_code = static_cast<uint8_t>(
- bluetooth::hci::ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
+ error_code = static_cast<uint8_t>(ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
}
SendLinkLayerPacket(
model::packets::ReadRemoteExtendedFeaturesResponseBuilder::Create(
@@ -394,7 +391,7 @@
uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
send_event_(
bluetooth::hci::ReadRemoteExtendedFeaturesCompleteBuilder::Create(
- static_cast<bluetooth::hci::ErrorCode>(view.GetStatus()), handle,
+ static_cast<ErrorCode>(view.GetStatus()), handle,
view.GetPageNumber(), view.GetMaxPageNumber(), view.GetFeatures()));
} else {
LOG_INFO("Discarding response from a disconnected device %s",
@@ -420,7 +417,7 @@
uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
send_event_(
bluetooth::hci::ReadRemoteVersionInformationCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetLmpVersion(),
+ ErrorCode::SUCCESS, handle, view.GetLmpVersion(),
view.GetManufacturerName(), view.GetLmpSubversion()));
} else {
LOG_INFO("Discarding response from a disconnected device %s",
@@ -443,7 +440,7 @@
if (connections_.IsDeviceConnected(source)) {
uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
send_event_(bluetooth::hci::ReadClockOffsetCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetOffset()));
+ ErrorCode::SUCCESS, handle, view.GetOffset()));
} else {
LOG_INFO("Discarding response from a disconnected device %s",
source.ToString().c_str());
@@ -480,8 +477,7 @@
return;
}
send_event_(bluetooth::hci::EncryptionChangeBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
- bluetooth::hci::EncryptionEnabled::ON));
+ ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::ON));
uint16_t count = security_manager_.ReadKey(peer);
if (count == 0) {
@@ -505,8 +501,7 @@
return;
}
auto packet = bluetooth::hci::EncryptionChangeBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
- bluetooth::hci::EncryptionEnabled::ON);
+ ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::ON);
send_event_(std::move(packet));
}
@@ -776,8 +771,7 @@
return;
}
auto packet = bluetooth::hci::LeConnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
- static_cast<bluetooth::hci::Role>(role),
+ ErrorCode::SUCCESS, handle, static_cast<bluetooth::hci::Role>(role),
static_cast<bluetooth::hci::AddressType>(address_type), address,
connection_interval, connection_latency, supervision_timeout,
static_cast<bluetooth::hci::MasterClockAccuracy>(0x00));
@@ -895,7 +889,7 @@
ASSERT(reject.IsValid());
LOG_INFO("%s: Sending CreateConnectionComplete", __func__);
auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
- static_cast<bluetooth::hci::ErrorCode>(reject.GetReason()), 0x0eff,
+ static_cast<ErrorCode>(reject.GetReason()), 0x0eff,
incoming.GetSourceAddress(), bluetooth::hci::LinkType::ACL,
bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet));
@@ -912,7 +906,7 @@
return;
}
auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, incoming.GetSourceAddress(),
+ ErrorCode::SUCCESS, handle, incoming.GetSourceAddress(),
bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet));
@@ -1072,37 +1066,37 @@
ASSERT(security_manager_.GetAuthenticationAddress() == peer);
// Check key in security_manager_ ?
auto packet = bluetooth::hci::AuthenticationCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle);
+ ErrorCode::SUCCESS, handle);
send_event_(std::move(packet));
}
-bluetooth::hci::ErrorCode LinkLayerController::LinkKeyRequestReply(
+ErrorCode LinkLayerController::LinkKeyRequestReply(
const Address& peer, const std::array<uint8_t, 16>& key) {
security_manager_.WriteKey(peer, key);
security_manager_.AuthenticationRequestFinished();
ScheduleTask(milliseconds(5), [this, peer]() { AuthenticateRemoteStage2(peer); });
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::LinkKeyRequestNegativeReply(
+ErrorCode LinkLayerController::LinkKeyRequestNegativeReply(
const Address& address) {
security_manager_.DeleteKey(address);
// Simple pairing to get a key
uint16_t handle = connections_.GetHandle(address);
if (handle == acl::kReservedHandle) {
LOG_INFO("%s: Device not connected %s", __func__, address.ToString().c_str());
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
security_manager_.AuthenticationRequest(address, handle);
ScheduleTask(milliseconds(5), [this, address]() { StartSimplePairing(address); });
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::IoCapabilityRequestReply(
+ErrorCode LinkLayerController::IoCapabilityRequestReply(
const Address& peer, uint8_t io_capability, uint8_t oob_data_present_flag,
uint8_t authentication_requirements) {
security_manager_.SetLocalIoCapability(peer, io_capability, oob_data_present_flag, authentication_requirements);
@@ -1124,13 +1118,13 @@
authentication_requirements));
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::IoCapabilityRequestNegativeReply(
- const Address& peer, bluetooth::hci::ErrorCode reason) {
+ErrorCode LinkLayerController::IoCapabilityRequestNegativeReply(
+ const Address& peer, ErrorCode reason) {
if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+ return ErrorCode::AUTHENTICATION_FAILURE;
}
security_manager_.InvalidateIoCapabilities();
@@ -1139,13 +1133,13 @@
properties_.GetAddress(), peer, static_cast<uint8_t>(reason));
SendLinkLayerPacket(std::move(packet));
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::UserConfirmationRequestReply(
+ErrorCode LinkLayerController::UserConfirmationRequestReply(
const Address& peer) {
if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+ return ErrorCode::AUTHENTICATION_FAILURE;
}
// TODO: Key could be calculated here.
std::array<uint8_t, 16> key_vec{1, 2, 3, 4, 5, 6, 7, 8,
@@ -1161,50 +1155,50 @@
ScheduleTask(milliseconds(15),
[this, peer]() { AuthenticateRemoteStage2(peer); });
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode
-LinkLayerController::UserConfirmationRequestNegativeReply(const Address& peer) {
- if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
- }
- return bluetooth::hci::ErrorCode::SUCCESS;
-}
-
-bluetooth::hci::ErrorCode LinkLayerController::UserPasskeyRequestReply(
- const Address& peer, uint32_t numeric_value) {
- if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
- }
- LOG_INFO("TODO:Do something with the passkey %06d", numeric_value);
- return bluetooth::hci::ErrorCode::SUCCESS;
-}
-
-bluetooth::hci::ErrorCode LinkLayerController::UserPasskeyRequestNegativeReply(
+ErrorCode LinkLayerController::UserConfirmationRequestNegativeReply(
const Address& peer) {
if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+ return ErrorCode::AUTHENTICATION_FAILURE;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::RemoteOobDataRequestReply(
+ErrorCode LinkLayerController::UserPasskeyRequestReply(const Address& peer,
+ uint32_t numeric_value) {
+ if (security_manager_.GetAuthenticationAddress() != peer) {
+ return ErrorCode::AUTHENTICATION_FAILURE;
+ }
+ LOG_INFO("TODO:Do something with the passkey %06d", numeric_value);
+ return ErrorCode::SUCCESS;
+}
+
+ErrorCode LinkLayerController::UserPasskeyRequestNegativeReply(
+ const Address& peer) {
+ if (security_manager_.GetAuthenticationAddress() != peer) {
+ return ErrorCode::AUTHENTICATION_FAILURE;
+ }
+ return ErrorCode::SUCCESS;
+}
+
+ErrorCode LinkLayerController::RemoteOobDataRequestReply(
const Address& peer, const std::vector<uint8_t>& c,
const std::vector<uint8_t>& r) {
if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+ return ErrorCode::AUTHENTICATION_FAILURE;
}
LOG_INFO("TODO:Do something with the OOB data c=%d r=%d", c[0], r[0]);
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode
-LinkLayerController::RemoteOobDataRequestNegativeReply(const Address& peer) {
+ErrorCode LinkLayerController::RemoteOobDataRequestNegativeReply(
+ const Address& peer) {
if (security_manager_.GetAuthenticationAddress() != peer) {
- return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+ return ErrorCode::AUTHENTICATION_FAILURE;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::HandleAuthenticationRequest(const Address& address, uint16_t handle) {
@@ -1215,23 +1209,22 @@
} else { // Should never happen for our phones
// Check for a key, try to authenticate, ask for a PIN.
auto packet = bluetooth::hci::AuthenticationCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE, handle);
+ ErrorCode::AUTHENTICATION_FAILURE, handle);
send_event_(std::move(packet));
}
}
-bluetooth::hci::ErrorCode LinkLayerController::AuthenticationRequested(
- uint16_t handle) {
+ErrorCode LinkLayerController::AuthenticationRequested(uint16_t handle) {
if (!connections_.HasHandle(handle)) {
LOG_INFO("Authentication Requested for unknown handle %04x", handle);
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
Address remote = connections_.GetAddress(handle);
ScheduleTask(milliseconds(5), [this, remote, handle]() { HandleAuthenticationRequest(remote, handle); });
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::HandleSetConnectionEncryption(const Address& peer, uint16_t handle,
@@ -1240,7 +1233,7 @@
if (connections_.IsEncrypted(handle) && encryption_enable) {
auto packet = bluetooth::hci::EncryptionChangeBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
+ ErrorCode::SUCCESS, handle,
static_cast<bluetooth::hci::EncryptionEnabled>(encryption_enable));
send_event_(std::move(packet));
return;
@@ -1258,33 +1251,33 @@
SendLinkLayerPacket(std::move(packet));
}
-bluetooth::hci::ErrorCode LinkLayerController::SetConnectionEncryption(
+ErrorCode LinkLayerController::SetConnectionEncryption(
uint16_t handle, uint8_t encryption_enable) {
if (!connections_.HasHandle(handle)) {
LOG_INFO("Set Connection Encryption for unknown handle %04x", handle);
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
if (connections_.IsEncrypted(handle) && !encryption_enable) {
- return bluetooth::hci::ErrorCode::ENCRYPTION_MODE_NOT_ACCEPTABLE;
+ return ErrorCode::ENCRYPTION_MODE_NOT_ACCEPTABLE;
}
Address remote = connections_.GetAddress(handle);
if (security_manager_.ReadKey(remote) == 0) {
- return bluetooth::hci::ErrorCode::PIN_OR_KEY_MISSING;
+ return ErrorCode::PIN_OR_KEY_MISSING;
}
ScheduleTask(milliseconds(5), [this, remote, handle, encryption_enable]() {
HandleSetConnectionEncryption(remote, handle, encryption_enable);
});
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::AcceptConnectionRequest(
- const Address& addr, bool try_role_switch) {
+ErrorCode LinkLayerController::AcceptConnectionRequest(const Address& addr,
+ bool try_role_switch) {
if (!connections_.HasPendingConnection(addr)) {
LOG_INFO("%s: No pending connection for %s", __func__, addr.ToString().c_str());
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
LOG_INFO("%s: Accept in 200ms", __func__);
@@ -1293,7 +1286,7 @@
MakeSlaveConnection(addr, try_role_switch);
});
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::MakeSlaveConnection(const Address& addr, bool try_role_switch) {
@@ -1309,22 +1302,22 @@
}
LOG_INFO("%s CreateConnection returned handle 0x%x", __func__, handle);
auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, addr,
- bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
+ ErrorCode::SUCCESS, handle, addr, bluetooth::hci::LinkType::ACL,
+ bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet));
}
-bluetooth::hci::ErrorCode LinkLayerController::RejectConnectionRequest(
- const Address& addr, uint8_t reason) {
+ErrorCode LinkLayerController::RejectConnectionRequest(const Address& addr,
+ uint8_t reason) {
if (!connections_.HasPendingConnection(addr)) {
LOG_INFO("%s: No pending connection for %s", __func__, addr.ToString().c_str());
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
ScheduleTask(milliseconds(200),
[this, addr, reason]() { RejectSlaveConnection(addr, reason); });
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::RejectSlaveConnection(const Address& addr, uint8_t reason) {
@@ -1335,39 +1328,37 @@
SendLinkLayerPacket(std::move(to_send));
auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
- static_cast<bluetooth::hci::ErrorCode>(reason), 0xeff, addr,
+ static_cast<ErrorCode>(reason), 0xeff, addr,
bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
send_event_(std::move(packet));
}
-bluetooth::hci::ErrorCode LinkLayerController::CreateConnection(
- const Address& addr, uint16_t, uint8_t, uint16_t,
- uint8_t allow_role_switch) {
+ErrorCode LinkLayerController::CreateConnection(const Address& addr, uint16_t,
+ uint8_t, uint16_t,
+ uint8_t allow_role_switch) {
if (!connections_.CreatePendingConnection(
addr, properties_.GetAuthenticationEnable() == 1)) {
- return bluetooth::hci::ErrorCode::CONTROLLER_BUSY;
+ return ErrorCode::CONTROLLER_BUSY;
}
auto page = model::packets::PageBuilder::Create(
properties_.GetAddress(), addr, properties_.GetClassOfDevice(),
allow_role_switch);
SendLinkLayerPacket(std::move(page));
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::CreateConnectionCancel(
- const Address& addr) {
+ErrorCode LinkLayerController::CreateConnectionCancel(const Address& addr) {
if (!connections_.CancelPendingConnection(addr)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::Disconnect(uint16_t handle,
- uint8_t reason) {
+ErrorCode LinkLayerController::Disconnect(uint16_t handle, uint8_t reason) {
// TODO: Handle LE
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
const Address& remote = connections_.GetAddress(handle);
@@ -1379,145 +1370,144 @@
ScheduleTask(milliseconds(20), [this, handle]() {
DisconnectCleanup(
handle,
- static_cast<uint8_t>(
- bluetooth::hci::ErrorCode::CONNECTION_TERMINATED_BY_LOCAL_HOST));
+ static_cast<uint8_t>(ErrorCode::CONNECTION_TERMINATED_BY_LOCAL_HOST));
});
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::DisconnectCleanup(uint16_t handle, uint8_t reason) {
// TODO: Clean up other connection state.
auto packet = bluetooth::hci::DisconnectionCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle,
- static_cast<bluetooth::hci::ErrorCode>(reason));
+ ErrorCode::SUCCESS, handle, static_cast<ErrorCode>(reason));
send_event_(std::move(packet));
}
-bluetooth::hci::ErrorCode LinkLayerController::ChangeConnectionPacketType(
- uint16_t handle, uint16_t types) {
+ErrorCode LinkLayerController::ChangeConnectionPacketType(uint16_t handle,
+ uint16_t types) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
auto packet = bluetooth::hci::ConnectionPacketTypeChangedBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS, handle, types);
+ ErrorCode::SUCCESS, handle, types);
std::shared_ptr<bluetooth::hci::ConnectionPacketTypeChangedBuilder>
shared_packet = std::move(packet);
ScheduleTask(milliseconds(20), [this, shared_packet]() {
send_event_(std::move(shared_packet));
});
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::ChangeConnectionLinkKey(
- uint16_t handle) {
+ErrorCode LinkLayerController::ChangeConnectionLinkKey(uint16_t handle) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::MasterLinkKey(
- uint8_t /* key_flag */) {
+ErrorCode LinkLayerController::MasterLinkKey(uint8_t /* key_flag */) {
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::HoldMode(
- uint16_t handle, uint16_t hold_mode_max_interval,
- uint16_t hold_mode_min_interval) {
+ErrorCode LinkLayerController::HoldMode(uint16_t handle,
+ uint16_t hold_mode_max_interval,
+ uint16_t hold_mode_min_interval) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
if (hold_mode_max_interval < hold_mode_min_interval) {
- return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+ return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::SniffMode(
- uint16_t handle, uint16_t sniff_max_interval, uint16_t sniff_min_interval,
- uint16_t sniff_attempt, uint16_t sniff_timeout) {
+ErrorCode LinkLayerController::SniffMode(uint16_t handle,
+ uint16_t sniff_max_interval,
+ uint16_t sniff_min_interval,
+ uint16_t sniff_attempt,
+ uint16_t sniff_timeout) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
if (sniff_max_interval < sniff_min_interval || sniff_attempt < 0x0001 || sniff_attempt > 0x7FFF ||
sniff_timeout > 0x7FFF) {
- return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+ return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::ExitSniffMode(uint16_t handle) {
+ErrorCode LinkLayerController::ExitSniffMode(uint16_t handle) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::QosSetup(
- uint16_t handle, uint8_t service_type, uint32_t /* token_rate */,
- uint32_t /* peak_bandwidth */, uint32_t /* latency */,
- uint32_t /* delay_variation */) {
+ErrorCode LinkLayerController::QosSetup(uint16_t handle, uint8_t service_type,
+ uint32_t /* token_rate */,
+ uint32_t /* peak_bandwidth */,
+ uint32_t /* latency */,
+ uint32_t /* delay_variation */) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
if (service_type > 0x02) {
- return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+ return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::SwitchRole(Address /* bd_addr */,
- uint8_t /* role */) {
+ErrorCode LinkLayerController::SwitchRole(Address /* bd_addr */,
+ uint8_t /* role */) {
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::WriteLinkPolicySettings(
- uint16_t handle, uint16_t) {
+ErrorCode LinkLayerController::WriteLinkPolicySettings(uint16_t handle,
+ uint16_t) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
-bluetooth::hci::ErrorCode LinkLayerController::FlowSpecification(
+ErrorCode LinkLayerController::FlowSpecification(
uint16_t handle, uint8_t flow_direction, uint8_t service_type,
uint32_t /* token_rate */, uint32_t /* token_bucket_size */,
uint32_t /* peak_bandwidth */, uint32_t /* access_latency */) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
if (flow_direction > 0x01 || service_type > 0x02) {
- return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+ return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
}
// TODO: implement real logic
- return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+ return ErrorCode::COMMAND_DISALLOWED;
}
-bluetooth::hci::ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(
- uint16_t handle, uint16_t) {
+ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(uint16_t handle,
+ uint16_t) {
if (!connections_.HasHandle(handle)) {
- return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+ return ErrorCode::UNKNOWN_CONNECTION;
}
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void LinkLayerController::LeWhiteListClear() {
@@ -1635,8 +1625,8 @@
void LinkLayerController::InquiryTimeout() {
if (inquiry_state_ == Inquiry::InquiryState::INQUIRY) {
inquiry_state_ = Inquiry::InquiryState::STANDBY;
- auto packet = bluetooth::hci::InquiryCompleteBuilder::Create(
- bluetooth::hci::ErrorCode::SUCCESS);
+ auto packet =
+ bluetooth::hci::InquiryCompleteBuilder::Create(ErrorCode::SUCCESS);
send_event_(std::move(packet));
}
}
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 487109f..b287123 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
@@ -30,66 +30,57 @@
namespace test_vendor_lib {
using ::bluetooth::hci::Address;
+using ::bluetooth::hci::ErrorCode;
+using ::bluetooth::hci::OpCode;
class LinkLayerController {
public:
static constexpr size_t kIrk_size = 16;
LinkLayerController(const DeviceProperties& properties) : properties_(properties) {}
- bluetooth::hci::ErrorCode SendCommandToRemoteByAddress(
- bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
+ ErrorCode SendCommandToRemoteByAddress(
+ OpCode opcode, bluetooth::packet::PacketView<true> args,
const Address& remote);
- bluetooth::hci::ErrorCode SendCommandToRemoteByHandle(
- bluetooth::hci::OpCode opcode, bluetooth::packet::PacketView<true> args,
- uint16_t handle);
- bluetooth::hci::ErrorCode SendScoToRemote(
- bluetooth::hci::ScoPacketView sco_packet);
- bluetooth::hci::ErrorCode SendAclToRemote(
- bluetooth::hci::AclPacketView acl_packet);
+ ErrorCode SendCommandToRemoteByHandle(
+ OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle);
+ ErrorCode SendScoToRemote(bluetooth::hci::ScoPacketView sco_packet);
+ ErrorCode SendAclToRemote(bluetooth::hci::AclPacketView acl_packet);
void WriteSimplePairingMode(bool enabled);
void StartSimplePairing(const Address& address);
void AuthenticateRemoteStage1(const Address& address, PairingType pairing_type);
void AuthenticateRemoteStage2(const Address& address);
- bluetooth::hci::ErrorCode LinkKeyRequestReply(
- const Address& address, const std::array<uint8_t, 16>& key);
- bluetooth::hci::ErrorCode LinkKeyRequestNegativeReply(const Address& address);
- bluetooth::hci::ErrorCode IoCapabilityRequestReply(
- const Address& peer, uint8_t io_capability, uint8_t oob_data_present_flag,
- uint8_t authentication_requirements);
- bluetooth::hci::ErrorCode IoCapabilityRequestNegativeReply(
- const Address& peer, bluetooth::hci::ErrorCode reason);
- bluetooth::hci::ErrorCode UserConfirmationRequestReply(const Address& peer);
- bluetooth::hci::ErrorCode UserConfirmationRequestNegativeReply(
- const Address& peer);
- bluetooth::hci::ErrorCode UserPasskeyRequestReply(const Address& peer,
- uint32_t numeric_value);
- bluetooth::hci::ErrorCode UserPasskeyRequestNegativeReply(
- const Address& peer);
- bluetooth::hci::ErrorCode RemoteOobDataRequestReply(
- const Address& peer, const std::vector<uint8_t>& c,
- const std::vector<uint8_t>& r);
- bluetooth::hci::ErrorCode RemoteOobDataRequestNegativeReply(
- const Address& peer);
+ ErrorCode LinkKeyRequestReply(const Address& address,
+ const std::array<uint8_t, 16>& key);
+ ErrorCode LinkKeyRequestNegativeReply(const Address& address);
+ ErrorCode IoCapabilityRequestReply(const Address& peer, uint8_t io_capability,
+ uint8_t oob_data_present_flag,
+ uint8_t authentication_requirements);
+ ErrorCode IoCapabilityRequestNegativeReply(const Address& peer,
+ ErrorCode reason);
+ ErrorCode UserConfirmationRequestReply(const Address& peer);
+ ErrorCode UserConfirmationRequestNegativeReply(const Address& peer);
+ ErrorCode UserPasskeyRequestReply(const Address& peer,
+ uint32_t numeric_value);
+ ErrorCode UserPasskeyRequestNegativeReply(const Address& peer);
+ ErrorCode RemoteOobDataRequestReply(const Address& peer,
+ const std::vector<uint8_t>& c,
+ const std::vector<uint8_t>& r);
+ ErrorCode RemoteOobDataRequestNegativeReply(const Address& peer);
void HandleSetConnectionEncryption(const Address& address, uint16_t handle, uint8_t encryption_enable);
- bluetooth::hci::ErrorCode SetConnectionEncryption(uint16_t handle,
- uint8_t encryption_enable);
+ ErrorCode SetConnectionEncryption(uint16_t handle, uint8_t encryption_enable);
void HandleAuthenticationRequest(const Address& address, uint16_t handle);
- bluetooth::hci::ErrorCode AuthenticationRequested(uint16_t handle);
+ ErrorCode AuthenticationRequested(uint16_t handle);
- bluetooth::hci::ErrorCode AcceptConnectionRequest(const Address& addr,
- bool try_role_switch);
+ ErrorCode AcceptConnectionRequest(const Address& addr, bool try_role_switch);
void MakeSlaveConnection(const Address& addr, bool try_role_switch);
- bluetooth::hci::ErrorCode RejectConnectionRequest(const Address& addr,
- uint8_t reason);
+ ErrorCode RejectConnectionRequest(const Address& addr, uint8_t reason);
void RejectSlaveConnection(const Address& addr, uint8_t reason);
- bluetooth::hci::ErrorCode CreateConnection(const Address& addr,
- uint16_t packet_type,
- uint8_t page_scan_mode,
- uint16_t clock_offset,
- uint8_t allow_role_switch);
- bluetooth::hci::ErrorCode CreateConnectionCancel(const Address& addr);
- bluetooth::hci::ErrorCode Disconnect(uint16_t handle, uint8_t reason);
+ ErrorCode CreateConnection(const Address& addr, uint16_t packet_type,
+ uint8_t page_scan_mode, uint16_t clock_offset,
+ uint8_t allow_role_switch);
+ ErrorCode CreateConnectionCancel(const Address& addr);
+ ErrorCode Disconnect(uint16_t handle, uint8_t reason);
private:
void DisconnectCleanup(uint16_t handle, uint8_t reason);
@@ -157,11 +148,10 @@
bool LeResolvingListFull();
void LeSetPrivacyMode(uint8_t address_type, Address addr, uint8_t mode);
- bluetooth::hci::ErrorCode SetLeAdvertisingEnable(
- uint8_t le_advertising_enable) {
+ ErrorCode SetLeAdvertisingEnable(uint8_t le_advertising_enable) {
le_advertising_enable_ = le_advertising_enable;
// TODO: Check properties and return errors
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void SetLeScanEnable(uint8_t le_scan_enable) {
@@ -185,9 +175,9 @@
void SetLeAddressType(uint8_t le_address_type) {
le_address_type_ = le_address_type;
}
- bluetooth::hci::ErrorCode SetLeConnect(bool le_connect) {
+ ErrorCode SetLeConnect(bool le_connect) {
le_connect_ = le_connect;
- return bluetooth::hci::ErrorCode::SUCCESS;
+ return ErrorCode::SUCCESS;
}
void SetLeConnectionIntervalMin(uint16_t min) {
le_connection_interval_min_ = min;
@@ -229,32 +219,25 @@
void SetInquiryScanEnable(bool enable);
void SetPageScanEnable(bool enable);
- bluetooth::hci::ErrorCode ChangeConnectionPacketType(uint16_t handle,
- uint16_t types);
- bluetooth::hci::ErrorCode ChangeConnectionLinkKey(uint16_t handle);
- bluetooth::hci::ErrorCode MasterLinkKey(uint8_t key_flag);
- bluetooth::hci::ErrorCode HoldMode(uint16_t handle,
- uint16_t hold_mode_max_interval,
- uint16_t hold_mode_min_interval);
- bluetooth::hci::ErrorCode SniffMode(uint16_t handle,
- uint16_t sniff_max_interval,
- uint16_t sniff_min_interval,
- uint16_t sniff_attempt,
- uint16_t sniff_timeout);
- bluetooth::hci::ErrorCode ExitSniffMode(uint16_t handle);
- bluetooth::hci::ErrorCode QosSetup(uint16_t handle, uint8_t service_type,
- uint32_t token_rate,
- uint32_t peak_bandwidth, uint32_t latency,
- uint32_t delay_variation);
- bluetooth::hci::ErrorCode SwitchRole(Address bd_addr, uint8_t role);
- bluetooth::hci::ErrorCode WriteLinkPolicySettings(uint16_t handle,
- uint16_t settings);
- bluetooth::hci::ErrorCode FlowSpecification(
- uint16_t handle, uint8_t flow_direction, uint8_t service_type,
- uint32_t token_rate, uint32_t token_bucket_size, uint32_t peak_bandwidth,
- uint32_t access_latency);
- bluetooth::hci::ErrorCode WriteLinkSupervisionTimeout(uint16_t handle,
- uint16_t timeout);
+ ErrorCode ChangeConnectionPacketType(uint16_t handle, uint16_t types);
+ ErrorCode ChangeConnectionLinkKey(uint16_t handle);
+ ErrorCode MasterLinkKey(uint8_t key_flag);
+ ErrorCode HoldMode(uint16_t handle, uint16_t hold_mode_max_interval,
+ uint16_t hold_mode_min_interval);
+ ErrorCode SniffMode(uint16_t handle, uint16_t sniff_max_interval,
+ uint16_t sniff_min_interval, uint16_t sniff_attempt,
+ uint16_t sniff_timeout);
+ ErrorCode ExitSniffMode(uint16_t handle);
+ ErrorCode QosSetup(uint16_t handle, uint8_t service_type, uint32_t token_rate,
+ uint32_t peak_bandwidth, uint32_t latency,
+ uint32_t delay_variation);
+ ErrorCode SwitchRole(Address bd_addr, uint8_t role);
+ ErrorCode WriteLinkPolicySettings(uint16_t handle, uint16_t settings);
+ ErrorCode FlowSpecification(uint16_t handle, uint8_t flow_direction,
+ uint8_t service_type, uint32_t token_rate,
+ uint32_t token_bucket_size,
+ uint32_t peak_bandwidth, uint32_t access_latency);
+ ErrorCode WriteLinkSupervisionTimeout(uint16_t handle, uint16_t timeout);
protected:
void SendLeLinkLayerPacket(