Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Migrate ReadLocalVersionInfoReturnParams to emb
Browse files Browse the repository at this point in the history
Bug: b/42167863
Test: fx test bt-host-gap-tests
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1095819
GitOrigin-RevId: 1ccdb9c2428d1137bf22f183552b12d3289ce701
Change-Id: Icec56872cc2c1f91cb20dd6eae57b2eada961e9d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230574
Reviewed-by: Josh Conner <[email protected]>
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Jason Graffius <[email protected]>
  • Loading branch information
BenjaminLawson authored and CQ Bot Account committed Aug 23, 2024
1 parent 1428e78 commit eb5d242
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
7 changes: 4 additions & 3 deletions pw_bluetooth_sapphire/host/gap/adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -950,15 +950,16 @@ void AdapterImpl::InitializeStep1() {
hci::EmbossCommandPacket::New<
pw::bluetooth::emboss::ReadLocalVersionInformationCommandView>(
hci_spec::kReadLocalVersionInfo),
[this](const hci::EventPacket& cmd_complete) {
[this](const hci::EmbossEventPacket& cmd_complete) {
if (hci_is_error(
cmd_complete, WARN, "gap", "read local version info failed")) {
return;
}
auto params =
cmd_complete
.return_params<hci_spec::ReadLocalVersionInfoReturnParams>();
state_.hci_version = params->hci_version;
.view<pw::bluetooth::emboss::
ReadLocalVersionInfoCommandCompleteEventView>();
state_.hci_version = params.hci_version().Read();
});

// HCI_Read_Local_Supported_Commands
Expand Down
10 changes: 5 additions & 5 deletions pw_bluetooth_sapphire/host/testing/fake_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2196,11 +2196,11 @@ void FakeController::OnReadLocalSupportedCommands() {
}

void FakeController::OnReadLocalVersionInfo() {
hci_spec::ReadLocalVersionInfoReturnParams params;
std::memset(&params, 0, sizeof(params));
params.hci_version = settings_.hci_version;
RespondWithCommandComplete(hci_spec::kReadLocalVersionInfo,
BufferView(&params, sizeof(params)));
auto packet = hci::EmbossEventPacket::New<
pwemb::ReadLocalVersionInfoCommandCompleteEventWriter>(
hci_spec::kCommandCompleteEventCode);
packet.view_t().hci_version().Write(settings_.hci_version);
RespondWithCommandComplete(hci_spec::kReadLocalVersionInfo, &packet);
}

void FakeController::OnReadRemoteNameRequestCommandReceived(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,18 +650,6 @@ constexpr OpCode InformationalParamsOpCode(const uint16_t ocf) {
// Read Local Version Information Command (v1.1)
constexpr OpCode kReadLocalVersionInfo = InformationalParamsOpCode(0x0001);

struct ReadLocalVersionInfoReturnParams {
// See enum StatusCode in hci_constants.h.
StatusCode status;

pw::bluetooth::emboss::CoreSpecificationVersion hci_version;

uint16_t hci_revision;
uint8_t lmp_pal_version;
uint16_t manufacturer_name;
uint16_t lmp_pal_subversion;
} __attribute__((packed));

// ============================================
// Read Local Supported Commands Command (v1.2)
constexpr OpCode kReadLocalSupportedCommands =
Expand Down

0 comments on commit eb5d242

Please sign in to comment.