pw_bluetooth: Use hci.LinkKey in LinkKeyNotificationEvent.link_key

Test: pw presubmit --step gn_emboss_nanopb_build
Change-Id: I45d01b72d5d9f5c5d58ba21f38f19410dd1b54b3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168858
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 eda5bf5..c5a8119 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_commands.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_commands.emb
@@ -22,6 +22,7 @@
 [(cpp) namespace: "pw::bluetooth::emboss"]
 # =========================== Constants =================================
 
+
 enum InquiryAccessCode:
   -- General- and Device-specific Inquiry Access Codes (DIACs) for use in Inquiry
   -- command LAP fields.
@@ -670,10 +671,6 @@
     -- Must be one of CONNECTION_REJECTED* from hci.StatusCode in this file
 
 
-struct LinkKey:
-  0 [+16]  UInt:8[16]  value
-
-
 struct LinkKeyRequestReplyCommand:
   -- 7.1.10 Link Key Request Reply command (v1.1) (BR/EDR)
   -- HCI_Link_Key_Request_Reply
@@ -682,8 +679,8 @@
   $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
     -- The 48-bit BD_ADDR of the remote device requesting the connection.
 
-  let bredr_link_key_size = LinkKey.$size_in_bytes
-  $next [+bredr_link_key_size]        LinkKey            link_key
+  let bredr_link_key_size = hci.LinkKey.$size_in_bytes
+  $next [+bredr_link_key_size]        hci.LinkKey        link_key
     -- Link key to use for the connection with the peer device.
 
 
@@ -869,14 +866,14 @@
   -- 7.1.29 IO Capability Request Reply command (v2.1 + EDR) (BR/EDR)
   -- HCI_IO_Capability_Request_Reply
   let hdr_size = hci.CommandHeader.$size_in_bytes
-  0     [+hdr_size]                   hci.CommandHeader           header
-  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                  bd_addr
+  0     [+hdr_size]                   hci.CommandHeader               header
+  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                      bd_addr
     -- The BD_ADDR of the remote device involved in simple pairing process
 
   $next [+1]                          hci.IoCapability                io_capability
     -- The IO capabilities of this device.
 
-  $next [+1]                          OobDataPresent              oob_data_present
+  $next [+1]                          OobDataPresent                  oob_data_present
     -- Whether there is out-of-band data present, and what type.
 
   $next [+1]                          hci.AuthenticationRequirements  authentication_requirements
@@ -946,10 +943,10 @@
 
 struct CodecId:
   0     [+1]  hci.CodingFormat  coding_format
-  $next [+2]  UInt          company_id
+  $next [+2]  UInt              company_id
     -- See assigned numbers.
 
-  $next [+2]  UInt          vendor_codec_id
+  $next [+2]  UInt              vendor_codec_id
     -- Shall be ignored if |coding_format| is not VENDOR_SPECIFIC.
 
 
@@ -958,10 +955,10 @@
 
   struct VendorCodingFormat:
     0     [+1]  hci.CodingFormat  coding_format
-    $next [+2]  UInt          company_id
+    $next [+2]  UInt              company_id
       -- See assigned numbers.
 
-    $next [+2]  UInt          vendor_codec_id
+    $next [+2]  UInt              vendor_codec_id
       -- Shall be ignored if |coding_format| is not VENDOR_SPECIFIC.
 
   enum ScoRetransmissionEffort:
@@ -2152,24 +2149,24 @@
   -- 7.8.24 LE Enable Encryption command (v4.0) (LE)
   -- HCI_LE_Enable_Encryption
   let hdr_size = hci.CommandHeader.$size_in_bytes
-  0     [+hdr_size]                hci.CommandHeader  header
-  $next [+2]                       UInt               connection_handle
+  0     [+hdr_size]                    hci.CommandHeader  header
+  $next [+2]                           UInt               connection_handle
     [requires: 0x0000 <= this <= 0x0EFF]
 
-  $next [+8]                       UInt               random_number
-  $next [+2]                       UInt               encrypted_diversifier
-  $next [+LinkKey.$size_in_bytes]  LinkKey            long_term_key
+  $next [+8]                           UInt               random_number
+  $next [+2]                           UInt               encrypted_diversifier
+  $next [+hci.LinkKey.$size_in_bytes]  hci.LinkKey        long_term_key
 
 
 struct LELongTermKeyRequestReplyCommand:
   -- 7.8.25 LE Long Term Key Request Reply command (v4.0) (LE)
   -- HCI_LE_Long_Term_Key_Request_Reply
   let hdr_size = hci.CommandHeader.$size_in_bytes
-  0     [+hdr_size]                hci.CommandHeader  header
-  $next [+2]                       UInt               connection_handle
+  0     [+hdr_size]                    hci.CommandHeader  header
+  $next [+2]                           UInt               connection_handle
     [requires: 0x0000 <= this <= 0x0EFF]
 
-  $next [+LinkKey.$size_in_bytes]  LinkKey            long_term_key
+  $next [+hci.LinkKey.$size_in_bytes]  hci.LinkKey        long_term_key
 
 
 struct LELongTermKeyRequestNegativeReplyCommand:
diff --git a/pw_bluetooth/public/pw_bluetooth/hci_common.emb b/pw_bluetooth/public/pw_bluetooth/hci_common.emb
index 05fb597..7aeb4e6 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_common.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_common.emb
@@ -438,6 +438,10 @@
 
 # inclusive-language: enable
 
+
+struct LinkKey:
+  0 [+16]  UInt:8[16]  value
+
 # ========================= HCI packet headers ==========================
 
 
diff --git a/pw_bluetooth/public/pw_bluetooth/hci_events.emb b/pw_bluetooth/public/pw_bluetooth/hci_events.emb
index 07d8bec..0874b43 100644
--- a/pw_bluetooth/public/pw_bluetooth/hci_events.emb
+++ b/pw_bluetooth/public/pw_bluetooth/hci_events.emb
@@ -598,14 +598,14 @@
 struct LinkKeyNotificationEvent:
   -- Link Key Notification Event (v1.1) (BR/EDR)
   let hdr_size = hci.EventHeader.$size_in_bytes
-  0     [+hdr_size]                   hci.EventHeader  header
-  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr       bd_addr
+  0     [+hdr_size]                    hci.EventHeader  header
+  $next [+hci.BdAddr.$size_in_bytes]   hci.BdAddr       bd_addr
     -- The address for the device for which a new link key has been generated.
 
-  $next [+16]                         UInt:8[16]       link_key
+  $next [+hci.LinkKey.$size_in_bytes]  hci.LinkKey      link_key
     -- Link key for the associated address.
 
-  $next [+1]                          KeyType          key_type
+  $next [+1]                           KeyType          key_type
     -- Type of key used when pairing.
 
 
@@ -638,8 +638,8 @@
 struct InquiryResultWithRssiEvent:
   -- Inquiry Result with RSSI Event (v1.2) (BR/EDR)
   let hdr_size = hci.EventHeader.$size_in_bytes
-  0     [+hdr_size]                    hci.EventHeader          header
-  $next [+1]                           UInt                     num_responses
+  0     [+hdr_size]                     hci.EventHeader          header
+  $next [+1]                            UInt                     num_responses
     -- The number of responses included.
 
   let response_size = InquiryResultWithRssi.$size_in_bytes