pw_bluetooth: Add Advertising definitions
Add definitions for the following core packet types:
LE Set Advertising Enable
LE Set Extended Advertising Enable
LE Remove Advertising Set
And the following Android extension packet type:
LE Multi Advertising Enable
Bug: b/265052417
Test: No pigweed regressions. All Sapphire bt-host tests pass when
run with this CL and https://fxrev.dev/798762
Change-Id: Iaabf7417995901f125ad8579308b06b3ae5feaa8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/128490
Reviewed-by: Ben Lawson <benlawson@google.com>
Commit-Queue: Josh Conner <joshconner@google.com>
diff --git a/pw_bluetooth/public/pw_bluetooth/hci.emb b/pw_bluetooth/public/pw_bluetooth/hci.emb
index 6e2c7a1..9772c6e 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci.emb
@@ -883,6 +883,37 @@
$next [+1] GenericEnableParam simple_pairing_mode
+struct LESetAdvertisingEnableCommand:
+ -- LE Set Advertising Enable command (v4.0) (LE)
+ let hdr_size = CommandHeader.$size_in_bytes
+ 0 [+hdr_size] CommandHeader header
+ $next [+1] GenericEnableParam advertising_enable
+
+
+struct LESetExtendedAdvertisingEnableData:
+ -- Data fields for variable-length portion of an LE Set Extended Advertising Enable command
+ 0 [+1] UInt advertising_handle
+ $next [+2] UInt duration
+ $next [+1] UInt max_extended_advertising_events
+
+
+struct LESetExtendedAdvertisingEnableCommand:
+ -- LE Set Extended Advertising Enable command (v5.0) (LE)
+ let hdr_size = CommandHeader.$size_in_bytes
+ 0 [+hdr_size] CommandHeader header
+ $next [+1] GenericEnableParam enable
+ $next [+1] UInt num_sets
+ let single_data_size = LESetExtendedAdvertisingEnableData.$size_in_bytes
+ $next [+single_data_size*num_sets] LESetExtendedAdvertisingEnableData[] data
+
+
+struct LERemoveAdvertisingSetCommand:
+ -- LE Remove Advertising Set command (v5.0) (LE)
+ let hdr_size = CommandHeader.$size_in_bytes
+ 0 [+hdr_size] CommandHeader header
+ $next [+1] UInt advertising_handle
+
+
struct LESetExtendedScanEnableCommand:
-- LE Set Extended Scan Enable Command (v5.0) (LE)
diff --git a/pw_bluetooth/public/pw_bluetooth/vendor.emb b/pw_bluetooth/public/pw_bluetooth/vendor.emb
index d528972..2c5681b 100644
--- a/pw_bluetooth/public/pw_bluetooth/vendor.emb
+++ b/pw_bluetooth/public/pw_bluetooth/vendor.emb
@@ -28,6 +28,18 @@
# Documentation: https://source.android.com/devices/bluetooth/hci_requirements
+# ============ Commands ============
+
+
+struct LEMultiAdvtEnableCommand:
+ -- LE multi-advertising enable command.
+ let hdr_size = hci.CommandHeader.$size_in_bytes
+ 0 [+hdr_size] hci.CommandHeader header
+ $next [+1] UInt opcode
+ $next [+1] hci.GenericEnableParam enable
+ $next [+1] UInt advertising_handle
+
+
# ============ Events ============