pw_bluetooth: Add SynchronousConnectionCompleteEvent Emboss definition
Move CodingFormat to hci_common.emb as it is used by both commands
and events.
Test: pw presubmit --step gn_emboss_nanopb_build
Change-Id: I3b74cff2ec0666ee2abf734129b257cc1795f99b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/167862
Reviewed-by: Ali Saeed <saeedali@google.com>
Commit-Queue: Ben Lawson <benlawson@google.com>
diff --git a/pw_bluetooth/public/pw_bluetooth/hci_commands.emb b/pw_bluetooth/public/pw_bluetooth/hci_commands.emb
index 09026c7..82d778f 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_commands.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_commands.emb
@@ -22,22 +22,6 @@
[(cpp) namespace: "pw::bluetooth::emboss"]
# =========================== Constants =================================
-
-enum CodingFormat:
- -- Coding formats from assigned numbers.
- -- (https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface)
- [maximum_bits: 8]
- U_LAW = 0x00
- A_LAW = 0x01
- CVSD = 0x02
- TRANSPARENT = 0x03
- LINEAR_PCM = 0x04
- MSBC = 0x05
- LC3 = 0x06
- G729A = 0x07
- VENDOR_SPECIFIC = 0xFF
-
-
enum InquiryAccessCode:
-- General- and Device-specific Inquiry Access Codes (DIACs) for use in Inquiry
-- command LAP fields.
@@ -988,7 +972,7 @@
struct CodecId:
- 0 [+1] CodingFormat coding_format
+ 0 [+1] hci.CodingFormat coding_format
$next [+2] UInt company_id
-- See assigned numbers.
@@ -1000,7 +984,7 @@
-- Enhanced Setup Synchronous Connection Command (CSA2) (BR/EDR)
struct VendorCodingFormat:
- 0 [+1] CodingFormat coding_format
+ 0 [+1] hci.CodingFormat coding_format
$next [+2] UInt company_id
-- See assigned numbers.
diff --git a/pw_bluetooth/public/pw_bluetooth/hci_common.emb b/pw_bluetooth/public/pw_bluetooth/hci_common.emb
index f6a7467..4f988b2 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_common.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_common.emb
@@ -389,6 +389,21 @@
R1_ = 0x01 # <= 1.28s
R2_ = 0x02 # <= 2.56s
+
+enum CodingFormat:
+ -- Coding formats from assigned numbers.
+ -- (https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface)
+ [maximum_bits: 8]
+ U_LAW = 0x00
+ A_LAW = 0x01
+ CVSD = 0x02
+ TRANSPARENT = 0x03
+ LINEAR_PCM = 0x04
+ MSBC = 0x05
+ LC3 = 0x06
+ G729A = 0x07
+ VENDOR_SPECIFIC = 0xFF
+
# ========================= HCI packet headers ==========================
diff --git a/pw_bluetooth/public/pw_bluetooth/hci_events.emb b/pw_bluetooth/public/pw_bluetooth/hci_events.emb
index ff17e31..a02a90e 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_events.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_events.emb
@@ -644,3 +644,40 @@
let response_size = InquiryResultWithRssi.$size_in_bytes
$next [+num_responses*response_size] InquiryResultWithRssi[] responses
+
+
+struct SynchronousConnectionCompleteEvent:
+ -- Synchronous Connection Complete Event (BR/EDR)
+
+ let hdr_size = hci.EventHeader.$size_in_bytes
+
+ 0 [+hdr_size] hci.EventHeader header
+
+ $next [+1] hci.StatusCode status
+
+ $next [+2] UInt connection_handle
+ -- A connection handle for the newly created SCO connection.
+ [requires: 0x0000 <= this <= 0x0EFF]
+
+ $next [+hci.BdAddr.$size_in_bytes] hci.BdAddr bd_addr
+ -- BD_ADDR of the other connected device forming the connection.
+
+ $next [+1] LinkType link_type
+
+ $next [+1] UInt transmission_interval
+ -- Time between two consecutive eSCO instants measured in slots. Shall be
+ -- zero for SCO links.
+
+ $next [+1] UInt retransmission_window
+ -- The size of the retransmission window measured in slots. Shall be zero
+ -- for SCO links.
+
+ $next [+2] UInt rx_packet_length
+ -- Length in bytes of the eSCO payload in the receive direction. Shall be
+ -- zero for SCO links.
+
+ $next [+2] UInt tx_packet_length
+ -- Length in bytes of the eSCO payload in the transmit direction. Shall be
+ -- zero for SCO links.
+
+ $next [+1] hci.CodingFormat air_mode