Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Embossify ReadPageScanTypeReturnParams
Browse files Browse the repository at this point in the history
Use emboss definitions instead of a packed struct for generating a
Read Page Scan Type command complete event.

Bug: b/42167863
Test: fx test //src/connectivity/bluetooth/core/bt-host
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1108772
GitOrigin-RevId: ef34b0db722292fbf901c68c2631107623d8749e
Change-Id: Id1181553ae215952f8f0ab0cd4527586360098e8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/232774
Lint: Lint 🤖 <[email protected]>
Pigweed-Auto-Submit: Jason Graffius <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Ben Lawson <[email protected]>
  • Loading branch information
josh-conner authored and CQ Bot Account committed Aug 31, 2024
1 parent aeecd22 commit 2a2c2ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
12 changes: 7 additions & 5 deletions pw_bluetooth_sapphire/host/testing/fake_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1786,11 +1786,13 @@ void FakeController::OnWritePageScanType(
}

void FakeController::OnReadPageScanType() {
hci_spec::ReadPageScanTypeReturnParams params;
params.status = pwemb::StatusCode::SUCCESS;
params.page_scan_type = page_scan_type_;
RespondWithCommandComplete(hci_spec::kReadPageScanType,
BufferView(&params, sizeof(params)));
auto event_packet = hci::EmbossEventPacket::New<
pwemb::ReadPageScanTypeCommandCompleteEventWriter>(
hci_spec::kCommandCompleteEventCode);
auto view = event_packet.view_t();
view.status().Write(pwemb::StatusCode::SUCCESS);
view.page_scan_type().Write(page_scan_type_);
RespondWithCommandComplete(pwemb::OpCode::READ_PAGE_SCAN_TYPE, &event_packet);
}

void FakeController::OnWriteInquiryMode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,6 @@ constexpr OpCode kWriteInquiryMode = ControllerAndBasebandOpCode(0x0045);
// Read Page Scan Type (v1.2) (BR/EDR)
constexpr OpCode kReadPageScanType = ControllerAndBasebandOpCode(0x0046);

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

// See enum class PageScanType in hci_constants.h for possible values.
pw::bluetooth::emboss::PageScanType page_scan_type;
} __attribute__((packed));

// ====================================
// Write Page Scan Type (v1.2) (BR/EDR)
constexpr OpCode kWritePageScanType = ControllerAndBasebandOpCode(0x0047);
Expand Down

0 comments on commit 2a2c2ad

Please sign in to comment.