Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Migrate UserPasskeyNotificationEvent to emboss
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/+/1094894
GitOrigin-RevId: d7f888e75a3ea7edf0ce1b59f27d71c44ec7c9f8
Change-Id: I59d1a40e2ff6ba929aea527cfc06802217e6dadf
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230571
Reviewed-by: Lulu Wang <[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 ad5c105 commit 0e348ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
16 changes: 8 additions & 8 deletions pw_bluetooth_sapphire/host/gap/bredr_connection_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1588,23 +1588,23 @@ BrEdrConnectionManager::OnUserPasskeyRequest(

hci::CommandChannel::EventCallbackResult
BrEdrConnectionManager::OnUserPasskeyNotification(
const hci::EventPacket& event) {
BT_DEBUG_ASSERT(event.event_code() ==
hci_spec::kUserPasskeyNotificationEventCode);
const auto& params =
event.params<hci_spec::UserPasskeyNotificationEventParams>();
const hci::EmbossEventPacket& event_packet) {
auto params =
event_packet
.view<pw::bluetooth::emboss::UserPasskeyNotificationEventView>();
DeviceAddressBytes bd_addr = DeviceAddressBytes(params.bd_addr());

auto conn_pair = FindConnectionByAddress(params.bd_addr);
auto conn_pair = FindConnectionByAddress(bd_addr);
if (!conn_pair) {
bt_log(WARN,
"gap-bredr",
"got %s for unconnected addr %s",
__func__,
bt_str(params.bd_addr));
bt_str(bd_addr));
return hci::CommandChannel::EventCallbackResult::kContinue;
}
conn_pair->second->pairing_state_manager().OnUserPasskeyNotification(
pw::bytes::ConvertOrderFrom(cpp20::endian::little, params.numeric_value));
params.passkey().Read());
return hci::CommandChannel::EventCallbackResult::kContinue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class BrEdrConnectionManager final {
hci::CommandChannel::EventCallbackResult OnUserPasskeyRequest(
const hci::EmbossEventPacket& event_packet);
hci::CommandChannel::EventCallbackResult OnUserPasskeyNotification(
const hci::EventPacket& event);
const hci::EmbossEventPacket& event_packet);
hci::CommandChannel::EventCallbackResult OnRoleChange(
const hci::EmbossEventPacket& event);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,6 @@ struct SimplePairingCompleteEventParams {
// User Passkey Notification Event (v2.1 + EDR) (BR/EDR)
constexpr EventCode kUserPasskeyNotificationEventCode = 0x3B;

struct UserPasskeyNotificationEventParams {
// Address of the device involved in simple pairing process
DeviceAddressBytes bd_addr;

// Numeric value (passkey) entered by user. Valid values are 0 - 999999.
uint32_t numeric_value;
} __attribute__((packed));

// =========================
// LE Meta Event (v4.0) (LE)
constexpr EventCode kLEMetaEventCode = 0x3E;
Expand Down

0 comments on commit 0e348ae

Please sign in to comment.