From 9e54847824b4fc28cd84ac6cf0635c0be689bd7f Mon Sep 17 00:00:00 2001 From: Josh Conner Date: Tue, 29 Oct 2024 20:10:14 +0000 Subject: [PATCH] pw_bluetooth_sapphire: Embossify another packed struct definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the definition of LEReadNumSupportedAdvertisingSetsReturnParams and replace all uses with references to emboss-generated definitions (LEReadNumberOfSupportedAdvertisingSetsCommandCompleteEvent). Bug: b/42167863 Test: pw presubmit --step gn_chre_googletest_nanopb_sapphire_build Change-Id: I913a9c843d778d902100fce61c30a848ef3ebb1a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/245253 Commit-Queue: Josh Conner Docs-Not-Needed: Josh Conner Lint: Lint 🤖 Reviewed-by: Faraaz Sareshwala --- pw_bluetooth_sapphire/host/testing/fake_controller.cc | 11 +++++++---- .../internal/host/hci-spec/protocol.h | 7 ------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/pw_bluetooth_sapphire/host/testing/fake_controller.cc b/pw_bluetooth_sapphire/host/testing/fake_controller.cc index 45963f789..150d9a9f0 100644 --- a/pw_bluetooth_sapphire/host/testing/fake_controller.cc +++ b/pw_bluetooth_sapphire/host/testing/fake_controller.cc @@ -3336,11 +3336,14 @@ void FakeController::OnLEReadMaximumAdvertisingDataLength() { } void FakeController::OnLEReadNumberOfSupportedAdvertisingSets() { - hci_spec::LEReadNumSupportedAdvertisingSetsReturnParams params; - params.status = pwemb::StatusCode::SUCCESS; - params.num_supported_adv_sets = num_supported_advertising_sets_; + auto event = hci::EmbossEventPacket::New< + pwemb::LEReadNumberOfSupportedAdvertisingSetsCommandCompleteEventWriter>( + hci_spec::kCommandCompleteEventCode); + auto view = event.view_t(); + view.status().Write(pwemb::StatusCode::SUCCESS); + view.num_supported_advertising_sets().Write(num_supported_advertising_sets_); RespondWithCommandComplete(hci_spec::kLEReadNumSupportedAdvertisingSets, - BufferView(¶ms, sizeof(params))); + &event); } void FakeController::OnLERemoveAdvertisingSet( diff --git a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h index 06c3031c4..7126fd903 100644 --- a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h +++ b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h @@ -1029,13 +1029,6 @@ constexpr OpCode kLEReadMaximumAdvertisingDataLength = constexpr OpCode kLEReadNumSupportedAdvertisingSets = LEControllerCommandOpCode(0x003B); -struct LEReadNumSupportedAdvertisingSetsReturnParams { - // See enum StatusCode in hci_constants.h. - StatusCode status; - - uint8_t num_supported_adv_sets; -} __attribute__((packed)); - // ============================================= // LE Remove Advertising Set Command (v5.0) (LE) constexpr OpCode kLERemoveAdvertisingSet = LEControllerCommandOpCode(0x003C);