• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15# This file contains Emboss definitions for Host Controller Interface packets
16# and types found in the Bluetooth Core Specification. The Emboss compiler is
17# used to generate a C++ header from this file.
18
19import "pw_bluetooth/hci_common.emb" as hci
20
21[$default byte_order: "LittleEndian"]
22[(cpp) namespace: "pw::bluetooth::emboss"]
23# =========================== Constants =================================
24
25
26enum InquiryAccessCode:
27  -- General- and Device-specific Inquiry Access Codes (DIACs) for use in Inquiry
28  -- command LAP fields.
29  -- (https://www.bluetooth.com/specifications/assigned-numbers/baseband)
30  [maximum_bits: 24]
31  GIAC = 0x9E8B33
32    -- General Inquiry Access Code
33
34  LIAC = 0x9E8B00
35    -- Limited Dedicated Inquiry Access Code
36
37
38enum PcmDataFormat:
39  -- PCM data formats from assigned numbers.
40  -- (https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface)
41  [maximum_bits: 8]
42  NOT_APPLICABLE  = 0x00
43  ONES_COMPLEMENT = 0x01
44  TWOS_COMPLEMENT = 0x02
45  SIGN_MAGNITUDE  = 0x03
46  UNSIGNED        = 0x04
47
48
49enum ScoDataPath:
50  [maximum_bits: 8]
51  HCI             = 0x00
52  AUDIO_TEST_MODE = 0xFF
53    -- 0x01 - 0xFE specify the logical channel number (vendor specific)
54
55
56enum PageTimeout:
57  [maximum_bits: 16]
58  MIN     = 0x0001
59  MAX     = 0xFFFF
60  DEFAULT = 0x2000
61
62
63enum ScanInterval:
64  -- The minimum and maximum range values for Page and Inquiry Scan Interval (in time slices)
65  -- Page Scan Interval: (see Core Spec v5.0, Vol 2, Part E, Section 7.3.19)
66  -- Inquiry Scan Interval: (see Core Spec v5.0, Vol 2, Part E, Section 7.3.21)
67  [maximum_bits: 16]
68  MIN = 0x0012
69  MAX = 0x1000
70
71
72enum ScanWindow:
73  -- The minimum and maximum range valeus for Page and Inquiry Scan Window (in time slices)
74  -- Page Scan Window: (see Core Spec v5.0, Vol 2, Part E, Section 7.3.19)
75  -- Inquiry Scan Window: (see Core Spec v5.0, Vol 2, Part E, Section 7.3.21)
76  [maximum_bits: 16]
77  MIN = 0x0011
78  MAX = 0x1000
79
80
81bits ScoPacketType:
82  -- Bitmask of SCO packet types.
83  # SCO packet types
84  0     [+1]  Flag  hv1
85  $next [+1]  Flag  hv2
86  $next [+1]  Flag  hv3
87  # eSCO packet types
88  $next [+1]  Flag  ev3
89  $next [+1]  Flag  ev4
90  $next [+1]  Flag  ev5
91  $next [+1]  Flag  not_2_ev3
92  $next [+1]  Flag  not_3_ev3
93  $next [+1]  Flag  not_2_ev5
94  $next [+1]  Flag  not_3_ev5
95
96
97bits PacketType:
98  -- Bitmask values for supported Packet Types
99  -- Used for HCI_Create_Connection and HCI_Change_Connection_Packet_Type
100  -- All other bits reserved for future use.
101  1  [+1]  Flag  disable_2_dh1
102  2  [+1]  Flag  disable_3_dh1
103  3  [+1]  Flag  enable_dm1     # Note: always on in >= v1.2
104  4  [+1]  Flag  enable_dh1
105  8  [+1]  Flag  disable_2_dh3
106  9  [+1]  Flag  disable_3_dh3
107  10 [+1]  Flag  enable_dm3
108  11 [+1]  Flag  enable_dh3
109  12 [+1]  Flag  disable_2_dh5
110  13 [+1]  Flag  disable_3_dh5
111  14 [+1]  Flag  enable_dm5
112  15 [+1]  Flag  enable_dh5
113
114
115enum OobDataPresent:
116  -- Whether there is out-of-band data present, and what type.
117  -- All other values reserved for future use.
118  [maximum_bits: 8]
119  NOT_PRESENT   = 0x00
120  P192_         = 0x01
121  P256_         = 0x02
122  P192_AND_P256 = 0x03
123
124
125bits ScanEnableBits:
126  -- Bitmask Values for the Scan_Enable parameter in a HCI_(Read,Write)_Scan_Enable command.
127  0 [+1]  Flag  inquiry
128    -- Inquiry scan enabled
129
130  1 [+1]  Flag  page
131    -- Page scan enabled
132
133
134enum InquiryScanType:
135  [maximum_bits: 8]
136  STANDARD   = 0x00
137    -- Standard scan (Default) (Mandatory)
138
139  INTERLACED = 0x01
140
141
142struct LocalName:
143  0 [+248]  UInt:8[248]  local_name
144
145
146struct ExtendedInquiryResponse:
147  0 [+240]  UInt:8[240]  extended_inquiry_response
148
149
150enum LEExtendedDuplicateFilteringOption:
151  -- Possible values that can be used for the |filter_duplicates| parameter in a
152  -- HCI_LE_Set_Extended_Scan_Enable command.
153  [maximum_bits: 8]
154  DISABLED                           = 0x00
155  ENABLED                            = 0x01
156  ENABLED_RESET_FOR_EACH_SCAN_PERIOD = 0x02
157    -- Duplicate advertisements in a single scan period should not be sent to the
158    -- Host in advertising report events; this setting shall only be used if the
159    -- Period parameter is non-zero.
160
161
162enum LEPeriodicAdvertisingCreateSyncUseParams:
163  [maximum_bits: 1]
164
165  USE_PARAMS                   = 0x00
166    -- Use the Advertising_SID, Advertiser_Address_Type, and Adertiser_Address parameters to
167    -- determine which advertiser to listen to.
168
169  USE_PERIODIC_ADVERTISER_LIST = 0x01
170    -- Use the Periodic Advertiser List to determine which advertiser to listen to.
171
172
173bits LEPeriodicAdvertisingCreateSyncOptions:
174  -- First parameter to the LE Periodic Advertising Create Sync command
175  0     [+1]  LEPeriodicAdvertisingCreateSyncUseParams  advertiser_source
176  $next [+1]  Flag                                      enable_reporting
177    -- 0: Reporting initially enabled
178    -- 1: Reporting initially disabled
179
180  $next [+1]  Flag                                      enable_duplicate_filtering
181    -- 0: Duplicate filtering initially disabled
182    -- 1: Duplicate filtering initially enabled
183
184
185enum LEPeriodicAdvertisingAddressType:
186  -- Possible values that can be specified for the |advertiser_address_type| in an LE Periodic
187  -- Advertising Create Sync command.
188  [maximum_bits: 8]
189  PUBLIC = 0x00
190    -- Public Device Address or Public Identity Address
191
192  RANDOM = 0x01
193    -- Random Device Address or Random (static) Identity Address
194
195
196bits LEPeriodicAdvertisingSyncCTEType:
197  -- Bit definitions for a |sync_cte_type| field in an LE Periodic Advertising Create Sync command
198
199  0     [+1]  Flag  dont_sync_aoa
200    -- Do not sync to packets with an AoA Constant Tone Extension
201
202  $next [+1]  Flag  dont_sync_aod_1us
203    -- Do not sync to packets with an AoD Constant Tone Extension with 1 microsecond slots
204
205  $next [+1]  Flag  dont_sync_aod_2us
206    -- Do not sync to packets with an AoD Constant Tone Extension with 2 microsecond slots
207
208  $next [+1]  Flag  dont_sync_type_3
209    -- Do not sync to packets with a typoe 3 Constant Tone Extension (currently reserved for future
210    -- use)
211
212  $next [+1]  Flag  dont_sync_without_cte
213    -- Do not sync to packets without a Constant Tone Extension
214
215
216enum LEScanType:
217  -- Possible values that can be used for the |scan_type| parameter in various LE HCI commands.
218  [maximum_bits: 8]
219  PASSIVE = 0x00
220    -- Passive Scanning. No scanning PDUs shall be sent (default)
221
222  ACTIVE  = 0x01
223    -- Active scanning. Scanning PDUs may be sent.
224
225
226enum LEScanFilterPolicy:
227  -- Possible values that can be used for the |filter_policy| parameter in various LE HCI commands
228  [maximum_bits: 8]
229  BASIC_UNFILTERED    = 0x00
230  BASIC_FILTERED      = 0x01
231  EXTENDED_UNFILTERED = 0x02
232  EXTENDED_FILTERED   = 0x03
233
234
235bits LEScanPHYBits:
236  0 [+1]  Flag  le_1m
237    -- Scan advertisements on the LE 1M PHY
238
239  2 [+1]  Flag  le_coded
240    -- Scan advertisements on the LE Coded PHY
241
242
243bits LEInitiatingPHYBits:
244  0 [+1]  Flag  le_1m
245  1 [+1]  Flag  le_2m
246  2 [+1]  Flag  le_coded
247
248
249enum LEPrivacyMode:
250  -- Possible values for the |privacy_mode| parameter in an LE Set Privacy Mode
251  -- command
252  [maximum_bits: 8]
253  NETWORK = 0x00
254    -- Use Network Privacy Mode for this peer device (default).
255
256  DEVICE  = 0x01
257    -- Use Device Privacy Mode for this peer device.
258
259
260enum InquiryMode:
261  [maximum_bits: 8]
262  STANDARD = 0x00
263    -- Standard Inquiry Result format (default)
264
265  RSSI     = 0x01
266    -- Inquiry Result format with RSSI
267
268  EXTENDED = 0x02
269    -- Inquiry Result format with RSSI or EIR format
270
271
272enum PageScanType:
273  [maximum_bits: 8]
274  STANDARD_SCAN   = 0x00
275    -- Standard scan (default) (mandatory)
276
277  INTERLACED_SCAN = 0x01
278    -- Interlaced scan (optional)
279
280
281bits LEEventMask:
282  0     [+1]  Flag  le_connection_complete
283  $next [+1]  Flag  le_advertising_report
284  $next [+1]  Flag  le_connection_update_complete
285  $next [+1]  Flag  le_read_remote_features_complete
286  $next [+1]  Flag  le_long_term_key_request
287  $next [+1]  Flag  le_remote_connection_parameter_request
288  $next [+1]  Flag  le_data_length_change
289  $next [+1]  Flag  le_read_local_p256_public_key_complete
290  $next [+1]  Flag  le_generate_dhkey_complete
291  $next [+1]  Flag  le_enhanced_connection_complete
292  $next [+1]  Flag  le_directed_advertising_report
293  $next [+1]  Flag  le_phy_update_complete
294  $next [+1]  Flag  le_extended_advertising_report
295  $next [+1]  Flag  le_periodic_advertising_sync_established
296  $next [+1]  Flag  le_periodic_advertising_report
297  $next [+1]  Flag  le_periodic_advertising_sync_lost
298  $next [+1]  Flag  le_extended_scan_timeout
299  $next [+1]  Flag  le_extended_advertising_set_terminated
300  $next [+1]  Flag  le_scan_request_received
301  $next [+1]  Flag  le_channel_selection_algorithm
302  $next [+1]  Flag  le_connectionless_iq_report
303  $next [+1]  Flag  le_connection_iq_report
304  $next [+1]  Flag  le_cte_request_failed
305  $next [+1]  Flag  le_periodic_advertising_sync_transfer_received_event
306  $next [+1]  Flag  le_cis_established_event
307  $next [+1]  Flag  le_cis_request_event
308  $next [+1]  Flag  le_create_big_complete_event
309  $next [+1]  Flag  le_terminate_big_complete_event
310  $next [+1]  Flag  le_big_sync_established_event
311  $next [+1]  Flag  le_big_sync_lost_event
312  $next [+1]  Flag  le_request_peer_sca_complete_event
313  $next [+1]  Flag  le_path_loss_threshold_event
314  $next [+1]  Flag  le_transmit_power_reporting_event
315  $next [+1]  Flag  le_biginfo_advertising_report_event
316  $next [+1]  Flag  le_subrate_change_event
317
318
319enum ScanRequestNotifications:
320  [maximum_bits: 8]
321  DISABLED = 0x00
322  ENABLED  = 0x01
323
324
325enum LESetExtendedAdvDataOp:
326  -- Potential values for the Operation parameter in a HCI_LE_Set_Extended_Advertising_Data command.
327  [maximum_bits: 8]
328  INTERMEDIATE_FRAGMENT = 0x00
329    -- Intermediate fragment of fragmented extended advertising data.
330
331  FIRST_FRAGMENT        = 0x01
332    -- First fragment of fragmented extended advertising data.
333
334  LAST_FRAGMENT         = 0x02
335    -- Last fragment of fragmented extended advertising data.
336
337  COMPLETE              = 0x03
338    -- Complete extended advertising data.
339
340  UNCHANGED_DATA        = 0x04
341    -- Unchanged data (just update the Advertising DID)
342
343
344enum LEExtendedAdvFragmentPreference:
345  -- Potential values for the Fragment_Preference parameter in a
346  -- HCI_LE_Set_Extended_Advertising_Data command.
347  [maximum_bits: 8]
348  MAY_FRAGMENT        = 0x00
349    -- The Controller may fragment all Host advertising data
350
351  SHOULD_NOT_FRAGMENT = 0x01
352    -- The Controller should not fragment or should minimize fragmentation of Host advertising data
353
354
355bits LEAdvertisingEventProperties:
356  -- The Advertising_Event_Properties bitfield values used in a HCI LE Set Extended Advertising
357  -- Parameters command.
358  0     [+1]  Flag  connectable
359  $next [+1]  Flag  scannable
360  $next [+1]  Flag  directed
361  $next [+1]  Flag  high_duty_cycle_directed_connectable
362  $next [+1]  Flag  use_legacy_pdus
363  $next [+1]  Flag  anonymous_advertising
364  $next [+1]  Flag  include_tx_power
365
366
367enum FlowControlMode:
368  [maximum_bits: 8]
369  PACKET_BASED     = 0x00
370  DATA_BLOCK_BASED = 0x01
371
372
373bits EventMask:
374  0  [+1]  Flag  inquiry_complete_event
375  1  [+1]  Flag  inquiry_result_event
376  2  [+1]  Flag  connection_complete_event
377  3  [+1]  Flag  connection_request_event
378  4  [+1]  Flag  disconnection_complete_event
379  5  [+1]  Flag  authentication_complete_event
380  6  [+1]  Flag  remote_name_request_complete_event
381  7  [+1]  Flag  encryption_change_event
382  8  [+1]  Flag  change_connection_link_key_complete_event
383  9  [+1]  Flag  link_key_type_changed_event
384  10 [+1]  Flag  read_remote_supported_features_complete_event
385  11 [+1]  Flag  read_remote_version_information_complete_event
386  12 [+1]  Flag  qos_setup_complete_event
387  # 13: reserved for future use
388  # 14: reserved for future use
389  15 [+1]  Flag  hardware_error_event
390  16 [+1]  Flag  flush_occurred_event
391  17 [+1]  Flag  role_change_event
392  # 18: reserved for future use
393  19 [+1]  Flag  mode_change_event
394  20 [+1]  Flag  return_link_keys_event
395  21 [+1]  Flag  pin_code_request_event
396  22 [+1]  Flag  link_key_request_event
397  23 [+1]  Flag  link_key_notification_event
398  24 [+1]  Flag  loopback_command_event
399  25 [+1]  Flag  data_buffer_overflow_event
400  26 [+1]  Flag  max_slots_change_event
401  27 [+1]  Flag  read_clock_offset_complete_event
402  28 [+1]  Flag  connection_packet_type_changed_event
403  29 [+1]  Flag  qos_violation_event
404  30 [+1]  Flag  page_scan_mode_change_event
405  31 [+1]  Flag  page_scan_repetition_mode_change_event
406  32 [+1]  Flag  flow_specification_complete_event
407  33 [+1]  Flag  inquiry_result_with_rssi_event
408  34 [+1]  Flag  read_remote_extended_features_complete_event
409  # 35: reserved for future use
410  # 36: reserved for future use
411  # 37: reserved for future use
412  # 38: reserved for future use
413  # 39: reserved for future use
414  # 40: reserved for future use
415  # 41: reserved for future use
416  # 42: reserved for future use
417  43 [+1]  Flag  synchronous_connection_complete_event
418  44 [+1]  Flag  synchronous_connection_changed_event
419  45 [+1]  Flag  sniff_subrating_event
420  46 [+1]  Flag  extended_inquiry_result_event
421  47 [+1]  Flag  encryption_key_refresh_complete_event
422  48 [+1]  Flag  io_capability_request_event
423  49 [+1]  Flag  io_capability_response_event
424  50 [+1]  Flag  user_confirmation_request_event
425  51 [+1]  Flag  user_passkey_request_event
426  52 [+1]  Flag  remote_oob_data_request_event
427  53 [+1]  Flag  simple_pairing_complete_event
428  # 54: reserved for future use
429  55 [+1]  Flag  link_supervision_timeout_changed_event
430  56 [+1]  Flag  enhanced_flush_complete_event
431  # 57: reserved for future use
432  58 [+1]  Flag  user_passkey_notification_event
433  59 [+1]  Flag  keypress_notification_event
434  60 [+1]  Flag  remote_host_supported_features_notification_event
435  61 [+1]  Flag  le_meta_event
436
437# 62: reserved for future use
438# 63: reserved for future use
439
440
441bits EventMaskPage2:
442  8  [+1]  Flag  number_of_completed_data_blocks_event
443  14 [+1]  Flag  triggered_clock_capture_event
444  15 [+1]  Flag  synchronization_train_complete_event
445  16 [+1]  Flag  synchronization_train_received_event
446  17 [+1]  Flag  connectionless_peripheral_broadcast_receive_event
447  18 [+1]  Flag  connectionless_peripheral_broadcast_timeout_event
448  19 [+1]  Flag  truncated_page_complete_event
449  20 [+1]  Flag  peripheral_page_response_timeout_event
450  21 [+1]  Flag  connectionless_peripheral_broadcast_channel_map_event
451  22 [+1]  Flag  inquiry_response_notification_event
452  23 [+1]  Flag  authenticated_payload_timeout_expired_event
453  24 [+1]  Flag  sam_status_change_event
454  25 [+1]  Flag  encryption_change_event_v2
455
456
457bits LECISPHYOptions:
458  -- Identifies PHYs that can be used for transmission
459  0     [+1]  Flag  le_1m
460  $next [+1]  Flag  le_2m
461  $next [+1]  Flag  le_coded
462
463
464struct LESetCIGParametersCISOptions:
465  -- Parameters for the CISes defined in a LESetCIGParametersCommand
466
467  0     [+1]                                UInt             cis_id
468    -- Used to identify a CIS
469    [requires: 0x00 <= this <= 0xEF]
470
471  $next [+2]                                UInt             max_sdu_c_to_p
472    -- Maximum size, in octets, of the payload from the Central's Host
473    [requires: 0x0000 <= this <= 0x0FFF]
474
475  $next [+2]                                UInt             max_sdu_p_to_c
476    -- Maximum size, in octets, of the payload from the Peripheral's Host
477    [requires: 0x0000 <= this <= 0x0FFF]
478
479  $next [+1]  bits:
480
481    0     [+LECISPHYOptions.$size_in_bits]  LECISPHYOptions  phy_c_to_p
482      -- Identifies which PHY to use for transmission from the Central to the Peripheral
483
484  $next [+1]  bits:
485
486    0     [+LECISPHYOptions.$size_in_bits]  LECISPHYOptions  phy_p_to_c
487      -- Identifies which PHY to use for transmission from the Peripheral to the Central
488
489  $next [+1]                                UInt             rtn_c_to_p
490    -- Number of times every CIS Data PDU should be retransmitted from the Central to the
491    -- Peripheral
492
493  $next [+1]                                UInt             rtn_p_to_c
494    -- Number of times every CIS Data PDU should be retransmitted from the Peripheral to the
495    -- Central
496
497
498enum LECISPacking:
499  -- Preferred method of arranging subevents of multiple CISes
500  [maximum_bits: 8]
501  SEQUENTIAL  = 0x00
502  INTERLEAVED = 0x01
503
504
505enum LECISFraming:
506  -- Format of CIS Data PDUs
507  [maximum_bits: 8]
508  UNFRAMED = 0x00
509  FRAMED   = 0x01
510
511
512enum DataPathDirection:
513  [maximum_bits: 8]
514  INPUT  = 0x00
515    -- Host to Controller
516
517  OUTPUT = 0x01
518    -- Controller to Host
519
520# ========================= HCI Command packets =========================
521# Core Spec v5.3 Vol 4, Part E, Section 7
522
523# ========== 7.1 Link Control Commands ==========
524
525
526struct InquiryCommand:
527  -- 7.1.1 Inquiry command (v1.1) (BR/EDR)
528  -- HCI_Inquiry
529  --
530  -- Note: NO Command Complete; Sends Inquiry Complete at the end of the
531  -- inquiry to indicate it's completion. No Inquiry Complete event is sent if
532  -- Inquiry is cancelled.
533
534  let hdr_size = hci.CommandHeader.$size_in_bytes
535
536  0     [+hdr_size]  hci.CommandHeader  header
537
538  $next [+3]         InquiryAccessCode  lap
539    -- LAP (Lower Address Part)
540    -- In the range 0x9E8B00 - 0x9E8B3F, defined by the Bluetooth SIG in
541    -- Baseband Assigned Numbers.
542
543  $next [+1]         UInt               inquiry_length
544    -- Time before the inquiry is halted. Defined in 1.28s units.
545    -- Range: 0x01 to kInquiryLengthMax in hci_constants.h
546
547  $next [+1]         UInt               num_responses
548    -- Maximum number of responses before inquiry is halted.
549    -- Set to 0x00 for unlimited.
550
551
552struct InquiryCancelCommand:
553  -- 7.1.2 Inquiry Cancel command (v1.1) (BR/EDR)
554  -- HCI_Inquiry_Cancel
555  --
556  -- No command parameters
557  let hdr_size = hci.CommandHeader.$size_in_bytes
558  0 [+hdr_size]  hci.CommandHeader  header
559
560# 7.1.3 Periodic Inquiry Mode command
561# HCI_Periodic_Inquiry_Mode
562# TODO: b/265052417 - Definition needs to be added
563
564
565# 7.1.4 Exit Periodic Inquiry Mode command
566# HCI_Exit_Periodic_Inquiry_Mode
567# TODO: b/265052417 - Definition needs to be added
568
569
570struct CreateConnectionCommand:
571  -- 7.1.5 Create Connection (v1.1) (BR/EDR)
572  -- HCI_Create_Connection
573  --
574  -- NOTE on ReturnParams: No Command Complete event will be sent by the
575  -- Controller to indicate that this command has been completed. Instead, the
576  -- Connection Complete event will indicate that this command has been
577  -- completed.
578  let hdr_size = hci.CommandHeader.$size_in_bytes
579  0     [+hdr_size]                   hci.CommandHeader           header
580  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                  bd_addr
581    -- BD_ADDR of the device to be connected
582
583  $next [+2]                          PacketType                  packet_type
584    -- Mask of allowable packet types.
585
586  $next [+1]                          hci.PageScanRepetitionMode  page_scan_repetition_mode
587    -- The Page Scan Repetition Mode of the remote device as retrieved by Inquiry.
588
589  $next [+1]                          UInt                        reserved
590    [requires: this == 0]
591
592  $next [+2]                          hci.ClockOffset             clock_offset
593    -- Clock Offset. The lower 15 bits are set to the clock offset as retrieved
594    -- by an Inquiry. The highest bit is set to 1 if the rest of this parameter
595    -- is valid.
596
597  $next [+1]                          hci.GenericEnableParam      allow_role_switch
598    -- Allow Role Switch.
599    -- Allowed values:
600    --  0x00 - No role switch allowed, this device will be the central
601    --  0x01 - Role switch allowed, this device may become peripheral during
602    --  connection setup
603
604
605struct DisconnectCommand:
606  -- 7.1.6 Disconnect command (v1.1) (BR/EDR & LE)
607  -- HCI_Disconnect
608  --
609  -- NOTE on ReturnParams: No Command Complete event will be sent by the
610  -- Controller to indicate that this command has been completed. Instead, the
611  -- Disconnection Complete event will indicate that this command has been
612  -- completed.
613  let hdr_size = hci.CommandHeader.$size_in_bytes
614  0     [+hdr_size]  hci.CommandHeader  header
615  $next [+2]         UInt               connection_handle
616    -- Connection_Handle (only the lower 12-bits are meaningful).
617    --   Range: 0x0000 to 0x0EFF
618
619  $next [+1]         hci.StatusCode     reason
620    -- Reason for the disconnect.
621
622
623struct CreateConnectionCancelCommand:
624  -- 7.1.7 Create Connection Cancel command (v1.1) (BR/EDR)
625  -- HCI_Create_Connection_Cancel
626  let hdr_size = hci.CommandHeader.$size_in_bytes
627  0     [+hdr_size]                   hci.CommandHeader  header
628  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
629    -- BD_ADDR of the Create Connection Command request
630
631
632struct AcceptConnectionRequestCommand:
633  -- 7.1.8 Accept Connection Request command (v1.1) (BR/EDR)
634  -- HCI_Accept_Connection_Request
635  let hdr_size = hci.CommandHeader.$size_in_bytes
636  0     [+hdr_size]                   hci.CommandHeader   header
637  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr          bd_addr
638    -- The 48-bit BD_ADDR of the remote device requesting the connection.
639
640  $next [+1]                          hci.ConnectionRole  role
641
642
643struct RejectConnectionRequestCommand:
644  -- 7.1.9 Reject Connection Request command (v1.1) (BR/EDR)
645  -- HCI_Reject_Connection_Request
646  let hdr_size = hci.CommandHeader.$size_in_bytes
647  0     [+hdr_size]                   hci.CommandHeader  header
648  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
649    -- The 48-bit BD_ADDR of the remote device requesting the connection.
650
651  $next [+1]                          hci.StatusCode     reason
652    -- Must be one of CONNECTION_REJECTED* from hci.StatusCode in this file
653
654
655struct LinkKeyRequestReplyCommand:
656  -- 7.1.10 Link Key Request Reply command (v1.1) (BR/EDR)
657  -- HCI_Link_Key_Request_Reply
658  let hdr_size = hci.CommandHeader.$size_in_bytes
659  0     [+hdr_size]                   hci.CommandHeader  header
660  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
661    -- The 48-bit BD_ADDR of the remote device requesting the connection.
662
663  let bredr_link_key_size = hci.LinkKey.$size_in_bytes
664  $next [+bredr_link_key_size]        hci.LinkKey        link_key
665    -- Link key to use for the connection with the peer device.
666
667
668struct LinkKeyRequestNegativeReplyCommand:
669  -- 7.1.11 Link Key Request Negative Reply command (v1.1) (BR/EDR)
670  -- HCI_Link_Key_Request_Negative_Reply
671  let hdr_size = hci.CommandHeader.$size_in_bytes
672  0     [+hdr_size]                   hci.CommandHeader  header
673  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
674    -- BD_ADDR of the peer device that the host does not have a link key for.
675
676# 7.1.12 PIN Code Request Reply command
677# HCI_PIN_Code_Request_Reply
678# TODO: b/265052417 - Definition needs to be added
679
680
681# 7.1.13 PIN Code Request Negative Reply command
682# HCI_PIN_Code_Request_Negative_Reply
683# TODO: b/265052417 - Definition needs to be added
684
685
686# 7.1.14 Change Connection Packet Type command
687# HCI_Change_Connection_Packet_Type
688# TODO: b/265052417 - Definition needs to be added
689
690
691struct AuthenticationRequestedCommand:
692  -- 7.1.15 Authentication Requested command (v1.1) (BR/EDR)
693  -- HCI_Authentication_Requested
694  --
695  -- NOTE on ReturnParams: No Command Complete event will be sent by the
696  -- Controller to indicate that this command has been completed. Instead, the
697  -- Authentication Complete event will indicate that this command has been
698  -- completed.
699  let hdr_size = hci.CommandHeader.$size_in_bytes
700  0     [+hdr_size]  hci.CommandHeader  header
701  $next [+2]         UInt               connection_handle
702    -- Connection_Handle (only the lower 12-bits are meaningful).
703    --   Range: 0x0000 to 0x0EFF
704    -- Must be the handle of a connected ACL-U logical link.
705
706
707struct SetConnectionEncryptionCommand:
708  -- 7.1.16 Set Connection Encryption command (v1.1) (BR/EDR)
709  -- HCI_Set_Connection_Encryption
710  --
711  -- NOTE on ReturnParams: No Command Complete event will be sent by the
712  -- Controller to indicate that this command has been completed. Instead, the
713  -- Encryption Change event will indicate that this command has been completed.
714  let hdr_size = hci.CommandHeader.$size_in_bytes
715  0     [+hdr_size]  hci.CommandHeader       header
716  $next [+2]         UInt                    connection_handle
717    -- Connection_Handle (only the lower 12-bits are meaningful).
718    --   Range: 0x0000 to 0x0EFF
719    -- Must be the handle of a connected ACL-U logical link.
720
721  $next [+1]         hci.GenericEnableParam  encryption_enable
722    -- Whether link level encryption should be turned on or off.
723
724# 7.1.17 Change Connection Link Key command
725# HCI_Change_Connection_Link_Key
726# TODO: b/265052417 - Definition needs to be added
727
728
729# 7.1.18 Link Key Selection command
730# HCI_Link_Key_Selection
731# TODO: b/265052417 - Definition needs to be added
732
733
734struct RemoteNameRequestCommand:
735  -- 7.1.19 Remote Name Request command (v1.1) (BR/EDR)
736  -- HCI_Remote_Name_Request
737  --
738  -- NOTE on ReturnParams: No Command Complete event will be sent by the
739  -- Controller to indicate that this command has been completed. Instead, the
740  -- Remote Name Request Complete event will indicate that this command has been
741  -- completed.
742  let hdr_size = hci.CommandHeader.$size_in_bytes
743  0     [+hdr_size]                   hci.CommandHeader           header
744  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                  bd_addr
745    -- Address of the device whose name is to be requested.
746
747  $next [+1]                          hci.PageScanRepetitionMode  page_scan_repetition_mode
748    -- Page Scan Repetition Mode of the device, obtained by Inquiry.
749
750  $next [+1]                          UInt                        reserved
751    [requires: this == 0]
752
753  $next [+2]                          hci.ClockOffset             clock_offset
754    -- Clock offset.  The lower 15 bits of this represent bits 16-2
755    -- of CLKNPeripheral-CLK, and the highest bit is set when the other
756    -- bits are valid.
757
758# 7.1.20 Remote Name Request Cancel command
759# HCI_Remote_Name_Request_Cancel
760
761
762struct ReadRemoteSupportedFeaturesCommand:
763  -- 7.1.21 Read Remote Supported Features command (v1.1) (BR/EDR)
764  -- HCI_Read_Remote_Supported_Features
765  --
766  -- NOTE on ReturnParams: No Command Complete event will be sent by the
767  -- Controller to indicate that this command has been completed. Instead, the
768  -- Read Remote Supported Features Complete event will indicate that this
769  -- command has been completed.
770  let hdr_size = hci.CommandHeader.$size_in_bytes
771  0     [+hdr_size]  hci.CommandHeader  header
772  $next [+2]         UInt               connection_handle
773    -- Connection_Handle (only the lower 12-bits are meaningful).
774    --   Range: 0x0000 to 0x0EFF
775    -- Must be the handle of a connected ACL-U logical link.
776
777
778struct ReadRemoteExtendedFeaturesCommand:
779  -- 7.1.22 Read Remote Extended Features command (v1.2) (BR/EDR)
780  -- HCI_Read_Remote_Extended_Features
781  --
782  -- NOTE on ReturnParams: No Command Complete event will be sent by the
783  -- Controller to indicate that this command has been completed. Instead, the
784  -- Read Remote Extended Features Complete event will indicate that this
785  -- command has been completed.
786  let hdr_size = hci.CommandHeader.$size_in_bytes
787  0     [+hdr_size]  hci.CommandHeader  header
788  $next [+2]         UInt               connection_handle
789    -- Connection_Handle (only the lower 12-bits are meaningful).
790    --   Range: 0x0000 to 0x0EFF
791    -- Must be the handle of a connected ACL-U logical link.
792
793  $next [+1]         UInt               page_number
794    -- Page of features to read.
795    -- Values:
796    --  - 0x00 standard features as if requested by Read Remote Supported Features
797    --  - 0x01-0xFF the corresponding features page (see Vol 2, Part C, Sec 3.3).
798
799
800struct ReadRemoteVersionInfoCommand:
801  -- 7.1.23 Read Remote Version Information command (v1.1) (BR/EDR & LE)
802  -- HCI_Read_Remote_Version_Information
803  --
804  -- NOTE on ReturnParams: No Command Complete event will be sent by the
805  -- Controller to indicate that this command has been completed. Instead, the
806  -- Read Remote Version Information Complete event will indicate that this
807  -- command has been completed.
808  let hdr_size = hci.CommandHeader.$size_in_bytes
809  0     [+hdr_size]  hci.CommandHeader  header
810  $next [+2]         UInt               connection_handle
811    -- Connection_Handle (only the lower 12-bits are meaningful).
812    --   Range: 0x0000 to 0x0EFF
813
814# 7.1.24 Read Clock Offset command
815# HCI_Read_Clock_Offset
816# TODO: b/265052417 - Definition needs to be added
817
818
819# 7.1.25 Read LMP Handle command
820# HCI_Read_LMP_Handle
821# TODO: b/265052417 - Definition needs to be added
822
823
824# 7.1.26 Setup Synchronous Connection command
825# HCI_Setup_Synchronous_Connection
826# TODO: b/265052417 - Definition needs to be added
827
828
829# 7.1.27 Accept Synchronous Connection Request command
830# HCI_Accept_Synchronous_Connection_Request
831# TODO: b/265052417 - Definition needs to be added
832
833
834struct RejectSynchronousConnectionRequestCommand:
835  -- 7.1.28 Reject Synchronous Connection command (BR/EDR)
836  -- HCI_Reject_Synchronous_Connection_Request
837  let hdr_size = hci.CommandHeader.$size_in_bytes
838  0     [+hdr_size]                   hci.CommandHeader  header
839  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
840    -- Address of the remote device that sent the request.
841
842  $next [+1]                          hci.StatusCode     reason
843    -- Reason the connection request was rejected.
844
845
846struct IoCapabilityRequestReplyCommand:
847  -- 7.1.29 IO Capability Request Reply command (v2.1 + EDR) (BR/EDR)
848  -- HCI_IO_Capability_Request_Reply
849  let hdr_size = hci.CommandHeader.$size_in_bytes
850  0     [+hdr_size]                   hci.CommandHeader               header
851  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                      bd_addr
852    -- The BD_ADDR of the remote device involved in simple pairing process
853
854  $next [+1]                          hci.IoCapability                io_capability
855    -- The IO capabilities of this device.
856
857  $next [+1]                          OobDataPresent                  oob_data_present
858    -- Whether there is out-of-band data present, and what type.
859
860  $next [+1]                          hci.AuthenticationRequirements  authentication_requirements
861    -- Authentication requirements of the host.
862
863
864struct UserConfirmationRequestReplyCommand:
865  -- 7.1.30 User Confirmation Request Reply command (v2.1 + EDR) (BR/EDR)
866  -- HCI_User_Confirmation_Request_Reply
867  let hdr_size = hci.CommandHeader.$size_in_bytes
868  0     [+hdr_size]                   hci.CommandHeader  header
869  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
870    -- The BD_ADDR of the remote device involved in simple pairing process
871
872
873struct UserConfirmationRequestNegativeReplyCommand:
874  -- 7.1.31 User Confirmation Request Negative Reply command (v2.1 + EDR) (BR/EDR)
875  -- HCI_User_Confirmation_Request_Negative_Reply
876  let hdr_size = hci.CommandHeader.$size_in_bytes
877  0     [+hdr_size]                   hci.CommandHeader  header
878  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
879    -- The BD_ADDR of the remote device involved in simple pairing process
880
881
882struct UserPasskeyRequestReplyCommand:
883  -- 7.1.32 User Passkey Request Reply command (v2.1 + EDR) (BR/EDR)
884  -- HCI_User_Passkey_Request_Reply
885  let hdr_size = hci.CommandHeader.$size_in_bytes
886  0     [+hdr_size]                   hci.CommandHeader  header
887  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
888    -- The BD_ADDR of the remote device involved in simple pairing process
889
890  $next [+4]                          UInt               numeric_value
891    -- Numeric value (passkey) entered by user.
892    [requires: 0 <= this <= 999999]
893
894
895struct UserPasskeyRequestNegativeReplyCommand:
896  -- 7.1.33 User Passkey Request Negative Reply command (v2.1 + EDR) (BR/EDR)
897  -- HCI_User_Passkey_Request_Negative_Reply
898  let hdr_size = hci.CommandHeader.$size_in_bytes
899  0     [+hdr_size]                   hci.CommandHeader  header
900  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
901    -- The BD_ADDR of the remote device involved in the simple pairing process.
902
903# 7.1.34 Remote OOB Data Request Reply command
904# HCI_Remote_OOB_Data_Request_Reply
905# TODO: b/265052417 - Definition needs to be added
906
907
908# 7.1.35 Remote OOB Data Request Negative Reply command
909# HCI_Remote_OOB_Data_Request_Negative_Reply
910# TODO: b/265052417 - Definition needs to be added
911
912
913struct IoCapabilityRequestNegativeReplyCommand:
914  -- 7.1.36 IO Capability Request Negative Reply command (v2.1 + EDR) (BR/EDR)
915  -- HCI_IO_Capability_Request_Negative_Reply
916  let hdr_size = hci.CommandHeader.$size_in_bytes
917  0     [+hdr_size]                   hci.CommandHeader  header
918  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         bd_addr
919    -- The BD_ADDR of the remote device involved in the simple pairing process.
920
921  $next [+1]                          hci.StatusCode     reason
922    -- Reason that Simple Pairing was rejected. See 7.1.36 for valid error codes.
923
924
925struct CodecId:
926  0     [+1]  hci.CodingFormat  coding_format
927  $next [+2]  UInt              company_id
928    -- See assigned numbers.
929
930  $next [+2]  UInt              vendor_codec_id
931    -- Shall be ignored if |coding_format| is not VENDOR_SPECIFIC.
932
933
934struct SynchronousConnectionParameters:
935  -- Enhanced Setup Synchronous Connection Command (CSA2) (BR/EDR)
936  -- TODO: b/308794058 - Use CodecId instead of VendorCodingFormat
937  struct VendorCodingFormat:
938    0     [+1]  hci.CodingFormat  coding_format
939    $next [+2]  UInt              company_id
940      -- See assigned numbers.
941
942    $next [+2]  UInt              vendor_codec_id
943      -- Shall be ignored if |coding_format| is not VENDOR_SPECIFIC.
944
945  enum ScoRetransmissionEffort:
946    [maximum_bits: 8]
947    NONE              = 0x00
948      -- SCO or eSCO
949
950    POWER_OPTIMIZED   = 0x01
951      -- eSCO only
952
953    QUALITY_OPTIMIZED = 0x02
954      -- eSCO only
955
956    DONT_CARE         = 0xFF
957      -- SCO or eSCO
958
959  0     [+4]                              UInt                     transmit_bandwidth
960    -- Transmit bandwidth in octets per second.
961
962  $next [+4]                              UInt                     receive_bandwidth
963    -- Receive bandwidth in octets per second.
964
965  let vcf_size = VendorCodingFormat.$size_in_bytes
966  $next [+vcf_size]                       VendorCodingFormat       transmit_coding_format
967    -- Local Controller -> Remote Controller coding format.
968
969  $next [+vcf_size]                       VendorCodingFormat       receive_coding_format
970    -- Remote Controller -> Local Controller coding format.
971
972  $next [+2]                              UInt                     transmit_codec_frame_size_bytes
973  $next [+2]                              UInt                     receive_codec_frame_size_bytes
974  $next [+4]                              UInt                     input_bandwidth
975    -- Host->Controller data rate in octets per second.
976
977  $next [+4]                              UInt                     output_bandwidth
978    -- Controller->Host data rate in octets per second.
979
980  $next [+vcf_size]                       VendorCodingFormat       input_coding_format
981    -- Host->Controller coding format.
982
983  $next [+vcf_size]                       VendorCodingFormat       output_coding_format
984    -- Controller->Host coding format.
985
986  $next [+2]                              UInt                     input_coded_data_size_bits
987    -- Size, in bits, of the sample or framed data.
988
989  $next [+2]                              UInt                     output_coded_data_size_bits
990    -- Size, in bits, of the sample or framed data.
991
992  $next [+1]                              PcmDataFormat            input_pcm_data_format
993  $next [+1]                              PcmDataFormat            output_pcm_data_format
994  $next [+1]                              UInt                     input_pcm_sample_payload_msb_position
995    -- The number of bit positions within an audio sample that the MSB of
996    -- the sample is away from starting at the MSB of the data.
997
998  $next [+1]                              UInt                     output_pcm_sample_payload_msb_position
999    -- The number of bit positions within an audio sample that the MSB of
1000    -- the sample is away from starting at the MSB of the data.
1001
1002  $next [+1]                              ScoDataPath              input_data_path
1003  $next [+1]                              ScoDataPath              output_data_path
1004  $next [+1]                              UInt                     input_transport_unit_size_bits
1005    -- The number of bits in each unit of data received from the Host over the audio data transport.
1006    -- 0 indicates "not applicable"  (implied by the choice of audio data transport).
1007
1008  $next [+1]                              UInt                     output_transport_unit_size_bits
1009    -- The number of bits in each unit of data sent to the Host over the audio data transport.
1010    -- 0 indicates "not applicable"  (implied by the choice of audio data transport).
1011
1012  $next [+2]                              UInt                     max_latency_ms
1013    -- The value in milliseconds representing the upper limit of the sum of
1014    -- the synchronous interval, and the size of the eSCO window, where the
1015    -- eSCO window is the reserved slots plus the retransmission window.
1016    -- Minimum: 0x0004
1017    -- Don't care: 0xFFFF
1018
1019  $next [+2]  bits:
1020    0     [+ScoPacketType.$size_in_bits]  ScoPacketType            packet_types
1021      -- Bitmask of allowed packet types.
1022
1023  $next [+1]                              ScoRetransmissionEffort  retransmission_effort
1024
1025
1026struct EnhancedSetupSynchronousConnectionCommand:
1027  -- 7.1.45 Enhanced Setup Synchronous Connection command
1028  -- HCI_Enhanced_Setup_Synchronous_Connection
1029  let hdr_size = hci.CommandHeader.$size_in_bytes
1030  0     [+hdr_size]  hci.CommandHeader                header
1031  $next [+2]         UInt                             connection_handle
1032    -- The connection handle of the associated ACL link if creating a new (e)SCO connection, or the
1033    -- handle of an existing eSCO link if updating connection parameters.
1034
1035  let scp_size = SynchronousConnectionParameters.$size_in_bytes
1036  $next [+scp_size]  SynchronousConnectionParameters  connection_parameters
1037
1038
1039struct EnhancedAcceptSynchronousConnectionRequestCommand:
1040  -- 7.1.46 Enhanced Accept Synchronous Connection Request command (CSA2) (BR/EDR)
1041  -- HCI_Enhanced_Accept_Synchronous_Connection_Request
1042  let hdr_size = hci.CommandHeader.$size_in_bytes
1043  0     [+hdr_size]                   hci.CommandHeader                header
1044  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                       bd_addr
1045    -- The 48-bit BD_ADDR of the remote device requesting the connection.
1046
1047  let scp_size = SynchronousConnectionParameters.$size_in_bytes
1048  $next [+scp_size]                   SynchronousConnectionParameters  connection_parameters
1049
1050# 7.1.47 Truncated Page command
1051# HCI_Truncated_Page
1052# TODO: b/265052417 - Definition needs to be added
1053
1054
1055# 7.1.48 Truncated Page Cancel command
1056# HCI_Truncated_Page_Cancel
1057# TODO: b/265052417 - Definition needs to be added
1058
1059
1060# 7.1.49 Set Connectionless Peripheral Broadcast command
1061# HCI_Set_Connectionless_Peripheral_Broadcast
1062# TODO: b/265052417 - Definition needs to be added
1063
1064
1065# 7.1.50 Set Connectionless Peripheral Broadcast Receive command
1066# HCI_Set_Connectionless_Peripheral_Broadcast_Receive
1067# TODO: b/265052417 - Definition needs to be added
1068
1069
1070# 7.1.51 Start Synchronization Train command
1071# HCI_Start_Synchronization_Train
1072# TODO: b/265052417 - Definition needs to be added
1073
1074
1075# 7.1.52 Receive Synchronization Train command
1076# HCI_Receive_Synchronization_Train
1077# TODO: b/265052417 - Definition needs to be added
1078
1079
1080# 7.1.53 Remote OOB Extended Data Request Reply command
1081# HCI_Remote_OOB_Extended_Data_Request_Reply
1082# TODO: b/265052417 - Definition needs to be added
1083
1084
1085# ========== 7.3 Controller & Baseband Commands ==========
1086
1087
1088struct SetEventMaskCommand:
1089  -- 7.3.1 Set Event Mask command (v1.1)
1090  -- HCI_Set_Event_Mask
1091  let hdr_size = hci.CommandHeader.$size_in_bytes
1092  0        [+hdr_size]  hci.CommandHeader  header
1093  hdr_size [+8]         UInt               event_mask
1094    -- 64-bit Bit mask used to control which HCI events are generated by the HCI for the
1095    -- Host. See enum class EventMask in hci_constants.h
1096
1097  hdr_size [+8]  bits:
1098    0        [+62]      EventMask          event_mask_bits
1099      -- Bit mask used to control which HCI events are generated by the HCI for the Host.
1100
1101
1102struct ResetCommand:
1103  -- 7.3.2 Reset command (v1.1)
1104  -- HCI_Reset
1105  let hdr_size = hci.CommandHeader.$size_in_bytes
1106  0 [+hdr_size]  hci.CommandHeader  header
1107
1108# 7.3.3 Set Event Filter command
1109# HCI_Set_Event_Filter
1110# TODO: b/265052417 - Definition needs to be added
1111
1112
1113# 7.3.4 Flush command
1114# HCI_Flush
1115# TODO: b/265052417 - Definition needs to be added
1116
1117
1118# 7.3.5 Read PIN Type command
1119# HCI_Read_PIN_Type
1120# TODO: b/265052417 - Definition needs to be added
1121
1122
1123# 7.3.6 Write PIN Type command
1124# HCI_Write_PIN_Type
1125# TODO: b/265052417 - Definition needs to be added
1126
1127
1128# 7.3.8 Read Stored Link Key command
1129# HCI_Read_Stored_Link_Key
1130# TODO: b/265052417 - Definition needs to be added
1131
1132
1133# 7.3.9 Write Stored Link Key command
1134# HCI_Write_Stored_Link_Key
1135# TODO: b/265052417 - Definition needs to be added
1136
1137
1138# 7.3.10 Delete Stored Link Key command
1139# HCI_Delete_Stored_Link_Key
1140# TODO: b/265052417 - Definition needs to be added
1141
1142
1143struct WriteLocalNameCommand:
1144  -- 7.3.11 Write Local Name command (v1.1) (BR/EDR)
1145  -- HCI_Write_Local_Name
1146  let hdr_size = hci.CommandHeader.$size_in_bytes
1147  0     [+hdr_size]         hci.CommandHeader  header
1148  let local_name_size = LocalName.$size_in_bytes
1149  $next [+local_name_size]  LocalName          local_name
1150    -- A UTF-8 encoded User Friendly Descriptive Name for the device.
1151    -- If the name contained in the parameter is shorter than 248 octets, the end
1152    -- of the name is indicated by a NULL octet (0x00), and the following octets
1153    -- (to fill up 248 octets, which is the length of the parameter) do not have
1154    -- valid values.
1155
1156
1157struct ReadLocalNameCommand:
1158  -- 7.3.12 Read Local Name command (v1.1) (BR/EDR)
1159  -- HCI_Read_Local_Name
1160  let hdr_size = hci.CommandHeader.$size_in_bytes
1161  0 [+hdr_size]  hci.CommandHeader  header
1162
1163# 7.3.13 Read Connection Accept Timeout command
1164# HCI_Read_Connection_Accept_Timeout
1165# TODO: b/265052417 - Definition needs to be added
1166
1167
1168# 7.3.14 Write Connection Accept Timeout command
1169# HCI_Write_Connection_Accept_Timeout
1170# TODO: b/265052417 - Definition needs to be added
1171
1172
1173# 7.3.15 Read Page Timeout command
1174# HCI_Read_Page_Timeout
1175# TODO: b/265052417 - Definition needs to be added
1176
1177
1178struct WritePageTimeoutCommand:
1179  -- 7.3.16 Write Page Timeout command (v1.1) (BR/EDR)
1180  -- HCI_Write_Page_Timeout
1181  let hdr_size = hci.CommandHeader.$size_in_bytes
1182  0     [+hdr_size]  hci.CommandHeader  header
1183  $next [+2]         UInt               page_timeout
1184    -- Page_Timeout, in time slices (0.625 ms)
1185    -- Range: From MIN to MAX in PageTimeout in this file
1186    [requires: 0x0001 <= this <= 0xFFFF]
1187
1188
1189struct ReadScanEnableCommand:
1190  -- 7.3.17 Read Scan Enable command (v1.1) (BR/EDR)
1191  -- HCI_Read_Scan_Enable
1192  let hdr_size = hci.CommandHeader.$size_in_bytes
1193  0 [+hdr_size]  hci.CommandHeader  header
1194
1195
1196struct WriteScanEnableCommand:
1197  -- 7.3.18 Write Scan Enable command (v1.1) (BR/EDR)
1198  -- HCI_Write_Scan_Enable
1199  let hdr_size = hci.CommandHeader.$size_in_bytes
1200  0     [+hdr_size]                        hci.CommandHeader  header
1201  $next [+1]  bits:
1202    0     [+ScanEnableBits.$size_in_bits]  ScanEnableBits     scan_enable
1203
1204
1205struct ReadPageScanActivityCommand:
1206  -- 7.3.19 Read Page Scan Activity command (v1.1) (BR/EDR)
1207  -- HCI_Read_Page_Scan_Activity
1208  let hdr_size = hci.CommandHeader.$size_in_bytes
1209  0 [+hdr_size]  hci.CommandHeader  header
1210
1211
1212struct WritePageScanActivityCommand:
1213  -- 7.3.20 Write Page Scan Activity command (v1.1) (BR/EDR)
1214  -- HCI_Write_Page_Scan_Activity
1215  let hdr_size = hci.CommandHeader.$size_in_bytes
1216  0     [+hdr_size]  hci.CommandHeader  header
1217  $next [+2]         UInt               page_scan_interval
1218    -- Page_Scan_Interval, in time slices (0.625ms)
1219    -- Valid Range: MIN - MAX in ScanInterval in this file
1220    [requires: 0x0012 <= this <= 0x1000]
1221
1222  $next [+2]         UInt               page_scan_window
1223    -- Page_Scan_Window, in time slices
1224    -- Valid Range: MIN - MAX in ScanWindow in this file
1225    [requires: 0x0011 <= this <= 0x1000]
1226
1227
1228struct ReadInquiryScanActivityCommand:
1229  -- 7.3.21 Read Inquiry Scan Activity command (v1.1) (BR/EDR)
1230  -- HCI_Read_Inquiry_Scan_Activity
1231  let hdr_size = hci.CommandHeader.$size_in_bytes
1232  0 [+hdr_size]  hci.CommandHeader  header
1233
1234
1235struct WriteInquiryScanActivityCommand:
1236  -- 7.3.22 Write Inquiry Scan Activity command (v1.1) (BR/EDR)
1237  -- HCI_Write_Inquiry_Scan_Activity
1238  let hdr_size = hci.CommandHeader.$size_in_bytes
1239  0     [+hdr_size]  hci.CommandHeader  header
1240  $next [+2]         UInt               inquiry_scan_interval
1241    -- Inquiry_Scan_Interval, in time slices (0.625ms)
1242    -- Valid Range: MIN - MAX in ScanInterval in this file
1243    [requires: 0x0012 <= this <= 0x1000]
1244
1245  $next [+2]         UInt               inquiry_scan_window
1246    -- Inquiry_Scan_Window, in time slices
1247    -- Valid Range: MIN - MAX in ScanWindow in this file
1248    [requires: 0x0011 <= this <= 0x1000]
1249
1250# 7.3.23 Read Authentication Enable command
1251# HCI_Read_Authentication_Enable
1252# TODO: b/265052417 - Definition needs to be added
1253
1254
1255# 7.3.24 Write Authentication Enable command
1256# HCI_Write_Authentication_Enable
1257# TODO: b/265052417 - Definition needs to be added
1258
1259
1260struct ReadClassOfDeviceCommand:
1261  -- 7.3.25 Read Class of Device command (v1.1) (BR/EDR)
1262  -- HCI_Read_Class_Of_Device
1263  let hdr_size = hci.CommandHeader.$size_in_bytes
1264  0 [+hdr_size]  hci.CommandHeader  header
1265
1266
1267struct WriteClassOfDeviceCommand:
1268  -- 7.3.26 Write Class Of Device command (v1.1) (BR/EDR)
1269  -- HCI_Write_Class_Of_Device
1270  let hdr_size = hci.CommandHeader.$size_in_bytes
1271  0     [+hdr_size]  hci.CommandHeader  header
1272  $next [+3]         hci.ClassOfDevice  class_of_device
1273
1274# 7.3.27 Read Voice Setting command
1275# HCI_Read_Voice_Setting
1276# TODO: b/265052417 - Definition needs to be added
1277
1278
1279# 7.3.28 Write Voice Setting command
1280# HCI_Write_Voice_Setting
1281# TODO: b/265052417 - Definition needs to be added
1282
1283
1284# 7.3.29 Read Automatic Flush Timeout command
1285# HCI_Read_Automatic_Flush_Timeout
1286# TODO: b/265052417 - Definition needs to be added
1287
1288
1289struct WriteAutomaticFlushTimeoutCommand:
1290  -- 7.3.30 Write Automatic Flush Timeout command (v1.1) (BR/EDR)
1291  -- HCI_Write_Automatic_Flush_Timeout
1292  let hdr_size = hci.CommandHeader.$size_in_bytes
1293  0     [+hdr_size]  hci.CommandHeader  header
1294  $next [+2]         UInt               connection_handle
1295    -- Connection_Handle (only the lower 12-bits are meaningful).
1296    --   Range: 0x0000 to 0x0EFF
1297    [requires: 0x0000 <= this <= 0x0EFF]
1298
1299  $next [+2]         UInt               flush_timeout
1300    -- The value for the Flush_Timeout configuration parameter (Core Spec v5.2, Vol 4, Part E, Sec 6.19).
1301    -- Range: 0x0000 to 0x07FF. 0x0000 indicates infinite flush timeout (no automatic flush).
1302    -- Time = flush_timeout * 0.625ms.
1303    -- Time Range: 0.625ms to 1279.375ms.
1304    [requires: 0x0000 <= this <= 0x07FF]
1305
1306# 7.3.31 Read Num Broadcast Retransmissions command
1307# HCI_Read_Num_Broadcast_Retransmissions
1308# TODO: b/265052417 - Definition needs to be added
1309
1310
1311# 7.3.32 Write Num Broadcast Retransmissions command
1312# HCI_Write_Num_Broadcast_Retransmissions
1313# TODO: b/265052417 - Definition needs to be added
1314
1315
1316# 7.3.33 Read Hold Mode Activity command
1317# HCI_Read_Hold_Mode_Activity
1318# TODO: b/265052417 - Definition needs to be added
1319
1320
1321# 7.3.34 Write Hold Mode Activity command
1322# HCI_Write_Hold_Mode_Activity
1323# TODO: b/265052417 - Definition needs to be added
1324
1325
1326# 7.3.35 Read Transmit Power Level command
1327# HCI_Read_Transmit_Power_Level
1328# TODO: b/265052417 - Definition needs to be added
1329
1330
1331# 7.3.36 Read Synchronous Flow Control Enable command
1332# HCI_Read_Synchronous_Flow_Control_Enable
1333# TODO: b/265052417 - Definition needs to be added
1334
1335
1336struct WriteSynchronousFlowControlEnableCommand:
1337  -- 7.3.37 Write Synchonous Flow Control Enable command (BR/EDR)
1338  -- HCI_Write_Synchronous_Flow_Control_Enable
1339  let hdr_size = hci.CommandHeader.$size_in_bytes
1340  0     [+hdr_size]  hci.CommandHeader       header
1341  $next [+1]         hci.GenericEnableParam  synchronous_flow_control_enable
1342    -- If enabled, HCI_Number_Of_Completed_Packets events shall be sent from the controller
1343    -- for synchronous connection handles.
1344
1345# 7.3.38 Set Controller To Host Flow Control command
1346# HCI_Set_Controller_To_Host_Flow_Control
1347# TODO: b/265052417 - Definition needs to be added
1348
1349
1350# 7.3.39 Host Buffer Size command
1351# HCI_Host_Buffer_Size
1352# TODO: b/265052417 - Definition needs to be added
1353
1354
1355# 7.3.40 Host Number Of Completed Packets command
1356# HCI_Host_Number_Of_Completed_Packets
1357# TODO: b/265052417 - Definition needs to be added
1358
1359
1360# 7.3.41 Read Link Supervision Timeout command
1361# HCI_Read_Link_Supervision_Timeout
1362# TODO: b/265052417 - Definition needs to be added
1363
1364
1365# 7.3.42 Write Link Supervision Timeout command
1366# HCI_Write_Link_Supervision_Timeout
1367# TODO: b/265052417 - Definition needs to be added
1368
1369
1370# 7.3.43 Read Number Of Supported IAC command
1371# HCI_Read_Number_Of_Supported_IAC
1372# TODO: b/265052417 - Definition needs to be added
1373
1374
1375# 7.3.44 Read Current IAC LAP command
1376# HCI_Read_Current_IAC_LAP
1377# TODO: b/265052417 - Definition needs to be added
1378
1379
1380# 7.3.45 Write Current IAC LAP command
1381# HCI_Write_Current_IAC_LAP
1382# TODO: b/265052417 - Definition needs to be added
1383
1384
1385# 7.3.46 Set AFH Host Channel Classification command
1386# HCI_Set_AFH_Host_Channel_Classification
1387# TODO: b/265052417 - Definition needs to be added
1388
1389
1390# 7.3.47 Read Inquiry Scan Type command
1391# HCI_Read_Inquiry_Scan_Type
1392# TODO: b/265052417 - Definition needs to be added
1393
1394
1395struct WriteInquiryScanTypeCommand:
1396  -- 7.3.48 Write Inquiry Scan Type (v1.2) (BR/EDR)
1397  -- HCI_Write_Inquiry_Scan_Type
1398  let hdr_size = hci.CommandHeader.$size_in_bytes
1399  0     [+hdr_size]  hci.CommandHeader  header
1400  $next [+1]         InquiryScanType    inquiry_scan_type
1401    -- See enum class InquiryScanType in this file for possible values
1402
1403
1404struct ReadInquiryModeCommand:
1405  -- 7.3.49 Read Inquiry Mode (v1.2) (BR/EDR)
1406  -- HCI_Read_Inquiry_Mode
1407  let hdr_size = hci.CommandHeader.$size_in_bytes
1408  0 [+hdr_size]  hci.CommandHeader  header
1409
1410
1411struct WriteInquiryModeCommand:
1412  -- 7.3.50 Write Inquiry Mode (v1.2) (BR/EDR)
1413  -- HCI_Write_Inquiry_Mode
1414  let hdr_size = hci.CommandHeader.$size_in_bytes
1415  0     [+hdr_size]  hci.CommandHeader  header
1416  $next [+1]         InquiryMode        inquiry_mode
1417
1418
1419struct ReadPageScanTypeCommand:
1420  -- 7.3.51 Read Page Scan Type (v1.2) (BR/EDR)
1421  -- HCI_Read_Page_Scan_Type
1422  let hdr_size = hci.CommandHeader.$size_in_bytes
1423  0 [+hdr_size]  hci.CommandHeader  header
1424
1425
1426struct WritePageScanTypeCommand:
1427  -- 7.3.52 Write Page Scan Type (v1.2) (BR/EDR)
1428  -- HCI_Write_Page_Scan_Type
1429  let hdr_size = hci.CommandHeader.$size_in_bytes
1430  0     [+hdr_size]  hci.CommandHeader  header
1431  $next [+1]         PageScanType       page_scan_type
1432
1433# 7.3.53 Read AFH Channel Assessment Mode command
1434# HCI_Read_AFH_Channel_Assessment_Mode
1435# TODO: b/265052417 - Definition needs to be added
1436
1437
1438# 7.3.54 Write AFH Channel Assessment Mode command
1439# HCI_Write_AFH_Channel_Assessment_Mode
1440# TODO: b/265052417 - Definition needs to be added
1441
1442
1443# 7.3.55 Read Extended Inquiry Response command
1444# HCI_Read_Extended_Inquiry_Response
1445# TODO: b/265052417 - Definition needs to be added
1446
1447
1448struct WriteExtendedInquiryResponseCommand:
1449  -- 7.3.56 Write Extended Inquiry Response (v1.2) (BR/EDR)
1450  -- HCI_Write_Extended_Inquiry_Response
1451  let hdr_size = hci.CommandHeader.$size_in_bytes
1452  0     [+hdr_size]  hci.CommandHeader        header
1453  $next [+1]         UInt                     fec_required
1454    -- If FEC Encoding is required. (v1.2) (7.3.56)
1455
1456  let eir_size = ExtendedInquiryResponse.$size_in_bytes
1457  $next [+eir_size]  ExtendedInquiryResponse  extended_inquiry_response
1458    -- Extended inquiry response data as defined in Vol 3, Part C, Sec 8
1459
1460# 7.3.57 Refresh Encryption Key command
1461# HCI_Refresh_Encryption_Key
1462# TODO: b/265052417 - Definition needs to be added
1463
1464
1465struct ReadSimplePairingModeCommand:
1466  -- 7.3.58 Read Simple Pairing Mode (v2.1 + EDR) (BR/EDR)
1467  -- HCI_Read_Simple_Pairing_Mode
1468  let hdr_size = hci.CommandHeader.$size_in_bytes
1469  0 [+hdr_size]  hci.CommandHeader  header
1470
1471
1472struct WriteSimplePairingModeCommand:
1473  -- 7.3.59 Write Simple Pairing Mode (v2.1 + EDR) (BR/EDR)
1474  -- HCI_Write_Simple_Pairing_Mode
1475  let hdr_size = hci.CommandHeader.$size_in_bytes
1476  0     [+hdr_size]  hci.CommandHeader       header
1477  $next [+1]         hci.GenericEnableParam  simple_pairing_mode
1478
1479# 7.3.60 Read Local OOB Data command
1480# HCI_Read_Local_OOB_Data
1481# TODO: b/265052417 - Definition needs to be added
1482
1483
1484# 7.3.61 Read Inquiry Response Transmit Power Level command
1485# HCI_Read_Inquiry_Response_Transmit_Power_Level
1486# TODO: b/265052417 - Definition needs to be added
1487
1488
1489# 7.3.62 Write Inquiry Transmit Power Level command
1490# HCI_Write_Inquiry_Transmit_Power_Level
1491# TODO: b/265052417 - Definition needs to be added
1492
1493
1494# 7.3.63 Send Keypress Notification command
1495# HCI_Send_Keypress_Notification
1496# TODO: b/265052417 - Definition needs to be added
1497
1498
1499# 7.3.64 Read Default Erroneous Data Reporting command
1500# HCI_Read_Default_Erroneous_Data_Reporting
1501# TODO: b/265052417 - Definition needs to be added
1502
1503
1504# 7.3.65 Write Default Erroneous Data Reporting command
1505# HCI_Write_Default_Erroneous_Data_Reporting
1506# TODO: b/265052417 - Definition needs to be added
1507
1508
1509# 7.3.66 Enhanced Flush command
1510# HCI_Enhanced_Flush
1511# TODO: b/265052417 - Definition needs to be added
1512
1513
1514struct SetEventMaskPage2Command:
1515  -- 7.3.69 Set Event Mask Page 2 command (v3.0 + HS)
1516  -- HCI_Set_Event_Mask_Page_2
1517  0     [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1518  $next [+8]  bits:
1519    0     [+26]                              EventMaskPage2     event_mask_page_2
1520      -- Bit mask used to control which HCI events are generated by the HCI for the Host.
1521
1522
1523struct ReadFlowControlModeCommand:
1524  -- 7.3.72 Read Flow Control Mode command (v3.0 + HS) (BR/EDR)
1525  -- HCI_Read_Flow_Control_Mode
1526  0 [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1527
1528
1529struct WriteFlowControlModeCommand:
1530  -- 7.3.73 Write Flow Control Mode command (v3.0 + HS) (BR/EDR)
1531  -- HCI_Write_Flow_Control_Mode
1532  0     [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1533  $next [+1]                                 FlowControlMode    flow_control_mode
1534
1535# 7.3.74 Read Enhanced Transmit Power Level command
1536# HCI_Read_Enhanced_Transmit_Power_Level
1537# TODO: b/265052417 - Definition needs to be added
1538
1539
1540struct ReadLEHostSupportCommand:
1541  -- 7.3.78 Read LE Host Support command (v4.0) (BR/EDR)
1542  -- HCI_Read_LE_Host_Support
1543  0 [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1544
1545
1546struct WriteLEHostSupportCommand:
1547  -- 7.3.79 Write LE Host Support command (v4.0) (BR/EDR)
1548  -- HCI_Write_LE_Host_Support
1549  let hdr_size = hci.CommandHeader.$size_in_bytes
1550  0     [+hdr_size]  hci.CommandHeader       header
1551  $next [+1]         hci.GenericEnableParam  le_supported_host
1552    -- Sets the LE Supported (Host) Link Manager Protocol feature bit.
1553
1554  $next [+1]         UInt                    unused
1555    -- Core Spec v5.0, Vol 2, Part E, Section 6.35: This parameter was named
1556    -- "Simultaneous_LE_Host" and the value is set to "disabled(0x00)" and
1557    -- "shall be ignored".
1558    -- Core Spec v5.3, Vol 4, Part E, Section 7.3.79: This parameter was renamed
1559    -- to "Unused" and "shall be ignored by the controller".
1560
1561# 7.3.80 Set MWS Channel Parameters command
1562# HCI_Set_MWS_Channel_Parameters
1563# TODO: b/265052417 - Definition needs to be added
1564
1565
1566# 7.3.81 Set External Frame Configuration command
1567# HCI_Set_External_Frame_Configuration
1568# TODO: b/265052417 - Definition needs to be added
1569
1570
1571# 7.3.82 Set MWS Signaling command
1572# HCI_Set_MWS_Signaling
1573# TODO: b/265052417 - Definition needs to be added
1574
1575
1576# 7.3.83 Set MWS Transport Layer command
1577# HCI_Set_MWS_Transport_Layer
1578# TODO: b/265052417 - Definition needs to be added
1579
1580
1581# 7.3.84 Set MWS Scan Frequency Table command
1582# HCI_Set_MWS_Scan_Frequency_Table
1583# TODO: b/265052417 - Definition needs to be added
1584
1585
1586# 7.3.85 Set MWS_PATTERN Configuration command
1587# HCI_Set_MWS_PATTERN_Configuration
1588# TODO: b/265052417 - Definition needs to be added
1589
1590
1591# 7.3.86 Set Reserved LT_ADDR command
1592# HCI_Set_Reserved_LT_ADDR
1593# TODO: b/265052417 - Definition needs to be added
1594
1595
1596# 7.3.87 Delete Reserved LT_ADDR command
1597# HCI_Delete_Reserved_LT_ADDR
1598# TODO: b/265052417 - Definition needs to be added
1599
1600
1601# 7.3.88 Set Connectionless Peripheral Broadcast Data command
1602# HCI_Set_Connectionless_Peripheral_Broadcast_Data
1603# TODO: b/265052417 - Definition needs to be added
1604
1605
1606# 7.3.89 Read Synchronization Train Parameters command
1607# HCI_Read_Synchronization_Train_Parameters
1608# TODO: b/265052417 - Definition needs to be added
1609
1610
1611# 7.3.90 Write Synchronization Train Parameters command
1612# HCI_Write_Synchronization_Train_Parameters
1613# TODO: b/265052417 - Definition needs to be added
1614
1615
1616# 7.3.91 Read Secure Connections Host Support command
1617# HCI_Read_Secure_Connections_Host_Support
1618# TODO: b/265052417 - Definition needs to be added
1619
1620
1621struct WriteSecureConnectionsHostSupportCommand:
1622  -- 7.3.92 Write Secure Connections Host Support command
1623  -- HCI_Write_Secure_Connections_Host_Support
1624  let hdr_size = hci.CommandHeader.$size_in_bytes
1625  0     [+hdr_size]  hci.CommandHeader       header
1626  $next [+1]         hci.GenericEnableParam  secure_connections_host_support
1627
1628
1629struct ReadAuthenticatedPayloadTimeoutCommand:
1630  -- 7.3.93 Read Authenticated Payload Timeout command (v4.1) (BR/EDR & LE)
1631  -- HCI_Read_Authenticated_Payload_Timeout
1632  0     [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1633  $next [+2]                                 UInt               connection_handle
1634    [requires: 0x0000 <= this <= 0x0EFF]
1635
1636
1637struct WriteAuthenticatedPayloadTimeoutCommand:
1638  -- 7.3.94 Write Authenticated Payload Timeout command (v4.1) (BR/EDR & LE)
1639  -- HCI_Write_Authenticated_Payload_Timeout
1640  0     [+hci.CommandHeader.$size_in_bytes]  hci.CommandHeader  header
1641  $next [+2]                                 UInt               connection_handle
1642    [requires: 0x0000 <= this <= 0x0EFF]
1643
1644  $next [+2]                                 UInt               authenticated_payload_timeout
1645    -- Default = 0x0BB8 (30 s)
1646    -- Time = N * 10 ms
1647    -- Time Range: 10 ms to 655,350 ms
1648    [requires: 0x0001 <= this <= 0xFFFF]
1649
1650# 7.3.95 Read Local OOB Extended Data command
1651# HCI_Read_Local_OOB_Extended_Data
1652# TODO: b/265052417 - Definition needs to be added
1653
1654
1655# 7.3.96 Read Extended Page Timeout command
1656# HCI_Read_Extended_Page_Timeout
1657# TODO: b/265052417 - Definition needs to be added
1658
1659
1660# 7.3.97 Write Extended Page Timeout command
1661# HCI_Write_Extended_Page_Timeout
1662# TODO: b/265052417 - Definition needs to be added
1663
1664
1665# 7.3.98 Read Extended Inquiry Length command
1666# HCI_Read_Extended_Inquiry_Length
1667# TODO: b/265052417 - Definition needs to be added
1668
1669
1670# 7.3.99 Write Extended Inquiry Length command
1671# HCI_Write_Extended_Inquiry_Length
1672# TODO: b/265052417 - Definition needs to be added
1673
1674
1675# 7.3.100 Set Ecosystem Base Interval command
1676# HCI_Set_Ecosystem_Base_Interval
1677# TODO: b/265052417 - Definition needs to be added
1678
1679
1680# 7.3.101 Configure Data Path command
1681# HCI_Configure_Data_Path
1682# TODO: b/265052417 - Definition needs to be added
1683
1684
1685# 7.3.102 Set Min Encryption Key Size command
1686# HCI_Set_Min_Encryption_Key_size
1687# TODO: b/265052417 - Definition needs to be added
1688
1689
1690# ========== 7.4 Informational Parameters ==========
1691
1692
1693struct ReadLocalVersionInformationCommand:
1694  -- 7.4.1 Read Local Version Information command (v1.1)
1695  -- HCI_Read_Local_Version_Information
1696  let hdr_size = hci.CommandHeader.$size_in_bytes
1697  0 [+hdr_size]  hci.CommandHeader  header
1698
1699
1700struct ReadLocalSupportedCommandsCommand:
1701  -- 7.4.2 Read Local Supported Commands command (v1.2)
1702  -- HCI_Read_Local_Supported_Commands
1703  let hdr_size = hci.CommandHeader.$size_in_bytes
1704  0 [+hdr_size]  hci.CommandHeader  header
1705
1706
1707struct ReadLocalSupportedFeaturesCommand:
1708  -- 7.4.3 Read Local Supported Features command (v1.1)
1709  -- HCI_Read_Local_Supported_Features
1710  let hdr_size = hci.CommandHeader.$size_in_bytes
1711  0 [+hdr_size]  hci.CommandHeader  header
1712
1713
1714struct ReadLocalExtendedFeaturesCommand:
1715  -- 7.4.4 Read Local Extended Features command (v1.2) (BR/EDR)
1716  -- HCI_Read_Local_Extended_Features
1717  let hdr_size = hci.CommandHeader.$size_in_bytes
1718  0     [+hdr_size]  hci.CommandHeader  header
1719  $next [+1]         UInt               page_number
1720    -- 0x00: Requests the normal LMP features as returned by
1721    -- Read_Local_Supported_Features.
1722    -- 0x01-0xFF: Return the corresponding page of features.
1723
1724
1725struct ReadBufferSizeCommand:
1726  -- 7.4.5 Read Buffer Size command (v1.1)
1727  -- HCI_Read_Buffer_Size
1728  let hdr_size = hci.CommandHeader.$size_in_bytes
1729  0 [+hdr_size]  hci.CommandHeader  header
1730
1731
1732struct ReadBdAddrCommand:
1733  -- 7.4.6 Read BD_ADDR command (v1.1) (BR/EDR, LE)
1734  -- HCI_Read_BD_ADDR
1735  let hdr_size = hci.CommandHeader.$size_in_bytes
1736  0 [+hdr_size]  hci.CommandHeader  header
1737
1738# 7.4.7 Read Data Block Size command
1739# HCI_Read_Data_Block_Size
1740# TODO: b/265052417 - Definition needs to be added
1741
1742
1743# 7.4.8 Read Local Supported Codecs command
1744# HCI_Read_Local_Supported_Codecs [v1][v2]
1745# TODO: b/265052417 - Definition needs to be added
1746
1747
1748# 7.4.9 Read Local Simple Pairing Options command
1749# HCI_Read_Local_Simple_Pairing_Options
1750# TODO: b/265052417 - Definition needs to be added
1751
1752
1753# 7.4.10 Read Local Supported Codec Capabilities command
1754# HCI_Read_Local_Supported_Codec_Capabilities
1755# TODO: b/265052417 - Definition needs to be added
1756
1757
1758enum LogicalTransportType:
1759  [maximum_bits: 8]
1760  BR_EDR_ACL         = 0x00
1761    -- BR/EDR ACL
1762
1763  BR_EDR_SCO_OR_ESCO = 0x01
1764    -- BR/EDR SCO or eSCO
1765
1766  LE_CIS             = 0x02
1767    -- LE CIS
1768
1769  LE_BIS             = 0x03
1770    -- LE BIS
1771
1772
1773struct ReadLocalSupportedControllerDelayCommand:
1774  -- 7.4.11 Read Local Supported Controller Delay command (v5.2)
1775  -- HCI_Read_Local_Supported_Controller_Delay
1776  let hdr_size = hci.CommandHeader.$size_in_bytes
1777  0     [+hdr_size]                    hci.CommandHeader                   header
1778  $next [+CodecId.$size_in_bytes]      CodecId                             codec_id
1779  $next [+1]                           LogicalTransportType                logical_transport_type
1780  $next [+1]                           DataPathDirection                   direction
1781  $next [+1]                           UInt                                codec_configuration_length
1782    -- Length of codec configuration
1783
1784  $next [+codec_configuration_length]  UInt:8[codec_configuration_length]  codec_configuration
1785    -- Codec-specific configuration data
1786
1787# ========== 7.5 Status Parameters ==========
1788
1789
1790struct ReadRssiCommand:
1791  -- 7.5.4 Read RSSI (v5.3)
1792  -- HCI_Read_RSSI
1793  let hdr_size = hci.CommandHeader.$size_in_bytes
1794  0     [+hdr_size]  hci.CommandHeader  header
1795  $next [+2]         UInt               connection_handle
1796    [requires: 0x0000 <= this <= 0x0EFF]
1797
1798
1799struct ReadEncryptionKeySizeCommand:
1800  -- 7.5.6 Read Encryption Key Size (v1.1) (BR/EDR)
1801  -- HCI_Read_Encryption_Key_Size
1802  let hdr_size = hci.CommandHeader.$size_in_bytes
1803  0     [+hdr_size]  hci.CommandHeader  header
1804  $next [+2]         UInt               connection_handle
1805    -- Identifies an active ACL link (only the lower 12 bits are meaningful).
1806    [requires: 0x0000 <= this <= 0x0EFF]
1807
1808# ========== 7.8 LE Controller Commands ==========
1809
1810
1811struct LESetEventMaskCommand:
1812  -- 7.8.1 LE Set Event Mask command (v4.0) (LE)
1813  -- HCI_LE_Set_Event_Mask
1814  let hdr_size = hci.CommandHeader.$size_in_bytes
1815  0     [+hdr_size]  hci.CommandHeader  header
1816  $next [+8]  bits:
1817    0     [+35]      LEEventMask        le_event_mask
1818      -- Bitmask that indicates which LE events are generated by the HCI for the Host.
1819
1820
1821struct LEReadBufferSizeCommandV1:
1822  -- 7.8.2 LE Read Buffer Size command [v1] (v4.0) (LE)
1823  -- HCI_LE_Read_Buffer_Size [v1]
1824  let hdr_size = hci.CommandHeader.$size_in_bytes
1825  0 [+hdr_size]  hci.CommandHeader  header
1826
1827
1828struct LEReadBufferSizeCommandV2:
1829  -- 7.8.2 LE Read Buffer Size command [v2] (v5.2) (LE)
1830  -- HCI_LE_Read_Buffer_Size [v2]
1831  -- Version 2 of this command changed the opcode and added ISO return
1832  -- parameters.
1833  let hdr_size = hci.CommandHeader.$size_in_bytes
1834  0 [+hdr_size]  hci.CommandHeader  header
1835
1836
1837struct LEReadLocalSupportedFeaturesCommand:
1838  -- 7.8.3 LE Read Local Supported Features command (v4.0) (LE)
1839  -- HCI_LE_Read_Local_Supported_Features
1840  let hdr_size = hci.CommandHeader.$size_in_bytes
1841  0 [+hdr_size]  hci.CommandHeader  header
1842
1843
1844struct LESetRandomAddressCommand:
1845  -- 7.8.4 LE Set Random Address command (v4.0) (LE)
1846  -- HCI_LE_Set_Random_Address
1847  let hdr_size = hci.CommandHeader.$size_in_bytes
1848  0     [+hdr_size]                   hci.CommandHeader  header
1849  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         random_address
1850
1851
1852struct LESetAdvertisingParametersCommand:
1853  -- 7.8.5 LE Set Advertising Parameters command (v4.0) (LE)
1854  -- HCI_LE_Set_Advertising_Parameters
1855
1856  [requires: advertising_interval_min <= advertising_interval_max]
1857
1858  let hdr_size = hci.CommandHeader.$size_in_bytes
1859
1860  0     [+hdr_size]                   hci.CommandHeader              header
1861
1862  $next [+2]                          UInt                           advertising_interval_min
1863    -- Default: 0x0800 (1.28 s)
1864    -- Time: N * 0.625 ms
1865    -- Time Range: 20 ms to 10.24 s
1866    [requires: 0x0020 <= this <= 0x4000]
1867
1868  $next [+2]                          UInt                           advertising_interval_max
1869    -- Default: 0x0800 (1.28 s)
1870    -- Time: N * 0.625 ms
1871    -- Time Range: 20 ms to 10.24 s
1872    [requires: 0x0020 <= this <= 0x4000]
1873
1874  $next [+1]                          hci.LEAdvertisingType          adv_type
1875    -- Used to determine the packet type that is used for advertising when
1876    -- advertising is enabled.
1877
1878  $next [+1]                          hci.LEOwnAddressType           own_address_type
1879
1880  $next [+1]                          hci.LEPeerAddressType          peer_address_type
1881    -- ANONYMOUS address type not allowed.
1882
1883  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                     peer_address
1884    -- Public Device Address, Random Device Address, Public Identity Address, or
1885    -- Random (static) Identity Address of the device to be connected.
1886
1887  $next [+1]  bits:
1888
1889    0     [+3]                        hci.LEAdvertisingChannels      advertising_channel_map
1890      -- Indicates the advertising channels that shall be used when transmitting
1891      -- advertising packets. At least 1 channel must be enabled.
1892      -- Default: all channels enabled
1893
1894  $next [+1]                          hci.LEAdvertisingFilterPolicy  advertising_filter_policy
1895    -- This parameter shall be ignored when directed advertising is enabled.
1896
1897
1898struct LEReadAdvertisingChannelTxPowerCommand:
1899  -- 7.8.6 LE Read Advertising Channel Tx Power command (v4.0) (LE)
1900  -- HCI_LE_Read_Advertising_Channel_Tx_Power
1901  let hdr_size = hci.CommandHeader.$size_in_bytes
1902  0 [+hdr_size]  hci.CommandHeader  header
1903
1904
1905struct LESetAdvertisingDataCommand:
1906  -- 7.8.7 LE Set Advertising Data command (v4.0) (LE)
1907  -- HCI_LE_Set_Advertising_Data
1908  let hdr_size = hci.CommandHeader.$size_in_bytes
1909  0     [+hdr_size]  hci.CommandHeader  header
1910  $next [+1]         UInt               advertising_data_length
1911    -- The number of significant octets in `advertising_data`.
1912    [requires: 0x00 <= this <= 0x1F]
1913
1914  $next [+31]        UInt:8[31]         advertising_data
1915    -- 31 octets of advertising data formatted as defined in Core Spec
1916    -- v5.3, Vol 3, Part C, Section 11.
1917    -- Default: All octets zero
1918
1919
1920struct LESetScanResponseDataCommand:
1921  -- 7.8.8 LE Set Scan Response Data command (v4.0) (LE)
1922  -- HCI_LE_Set_Scan_Response_Data
1923  let hdr_size = hci.CommandHeader.$size_in_bytes
1924  0     [+hdr_size]  hci.CommandHeader  header
1925  $next [+1]         UInt               scan_response_data_length
1926    -- The number of significant octets in `scan_response_data`.
1927    [requires: 0x00 <= this <= 0x1F]
1928
1929  $next [+31]        UInt:8[31]         scan_response_data
1930    -- 31 octets of scan response data formatted as defined in Core Spec
1931    -- v5.3, Vol 3, Part C, Section 11.
1932    -- Default: All octets zero
1933
1934
1935struct LESetAdvertisingEnableCommand:
1936  -- 7.8.9 LE Set Advertising Enable command (v4.0) (LE)
1937  -- HCI_LE_Set_Advertising_Enable
1938  let hdr_size = hci.CommandHeader.$size_in_bytes
1939  0     [+hdr_size]  hci.CommandHeader       header
1940  $next [+1]         hci.GenericEnableParam  advertising_enable
1941
1942
1943struct LESetScanParametersCommand:
1944  -- 7.8.10 LE Set Scan Parameters command (v4.0) (LE)
1945  -- HCI_LE_Set_Scan_Parameters
1946
1947  [requires: le_scan_window <= le_scan_interval]
1948
1949  let hdr_size = hci.CommandHeader.$size_in_bytes
1950
1951  0     [+hdr_size]  hci.CommandHeader     header
1952
1953  $next [+1]         LEScanType            le_scan_type
1954    -- Controls the type of scan to perform.
1955
1956  $next [+2]         UInt                  le_scan_interval
1957    -- Default: 0x0010 (10ms)
1958    -- Time: N * 0.625 ms
1959    -- Time Range: 2.5 ms to 10.24 s
1960    [requires: 0x0004 <= this <= 0x4000]
1961
1962  $next [+2]         UInt                  le_scan_window
1963    -- Default: 0x0010 (10ms)
1964    -- Time: N * 0.625 ms
1965    -- Time Range: 2.5ms to 10.24 s
1966    [requires: 0x0004 <= this <= 0x4000]
1967
1968  $next [+1]         hci.LEOwnAddressType  own_address_type
1969    -- The type of address being used in the scan request packets.
1970
1971  $next [+1]         LEScanFilterPolicy    scanning_filter_policy
1972
1973
1974struct LESetScanEnableCommand:
1975  -- 7.8.11 LE Set Scan Enable command (v4.0) (LE)
1976  -- HCI_LE_Set_Scan_Enable
1977  let hdr_size = hci.CommandHeader.$size_in_bytes
1978  0     [+hdr_size]  hci.CommandHeader       header
1979  $next [+1]         hci.GenericEnableParam  le_scan_enable
1980  $next [+1]         hci.GenericEnableParam  filter_duplicates
1981    -- Controls whether the Link Layer should filter out duplicate advertising
1982    -- reports to the Host, or if the Link Layer should generate advertising
1983    -- reports for each packet received. Ignored if le_scan_enable is set to
1984    -- disabled.
1985    -- See Core Spec v5.3, Vol 6, Part B, Section 4.4.3.5
1986
1987
1988struct LECreateConnectionCommand:
1989  -- 7.8.12 LE Create Connection command (v4.0) (LE)
1990  -- HCI_LE_Create_Connection
1991
1992  [requires: le_scan_window <= le_scan_interval && connection_interval_min <= connection_interval_max]
1993
1994  let hdr_size = hci.CommandHeader.$size_in_bytes
1995
1996  0     [+hdr_size]                   hci.CommandHeader       header
1997
1998  $next [+2]                          UInt                    le_scan_interval
1999    -- The time interval from when the Controller started the last LE scan until
2000    -- it begins the subsequent LE scan.
2001    -- Time: N * 0.625 ms
2002    -- Time Range: 2.5 ms to 10.24 s
2003    [requires: 0x0004 <= this <= 0x4000]
2004
2005  $next [+2]                          UInt                    le_scan_window
2006    -- Amount of time for the duration of the LE scan.
2007    -- Time: N * 0.625 ms
2008    -- Time Range: 2.5 ms to 10.24 s
2009    [requires: 0x0004 <= this <= 0x4000]
2010
2011  $next [+1]                          hci.GenericEnableParam  initiator_filter_policy
2012
2013  $next [+1]                          hci.LEAddressType       peer_address_type
2014
2015  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr              peer_address
2016
2017  $next [+1]                          hci.LEOwnAddressType    own_address_type
2018
2019  $next [+2]                          UInt                    connection_interval_min
2020    -- Time: N * 1.25 ms
2021    -- Time Range: 7.5 ms to 4 s.
2022    [requires: 0x0006 <= this <= 0x0C80]
2023
2024  $next [+2]                          UInt                    connection_interval_max
2025    -- Time: N * 1.25 ms
2026    -- Time Range: 7.5 ms to 4 s.
2027    [requires: 0x0006 <= this <= 0x0C80]
2028
2029  $next [+2]                          UInt                    max_latency
2030    -- Maximum Peripheral latency for the connection in number of connection
2031    -- events.
2032    [requires: 0x0000 <= this <= 0x01F3]
2033
2034  $next [+2]                          UInt                    supervision_timeout
2035    -- See Core Spec v5.3, Vol 6, Part B, Section 4.5.2.
2036    -- Time: N * 10 ms
2037    -- Time Range: 100 ms to 32 s
2038    [requires: 0x000A <= this <= 0x0C80]
2039
2040  $next [+2]                          UInt                    min_connection_event_length
2041    -- Time: N * 0.625 ms
2042
2043  $next [+2]                          UInt                    max_connection_event_length
2044    -- Time: N * 0.625 ms
2045
2046
2047struct LECreateConnectionCancelCommand:
2048  -- 7.8.13 LE Create Connection Cancel command (v4.0) (LE)
2049  -- HCI_LE_Create_Connection_Cancel
2050  let hdr_size = hci.CommandHeader.$size_in_bytes
2051  0 [+hdr_size]  hci.CommandHeader  header
2052
2053# 7.8.14 LE Read Filter Accept List Size command
2054# HCI_LE_Read_Filter_Accept_List_Size
2055# TODO: b/265052417 - Definition needs to be added
2056
2057
2058struct LEClearFilterAcceptListCommand:
2059  -- 7.8.15 LE Clear Filter Accept List command (v4.0) (LE)
2060  -- HCI_LE_Clear_Filter_Accept_List
2061  let hdr_size = hci.CommandHeader.$size_in_bytes
2062  0 [+hdr_size]  hci.CommandHeader  header
2063
2064
2065struct LEAddDeviceToFilterAcceptListCommand:
2066  -- 7.8.16 LE Add Device To Filter Accept List command (v4.0) (LE)
2067  -- HCI_LE_Add_Device_To_Filter_Accept_List
2068  let hdr_size = hci.CommandHeader.$size_in_bytes
2069  0     [+hdr_size]                   hci.CommandHeader      header
2070  $next [+1]                          hci.LEPeerAddressType  address_type
2071    -- The address type of the peer.
2072
2073  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr             address
2074    -- Public Device Address or Random Device Address of the device to be added
2075    -- to the Filter Accept List. Ignored if `address_type` is ANONYMOUS.
2076
2077
2078struct LERemoveDeviceFromFilterAcceptListCommand:
2079  -- 7.8.17 LE Remove Device From Filter Accept List command (v4.0) (LE)
2080  -- HCI_LE_Remove_Device_From_Filter_Accept_List
2081  let hdr_size = hci.CommandHeader.$size_in_bytes
2082  0     [+hdr_size]                   hci.CommandHeader      header
2083  $next [+1]                          hci.LEPeerAddressType  address_type
2084    -- The address type of the peer.
2085
2086  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr             address
2087    -- Public Device Address or Random Device Address of the device to be added
2088    -- to the Filter Accept List. Ignored if `address_type` is ANONYMOUS.
2089
2090
2091struct LEConnectionUpdateCommand:
2092  -- 7.8.18 LE Connection Update command (v4.0) (LE)
2093  -- HCI_LE_Connection_Update
2094
2095  [requires: connection_interval_min <= connection_interval_max && min_connection_event_length <= max_connection_event_length]
2096
2097  let hdr_size = hci.CommandHeader.$size_in_bytes
2098
2099  0     [+hdr_size]  hci.CommandHeader  header
2100
2101  $next [+2]         UInt               connection_handle
2102    [requires: 0x0000 <= this <= 0x0EFF]
2103
2104  $next [+2]         UInt               connection_interval_min
2105    -- Time: N * 1.25 ms
2106    -- Time Range: 7.5 ms to 4 s.
2107    [requires: 0x0006 <= this <= 0x0C80]
2108
2109  $next [+2]         UInt               connection_interval_max
2110    -- Time: N * 1.25 ms
2111    -- Time Range: 7.5 ms to 4 s.
2112    [requires: 0x0006 <= this <= 0x0C80]
2113
2114  $next [+2]         UInt               max_latency
2115    -- Maximum Peripheral latency for the connection in number of subrated
2116    -- connection events.
2117    [requires: 0x0000 <= this <= 0x01F3]
2118
2119  $next [+2]         UInt               supervision_timeout
2120    -- See Core Spec v5.3, Vol 6, Part B, Section 4.5.2.
2121    -- Time: N * 10 ms
2122    -- Time Range: 100 ms to 32 s
2123    [requires: 0x000A <= this <= 0x0C80]
2124
2125  $next [+2]         UInt               min_connection_event_length
2126    -- Time: N * 0.625 ms
2127
2128  $next [+2]         UInt               max_connection_event_length
2129    -- Time: N * 0.625 ms
2130
2131# 7.8.19 LE Set Host Channel Classification command
2132# HCI_LE_Set_Host_Channel_Classification
2133# TODO: b/265052417 - Definition needs to be added
2134
2135
2136# 7.8.20 LE Read Channel Map command
2137# HCI_LE_Read_Channel_Map
2138# TODO: b/265052417 - Definition needs to be added
2139
2140
2141struct LEReadRemoteFeaturesCommand:
2142  -- 7.8.21 LE Read Remote Features command (v4.0) (LE)
2143  -- HCI_LE_Read_Remote_Features
2144  let hdr_size = hci.CommandHeader.$size_in_bytes
2145  0     [+hdr_size]  hci.CommandHeader  header
2146  $next [+2]         UInt               connection_handle
2147    [requires: 0x0000 <= this <= 0x0EFF]
2148
2149# 7.8.22 LE Encrypt command
2150# HCI_LE_Encrypt
2151# TODO: b/265052417 - Definition needs to be added
2152
2153
2154# 7.8.23 LE Rand command
2155# HCI_LE_Rand
2156# TODO: b/265052417 - Definition needs to be added
2157
2158
2159struct LEEnableEncryptionCommand:
2160  -- 7.8.24 LE Enable Encryption command (v4.0) (LE)
2161  -- HCI_LE_Enable_Encryption
2162  let hdr_size = hci.CommandHeader.$size_in_bytes
2163  0     [+hdr_size]                    hci.CommandHeader  header
2164  $next [+2]                           UInt               connection_handle
2165    [requires: 0x0000 <= this <= 0x0EFF]
2166
2167  $next [+8]                           UInt               random_number
2168  $next [+2]                           UInt               encrypted_diversifier
2169  $next [+hci.LinkKey.$size_in_bytes]  hci.LinkKey        long_term_key
2170
2171
2172struct LELongTermKeyRequestReplyCommand:
2173  -- 7.8.25 LE Long Term Key Request Reply command (v4.0) (LE)
2174  -- HCI_LE_Long_Term_Key_Request_Reply
2175  let hdr_size = hci.CommandHeader.$size_in_bytes
2176  0     [+hdr_size]                    hci.CommandHeader  header
2177  $next [+2]                           UInt               connection_handle
2178    [requires: 0x0000 <= this <= 0x0EFF]
2179
2180  $next [+hci.LinkKey.$size_in_bytes]  hci.LinkKey        long_term_key
2181
2182
2183struct LELongTermKeyRequestNegativeReplyCommand:
2184  -- 7.8.26 LE Long Term Key Request Negative Reply command (v4.0) (LE)
2185  -- HCI_LE_Long_Term_Key_Request_Negative_Reply
2186  let hdr_size = hci.CommandHeader.$size_in_bytes
2187  0     [+hdr_size]  hci.CommandHeader  header
2188  $next [+2]         UInt               connection_handle
2189    [requires: 0x0000 <= this <= 0x0EFF]
2190
2191
2192struct LEReadSupportedStatesCommand:
2193  -- 7.8.27 LE Read Supported States command (v4.0) (LE)
2194  -- HCI_LE_Read_Supported_States
2195  let hdr_size = hci.CommandHeader.$size_in_bytes
2196  0 [+hdr_size]  hci.CommandHeader  header
2197
2198# 7.8.28 LE Receiver Test command
2199# HCI_LE_Receiver_Test [v1] [v2] [v3]
2200# TODO: b/265052417 - Definition needs to be added
2201
2202
2203# 7.8.29 LE Transmitter Test command
2204# HCI_LE_Transmitter_Test [v1] [v2] [v3] [v4]
2205# TODO: b/265052417 - Definition needs to be added
2206
2207
2208# 7.8.30 LE Test End command
2209# HCI_LE_Test_End
2210# TODO: b/265052417 - Definition needs to be added
2211
2212
2213# 7.8.31 LE Remote Connection Parameter Request Reply command
2214# HCI_LE_Remote_Connection_Parameter_Request_Reply
2215# TODO: b/265052417 - Definition needs to be added
2216
2217
2218# 7.8.32 LE Remote Connection Parameter Request Negative Reply command
2219# HCI_LE_Remote_Connection_Parameter_Request_Negative_Reply
2220# TODO: b/265052417 - Definition needs to be added
2221
2222
2223# 7.8.33 LE Set Data Length command
2224# HCI_LE_Set_Data_Length
2225# TODO: b/265052417 - Definition needs to be added
2226
2227
2228# 7.8.34 LE Read Suggested Default Data Length command
2229# HCI_LE_Read_Suggested_Default_Data_Length
2230# TODO: b/265052417 - Definition needs to be added
2231
2232
2233# 7.8.35 LE Write Suggested Default Data Length command
2234# HCI_LE_Write_Suggested_Default_Data_Length
2235# TODO: b/265052417 - Definition needs to be added
2236
2237
2238# 7.8.36 LE Read Local P-256 Public Key command
2239# HCI_LE_Read_Local_P-256_Public_Key
2240# TODO: b/265052417 - Definition needs to be added
2241
2242
2243# 7.8.37 LE Generate DHKey command
2244# HCI_LE_Generate_DHKey [v1] [v2]
2245# TODO: b/265052417 - Definition needs to be added
2246
2247
2248# 7.8.38 LE Add Device To Resolving List command
2249# HCI_LE_Add_Device_To_Resolving_List
2250# TODO: b/265052417 - Definition needs to be added
2251
2252
2253# 7.8.39 LE Remove Device From Resolving List command
2254# HCI_LE_Remove_Device_From_Resolving_List
2255# TODO: b/265052417 - Definition needs to be added
2256
2257
2258struct LEClearResolvingListCommand:
2259  -- 7.8.40 LE Clear Resolving List command (v4.2) (LE)
2260  -- HCI_LE_Clear_Resolving_List
2261  let hdr_size = hci.CommandHeader.$size_in_bytes
2262  0 [+hdr_size]  hci.CommandHeader  header
2263
2264# 7.8.41 LE Read Resolving List Size command
2265# HCI_LE_Read_Resolving_List_Size
2266# TODO: b/265052417 - Definition needs to be added
2267
2268
2269# 7.8.42 LE Read Peer Resolvable Address command
2270# HCI_LE_Read_Peer_Resolvable_Address
2271# TODO: b/265052417 - Definition needs to be added
2272
2273
2274# 7.8.43 LE Read Local Resolvable Address command
2275# HCI_LE_Read_Local_Resolvable_Address
2276# TODO: b/265052417 - Definition needs to be added
2277
2278
2279struct LESetAddressResolutionEnableCommand:
2280  -- 7.8.44 LE Set Address Resolution Enable command (v4.2) (LE)
2281  -- HCI_LE_Set_Address_Resolution_Enable
2282  let hdr_size = hci.CommandHeader.$size_in_bytes
2283  0     [+hdr_size]  hci.CommandHeader       header
2284  $next [+1]         hci.GenericEnableParam  address_resolution_enable
2285
2286# 7.8.45 LE Set Resolvable Private Address Timeout command
2287# HCI_LE_Set_Resolvable_Private_Address_Timeout
2288# TODO: b/265052417 - Definition needs to be added
2289
2290
2291# 7.8.46 LE Read Maximum Data Length command
2292# HCI_LE_Read_Maximum_Data_Length
2293# TODO: b/265052417 - Definition needs to be added
2294
2295
2296# 7.8.47 LE Read PHY command
2297# HCI_LE_Read_PHY
2298# TODO: b/265052417 - Definition needs to be added
2299
2300
2301# 7.8.48 LE Set Default PHY command
2302# HCI_LE_Set_Default_PHY
2303# TODO: b/265052417 - Definition needs to be added
2304
2305
2306# 7.8.49 LE Set PHY command
2307# HCI_LE_Set_PHY
2308# TODO: b/265052417 - Definition needs to be added
2309
2310
2311struct LESetAdvertisingSetRandomAddressCommand:
2312  -- 7.8.52 LE Set Advertising Set Random Address command (v5.0) (LE)
2313  -- HCI_LE_Set_Advertising_Set_Random_Address
2314  let hdr_size = hci.CommandHeader.$size_in_bytes
2315  0     [+hdr_size]                   hci.CommandHeader  header
2316  $next [+1]                          UInt               advertising_handle
2317    -- Handle used to identify an advertising set.
2318
2319  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         random_address
2320    -- The random address to use in the advertising PDUs.
2321
2322
2323struct LESetExtendedAdvertisingParametersV1Command:
2324  -- 7.8.53 LE Set Extended Advertising Parameters [v1] command (v5.0) (LE)
2325  -- HCI_LE_Set_Extended_Advertising_Parameters [v1]
2326
2327  let hdr_size = hci.CommandHeader.$size_in_bytes
2328
2329  0     [+hdr_size]                   hci.CommandHeader              header
2330
2331  $next [+1]                          UInt                           advertising_handle
2332    -- Handle used to identify an advertising set.
2333
2334  $next [+2]  bits:
2335
2336    0     [+7]                        LEAdvertisingEventProperties   advertising_event_properties
2337
2338  $next [+3]                          UInt                           primary_advertising_interval_min
2339    -- Time = N * 0.625 s
2340    -- Time Range: 20 ms to 10,485.759375 s
2341    [requires: 0x000020 <= this]
2342
2343  $next [+3]                          UInt                           primary_advertising_interval_max
2344    -- Time = N * 0.625 s
2345    -- Time Range: 20 ms to 10,485.759375 s
2346    [requires: 0x000020 <= this]
2347
2348  $next [+1]  bits:
2349
2350    0     [+3]                        hci.LEAdvertisingChannels      primary_advertising_channel_map
2351
2352  $next [+1]                          hci.LEOwnAddressType           own_address_type
2353
2354  $next [+1]                          hci.LEPeerAddressTypeNoAnon    peer_address_type
2355
2356  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                     peer_address
2357    -- Public Device Address, Random Device Address, Public Identity Address, or Random (static)
2358    -- Identity Address of the device to be connected.
2359
2360  $next [+1]                          hci.LEAdvertisingFilterPolicy  advertising_filter_policy
2361
2362  $next [+1]                          Int                            advertising_tx_power
2363    -- Range: -127 <= N <= +126
2364    -- Units: dBm
2365    -- If N = 127: Host has no preference.
2366    [requires: -127 <= this]
2367
2368  $next [+1]                          hci.LEPrimaryAdvertisingPHY    primary_advertising_phy
2369    -- LEPHY::kLE2M and LEPHY::kLECodedS2 are excluded.
2370
2371  $next [+1]                          UInt                           secondary_advertising_max_skip
2372    -- Maximum advertising events the controller can skip before sending the AUX_ADV_IND packets on
2373    -- the secondary advertising physical channel. If this value is zero, AUX_ADV_IND shall be sent
2374    -- prior to the next advertising event.
2375
2376  $next [+1]                          hci.LESecondaryAdvertisingPHY  secondary_advertising_phy
2377
2378  $next [+1]                          UInt                           advertising_sid
2379    -- Value of the Advertising SID subfield in the ADI field of the PDU
2380    [requires: 0x00 <= this <= 0x0F]
2381
2382  $next [+1]                          hci.GenericEnableParam         scan_request_notification_enable
2383
2384# TODO: b/265052417 - LE Set Extended Advertising Parameters [v2] definition needs to be added
2385
2386
2387struct LESetExtendedAdvertisingDataCommand:
2388  -- 7.8.54 LE Set Extended Advertising Data command (v5.0) (LE)
2389  -- HCI_LE_Set_Extended_Advertising_Data
2390
2391  let hdr_size = hci.CommandHeader.$size_in_bytes
2392
2393  0     [+hdr_size]  hci.CommandHeader                header
2394
2395  $next [+1]         UInt                             advertising_handle
2396    -- Handle used to identify an advertising set.
2397
2398  $next [+1]         LESetExtendedAdvDataOp           operation
2399
2400  $next [+1]         LEExtendedAdvFragmentPreference  fragment_preference
2401    -- Provides a hint to the Controller as to whether advertising data should be fragmented.
2402
2403  let advertising_data_length_max = 251
2404
2405  $next [+1]         UInt                             advertising_data_length (sz)
2406    -- Length of the advertising data included in this command packet. If the
2407    -- advertising set uses legacy advertising PDUs that support advertising
2408    -- data then this shall not exceed kMaxLEAdvertisingDataLength bytes.
2409    # NOTE(https://github.com/google/emboss/issues/124): Emboss doesn't
2410    # currently support referring to other fields (i.e. virtual fields) when
2411    # [requires] itself is set on a field.
2412    [requires: 0 <= this <= 251]
2413
2414  $next [+sz]        UInt:8[sz]                       advertising_data
2415    -- Variable length advertising data.
2416
2417
2418struct LESetExtendedScanResponseDataCommand:
2419  -- 7.8.55 LE Set Extended Scan Response Data command (v5.0) (LE)
2420  -- HCI_LE_Set_Extended_Scan_Response_Data
2421
2422  let hdr_size = hci.CommandHeader.$size_in_bytes
2423
2424  0     [+hdr_size]  hci.CommandHeader                header
2425
2426  $next [+1]         UInt                             advertising_handle
2427    -- Used to identify an advertising set
2428    [requires: 0x00 <= this <= 0xEF]
2429
2430  $next [+1]         LESetExtendedAdvDataOp           operation
2431
2432  $next [+1]         LEExtendedAdvFragmentPreference  fragment_preference
2433    -- Provides a hint to the controller as to whether advertising data should be fragmented
2434
2435  let scan_response_data_length_max = 251
2436
2437  $next [+1]         UInt                             scan_response_data_length (sz)
2438    -- Length of the scan response data included in this command packet. If the
2439    -- advertising set uses legacy advertising PDUs that support advertising
2440    -- data then this shall not exceed kMaxLEAdvertisingDataLength bytes.
2441    # NOTE(https://github.com/google/emboss/issues/124): Emboss doesn't
2442    # currently support referring to other fields (i.e. virtual fields) when
2443    # [requires] itself is set on a field.
2444    [requires: 0 <= this <= 251]
2445
2446  $next [+sz]        UInt:8[sz]                       scan_response_data
2447    -- Scan response data formatted as defined in Core Spec v5.4, Vol 3, Part C, Section 11
2448
2449
2450struct LESetExtendedAdvertisingEnableData:
2451  -- Data fields for variable-length portion of an LE Set Extended Advertising Enable command
2452  0     [+1]  UInt  advertising_handle
2453  $next [+2]  UInt  duration
2454  $next [+1]  UInt  max_extended_advertising_events
2455
2456
2457struct LESetExtendedAdvertisingEnableCommand:
2458  -- 7.8.56 LE Set Extended Advertising Enable command (v5.0) (LE)
2459  -- HCI_LE_Set_Extended_Advertising_Enable
2460  let hdr_size = hci.CommandHeader.$size_in_bytes
2461  0     [+hdr_size]                   hci.CommandHeader                     header
2462  $next [+1]                          hci.GenericEnableParam                enable
2463  $next [+1]                          UInt                                  num_sets
2464  let single_data_size = LESetExtendedAdvertisingEnableData.$size_in_bytes
2465  $next [+single_data_size*num_sets]  LESetExtendedAdvertisingEnableData[]  data
2466
2467
2468struct LEReadMaxAdvertisingDataLengthCommand:
2469  -- 7.8.57 LE Read Maximum Advertising Data Length command (v5.0) (LE)
2470  -- HCI_LE_Read_Maximum_Advertising_Data_Length
2471  -- This command has no parameters
2472  let hdr_size = hci.CommandHeader.$size_in_bytes
2473  0 [+hdr_size]  hci.CommandHeader  header
2474
2475
2476struct LEReadNumSupportedAdvertisingSetsCommand:
2477  -- 7.8.58 LE Read Number of Supported Advertising Sets command (v5.0) (LE)
2478  -- HCI_LE_Read_Number_of_Supported_Advertising_Sets
2479  -- This command has no parameters
2480  let hdr_size = hci.CommandHeader.$size_in_bytes
2481  0 [+hdr_size]  hci.CommandHeader  header
2482
2483
2484struct LERemoveAdvertisingSetCommand:
2485  -- 7.8.59 LE Remove Advertising Set command (v5.0) (LE)
2486  -- HCI_LE_Remove_Advertising_Set
2487  let hdr_size = hci.CommandHeader.$size_in_bytes
2488  0     [+hdr_size]  hci.CommandHeader  header
2489  $next [+1]         UInt               advertising_handle
2490
2491
2492struct LEClearAdvertisingSetsCommand:
2493  -- 7.8.60 LE Clear Advertising Sets command (v5.0) (LE)
2494  -- HCI_LE_Clear_Advertising_Sets
2495  -- This command has no parameters
2496  let hdr_size = hci.CommandHeader.$size_in_bytes
2497  0 [+hdr_size]  hci.CommandHeader  header
2498
2499# 7.8.61 LE Set Periodic Advertising Parameters command
2500# HCI_LE_Set_Periodic_Advertising_Parameters [v1] [v2]
2501# TODO: b/265052417 - Definition needs to be added
2502
2503
2504# 7.8.62 LE Set Periodic Advertising Data command
2505# HCI_LE_Set_Periodic_Advertising_Data
2506# TODO: b/265052417 - Definition needs to be added
2507
2508
2509# 7.8.63 LE Set Periodic Advertising Enable command
2510# HCI_LE_Set_Periodic_Advertising_Enable
2511# TODO: b/265052417 - Definition needs to be added
2512
2513
2514struct LESetExtendedScanParametersData:
2515  -- Data fields for variable-length portion of an LE Set Extended Scan Parameters command
2516
2517  0     [+1]  LEScanType  scan_type
2518
2519  $next [+2]  UInt        scan_interval
2520    -- Time interval from when the Controller started its last scan until it begins the subsequent
2521    -- scan on the primary advertising physical channel.
2522    -- Time = N × 0.625 ms
2523    -- Time Range: 2.5 ms to 40.959375 s
2524    [requires: 0x0004 <= this]
2525
2526  $next [+2]  UInt        scan_window
2527    -- Duration of the scan on the primary advertising physical channel.
2528    -- Time = N × 0.625 ms
2529    -- Time Range: 2.5 ms to 40.959375 s
2530    [requires: 0x0004 <= this]
2531
2532
2533struct LESetExtendedScanParametersCommand:
2534  -- 7.8.64 LE Set Extended Scan Parameters command (v5.0) (LE)
2535  -- HCI_LE_Set_Extended_Scan_Parameters
2536  -- num_entries corresponds to the number of bits set in the |scanning_phys| field
2537  let hdr_size = hci.CommandHeader.$size_in_bytes
2538  0     [+hdr_size]                       hci.CommandHeader                             header
2539  $next [+1]                              hci.LEOwnAddressType                          own_address_type
2540  $next [+1]                              LEScanFilterPolicy                            scanning_filter_policy
2541  $next [+1]  bits:
2542    0     [+LEScanPHYBits.$size_in_bits]  LEScanPHYBits                                 scanning_phys
2543
2544  let single_entry_size = LESetExtendedScanParametersData.$size_in_bytes
2545  let num_entries = (scanning_phys.le_1m ? 1 : 0)+(scanning_phys.le_coded ? 1 : 0)
2546  let total_entries_size = num_entries*single_entry_size
2547  $next [+total_entries_size]             LESetExtendedScanParametersData[num_entries]  data
2548
2549
2550struct LESetExtendedScanEnableCommand:
2551  -- 7.8.65 LE Set Extended Scan Enable command (v5.0) (LE)
2552  -- HCI_LE_Set_Extended_Scan_Enable
2553
2554  let hdr_size = hci.CommandHeader.$size_in_bytes
2555
2556  0     [+hdr_size]  hci.CommandHeader                   header
2557
2558  $next [+1]         hci.GenericEnableParam              scanning_enabled
2559
2560  $next [+1]         LEExtendedDuplicateFilteringOption  filter_duplicates
2561    -- See enum class LEExtendedDuplicateFilteringOption in this file for possible values
2562
2563  $next [+2]         UInt                                duration
2564    -- Possible values:
2565    --   0x0000: Scan continuously until explicitly disabled
2566    --   0x0001-0xFFFF: Scan duration, where:
2567    --     Time = N * 10 ms
2568    --     Time Range: 10 ms to 655.35 s
2569
2570  $next [+2]         UInt                                period
2571    -- Possible values:
2572    --   0x0000: Periodic scanning disabled (scan continuously)
2573    --   0x0001-0xFFFF: Time interval from when the Controller started its last
2574    --   Scan_Duration until it begins the subsequent Scan_Duration, where:
2575    --     Time = N * 1.28 sec
2576    --     Time Range: 1.28 s to 83,884.8 s
2577
2578
2579struct LEExtendedCreateConnectionData:
2580  -- Data fields for variable-length portion of an LE Extneded Create Connection command
2581
2582  0     [+2]  UInt  scan_interval
2583    -- Time interval from when the Controller started its last scan until it begins the subsequent
2584    -- scan on the primary advertising physical channel.
2585    -- Time = N × 0.625 ms
2586    -- Time Range: 2.5 ms to 40.959375 s
2587    [requires: 0x0004 <= this]
2588
2589  $next [+2]  UInt  scan_window
2590    -- Duration of the scan on the primary advertising physical channel.
2591    -- Time = N × 0.625 ms
2592    -- Time Range: 2.5 ms to 40.959375 s
2593    [requires: 0x0004 <= this]
2594
2595  $next [+2]  UInt  connection_interval_min
2596    -- Time: N * 1.25 ms
2597    -- Time Range: 7.5 ms to 4 s.
2598    [requires: 0x0006 <= this <= 0x0C80]
2599
2600  $next [+2]  UInt  connection_interval_max
2601    -- Time: N * 1.25 ms
2602    -- Time Range: 7.5 ms to 4 s.
2603    [requires: 0x0006 <= this <= 0x0C80]
2604
2605  $next [+2]  UInt  max_latency
2606    -- Maximum Peripheral latency for the connection in number of connection events.
2607    [requires: this <= 0x01F3]
2608
2609  $next [+2]  UInt  supervision_timeout
2610    -- See Core Spec v5.3, Vol 6, Part B, Section 4.5.2.
2611    -- Time: N * 10 ms
2612    -- Time Range: 100 ms to 32 s
2613    [requires: 0x000A <= this <= 0x0C80]
2614
2615  $next [+2]  UInt  min_connection_event_length
2616    -- Time: N * 0.625 ms
2617
2618  $next [+2]  UInt  max_connection_event_length
2619    -- Time: N * 0.625 ms
2620
2621
2622struct LEExtendedCreateConnectionCommandV1:
2623  -- 7.8.66 LE Extended Create Connection command version 1
2624  -- HCI_LE_Extended_Create_Connection v1
2625  let hdr_size = hci.CommandHeader.$size_in_bytes
2626  0     [+hdr_size]                             hci.CommandHeader                            header
2627  $next [+1]                                    hci.GenericEnableParam                       initiator_filter_policy
2628  $next [+1]                                    hci.LEOwnAddressType                         own_address_type
2629  $next [+1]                                    hci.LEPeerAddressType                        peer_address_type
2630  $next [+hci.BdAddr.$size_in_bytes]            hci.BdAddr                                   peer_address
2631  $next [+1]  bits:
2632    0     [+LEInitiatingPHYBits.$size_in_bits]  LEInitiatingPHYBits                          initiating_phys
2633
2634  let num_entries = (initiating_phys.le_1m ? 1 : 0)+(initiating_phys.le_2m ? 1 : 0)+(initiating_phys.le_coded ? 1 : 0)
2635  let single_entry_size = LEExtendedCreateConnectionData.$size_in_bytes
2636  let total_entries_size = num_entries*single_entry_size
2637  $next [+total_entries_size]                   LEExtendedCreateConnectionData[num_entries]  data
2638
2639# 7.8.66 LE Extended Create Connection command version 2
2640# HCI_LE_Extended_Create_Connection v2
2641# TODO: b/265052417 - Definition needs to be added
2642
2643
2644struct LEPeriodicAdvertisingCreateSyncCommand:
2645  -- 7.8.67 LE Periodic Advertising Create Sync command (v5.0) (LE)
2646  -- HCI_LE_Periodic_Advertising_Create_Sync
2647
2648  let hdr_size = hci.CommandHeader.$size_in_bytes
2649
2650  0     [+hdr_size]                                                hci.CommandHeader                       header
2651
2652  $next [+1]  bits:
2653
2654    0     [+LEPeriodicAdvertisingCreateSyncOptions.$size_in_bits]  LEPeriodicAdvertisingCreateSyncOptions  options
2655
2656  $next [+1]                                                       UInt                                    advertising_sid
2657    -- Advertising SID subfield in the ADI field used to identify the Periodic Advertising
2658    [requires: 0x00 <= this <= 0x0F]
2659
2660  $next [+1]                                                       hci.LEPeerAddressTypeNoAnon             advertiser_address_type
2661
2662  $next [+hci.BdAddr.$size_in_bytes]                               hci.BdAddr                              advertiser_address
2663    -- Public Device Address, Random Device Address, Public Identity Address, or Random (static)
2664    -- Identity Address of the advertiser
2665
2666  $next [+2]                                                       UInt                                    skip
2667    -- The maximum number of periodic advertising events that can be skipped after a successful
2668    -- receive
2669    [requires: 0x0000 <= this <= 0x01F3]
2670
2671  $next [+2]                                                       UInt                                    sync_timeout
2672    -- Synchronization timeout for the periodic advertising.
2673    -- Time = N * 10 ms
2674    -- Time Range: 100 ms to 163.84 s
2675    [requires: 0x000A <= this <= 0x4000]
2676
2677  $next [+1]  bits:
2678
2679    0     [+LEPeriodicAdvertisingSyncCTEType.$size_in_bits]        LEPeriodicAdvertisingSyncCTEType        sync_cte_type
2680      -- Constant Tone Extension sync options
2681
2682
2683struct LEPeriodicAdvertisingCreateSyncCancel:
2684  -- 7.8.68 LE Periodic Advertising Create Sync Cancel command (v5.0) (LE)
2685  -- HCI_LE_Periodic_Advertising_Create_Sync_Cancel
2686  -- Note that this command has no arguments
2687  let hdr_size = hci.CommandHeader.$size_in_bytes
2688  0 [+hdr_size]  hci.CommandHeader  header
2689
2690
2691struct LEPeriodicAdvertisingTerminateSyncCommand:
2692  -- 7.8.69 LE Periodic Advertising Terminate Sync command (v5.0) (LE)
2693  -- HCI_LE_Periodic_Advertising_Terminate_Sync
2694  let hdr_size = hci.CommandHeader.$size_in_bytes
2695  0     [+hdr_size]  hci.CommandHeader  header
2696  $next [+2]         UInt               sync_handle
2697    -- Identifies the periodic advertising train
2698    [requires: 0x0000 <= this <= 0x0EFF]
2699
2700
2701struct LEAddDeviceToPeriodicAdvertiserListCommand:
2702  -- 7.8.70 LE Add Device To Periodic Advertiser List command (v5.0) (LE)
2703  -- HCI_LE_Add_Device_To_Periodic_Advertiser_List
2704  let hdr_size = hci.CommandHeader.$size_in_bytes
2705  0     [+hdr_size]                   hci.CommandHeader  header
2706  $next [+1]                          hci.LEAddressType  advertiser_address_type
2707    -- Address type of the advertiser. The LEAddressType::kPublicIdentity and
2708    -- LEAddressType::kRandomIdentity values are excluded for this command.
2709
2710  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         advertiser_address
2711    -- Public Device Address, Random Device Address, Public Identity Address, or
2712    -- Random (static) Identity Address of the advertiser.
2713
2714  $next [+1]                          UInt               advertising_sid
2715    -- Advertising SID subfield in the ADI field used to identify the Periodic
2716    -- Advertising.
2717
2718
2719struct LERemoveDeviceFromPeriodicAdvertiserListCommand:
2720  -- 7.8.71 LE Remove Device From Periodic Advertiser List command (v5.0) (LE)
2721  -- HCI_LE_Remove_Device_From_Periodic_Advertiser_List
2722  let hdr_size = hci.CommandHeader.$size_in_bytes
2723  0     [+hdr_size]                   hci.CommandHeader  header
2724  $next [+1]                          UInt               advertiser_address_type
2725    -- Address type of the advertiser. The LEAddressType::kPublicIdentity and
2726    -- LEAddressType::kRandomIdentity values are excluded for this command.
2727
2728  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr         advertiser_address
2729    -- Public Device Address, Random Device Address, Public Identity Address, or
2730    -- Random (static) Identity Address of the advertiser.
2731
2732  $next [+1]                          UInt               advertising_sid
2733    -- Advertising SID subfield in the ADI field used to identify the Periodic
2734    -- Advertising.
2735
2736
2737struct LEClearPeriodicAdvertiserListCommand:
2738  -- 7.8.72 LE Clear Periodic Advertiser List command (v5.0) (LE)
2739  -- HCI_LE_Clear_Periodic_Advertiser_List
2740  -- Note that this command has no arguments
2741  let hdr_size = hci.CommandHeader.$size_in_bytes
2742  0 [+hdr_size]  hci.CommandHeader  header
2743
2744
2745struct LEReadPeriodicAdvertiserListSizeCommand:
2746  -- 7.8.73 LE Read Periodic Advertiser List Size command (v5.0) (LE)
2747  -- HCI_LE_Read_Periodic_Advertiser_List_Size
2748  -- Note that this command has no arguments
2749  let hdr_size = hci.CommandHeader.$size_in_bytes
2750  0 [+hdr_size]  hci.CommandHeader  header
2751
2752
2753struct LEReadTransmitPowerCommand:
2754  -- 7.8.74 LE Read Transmit Power command (v5.0) (LE)
2755  -- HCI_LE_Read_Transmit_Power
2756  -- Note that this command has no arguments
2757  let hdr_size = hci.CommandHeader.$size_in_bytes
2758  0 [+hdr_size]  hci.CommandHeader  header
2759
2760
2761struct LEReadRFPathCompensationCommand:
2762  -- 7.8.75 LE Read RF Path Compensation command (v5.0) (LE)
2763  -- HCI_LE_Read_RF_Path_Compensation
2764  -- Note that this command has no arguments
2765  let hdr_size = hci.CommandHeader.$size_in_bytes
2766  0 [+hdr_size]  hci.CommandHeader  header
2767
2768
2769struct LEWriteRFPathCompensationCommand:
2770  -- 7.8.76 LE Write RF Path Compensation command (v5.0) (LE)
2771  -- HCI_LE_Write_RF_Path_Compensation
2772  -- Values provided are used in the Tx Power Level and RSSI calculation.
2773  --   Range: -128.0 dB (0xFB00) ≤ N ≤ 128.0 dB (0x0500)
2774  --   Units: 0.1 dB
2775  let hdr_size = hci.CommandHeader.$size_in_bytes
2776  0     [+hdr_size]  hci.CommandHeader  header
2777  $next [+2]         Int                rf_tx_path_compensation_value
2778    [requires: -1280 <= this <= 1280]
2779
2780  $next [+2]         Int                rf_rx_path_compensation_value
2781    [requires: -1280 <= this <= 1280]
2782
2783
2784struct LESetPrivacyModeCommand:
2785  -- 7.8.77 LE Set Privacy Mode command (v5.0) (LE)
2786  -- HCI_LE_Set_Privacy_Mode
2787  let hdr_size = hci.CommandHeader.$size_in_bytes
2788  0     [+hdr_size]                   hci.CommandHeader            header
2789  $next [+1]                          hci.LEPeerAddressTypeNoAnon  peer_identity_address_type
2790    -- The peer identity address type (either Public Identity or Private
2791    -- Identity).
2792
2793  $next [+hci.BdAddr.$size_in_bytes]  hci.BdAddr                   peer_identity_address
2794    -- Public Identity Address or Random (static) Identity Address of the
2795    -- advertiser.
2796
2797  $next [+1]                          LEPrivacyMode                privacy_mode
2798    -- The privacy mode to be used for the given entry on the resolving list.
2799
2800# 7.8.93 [No longer used]
2801# 7.8.94 LE Modify Sleep Clock Accuracy command
2802# 7.8.95 [No longer used]
2803
2804
2805struct LEReadISOTXSyncCommand:
2806  -- 7.8.96 LE Read ISO TX Sync command (v5.2) (LE)
2807  -- HCI_LE_Read_ISO_TX_Sync
2808  let hdr_size = hci.CommandHeader.$size_in_bytes
2809  0     [+hdr_size]  hci.CommandHeader  header
2810  $next [+2]         UInt               connection_handle
2811    -- Connection handle of the CIS or BIS
2812    [requires: 0x0000 <= this <= 0x0EFF]
2813
2814
2815struct LESetCIGParametersCommand:
2816  -- 7.8.97 LE Set CIG Parameters command (v5.2) (LE)
2817  -- HCI_LE_Set_CIG_Parameters
2818
2819  let hdr_size = hci.CommandHeader.$size_in_bytes
2820
2821  0     [+hdr_size]                hci.CommandHeader                        header
2822
2823  $next [+1]                       UInt                                     cig_id
2824    -- Used to identify the CIG
2825    [requires: 0x00 <= this <= 0xEF]
2826
2827  $next [+3]                       UInt                                     sdu_interval_c_to_p
2828    -- The interval, in microseconds, of periodic SDUs (Central => Peripheral)
2829    [requires: 0x0000FF <= this <= 0x0FFFFF]
2830
2831  $next [+3]                       UInt                                     sdu_interval_p_to_c
2832    -- The interval, in microseconds, of periodic SDUs (Peripheral => Central)
2833    [requires: 0x0000FF <= this <= 0x0FFFFF]
2834
2835  $next [+1]                       hci.LESleepClockAccuracyRange            worst_case_sca
2836    -- Worst-case sleep clock accuracy of all Peripherals that will participate in the CIG
2837
2838  $next [+1]                       LECISPacking                             packing
2839    -- Preferred method of arranging subevents of multiple CISes
2840
2841  $next [+1]                       LECISFraming                             framing
2842    -- Format of the CIS Data PDUs
2843
2844  $next [+2]                       UInt                                     max_transport_latency_c_to_p
2845    -- Maximum transport latency, in milliseconds, from the Central's Controller to the
2846    -- Peripheral's Controller
2847    [requires: 0x0005 <= this <= 0x0FA0]
2848
2849  $next [+2]                       UInt                                     max_transport_latency_p_to_c
2850    -- Maximum transport latency, in milliseconds, from the Peripheral's Controller to the
2851    -- Central's Controller
2852    [requires: 0x0005 <= this <= 0x0FA0]
2853
2854  $next [+1]                       UInt                                     cis_count
2855    -- Total number of CIS configurations in the CIG being added or modified
2856    [requires: 0x00 <= this <= 0x1F]
2857
2858  let single_cis_options_size = LESetCIGParametersCISOptions.$size_in_bytes
2859
2860  let total_cis_options_size = cis_count*single_cis_options_size
2861
2862  $next [+total_cis_options_size]  LESetCIGParametersCISOptions[cis_count]  cis_options
2863    -- Array of parameters, one for each of the CISes in this CIG
2864
2865# 7.8.98 LE Set CIG Parameters Test command
2866
2867
2868struct LECreateCISCommand:
2869  -- 7.8.99 LE Create CIS command (v5.2) (LE)
2870  -- HCI_LE_Create_CIS
2871  struct ConnectionInfo:
2872    -- Handles for each stream being created
2873
2874    0     [+2]  UInt  cis_connection_handle
2875      -- Connection handle of a CIS
2876      [requires: 0x0000 <= this <= 0xEFFF]
2877
2878    $next [+2]  UInt  acl_connection_handle
2879      -- Connection handle of an ACL connection
2880      [requires: 0x0000 <= this <= 0xEFFF]
2881
2882  let hdr_size = hci.CommandHeader.$size_in_bytes
2883  0     [+hdr_size]               hci.CommandHeader          header
2884  $next [+1]                      UInt                       cis_count
2885    -- Total number of CISes to be created
2886    [requires: 0x01 <= this <= 0x1F]
2887
2888  let single_cis_params_size = ConnectionInfo.$size_in_bytes
2889  let total_cis_params_size = cis_count*single_cis_params_size
2890  $next [+total_cis_params_size]  ConnectionInfo[cis_count]  cis_connection_info
2891    -- Connection handle information for the CIS(es) being created
2892
2893
2894struct LERemoveCIGCommand:
2895  -- 7.8.100 LE Remove CIG command (v5.2) (LE)
2896  -- HCI_LE_Remove_CIG
2897  let hdr_size = hci.CommandHeader.$size_in_bytes
2898  0     [+hdr_size]  hci.CommandHeader  header
2899  $next [+1]         UInt               cig_id
2900    -- Identifier of a CIG
2901    [requires: 0x00 <= this <= 0xEF]
2902
2903
2904struct LEAcceptCISRequestCommand:
2905  -- 7.8.101 LE Accept CIS Request command (v5.2) (LE)
2906  -- HCI_LE_Accept_CIS_Request
2907  let hdr_size = hci.CommandHeader.$size_in_bytes
2908  0     [+hdr_size]  hci.CommandHeader  header
2909  $next [+2]         UInt               connection_handle
2910    -- Connection handle of the CIS
2911    [requires: 0x0000 <= this <= 0x0EFF]
2912
2913
2914struct LERejectCISRequestCommand:
2915  -- 7.8.102 LE Reject CIS Request command (v5.2) (LE)
2916  -- HCI_LE_Reject_CIS_Request
2917  let hdr_size = hci.CommandHeader.$size_in_bytes
2918  0     [+hdr_size]  hci.CommandHeader  header
2919  $next [+2]         UInt               connection_handle
2920    -- Connection handle of the CIS
2921    [requires: 0x0000 <= this <= 0x0EFF]
2922
2923  $next [+1]         hci.StatusCode     reason
2924    -- Reason the CIS request was rejected
2925
2926# 7.8.103 LE Create BIG command
2927# 7.8.104 LE Create BIG Test command
2928# 7.8.105 LE Terminate BIG command
2929# 7.8.106 LE BIG Create Sync command
2930# 7.8.107 LE BIG Terminate Sync command
2931
2932
2933struct LERequestPeerSCACommand:
2934  -- 7.8.108 LE Request Peer SCA command
2935  -- HCI_LE_Request_Peer_SCA
2936  let hdr_size = hci.CommandHeader.$size_in_bytes
2937  0     [+hdr_size]  hci.CommandHeader  header
2938  $next [+2]         UInt               connection_handle
2939    -- Connection handle of the ACL
2940    [requires: 0x0000 <= this <= 0xEFF]
2941
2942
2943struct LESetupISODataPathCommand:
2944  -- 7.8.109 LE Setup ISO Data Path command
2945  -- HCI_LE_Setup_ISO_Data_Path
2946  let hdr_size = hci.CommandHeader.$size_in_bytes
2947  0     [+hdr_size]                    hci.CommandHeader                   header
2948  $next [+2]                           UInt                                connection_handle
2949    -- Connection handle of the CIS or BIS
2950    [requires: 0x0000 <= this <= 0x0EFF]
2951
2952  $next [+1]                           DataPathDirection                   data_path_direction
2953    -- Specifies the direction for which the data path is being configured
2954
2955  $next [+1]                           UInt                                data_path_id
2956    -- Data transport path used (0x00 for HCI).
2957    [requires: 0x00 <= this <= 0xFE]
2958
2959  let vcf_size = CodecId.$size_in_bytes
2960  $next [+vcf_size]                    CodecId                             codec_id
2961    -- Codec to be used
2962
2963  $next [+3]                           UInt                                controller_delay
2964    -- Controller delay in microseconds (0s to 4s)
2965    [requires: 0x000000 <= this <= 0x3D0900]
2966
2967  $next [+1]                           UInt                                codec_configuration_length
2968    -- Length of codec configuration
2969
2970  $next [+codec_configuration_length]  UInt:8[codec_configuration_length]  codec_configuration
2971    -- Codec-specific configuration data
2972
2973
2974struct LERemoveISODataPathCommand:
2975  -- 7.8.110 LE Remove ISO Data Path command
2976  -- HCI_LE_Remove_ISO_Data_Path
2977  let hdr_size = hci.CommandHeader.$size_in_bytes
2978  0     [+hdr_size]  hci.CommandHeader  header
2979  $next [+2]         UInt               connection_handle
2980    -- Connection handle of the CIS or BIS
2981    [requires: 0x0000 <= this <= 0x0EFFF]
2982
2983  $next [+1]  bits:
2984    0     [+1]       Flag               remove_input_data_path
2985    1     [+1]       Flag               remove_output_data_path
2986
2987# 7.8.111 LE ISO Transmit Test command
2988# 7.8.112 LE ISO Receive Test command
2989# 7.8.113 LE ISO Read Test Counters command
2990# 7.8.114 LE ISO Test End command
2991
2992
2993struct LESetHostFeatureCommand:
2994  -- 7.8.115 LE Set Host Feature command
2995  -- HCI_LE_Set_Host_Feature
2996  let hdr_size = hci.CommandHeader.$size_in_bytes
2997  0     [+hdr_size]  hci.CommandHeader       header
2998  $next [+1]         UInt                    bit_number
2999    -- Bit position in the Feature Set
3000    [requires: 0x00 <= this <= 0x3F]
3001
3002  $next [+1]         hci.GenericEnableParam  bit_value
3003    -- Indicates if Host feature is enabled or disabled
3004