Skip to main content

bt_hci/cmd/
le.rs

1//! LE Controller commands [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-0f07d2b9-81e3-6508-ee08-8c808e468fed)
2
3use crate::param::{
4    AddrKind, AdvChannelMap, AdvEventProps, AdvFilterPolicy, AdvHandle, AdvKind, AdvPhyOptions, AdvSet, AllLeFeatures,
5    AllPhys, BdAddr, BigHandle, BroadcastCode, ChannelMap, CigId, CisConfig, CisConfigTest, CisConnConfig, CodecId,
6    ConnHandle, ConnIntervalGroup, CteKind, CteMask, DataPathDirection, DataPathId, Duration, DurationU8,
7    EncryptionMode, ExtDuration, FilterDuplicates, Framing, InitiatingPhy, LeDataRelatedAddrChangeReasons, LeEventMask,
8    LeFeatureMask, LeHostFeature, LeHostFeatureV2, LePeriodicAdvCreateSyncOptions, LePeriodicAdvReceiveEnable,
9    LePeriodicAdvSubeventData, LePeriodicAdvSyncTransferMode, LeScanKind, Operation, Packing, PayloadType,
10    PeriodicAdvProps, PhyKind, PhyMask, PhyOptions, PhyParams, PrivacyMode, RemoteConnectionParamsRejectReason,
11    ScanningFilterPolicy, ScanningPhy, SpacingTypes, SwitchingSamplingRates, SyncHandle,
12};
13use crate::{cmd, WriteHci};
14
15cmd! {
16    /// LE Set Event Mask command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-8d6890a5-79b9-ba8a-2079-4efa3128263c)
17    LeSetEventMask(LE, 0x0001) {
18        Params = LeEventMask;
19        Return = ();
20    }
21}
22
23cmd! {
24    /// LE Read Buffer Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1446fd8f-af42-e54c-890d-3cc275ed372f)
25    LeReadBufferSize(LE, 0x0002) {
26        Params = ();
27        LeReadBufferSizeReturn {
28            le_acl_data_packet_length: u16,
29            total_num_le_acl_data_packets: u8,
30        }
31    }
32}
33
34cmd! {
35    /// LE Read Local Supported Features command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3ad76ac5-3812-cca4-a4f5-f73e96cebcba)
36    LeReadLocalSupportedFeatures(LE, 0x0003) {
37        Params = ();
38        Return = LeFeatureMask;
39    }
40}
41
42cmd! {
43    /// LE Read All Local Supported Features command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core_v6.3/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-c6cb0f13-342d-2c5b-eee4-c7de9d1d3514)
44    LeReadAllLocalSupportedFeatures(LE, 0x0087) {
45        Params = ();
46        Return = AllLeFeatures;
47    }
48}
49
50cmd! {
51    /// LE Read All Remote Features command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-34695fdf-d4ca-6138-5bcf-8a5ad0296f7f)
52    LeReadAllRemoteFeatures(LE, 0x0088) {
53        LeReadAllRemoteFeaturesParams {
54            handle: ConnHandle,
55            pages_requested: u8,
56        }
57    }
58}
59
60cmd! {
61    /// LE CS Read Local Supported Capabilities command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-730b735b-83e3-3921-9fed-0ab5b1025938)
62    LeCsReadLocalSupportedCapabilities(LE, 0x0089) {
63        Params = ();
64        LeCsReadLocalSupportedCapabilitiesReturn {
65            num_config_supported: u8,
66            max_consecutive_procedures_supported: u16,
67            num_antennas_supported: u8,
68            max_antenna_paths_supported: u8,
69            roles_supported: u8,
70            optional_modes_supported: u8,
71            rtt_capability: u8,
72            rtt_aa_only_n: u8,
73            rtt_sounding_n: u8,
74            rtt_random_payload_n: u8,
75            nadm_sounding_capability: u16,
76            nadm_random_capability: u16,
77            cs_sync_phys_supported: u8,
78            subfeatures_supported: u16,
79            t_ip1_times_supported: u16,
80            t_ip2_times_supported: u16,
81            t_fcs_times_supported: u16,
82            t_pm_times_supported: u16,
83            t_sw_time_supported: u8,
84            tx_snr_capability: u8,
85        }
86    }
87}
88
89cmd! {
90    /// LE CS Read Remote Supported Capabilities command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3b195e3d-3f9b-8f0e-1292-a3c56e9b76d5)
91    LeCsReadRemoteSupportedCapabilities(LE, 0x008a) {
92        Params = ConnHandle;
93    }
94}
95
96cmd! {
97    /// LE CS Write Cached Remote Supported Capabilities command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f0bb51e5-a727-46b7-106e-db37b67bc43b)
98    LeCsWriteCachedRemoteSupportedCapabilities(LE, 0x008b) {
99        LeCsWriteCachedRemoteSupportedCapabilitiesParams {
100            num_config_supported: u8,
101            max_consecutive_procedures_supported: u16,
102            num_antennas_supported: u8,
103            max_antenna_paths_supported: u8,
104            roles_supported: u8,
105            modes_supported: u8,
106            rtt_capability: u8,
107            rtt_aa_only_n: u8,
108            rtt_sounding_n: u8,
109            rtt_random_payload_n: u8,
110            nadm_sounding_capability: u16,
111            nadm_random_capability: u16,
112            cs_sync_phys_supported: u8,
113            subfeatures_supported: u16,
114            t_ip1_times_supported: u16,
115            t_ip2_times_supported: u16,
116            t_fcs_times_supported: u16,
117            t_pm_times_supported: u16,
118            t_sw_time_supported: u8,
119            tx_snr_capability: u8,
120        }
121        Return = ConnHandle;
122        Handle = handle: ConnHandle;
123    }
124}
125
126cmd! {
127    /// LE CS Security Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-fbf11b16-b638-554b-a6db-c5594a5c5442)
128    LeCsSecurityEnableCommand(LE, 0x008c) {
129        Params = ConnHandle;
130    }
131}
132
133cmd! {
134    /// LE CS Set Default Settings command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f7f6d516-b433-0664-33bd-261cbfa168b8)
135    LeCsSetDefaultSettings(LE, 0x008d) {
136        LeCsSetDefaultSettingsParams {
137            role_enable: u8,
138            cs_sync_antenna_selection: u8,
139            max_tx_power: i8,
140        }
141        Return = ConnHandle;
142        Handle = handle: ConnHandle;
143    }
144}
145
146cmd! {
147    /// LE CS Read Remote FAE Table command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-185cf599-6949-988c-07ef-7bdbb6370aad)
148    LeCsReadRemoteFaeTable(LE, 0x008e) {
149        Params = ConnHandle;
150    }
151}
152
153cmd! {
154    /// LE CS Write Cached Remote FAE Table command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7aef4e15-4fe0-2a57-0d2d-6bbeca973ff0)
155    LeCsWriteCachedRemoteFaeTable(LE, 0x008f) {
156        LeCsWriteCachedRemoteFaeTableParams {
157            remote_fae_table: [u8; 72],
158        }
159        Return = ConnHandle;
160        Handle = handle: ConnHandle;
161    }
162}
163
164cmd! {
165    /// LE CS Create Config command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-6647575f-ceb6-e3e7-dd03-8ac82677a3a4)
166    LeCsCreateConfig(LE, 0x0090) {
167        LeCsCreateConfigParams {
168            handle: ConnHandle,
169            config_id: u8,
170            create_context: u8,
171            main_mode_type: u8,
172            sub_mode_type: u8,
173            min_main_mode_steps: u8,
174            max_main_mode_steps: u8,
175            main_mode_repetition: u8,
176            mode_0_steps: u8,
177            role: u8,
178            rtt_type: u8,
179            cs_sync_phy: u8,
180            channel_map: [u8; 10],
181            channel_map_repetition: u8,
182            channel_selection_type: u8,
183            ch3c_shape: u8,
184            ch3c_jump: u8,
185            reserved: u8,
186        }
187    }
188}
189
190cmd! {
191    /// LE CS Remove Config command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-df1df40d-b8db-5ecd-7114-30b9e18a79c3)
192    LeCsRemoveConfig(LE, 0x0091) {
193        LeCsRemoveConfigParams {
194            handle: ConnHandle,
195            config_id: u8,
196        }
197    }
198}
199
200cmd! {
201    /// LE CS Set Channel Classification command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-17c54c10-3ea0-9c98-6708-f0a8d6b2658b)
202    LeCsSetChannelClassification(LE, 0x0092) {
203        Params = [u8; 10];
204        Return = ();
205    }
206}
207
208cmd! {
209    /// LE CS Set Procedure Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-874b4326-0043-5b98-b910-69b46116774e)
210    LeCsSetProcedureParams(LE, 0x0093) {
211        LeCsSetProcedureParamsParams {
212            config_id: u8,
213            max_procedure_len: Duration<625>,
214            min_procedure_interval: u16,
215            max_procedure_interval: u16,
216            max_procedure_count: u16,
217            min_subevent_len: ExtDuration<1>,
218            max_subevent_len: ExtDuration<1>,
219            tone_antenna_config_selection: u8,
220            phy: PhyKind,
221            tx_power_delta: i8,
222            preferred_peer_antenna: u8,
223            snr_control_initiator: u8,
224            snr_control_reflector: u8,
225        }
226        Return = ConnHandle;
227        Handle = handle: ConnHandle;
228    }
229}
230
231cmd! {
232    /// LE CS Procedure Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-617d20e0-bf48-195d-778c-34b5a5f909e4)
233    LeCsProcedureEnable(LE, 0x0094) {
234        LeCsProcedureEnableParams {
235            handle: ConnHandle,
236            config_id: u8,
237            enable: bool,
238        }
239    }
240}
241
242cmd! {
243    /// LE CS Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-79eac656-27b0-91ee-6776-06092b93bc8c)
244    LeCsTest(LE, 0x0095) {
245        LeCsTestParams<'a> {
246            main_mode_type: u8,
247            sub_mode_type: u8,
248            main_mode_repetition: u8,
249            mode_0_steps: u8,
250            role: u8,
251            rtt_type: u8,
252            cs_sync_phy: u8,
253            cs_sync_antenna_selection: u8,
254            subevent_len: ExtDuration<1>,
255            subevent_interval: Duration<625>,
256            max_num_subevents: u8,
257            transmit_power_level: i8,
258            t_ip1_time: u8,
259            t_ip2_time: u8,
260            t_fcs_time: u8,
261            t_pm_time: u8,
262            t_sw_time: u8,
263            tone_antenna_config_selection: u8,
264            reserved: u8,
265            snr_control_initiator: u8,
266            snr_control_reflector: u8,
267            drbg_nonce: u16,
268            channel_map_repetition: u8,
269            override_config: u16,
270            override_parameters_data: &'a [u8],
271        }
272        Return = ();
273    }
274}
275
276cmd! {
277    /// LE CS Test End command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-02c5f1fd-7880-224c-d166-d2128fd83777)
278    LeCsTestEnd(LE, 0x0096) {
279        Params = ();
280    }
281}
282
283cmd! {
284    /// LE Set Random Address command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-89d45457-bdb5-cade-32c5-a27240733659)
285    LeSetRandomAddr(LE, 0x0005) {
286        Params = BdAddr;
287        Return = ();
288    }
289}
290
291cmd! {
292    /// LE Set Advertising Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d33351b8-bd92-76f5-47b7-2051fc6e7379)
293    LeSetAdvParams(LE, 0x0006) {
294        LeSetAdvParamsParams {
295            adv_interval_min: Duration<625>,
296            adv_interval_max: Duration<625>,
297            adv_kind: AdvKind,
298            own_addr_kind: AddrKind,
299            peer_addr_kind: AddrKind,
300            peer_addr: BdAddr,
301            adv_channel_map: AdvChannelMap,
302            adv_filter_policy: AdvFilterPolicy,
303        }
304        Return = ();
305    }
306}
307
308cmd! {
309    /// LE Read Advertising Physical Channel Tx Power command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9b984fde-3e9f-05f3-d698-054ca618bcf3)
310    LeReadAdvPhysicalChannelTxPower(LE, 0x0007) {
311        Params = ();
312        Return = i8;
313    }
314}
315
316cmd! {
317    /// LE Set Advertising Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7b83376f-e321-e7ce-3bf1-2af187798be4)
318    LeSetAdvData(LE, 0x0008) {
319        LeSetAdvDataParams {
320            data_len: u8,
321            data: [u8; 31],
322        }
323        Return = ();
324    }
325}
326
327cmd! {
328    /// LE Set Scan Response Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7f9e3a5b-fa09-5292-b64e-1a5304b6a255)
329    LeSetScanResponseData(LE, 0x0009) {
330        LeSetScanResponseDataParams {
331            data_len: u8,
332            data: [u8; 31],
333        }
334        Return = ();
335    }
336}
337
338cmd! {
339    /// LE Set Advertising Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-79bb990c-0338-9c1e-e615-7be8508c8e12)
340    LeSetAdvEnable(LE, 0x000a) {
341        Params = bool;
342        Return = ();
343    }
344}
345
346cmd! {
347    /// LE Set Scan Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-28d28698-0fd7-d273-2e31-7a6731617c77)
348    LeSetScanParams(LE, 0x000b) {
349        LeSetScanParamsParams {
350            le_scan_kind: LeScanKind,
351            le_scan_interval: Duration<625>,
352            le_scan_window: Duration<625>,
353            own_addr_kind: AddrKind,
354            scanning_filter_policy: ScanningFilterPolicy,
355        }
356        Return = ();
357    }
358}
359
360cmd! {
361    /// LE Set Scan Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-10327f75-4024-80df-14bc-68fe1e42b9e0)
362    LeSetScanEnable(LE, 0x000c) {
363        LeSetScanEnableParams {
364            enable: bool,
365            filter_duplicates: bool,
366        }
367        Return = ();
368    }
369}
370
371cmd! {
372    /// LE Create Connection command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-dc5080f3-63c3-ac48-23d1-2d35c6393ac2)
373    LeCreateConn(LE, 0x000d) {
374        LeCreateConnParams {
375            le_scan_interval: Duration<625>,
376            le_scan_window: Duration<625>,
377            use_filter_accept_list: bool,
378            peer_addr_kind: AddrKind,
379            peer_addr: BdAddr,
380            own_addr_kind: AddrKind,
381            conn_interval_min: Duration<1_250>,
382            conn_interval_max: Duration<1_250>,
383            max_latency: u16,
384            supervision_timeout: Duration<10_000>,
385            min_ce_length: Duration<625>,
386            max_ce_length: Duration<625>,
387        }
388    }
389}
390
391cmd! {
392    /// LE Create Connection Cancel command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-37a5c913-6abe-c7b6-9fc8-0d94c8cd266d)
393    LeCreateConnCancel(LE, 0x000e) {
394        Params = ();
395        Return = ();
396    }
397}
398
399cmd! {
400    /// LE Read Filter Accept List Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-453b3a49-0aba-3f5e-ee16-5919bea4903d)
401    LeReadFilterAcceptListSize(LE, 0x000f) {
402        Params = ();
403        Return = u8;
404    }
405}
406
407cmd! {
408    /// LE Clear Filter Accept List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-85c43f7b-9100-63a2-1e97-4def7f859861)
409    LeClearFilterAcceptList(LE, 0x0010) {
410        Params = ();
411        Return = ();
412    }
413}
414
415cmd! {
416    /// LE Add Device To Filter Accept List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-80115d56-8927-4ad8-8da7-b9c5ed728c3d)
417    LeAddDeviceToFilterAcceptList(LE, 0x0011) {
418        LeAddDeviceToFilterAcceptListParams {
419            addr_kind: AddrKind,
420            addr: BdAddr,
421        }
422        Return = ();
423    }
424}
425
426cmd! {
427    /// LE Remove Device From Filter Accept List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7e2ae96c-2231-3fe0-603e-c4e2d27e7448)
428    LeRemoveDeviceFromFilterAcceptList(LE, 0x0012) {
429        LeRemoveDeviceFromFilterAcceptListParams {
430            addr_kind: AddrKind,
431            addr: BdAddr,
432        }
433        Return = ();
434    }
435}
436
437cmd! {
438    /// LE Connection Update command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9d9b11a8-7762-8a3a-5204-0b7f27eea504)
439    LeConnUpdate(LE, 0x0013) {
440        LeConnUpdateParams {
441            handle: ConnHandle,
442            conn_interval_min: Duration<1_250>,
443            conn_interval_max: Duration<1_250>,
444            max_latency: u16,
445            supervision_timeout: Duration<10_000>,
446            min_ce_length: Duration<625>,
447            max_ce_length: Duration<625>,
448        }
449    }
450}
451
452cmd! {
453    /// LE Set Host Channel Classification command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d76b3c58-aa23-3e1f-d771-fbc347ab29b5)
454    LeSetHostChannelClassification(LE, 0x0014) {
455        Params = ChannelMap;
456        Return = ();
457    }
458}
459
460cmd! {
461    /// LE Read Channel Map command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-adaea68c-13d3-4d3d-dc76-317d6f7f606b)
462    LeReadChannelMap(LE, 0x0015) {
463        Params = ConnHandle;
464        LeReadChannelMapReturn {
465            channel_map: ChannelMap,
466        }
467        Handle = handle: ConnHandle;
468    }
469}
470
471cmd! {
472    /// LE Read Remote Features command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-5cef6d01-c629-c784-03a5-490eb9b0408e)
473    LeReadRemoteFeatures(LE, 0x0016) {
474        Params = ConnHandle;
475    }
476}
477
478cmd! {
479    /// LE Encrypt command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-a902995a-d073-7d20-bede-01bf748323e7)
480    LeEncrypt(LE, 0x0017) {
481        LeEncryptParams {
482            key: [u8; 16],
483            plaintext: [u8; 16],
484        }
485        Return = [u8; 16];
486    }
487}
488
489cmd! {
490    /// LE Rand command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-71fbbee4-dc3f-4c0e-2170-b7c25e22f18d)
491    LeRand(LE, 0x0018) {
492        Params = ();
493        Return = [u8; 8];
494    }
495}
496
497cmd! {
498    /// LE Enable Encryption command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d4c636e4-5e0c-39ca-09ec-43b7d229efa0)
499    LeEnableEncryption(LE, 0x0019) {
500        LeEnableEncryptionParams {
501            handle: ConnHandle,
502            random: [u8; 8],
503            encrypted_diversifier: u16,
504            long_term_key: [u8; 16],
505        }
506    }
507}
508
509cmd! {
510    /// LE Receiver Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d5d30b61-e8be-8fa5-a04b-7d505a74ea9d)
511    LeReceiverTest(LE, 0x001d) {
512        LeReceiverTestParams {
513            rx_frequency: u8,
514        }
515        Return = ();
516    }
517}
518
519cmd! {
520    /// LE Remote Connection Parameter Request Reply  [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-31f1114e-a57b-bcff-812f-d68f95bdec2f)
521    LeRemoteConnectionParameterRequestReply(LE, 0x0020) {
522        LeRemoteConnectionParameterRequestReplyParams {
523            interval_min: Duration<1_250>,
524            interval_max: Duration<1_250>,
525            max_latency: u16,
526            supervision_timeout: Duration<10_000>,
527            min_ce_length: Duration<625>,
528            max_ce_length: Duration<625>,
529        }
530        Return = ConnHandle;
531        Handle = handle: ConnHandle;
532    }
533}
534
535cmd! {
536    /// LE Remote Connection Parameter Request Negative Reply  [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-44860832-db97-c092-97e7-ea02011f08b0)
537    LeRemoteConnectionParameterRequestNegativeReply(LE, 0x0021) {
538        LeRemoteConnectionParameterRequestNegativeReplyParams {
539            reason: RemoteConnectionParamsRejectReason,
540        }
541        Return = ConnHandle;
542        Handle = handle: ConnHandle;
543    }
544}
545
546cmd! {
547    /// LE Long Term Key Request Reply command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e89a5372-a7cd-ae2b-5c8d-e281694793ae)
548    LeLongTermKeyRequestReply(LE, 0x001a) {
549        LeLongTermKeyRequestReplyParams {
550            long_term_key: [u8; 16],
551        }
552        Return = ConnHandle;
553        Handle = handle: ConnHandle;
554    }
555}
556
557cmd! {
558    /// LE Long Term Key Request Negative Reply command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e64f1aa8-6c23-0d70-c11d-4ac00fb2abe7)
559    LeLongTermKeyRequestNegativeReply(LE, 0x001b) {
560        Params = ConnHandle;
561        Return = ConnHandle;
562        Handle = ConnHandle;
563    }
564}
565
566cmd! {
567    /// LE Read Supported States command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-69afd9a8-4d1a-18fe-ccd0-adf5080328f5)
568    LeReadSupportedStates(LE, 0x001c) {
569        Params = ();
570        Return = [u8; 8];
571    }
572}
573
574cmd! {
575    /// LE Transmitter Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-15c2cfce-06a0-5da7-5cbb-45c1896cca8d)
576    LeTransmitterTest(LE, 0x001e) {
577        LeTransmitterTestParams {
578            tx_frequency: u8,
579            length_of_test_data: u8,
580            packet_payload: u8,
581        }
582        Return = ();
583    }
584}
585
586cmd! {
587    /// LE Test End command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-cafabb90-1522-7ad5-8def-5d6dc5a8dabd)
588    LeTestEnd(LE, 0x001f) {
589        Params = ();
590        Return = u16;
591    }
592}
593
594cmd! {
595    /// LE Set Data Length command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-242f8446-8cd1-8293-a341-b09354bae550)
596    LeSetDataLength(LE, 0x0022) {
597        LeSetDataLengthParams {
598            tx_octets: u16,
599            tx_time: u16,
600        }
601        Return = ConnHandle;
602        Handle = handle: ConnHandle;
603    }
604}
605
606cmd! {
607    /// LE Read Suggested Default Data Length command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-63da6c78-1392-4471-9a11-a31567c10655)
608    LeReadSuggestedDefaultDataLength(LE, 0x0023) {
609        Params = ();
610        LeReadSuggestedDefaultDataLengthReturn {
611            suggested_max_tx_octets: u16,
612            suggested_max_tx_time: u16,
613        }
614    }
615}
616
617cmd! {
618    /// LE Write Suggested Default Data Length command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-ab836cdb-5055-0155-37fe-e480ac02bd20)
619    LeWriteSuggestedDefaultDataLength(LE, 0x0024) {
620        LeWriteSuggestedDefaultDataLengthParams {
621            suggested_max_tx_octets: u16,
622            suggested_max_tx_time: u16,
623        }
624        Return = ();
625    }
626}
627
628cmd! {
629    /// LE Read Local P-256 Public Key command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-0584eac0-17e3-fe2a-5870-642dc8711508)
630    ///
631    /// The key arrives in an [`LeReadLocalP256PublicKeyComplete`](crate::event::le::LeReadLocalP256PublicKeyComplete) event.
632    LeReadLocalP256PublicKey(LE, 0x0025) {
633        Params = ();
634    }
635}
636
637cmd! {
638    /// LE Generate DHKey command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3e12f0bc-bec6-f519-7dc7-544396c0eeb8)
639    ///
640    /// The key arrives in an [`LeGenerateDhkeyComplete`](crate::event::le::LeGenerateDhkeyComplete) event.
641    LeGenerateDhkey(LE, 0x0026) {
642        Params = [u8; 64];
643    }
644}
645
646cmd! {
647    /// LE Add Device To Resolving List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d9a635b2-e7bc-359b-2e6a-5e8b45b38df3)
648    LeAddDeviceToResolvingList(LE, 0x0027) {
649        LeAddDeviceToResolvingListParams {
650            peer_id_addr_kind: AddrKind,
651            peer_id_addr: BdAddr,
652            peer_irk: [u8; 16],
653            local_irk: [u8; 16],
654        }
655        Return = ();
656    }
657}
658
659cmd! {
660    /// LE Remove Device From Resolving List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4e58626c-6af2-3797-18f1-7ccf643377d8)
661    LeRemoveDeviceFromResolvingList(LE, 0x0028) {
662        LeRemoveDeviceFromResolvingListParams {
663            peer_id_addr_kind: AddrKind,
664            peer_id_addr: BdAddr,
665        }
666        Return = ();
667    }
668}
669
670cmd! {
671    /// LE Clear Resolving List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7db0d65f-6851-c005-634b-6e7c31835a2e)
672    LeClearResolvingList(LE, 0x0029) {
673        Params = ();
674        Return = ();
675    }
676}
677
678cmd! {
679    /// LE Read Resolving List Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-dc9dd4cf-11ac-ed84-5101-d7c80ba06f2e)
680    LeReadResolvingListSize(LE, 0x002a) {
681        Params = ();
682        Return = u8;
683    }
684}
685
686cmd! {
687    /// LE Read Peer Resolvable Address command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-2929c17b-0b4b-ec14-ccfc-0901f4bdc035)
688    LeReadPeerResolvableAddr(LE, 0x002b) {
689        LeReadPeerResolvableAddrParams {
690            peer_id_addr_kind: AddrKind,
691            peer_id_addr: BdAddr,
692        }
693        Return = BdAddr;
694    }
695}
696
697cmd! {
698    /// LE Read Local Resolvable Address command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-ea29c3c3-278a-e3a3-a84a-ea8159183476)
699    LeReadLocalResolvableAddr(LE, 0x002c) {
700        LeReadLocalResolvableAddrParams {
701            peer_id_addr_kind: AddrKind,
702            peer_id_addr: BdAddr,
703        }
704        Return = BdAddr;
705    }
706}
707
708cmd! {
709    /// LE Set Address Resolution Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-ff994d82-39b7-a0a3-dab9-d145d42a35bf)
710    LeSetAddrResolutionEnable(LE, 0x002d) {
711        Params = bool;
712        Return = ();
713    }
714}
715
716cmd! {
717    /// LE Set Resolvable Private Address Timeout command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f539d523-751b-6ffa-fa0c-e9633f0d7cc9)
718    LeSetResolvablePrivateAddrTimeout(LE, 0x002e) {
719        Params = Duration<1_000_000>;
720        Return = ();
721    }
722}
723
724cmd! {
725    /// LE Read Maximum Data Length command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-467bd8e9-d61a-7a76-593f-02cfe246d126)
726    LeReadMaxDataLength(LE, 0x002f) {
727        Params = ();
728        LeReadMaxDataLengthReturn {
729            supported_max_tx_octets: u16,
730            supported_max_tx_time: u16,
731            supported_max_rx_octets: u16,
732            supported_max_rx_time: u16,
733        }
734    }
735}
736
737cmd! {
738    /// LE Read PHY command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d5598779-e01d-73fc-143f-749484029046)
739    LeReadPhy(LE, 0x0030) {
740        Params = ConnHandle;
741        LeReadPhyReturn {
742            tx_phy: PhyKind,
743            rx_phy: PhyKind,
744        }
745        Handle = handle: ConnHandle;
746    }
747}
748
749cmd! {
750    /// LE Set Default PHY command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f0d3d393-85fa-9083-d9c0-589b3800a153)
751    LeSetDefaultPhy(LE, 0x0031) {
752        LeSetDefaultPhyParams {
753            all_phys: AllPhys,
754            tx_phys: PhyMask,
755            rx_phys: PhyMask,
756        }
757        Return = ();
758    }
759}
760
761cmd! {
762    /// LE Set PHY command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-8b2521a7-2192-15c2-1815-bcd8fa11da15)
763    LeSetPhy(LE, 0x0032) {
764        LeSetPhyParams {
765            handle: ConnHandle,
766            all_phys: AllPhys,
767            tx_phys: PhyMask,
768            rx_phys: PhyMask,
769            phy_options: PhyOptions,
770        }
771    }
772}
773
774cmd! {
775    /// LE Receiver Test V2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d5d30b61-e8be-8fa5-a04b-7d505a74ea9d)
776    LeReceiverTestV2(LE, 0x0033) {
777        LeReceiverTestV2Params {
778            rx_frequency: u8,
779            phy: u8,
780            modulation_index: u8,
781        }
782        Return = ();
783    }
784}
785
786cmd! {
787    /// LE Transmitter Test V2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-15c2cfce-06a0-5da7-5cbb-45c1896cca8d)
788    LeTransmitterTestV2(LE, 0x0034) {
789        LeTransmitterTestV2Params {
790            tx_frequency: u8,
791            length_of_test_data: u8,
792            packet_payload: u8,
793            phy: u8,
794        }
795        Return = ();
796    }
797}
798
799cmd! {
800    /// LE Set Advertising Set Random Address command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7c76cb49-d60d-1b5a-09ba-e3637d96d41d)
801    LeSetAdvSetRandomAddr(LE, 0x0035) {
802        LeSetAdvSetRandomAddrParams {
803            adv_handle: AdvHandle,
804            random_addr: BdAddr,
805        }
806        Return = ();
807    }
808}
809
810cmd! {
811    /// LE Set Extended Advertising Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-2d5f3e1f-6666-baa9-dcc2-5d8af3709dac)
812    LeSetExtAdvParams(LE, 0x0036) {
813        LeSetExtAdvParamsParams {
814                adv_handle: AdvHandle,
815                adv_event_props: AdvEventProps,
816                primary_adv_interval_min: ExtDuration<625>,
817                primary_adv_interval_max: ExtDuration<625>,
818                primary_adv_channel_map: AdvChannelMap,
819                own_addr_kind: AddrKind,
820                peer_addr_kind: AddrKind,
821                peer_addr: BdAddr,
822                adv_filter_policy: AdvFilterPolicy,
823                adv_tx_power: i8,
824                primary_adv_phy: PhyKind,
825                secondary_adv_max_skip: u8,
826                secondary_adv_phy: PhyKind,
827                adv_sid: u8,
828                scan_request_notification_enable: bool,
829        }
830        Return = i8;
831    }
832}
833
834cmd! {
835    /// LE Set Extended Advertising Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-2d5f3e1f-6666-baa9-dcc2-5d8af3709dac)
836    LeSetExtAdvParamsV2(LE, 0x007F) {
837        LeSetExtAdvParamsV2Params {
838                adv_handle: AdvHandle,
839                adv_event_props: AdvEventProps,
840                primary_adv_interval_min: ExtDuration<625>,
841                primary_adv_interval_max: ExtDuration<625>,
842                primary_adv_channel_map: AdvChannelMap,
843                own_addr_kind: AddrKind,
844                peer_addr_kind: AddrKind,
845                peer_addr: BdAddr,
846                adv_filter_policy: AdvFilterPolicy,
847                adv_tx_power: i8,
848                primary_adv_phy: PhyKind,
849                secondary_adv_max_skip: u8,
850                secondary_adv_phy: PhyKind,
851                adv_sid: u8,
852                scan_request_notification_enable: bool,
853                primary_adv_phy_options: AdvPhyOptions,
854                secondary_adv_phy_options: AdvPhyOptions,
855        }
856        Return = i8;
857    }
858}
859
860cmd! {
861    /// LE Set Extended Advertising Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-b63f0c30-a14d-ffdf-8a57-73cfe903c539)
862    LeSetExtAdvData(LE, 0x0037) {
863        LeSetExtAdvDataParams<'d> {
864            adv_handle: AdvHandle,
865            operation: Operation,
866            fragment_preference: bool,
867            adv_data: &'d [u8],
868        }
869        Return = ();
870    }
871}
872
873cmd! {
874    /// LE Set Extended Scan Response Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e3dc6edb-4cde-4655-8186-cbde281bcb53)
875    LeSetExtScanResponseData(LE, 0x0038) {
876        LeSetExtScanResponseDataParams<'d> {
877            adv_handle: AdvHandle,
878            operation: Operation,
879            fragment_preference: bool,
880            scan_response_data: &'d [u8],
881        }
882        Return = ();
883    }
884}
885
886cmd! {
887    /// LE Set Extended Advertising Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d05d4cfe-f0b5-b0e2-1a63-672c960dc088)
888    LeSetExtAdvEnable(LE, 0x0039) {
889        LeSetExtAdvEnableParams<'a> {
890            enable: bool,
891            sets: &'a [AdvSet],
892        }
893        Return = ();
894    }
895}
896
897cmd! {
898    /// LE Read Maximum Advertising Data Length command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-762a3b37-a74d-a5b8-31ea-2d1ad02f257d)
899    LeReadMaxAdvDataLength(LE, 0x003a) {
900        Params = ();
901        Return = u16;
902    }
903}
904
905cmd! {
906    /// LE Read Number of Supported Advertising Sets command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-2b7bf2df-474b-031d-35c5-74623905cfe8)
907    LeReadNumberOfSupportedAdvSets(LE, 0x003b) {
908        Params = ();
909        Return = u8;
910    }
911}
912
913cmd! {
914    /// LE Remove Advertising Set command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-eaf84df1-f597-9d23-067d-29931a2bdac9)
915    LeRemoveAdvSet(LE, 0x003c) {
916        Params = AdvHandle;
917        Return = ();
918    }
919}
920
921cmd! {
922    /// LE Clear Advertising Sets command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-6b002f0a-b5b7-cb02-bc4d-deb80c9bab77)
923    LeClearAdvSets(LE, 0x003d) {
924        Params = ();
925        Return = ();
926    }
927}
928
929cmd! {
930    /// LE Set Periodic Advertising Parameters (v1) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e0bc9abb-d57e-8a02-b515-428c7f30e7d2)
931    LeSetPeriodicAdvParams(LE, 0x003e) {
932        LeSetPeriodicAdvParamsParams {
933            adv_handle: AdvHandle,
934            periodic_adv_interval_min: Duration<1_250>,
935            periodic_adv_interval_max: Duration<1_250>,
936            periodic_adv_props: PeriodicAdvProps,
937        }
938        Return = ();
939    }
940}
941
942cmd! {
943    /// LE Set Periodic Advertising Parameters (v2) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e0bc9abb-d57e-8a02-b515-428c7f30e7d2)
944    LeSetPeriodicAdvParamsV2(LE, 0x0086) {
945        LeSetPeriodicAdvParamsV2Params {
946            periodic_adv_interval_min: Duration<1_250>,
947            periodic_adv_interval_max: Duration<1_250>,
948            periodic_adv_props: PeriodicAdvProps,
949            num_subevents: u8,
950            subevent_interval: u8, // * 1.25ms
951            response_slot_delay: u8, // * 1.25ms
952            response_slot_spacing: u8, // * 0.125ms
953            num_response_slots: u8,
954        }
955        Return = AdvHandle;
956        Handle = adv_handle: AdvHandle;
957    }
958}
959
960cmd! {
961    /// LE Set Periodic Advertising Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-6154cdf5-c004-4eb1-7bdf-13ecda5bba78)
962    LeSetPeriodicAdvData(LE, 0x003f) {
963        LeSetPeriodicAdvDataParams<'a> {
964            adv_handle: AdvHandle,
965            operation: Operation,
966            adv_data: &'a [u8],
967        }
968        Return = ();
969    }
970}
971
972cmd! {
973    /// LE Set Periodic Advertising Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f69a3383-9839-e8f2-5339-a1e9327d5bf8)
974    LeSetPeriodicAdvEnable(LE, 0x0040) {
975        LeSetPeriodicAdvEnableParams {
976            enable: bool,
977            adv_handle: AdvHandle,
978        }
979        Return = ();
980    }
981}
982
983cmd! {
984    BASE
985    /// LE Set Extended Scan Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-431e2ed0-fe1f-17bd-6e6a-91ff801c6063)
986    LeSetExtScanParams(LE, 0x0041) {
987        Params = LeSetExtScanParamsParams;
988        Return = ();
989      }
990}
991
992impl LeSetExtScanParams {
993    /// Create a new instance of scan parameters.
994    pub fn new(
995        own_addr_kind: AddrKind,
996        scanning_filter_policy: ScanningFilterPolicy,
997        scanning_phys: PhyParams<ScanningPhy>,
998    ) -> Self {
999        Self(LeSetExtScanParamsParams {
1000            own_addr_kind,
1001            scanning_filter_policy,
1002            scanning_phys,
1003        })
1004    }
1005}
1006
1007/// Parameters for LE Set Extended Scan Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-431e2ed0-fe1f-17bd-6e6a-91ff801c6063)
1008#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1009#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1010pub struct LeSetExtScanParamsParams {
1011    /// Kind of address for self.
1012    pub own_addr_kind: AddrKind,
1013    /// Scanning filter policy.
1014    pub scanning_filter_policy: ScanningFilterPolicy,
1015    /// Phys used when scanning.
1016    pub scanning_phys: PhyParams<ScanningPhy>,
1017}
1018
1019impl WriteHci for LeSetExtScanParamsParams {
1020    #[inline(always)]
1021    fn size(&self) -> usize {
1022        self.own_addr_kind.size() + self.scanning_filter_policy.size() + self.scanning_phys.size()
1023    }
1024
1025    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1026        self.own_addr_kind.write_hci(&mut writer)?;
1027        self.scanning_filter_policy.write_hci(&mut writer)?;
1028        self.scanning_phys.write_hci(writer)
1029    }
1030
1031    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1032        self.own_addr_kind.write_hci_async(&mut writer).await?;
1033        self.scanning_filter_policy.write_hci_async(&mut writer).await?;
1034        self.scanning_phys.write_hci_async(writer).await
1035    }
1036}
1037
1038cmd! {
1039    /// LE Set Extended Scan Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-bfe8407c-4def-2ded-51dd-e47cf9e8916c)
1040    LeSetExtScanEnable(LE, 0x0042) {
1041        LeSetExtScanEnableParams {
1042            enable: bool,
1043            filter_duplicates: FilterDuplicates,
1044            duration: Duration<10_000>,
1045            period: Duration<1_280_000>,
1046        }
1047        Return = ();
1048    }
1049}
1050
1051cmd! {
1052    BASE
1053    /// LE Extended Create Connection (v1) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1dad213e-f660-2937-c94d-7a3162e94105)
1054    LeExtCreateConn(LE, 0x0043) {
1055        Params = LeExtCreateConnParams;
1056    }
1057}
1058
1059impl LeExtCreateConn {
1060    /// Create a new instance of this command.
1061    pub fn new(
1062        initiator_filter_policy: bool,
1063        own_addr_kind: AddrKind,
1064        peer_addr_kind: AddrKind,
1065        peer_addr: BdAddr,
1066        initiating_phys: PhyParams<InitiatingPhy>,
1067    ) -> Self {
1068        Self(LeExtCreateConnParams {
1069            initiator_filter_policy,
1070            own_addr_kind,
1071            peer_addr_kind,
1072            peer_addr,
1073            initiating_phys,
1074        })
1075    }
1076}
1077
1078/// Parameters for LE Extended Create Connection (v1) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1dad213e-f660-2937-c94d-7a3162e94105)
1079#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1080#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1081pub struct LeExtCreateConnParams {
1082    /// Should use the initiator filter policy or not.
1083    pub initiator_filter_policy: bool,
1084    /// What kind of address for self.
1085    pub own_addr_kind: AddrKind,
1086    /// What kind of address for peer.
1087    pub peer_addr_kind: AddrKind,
1088    /// The peer address to connect to.
1089    pub peer_addr: BdAddr,
1090    /// Which phys used for connecting.
1091    pub initiating_phys: PhyParams<InitiatingPhy>,
1092}
1093
1094impl WriteHci for LeExtCreateConnParams {
1095    #[inline(always)]
1096    fn size(&self) -> usize {
1097        self.initiator_filter_policy.size()
1098            + self.own_addr_kind.size()
1099            + self.peer_addr_kind.size()
1100            + self.peer_addr.size()
1101            + self.initiating_phys.size()
1102    }
1103
1104    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1105        self.initiator_filter_policy.write_hci(&mut writer)?;
1106        self.own_addr_kind.write_hci(&mut writer)?;
1107        self.peer_addr_kind.write_hci(&mut writer)?;
1108        self.peer_addr.write_hci(&mut writer)?;
1109        self.initiating_phys.write_hci(writer)
1110    }
1111
1112    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1113        self.initiator_filter_policy.write_hci_async(&mut writer).await?;
1114        self.own_addr_kind.write_hci_async(&mut writer).await?;
1115        self.peer_addr_kind.write_hci_async(&mut writer).await?;
1116        self.peer_addr.write_hci_async(&mut writer).await?;
1117        self.initiating_phys.write_hci_async(writer).await
1118    }
1119}
1120
1121cmd! {
1122    BASE
1123    /// LE Extended Create Connection (v2) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1dad213e-f660-2937-c94d-7a3162e94105)
1124    LeExtCreateConnV2(LE, 0x0085) {
1125        Params = LeExtCreateConnV2Params;
1126    }
1127}
1128
1129impl LeExtCreateConnV2 {
1130    /// Create a new instance.
1131    pub fn new(
1132        adv_handle: AdvHandle,
1133        subevent: u8,
1134        initiator_filter_policy: bool,
1135        own_addr_kind: AddrKind,
1136        peer_addr_kind: AddrKind,
1137        peer_addr: BdAddr,
1138        initiating_phys: PhyParams<InitiatingPhy>,
1139    ) -> Self {
1140        Self(LeExtCreateConnV2Params {
1141            adv_handle,
1142            subevent,
1143            initiator_filter_policy,
1144            own_addr_kind,
1145            peer_addr_kind,
1146            peer_addr,
1147            initiating_phys,
1148        })
1149    }
1150}
1151
1152/// LE Extended Create Connection (v2) command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1dad213e-f660-2937-c94d-7a3162e94105)
1153#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1154#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1155pub struct LeExtCreateConnV2Params {
1156    /// The advertising handle to use.
1157    pub adv_handle: AdvHandle,
1158    /// Use connection sub-events.
1159    pub subevent: u8,
1160    /// Should use the initiator filter policy or not.
1161    pub initiator_filter_policy: bool,
1162    /// What kind of address for self.
1163    pub own_addr_kind: AddrKind,
1164    /// What kind of address for peer.
1165    pub peer_addr_kind: AddrKind,
1166    /// The peer address to connect to.
1167    pub peer_addr: BdAddr,
1168    /// Which phys used for connecting.
1169    pub initiating_phys: PhyParams<InitiatingPhy>,
1170}
1171
1172impl WriteHci for LeExtCreateConnV2Params {
1173    #[inline(always)]
1174    fn size(&self) -> usize {
1175        self.adv_handle.size()
1176            + self.subevent.size()
1177            + self.initiator_filter_policy.size()
1178            + self.own_addr_kind.size()
1179            + self.peer_addr_kind.size()
1180            + self.peer_addr.size()
1181            + self.initiating_phys.size()
1182    }
1183
1184    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1185        self.adv_handle.write_hci(&mut writer)?;
1186        self.subevent.write_hci(&mut writer)?;
1187        self.initiator_filter_policy.write_hci(&mut writer)?;
1188        self.own_addr_kind.write_hci(&mut writer)?;
1189        self.peer_addr_kind.write_hci(&mut writer)?;
1190        self.peer_addr.write_hci(&mut writer)?;
1191        self.initiating_phys.write_hci(writer)
1192    }
1193
1194    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1195        self.adv_handle.write_hci_async(&mut writer).await?;
1196        self.subevent.write_hci_async(&mut writer).await?;
1197        self.initiator_filter_policy.write_hci_async(&mut writer).await?;
1198        self.own_addr_kind.write_hci_async(&mut writer).await?;
1199        self.peer_addr_kind.write_hci_async(&mut writer).await?;
1200        self.peer_addr.write_hci_async(&mut writer).await?;
1201        self.initiating_phys.write_hci_async(writer).await
1202    }
1203}
1204
1205cmd! {
1206    /// LE Periodic Advertising Create Sync command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-29188ef0-bf80-7807-2c96-385e7d9782ed)
1207    LePeriodicAdvCreateSync(LE, 0x0044) {
1208        LePeriodicAdvCreateSyncParams {
1209            options: LePeriodicAdvCreateSyncOptions,
1210            adv_sid: u8,
1211            adv_addr_kind: AddrKind,
1212            adv_addr: BdAddr,
1213            skip: u16,
1214            sync_timeout: Duration<10_000>,
1215            sync_cte_kind: CteMask,
1216        }
1217    }
1218}
1219
1220cmd! {
1221    /// LE Periodic Advertising Create Sync Cancel command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-203d8b19-9d3f-65b2-82c7-96c6abdc5928)
1222    LePeriodicAdvCreateSyncCancel(LE, 0x0045) {
1223        Params = ();
1224        Return = ();
1225    }
1226}
1227
1228cmd! {
1229    /// LE Periodic Advertising Terminate Sync command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-c47f3b5c-e6db-f151-3a45-203bfe8b4fb9)
1230    LePeriodicAdvTerminateSync(LE, 0x0046) {
1231        Params = SyncHandle;
1232        Return = ();
1233    }
1234}
1235
1236cmd! {
1237    /// LE Add Device To Periodic Advertiser List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f73da323-a9c4-78cc-669d-6ebf05029416)
1238    LeAddDeviceToPeriodicAdvList(LE, 0x0047) {
1239        LeAddDeviceToPeriodicAdvListParams {
1240            adv_addr_kind: AddrKind,
1241            adv_addr: BdAddr,
1242            adv_sid: u8,
1243        }
1244        Return = ();
1245    }
1246}
1247
1248cmd! {
1249    /// LE Remove Device From Periodic Advertiser List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-2f419914-71e3-3886-cecb-c9b5da98b538)
1250    LeRemoveDeviceFromPeriodicAdvList(LE, 0x0048) {
1251        LeRemoveDeviceFromPeriodicAdvListParams {
1252            adv_addr_kind: AddrKind,
1253            adv_addr: BdAddr,
1254            adv_sid: u8,
1255        }
1256        Return = ();
1257    }
1258}
1259
1260cmd! {
1261    /// LE Clear Periodic Advertiser List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-049826bb-cdb2-df43-7c18-c5232ad99ef8)
1262    LeClearPeriodicAdvList(LE, 0x0049) {
1263        Params = ();
1264        Return = ();
1265    }
1266}
1267
1268cmd! {
1269    /// LE Read Periodic Advertiser List Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3212f6f2-a838-872c-9ead-dd81ac4b7a66)
1270    LeReadPeriodicAdvListSize(LE, 0x004a) {
1271        Params = ();
1272        Return = u8;
1273    }
1274}
1275
1276cmd! {
1277    /// LE Read Transmit Power command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-66ee9869-6f38-c57f-0ab5-b5228ff5302c)
1278    LeReadTransmitPower(LE, 0x004b) {
1279        Params = ();
1280        LeReadTransmitPowerReturn {
1281            min_tx_power: i8,
1282            max_tx_power: i8,
1283        }
1284    }
1285}
1286
1287cmd! {
1288    /// LE Read RF Path Compensation command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-8bba170c-e42b-8b42-f44b-64a0bc73af1d)
1289    LeReadRfPathCompensation(LE, 0x004c) {
1290        Params = ();
1291        LeReadRfPathCompensationReturn {
1292            rf_tx_path_compensation_value: i16,
1293            rf_rx_path_compenstaion_value: i16,
1294        }
1295    }
1296}
1297
1298cmd! {
1299    /// LE Write RF Path Compensation command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-85f69948-b4de-6b55-8282-77208c43f3aa)
1300    LeWriteRfPathCompensation(LE, 0x004d) {
1301        LeWriteRfPathCompensationParams {
1302            rf_tx_path_compensation_value: i16,
1303            rf_rx_path_compensation_value: i16,
1304        }
1305        Return = ();
1306    }
1307}
1308
1309cmd! {
1310    /// LE Set Privacy Mode command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-6a48bb1b-af90-9620-22c8-a4b9297d257c)
1311    LeSetPrivacyMode(LE, 0x004e) {
1312        LeSetPrivacyModeParams {
1313            peer_id_addr_kind: AddrKind,
1314            peer_id_addr: BdAddr,
1315            privacy_mode: PrivacyMode,
1316        }
1317        Return = ();
1318    }
1319}
1320
1321cmd! {
1322    /// LE Set Connectionless CTE Transmit Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-53d42c3c-cefd-aff5-f3f4-a27d02c8d46e)
1323    LeSetConnectionlessCteTransmitParams(LE, 0x0051) {
1324        LeSetConnectionlessCteTransmitParamsParams<'a> {
1325            adv_handle: AdvHandle,
1326            cte_length: u8,
1327            cte_kind: CteKind,
1328            cte_count: u8,
1329            switching_pattern: &'a [u8],
1330        }
1331        Return = ();
1332    }
1333}
1334
1335cmd! {
1336    /// LE Set Connectionless CTE Transmit Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f816ec0f-6970-7548-4370-b009c693259f)
1337    LeSetConnectionlessCteTransmitEnable(LE, 0x0052) {
1338        LeSetConnectionlessCteTransmitEnableParams {
1339            adv_handle: AdvHandle,
1340            cte_enable: bool,
1341        }
1342        Return = ();
1343    }
1344}
1345
1346cmd! {
1347    /// LE Set Connectionless IQ Sampling Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7cb279b8-3634-75b5-d6fc-52a55172673d)
1348    LeSetConnectionlessIqSamplingEnable(LE, 0x0053) {
1349        LeSetConnectionlessIqSamplingEnableParams<'a> {
1350            sampling_enable: bool,
1351            slot_durations: u8,
1352            max_sampled_ctes: u8,
1353            switching_pattern: &'a [u8],
1354        }
1355        Return = SyncHandle;
1356        Handle = sync_handle: SyncHandle;
1357    }
1358}
1359
1360cmd! {
1361    /// LE Set Connection CTE Receive Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9d29d497-891f-e05e-e043-59fe8b7c11a7)
1362    LeSetConnCteReceiveParams(LE, 0x0054) {
1363        LeSetConnCteReceiveParamsParams<'a> {
1364            sampling_enable: bool,
1365            slot_durations: u8,
1366            switching_pattern: &'a [u8],
1367        }
1368        Return = ConnHandle;
1369        Handle = handle: ConnHandle;
1370    }
1371}
1372
1373cmd! {
1374    /// LE Set Connection CTE Transmit Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-a8cd66e1-b702-2d8e-c027-4f0a89d4f8a1)
1375    LeSetConnCteTransmitParams(LE, 0x0055) {
1376        LeSetConnCteTransmitParamsParams<'a> {
1377            cte_kinds: CteMask,
1378            switching_pattern: &'a [u8],
1379        }
1380        Return = ConnHandle;
1381        Handle = handle: ConnHandle;
1382    }
1383}
1384
1385cmd! {
1386    /// LE Connection CTE Request Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-469dbd0a-9a4f-1366-ea4f-f38cf19031a4)
1387    LeConnCteRequestEnable(LE, 0x0056) {
1388        LeConnCteRequestEnableParams {
1389            enable: bool,
1390            cte_request_interval: u16,
1391            requested_cte_length: u8,
1392            requested_cte_kind: CteKind,
1393        }
1394        Return = ConnHandle;
1395        Handle = handle: ConnHandle;
1396    }
1397}
1398
1399cmd! {
1400    /// LE Connection CTE Response Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-cbb39f47-1d2f-e229-ff9e-d716111b38a8)
1401    LeConnCteResponseEnable(LE, 0x0057) {
1402        LeConnCteResponseEnableParams {
1403            enable: bool,
1404        }
1405        Return = ConnHandle;
1406        Handle = handle: ConnHandle;
1407    }
1408}
1409
1410cmd! {
1411    /// LE Read Antenna Information command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7a80c226-cea1-de43-ff2b-2503b2e7f91e)
1412    LeReadAntennaInformation(LE, 0x0058) {
1413        Params = ();
1414        LeReadAntennaInformationReturn {
1415            supported_switching_sampling_rates: SwitchingSamplingRates,
1416            num_antennae: u8,
1417            max_switching_pattern_len: u8,
1418            max_cte_len: u8,
1419        }
1420    }
1421}
1422
1423cmd! {
1424    /// LE Set Periodic Advertising Receive Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-b055b724-7607-bf63-3862-3e164dfc2251)
1425    LeSetPeriodicAdvReceiveEnable(LE, 0x0059) {
1426        LeSetPeriodicAdvReceiveEnableParams {
1427            sync_handle: SyncHandle,
1428            enable: LePeriodicAdvReceiveEnable,
1429        }
1430        Return = ();
1431    }
1432}
1433
1434cmd! {
1435    /// LE Read Buffer Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1446fd8f-af42-e54c-890d-3cc275ed372f)
1436    LeReadBufferSizeV2(LE, 0x0060) {
1437        Params = ();
1438        LeReadBufferSizeV2Return {
1439            le_acl_data_packet_length: u16,
1440            total_num_le_acl_data_packets: u8,
1441            iso_data_packet_length: u16,
1442            total_num_iso_data_packets: u8,
1443        }
1444    }
1445}
1446
1447cmd! {
1448    /// LE Periodic Advertising Sync Transfer command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-28bd445b-503e-6c1e-7d80-7bf4c8bd5e8d)
1449    LePeriodicAdvSyncTransfer(LE, 0x005a) {
1450        LePeriodicAdvSyncTransferParams {
1451            service_data: u16,
1452            sync_handle: SyncHandle,
1453        }
1454        Return = ConnHandle;
1455        Handle = handle: ConnHandle;
1456    }
1457}
1458
1459cmd! {
1460    /// LE Periodic Advertising Set Info Transfer command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-b1707675-34fd-4375-7c1c-354098a52db6)
1461    LePeriodicAdvSetInfoTransfer(LE, 0x005b) {
1462        LePeriodicAdvSetInfoTransferParams {
1463            service_data: u16,
1464            adv_handle: AdvHandle,
1465        }
1466        Return = ConnHandle;
1467        Handle = handle: ConnHandle;
1468    }
1469}
1470
1471cmd! {
1472    /// LE Set Periodic Advertising Sync Transfer Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-5ae627f7-febe-a209-e4fb-275a35572ae7)
1473    LeSetPeriodicAdvSyncTransferParams(LE, 0x005c) {
1474        LeSetPeriodicAdvSyncTransferParamsParams {
1475            mode: LePeriodicAdvSyncTransferMode,
1476            skip: u16,
1477            sync_timeout: Duration<10_000>,
1478            cte_kind: CteMask,
1479        }
1480        Return = ConnHandle;
1481        Handle = handle: ConnHandle;
1482    }
1483}
1484
1485cmd! {
1486    /// LE Set Default Periodic Advertising Sync Transfer Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-5c2a7c01-0658-1b94-ae09-16a436c9ef4f)
1487    LeSetDefaultPeriodicAdvSyncTransferParams(LE, 0x005d) {
1488        LeSetDefaultPeriodicAdvSyncTransferParamsParams {
1489            mode: LePeriodicAdvSyncTransferMode,
1490            skip: u16,
1491            sync_timeout: Duration<10_000>,
1492            cte_kind: CteMask,
1493        }
1494        Return = ();
1495    }
1496}
1497
1498cmd! {
1499    /// LE Generate DHKey V2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3e12f0bc-bec6-f519-7dc7-544396c0eeb8)
1500    ///
1501    /// The key arrives in an [`LeGenerateDhkeyComplete`](crate::event::le::LeGenerateDhkeyComplete) event.
1502    LeGenerateDhkeyV2(LE, 0x005e) {
1503        LeGenerateDhkeyV2Params {
1504            remote_p256_public_key: [u8; 64],
1505            use_debug_key: bool,
1506        }
1507    }
1508}
1509
1510cmd! {
1511    /// LE Request Peer SCA command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4960a916-5311-968d-b432-8537b2dd12ed)
1512    LeRequestPeerSca(LE, 0x006d) {
1513        Params = ConnHandle;
1514    }
1515}
1516
1517cmd! {
1518    /// LE Set Host Feature command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-873282cd-6e49-e9aa-cf6f-02fb4c0ea924)
1519    LeSetHostFeature(LE, 0x0074) {
1520        LeSetHostFeatureParams {
1521            bit_number: LeHostFeature,
1522            bit_value: bool,
1523        }
1524        Return = ();
1525    }
1526}
1527
1528cmd! {
1529    /// LE Enhanced Read Transmit Power Level command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9460c908-2c3d-5915-e04b-25ce98dda7a8)
1530    LeEnhancedReadTransmitPowerLevel(LE, 0x0076) {
1531        LeEnhancedReadTransmitPowerLevelParams {
1532            phy: PhyKind,
1533        }
1534        LeEnhancedReadTransmitPowerLevelReturn {
1535            phy: PhyKind,
1536            current_tx_power_level: i8,
1537            max_tx_power_level: i8,
1538        }
1539        Handle = handle: ConnHandle;
1540    }
1541}
1542
1543cmd! {
1544    /// LE Read Remote Transmit Power Level command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e0399448-0f93-7fcf-73ed-43171e6627ea)
1545    LeReadRemoteTransmitPowerLevel(LE, 0x0077) {
1546        LeReadRemoteTransmitPowerLevelParams {
1547            handle: ConnHandle,
1548            phy: PhyKind,
1549        }
1550    }
1551}
1552
1553cmd! {
1554    /// LE Set Path Loss Reporting Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-40bf69ec-6834-33a5-2978-4bec08e281f2)
1555    LeSetPathLossReportingParams(LE, 0x0078) {
1556        LeSetPathLossReportingParamsParams {
1557            high_threshold: i8,
1558            high_hysteresis: i8,
1559            low_threshold: i8,
1560            low_hysteresis: i8,
1561            min_time_spent: u16,
1562        }
1563        Return = ConnHandle;
1564        Handle = handle: ConnHandle;
1565    }
1566}
1567
1568cmd! {
1569    /// LE Set Path Loss Reporting Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-fd9496a1-33de-7228-a0c1-44b9024daae1)
1570    LeSetPathLossReportingEnable(LE, 0x0079) {
1571        LeSetPathLossReportingEnableParams {
1572            enable: bool,
1573        }
1574        Return = ConnHandle;
1575        Handle = handle: ConnHandle;
1576    }
1577}
1578
1579cmd! {
1580    /// LE Set Transmit Power Reporting Enable command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-cdc834a7-3f30-7329-01d8-44a457aae980)
1581    LeSetTransmitPowerReportingEnable(LE, 0x007a) {
1582        LeSetTransmitPowerReportingEnableParams {
1583            local_enable: bool,
1584            remote_enable: bool,
1585        }
1586        Return = ConnHandle;
1587        Handle = handle: ConnHandle;
1588    }
1589}
1590
1591cmd! {
1592    /// LE Transmitter Test V4 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-15c2cfce-06a0-5da7-5cbb-45c1896cca8d)
1593    LeTransmitterTestV4(LE, 0x007b) {
1594        LeTransmitterTestV4Params<'a> {
1595            tx_channel: u8,
1596            test_data_length: u8,
1597            packet_payload: u8,
1598            phy: PhyKind,
1599            cte_length: u8,
1600            cte_kind: CteKind,
1601            switching_pattern: &'a [u8],
1602            tx_power_level: i8,
1603        }
1604        Return = ();
1605    }
1606}
1607
1608cmd! {
1609    /// LE Set Data Related Address Changes command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-cd6cc02d-3496-3d16-22cb-37f39c2df763)
1610    LeSetDataRelatedAddrChanges(LE, 0x007c) {
1611        LeSetDataRelatedAddrChangesParams {
1612            adv_handle: AdvHandle,
1613            change_reasons: LeDataRelatedAddrChangeReasons,
1614        }
1615        Return = ();
1616    }
1617}
1618
1619cmd! {
1620    /// LE Set Default Subrate command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d486bcfd-562a-3bef-e705-676715c6c3cc)
1621    LeSetDefaultSubrate(LE, 0x007d) {
1622        LeSetDefaultSubrateParams {
1623            subrate_min: u16,
1624            subrate_max: u16,
1625            max_latency: u16,
1626            continuation_number: u16,
1627            supervision_timeout: Duration<10_000>,
1628        }
1629        Return = ();
1630    }
1631}
1632
1633cmd! {
1634    /// LE Subrate Request command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e8e89250-dd32-6ec9-5aa4-04678fee288b)
1635    LeSubrateRequest(LE, 0x007e) {
1636        LeSubrateRequestParams {
1637            handle: ConnHandle,
1638            subrate_min: u16,
1639            subrate_max: u16,
1640            max_latency: u16,
1641            continuation_number: u16,
1642            supervision_timeout: Duration<10_000>,
1643        }
1644    }
1645}
1646
1647cmd! {
1648    BASE
1649    /// LE Set Periodic Advertising Subevent Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-927cb8c3-4a12-6154-d2f2-384f4a10f0a4)
1650    LeSetPeriodicAdvSubeventData(LE, 0x0082) {
1651        Params<'a> = LeSetPeriodicAdvSubeventDataParams<'a, 'a>;
1652        Return = AdvHandle;
1653    }
1654}
1655
1656impl<'a> LeSetPeriodicAdvSubeventData<'a> {
1657    /// Create a new instance.
1658    pub fn new(adv_handle: AdvHandle, subevent: &'a [LePeriodicAdvSubeventData<'a>]) -> Self {
1659        Self(LeSetPeriodicAdvSubeventDataParams { adv_handle, subevent })
1660    }
1661}
1662
1663/// Parameters for LE Set Periodic Advertising Subevent Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-927cb8c3-4a12-6154-d2f2-384f4a10f0a4)
1664#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1665#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1666pub struct LeSetPeriodicAdvSubeventDataParams<'a, 'b> {
1667    /// Which advertising handle to use.
1668    pub adv_handle: AdvHandle,
1669    /// List of sub events used.
1670    pub subevent: &'b [LePeriodicAdvSubeventData<'a>],
1671}
1672
1673impl WriteHci for LeSetPeriodicAdvSubeventDataParams<'_, '_> {
1674    #[inline(always)]
1675    fn size(&self) -> usize {
1676        self.adv_handle.size() + self.subevent.size()
1677    }
1678
1679    #[inline(always)]
1680    fn write_hci<W: ::embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1681        self.adv_handle.write_hci(&mut writer)?;
1682        self.subevent.write_hci(&mut writer)?;
1683        Ok(())
1684    }
1685
1686    #[inline(always)]
1687    async fn write_hci_async<W: ::embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1688        self.adv_handle.write_hci_async(&mut writer).await?;
1689        self.subevent.write_hci_async(&mut writer).await?;
1690        Ok(())
1691    }
1692}
1693
1694cmd! {
1695    /// LE Set Periodic Advertising Response Data command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-8ada75aa-8e1f-c742-6441-8dd1164fc646)
1696    LeSetPeriodicAdvResponseData(LE, 0x0083) {
1697        LeSetPeriodicAdvResponseDataParams<'a> {
1698            adv_handle: SyncHandle,
1699            request_event: u16,
1700            request_subevent: u8,
1701            response_subevent: u8,
1702            response_slot: u8,
1703            response_data: &'a [u8],
1704        }
1705        Return = SyncHandle;
1706    }
1707}
1708
1709cmd! {
1710    /// LE Set Periodic Sync Subevent command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-e3b9bdd9-b435-9adf-2516-ad94e14ece70)
1711    LeSetPeriodicSyncSubevent(LE, 0x0084) {
1712        LeSetPeriodicSyncSubeventParams<'a> {
1713            adv_handle: SyncHandle,
1714            periodic_adv_props: PeriodicAdvProps,
1715            subevents: &'a [u8],
1716        }
1717        Return = SyncHandle;
1718    }
1719}
1720
1721cmd! {
1722    /// LE Set Host Feature V2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-c8e1603a-50b7-6ba6-2867-d9c78fd5c89d)
1723    LeSetHostFeatureV2(LE, 0x0097) {
1724        LeSetHostFeatureV2Params {
1725            bit_number: LeHostFeatureV2,
1726            bit_value: bool,
1727        }
1728        Return = ();
1729    }
1730}
1731
1732cmd! {
1733    /// LE Frame Space Update command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d13d94d2-5a3c-66a9-9a17-89659b5dbda6)
1734    LeFrameSpaceUpdate(LE, 0x009D) {
1735        LeFrameSpaceUpdateParams {
1736            handle: ConnHandle,
1737            frame_space_min: Duration<1>,
1738            frame_space_max: Duration<1>,
1739            phy: PhyMask,
1740            spacing_types: SpacingTypes,
1741        }
1742    }
1743}
1744
1745cmd! {
1746    /// LE Add Device To Monitored Advertisers List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1fba0fa9-c2ca-a414-8bb5-a2b9d6843ceb)
1747    LeAddDeviceToMonitoredAdvList(LE, 0x0098) {
1748        LeAddDeviceToMonitoredAdvListParams {
1749            addr_kind: AddrKind,
1750            addr: BdAddr,
1751            rssi_threshold_low: i8,
1752            rssi_threshold_high: i8,
1753            timeout: u8,
1754        }
1755        Return = ();
1756    }
1757}
1758
1759cmd! {
1760    /// LE Remove Device From Monitored Advertisers List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d02c54a5-012b-dba0-4979-b7536e44112d)
1761    LeRemoveDeviceFromMonitoredAdvList(LE, 0x0099) {
1762        LeRemoveDeviceFromMonitoredAdvListParams {
1763            addr_kind: AddrKind,
1764            addr: BdAddr,
1765        }
1766        Return = ();
1767    }
1768}
1769
1770cmd! {
1771    /// LE Clear Monitored Advertisers List command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-8f5aef39-3dea-9ce2-b323-14a73b6b59cd)
1772    LeClearMonitoredAdvList(LE, 0x009a) {
1773        Params = ();
1774        Return = ();
1775    }
1776}
1777
1778cmd! {
1779    /// LE Read Monitored Advertisers List Size command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4fce6390-cce5-0d24-c5b4-1c7e3f1f943d)
1780    LeReadMonitoredAdvListSize(LE, 0x009b) {
1781        Params = ();
1782        Return = u8;
1783    }
1784}
1785
1786cmd! {
1787    /// LE Enable Monitoring Advertisers command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-60/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-61e73411-6be7-c08f-e2d1-fc99257837e3)
1788    LeEnableMonitoringAdv(LE, 0x009c) {
1789        Params = bool;
1790        Return = ();
1791    }
1792}
1793
1794cmd! {
1795    /// LE Set Resolvable Private Address Timeout V2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core_v6.3/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-f539d523-751b-6ffa-fa0c-e9633f0d7cc9)
1796    LeSetResolvablePrivateAddrTimeoutV2(LE, 0x009e) {
1797        LeSetResolvablePrivateAddrTimeoutV2Params {
1798            rpa_timeout_min: Duration<1_000_000>,
1799            rpa_timeout_max: Duration<1_000_000>,
1800        }
1801        Return = ();
1802    }
1803}
1804
1805cmd! {
1806    /// LE Connection Rate Request command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-62/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d09bc90b-2b78-6a0b-c33d-cc086e4e7e66)
1807    LeConnectionRateRequest(LE, 0x00A1) {
1808        LeConnectionRateRequestParams {
1809            handle: ConnHandle,
1810            conn_interval_min: Duration<125>,
1811            conn_interval_max: Duration<125>,
1812            subrate_min: u16,
1813            subrate_max: u16,
1814            max_latency: u16,
1815            continuation_number: u16,
1816            supervision_timeout: Duration<10_000>,
1817            min_ce_length: Duration<125>,
1818            max_ce_length: Duration<125>,
1819        }
1820        Return = ();
1821    }
1822}
1823
1824cmd! {
1825    /// LE Set Default Rate Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-62/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4d7dcf09-f740-e58a-d0ea-41f29e7bed37)
1826    LeSetDefaultRateParameters(LE, 0x00A2) {
1827        LeSetDefaultRateParametersParams {
1828            conn_interval_min: Duration<125>,
1829            conn_interval_max: Duration<125>,
1830            subrate_min: u16,
1831            subrate_max: u16,
1832            max_latency: u16,
1833            continuation_number: u16,
1834            supervision_timeout: Duration<10_000>,
1835            min_ce_length: Duration<125>,
1836            max_ce_length: Duration<125>,
1837        }
1838        Return = ();
1839    }
1840}
1841
1842cmd! {
1843    /// LE Read Minimum Supported Connection Interval command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-62/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-1cb9e115-3445-39f6-38de-cc3fc5dcb4c7)
1844    LeReadMinimumSupportedConnectionInterval(LE, 0x00A3) {
1845        Params = ();
1846        LeReadMinimumSupportedConnectionIntervalReturn {
1847            minimum_supported_connection_interval: DurationU8<125>,
1848            num_groups: u8,
1849            groups: [ConnIntervalGroup; 255],
1850        }
1851    }
1852}
1853
1854// ============================================================================
1855// ISO / LE Audio commands (Bluetooth Core Specification v5.4+)
1856// ============================================================================
1857
1858cmd! {
1859    /// LE Read ISO TX Sync command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-cf634e13-b00c-6cfc-0b17-207ac33e6b61)
1860    LeReadIsoTxSync(LE, 0x0061) {
1861        Params = ConnHandle;
1862        LeReadIsoTxSyncReturn {
1863            packet_sequence_number: u16,
1864            tx_time_stamp: u32,
1865            time_offset: ExtDuration<1>,
1866        }
1867        Handle = handle: ConnHandle;
1868    }
1869}
1870
1871cmd! {
1872    /// LE Set CIG Parameters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9b09845e-f6b6-d9a5-229e-67c56ef64bbd)
1873    LeSetCigParameters(LE, 0x0062) {
1874        LeSetCigParametersParams<'a> {
1875            cig_id: CigId,
1876            sdu_interval_c_to_p: ExtDuration<1>,
1877            sdu_interval_p_to_c: ExtDuration<1>,
1878            ft_c_to_p: u8,
1879            ft_p_to_c: u8,
1880            iso_interval: u16,
1881            worst_case_sca: u8,
1882            packing: Packing,
1883            framing: Framing,
1884            cis_configs: &'a [CisConfig],
1885        }
1886        LeSetCigParametersReturn {
1887            cig_id: CigId,
1888            num_cis: u8,
1889            cis_handles: [ConnHandle; 31],
1890        }
1891    }
1892}
1893
1894cmd! {
1895    /// LE Set CIG Parameters Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7e0787ab-982b-5f41-25d9-36b34a0296ec)
1896    LeSetCigParametersTest(LE, 0x0063) {
1897        LeSetCigParametersTestParams<'a> {
1898            cig_id: CigId,
1899            sdu_interval_c_to_p: ExtDuration<1>,
1900            sdu_interval_p_to_c: ExtDuration<1>,
1901            ft_c_to_p: u8,
1902            ft_p_to_c: u8,
1903            iso_interval: u16,
1904            worst_case_sca: u8,
1905            packing: Packing,
1906            framing: Framing,
1907            cis_configs: &'a [CisConfigTest],
1908        }
1909        LeSetCigParametersTestReturn {
1910            cig_id: CigId,
1911            num_cis: u8,
1912            cis_handles: [ConnHandle; 31],
1913        }
1914    }
1915}
1916
1917cmd! {
1918    /// LE Create CIS command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4c126319-a7b1-6765-ab23-04777e78599f)
1919    LeCreateCis(LE, 0x0064) {
1920        LeCreateCisParams<'a> {
1921            cig_id: CigId,
1922            cis_configs: &'a [CisConnConfig],
1923        }
1924    }
1925}
1926
1927cmd! {
1928    /// LE Remove CIG command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-0d4fd619-7ae9-67ef-8f00-70264a5b3a0c)
1929    LeRemoveCig(LE, 0x0065) {
1930        Params = CigId;
1931        LeRemoveCigReturn {
1932            cig_id: CigId,
1933        }
1934    }
1935}
1936
1937cmd! {
1938    /// LE Accept CIS Request command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-999840ef-fb58-166d-2822-14b10a259d20)
1939    LeAcceptCisRequest(LE, 0x0066) {
1940        Params = ConnHandle;
1941    }
1942}
1943
1944cmd! {
1945    /// LE Reject CIS Request command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-bb5d147e-a5d2-9fd0-b7a2-a2e9827a965a)
1946    LeRejectCisRequest(LE, 0x0067) {
1947        LeRejectCisRequestParams {
1948            reason: u8,
1949        }
1950        Return = ConnHandle;
1951        Handle = handle: ConnHandle;
1952    }
1953}
1954
1955cmd! {
1956    /// LE Create BIG command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-b085cd32-0c2b-9b20-acfa-c825ee69820f)
1957    LeCreateBig(LE, 0x0068) {
1958        LeCreateBigParams {
1959            big_handle: BigHandle,
1960            adv_handle: AdvHandle,
1961            num_bis: u8,
1962            sdu_interval: ExtDuration<1>,
1963            max_sdu: u16,
1964            max_transport_latency: u16,
1965            rtn: u8,
1966            phy: PhyMask,
1967            packing: Packing,
1968            framing: Framing,
1969            encryption: EncryptionMode,
1970            broadcast_code: BroadcastCode,
1971        }
1972    }
1973}
1974
1975cmd! {
1976    /// LE Create BIG Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-a15005d1-019f-e827-284b-e8ee558d9a69)
1977    LeCreateBigTest(LE, 0x0069) {
1978        LeCreateBigTestParams {
1979            big_handle: BigHandle,
1980            adv_handle: AdvHandle,
1981            num_bis: u8,
1982            sdu_interval: ExtDuration<1>,
1983            iso_interval: u16,
1984            nse: u8,
1985            max_sdu: u16,
1986            max_pdu: u16,
1987            phy: PhyMask,
1988            packing: Packing,
1989            framing: Framing,
1990            bn: u8,
1991            irc: u8,
1992            pto: u8,
1993            encryption: EncryptionMode,
1994            broadcast_code: BroadcastCode,
1995        }
1996    }
1997}
1998
1999cmd! {
2000    /// LE Terminate BIG command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-aa21e86e-aeb9-35a3-dbf4-15d48fc30491)
2001    LeTerminateBig(LE, 0x006a) {
2002        LeTerminateBigParams {
2003            big_handle: BigHandle,
2004            reason: u8,
2005        }
2006    }
2007}
2008
2009cmd! {
2010    /// LE BIG Create Sync command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-19c7d386-e227-0e12-cd0b-eb567f3c7d18)
2011    LeBigCreateSync(LE, 0x006b) {
2012        LeBigCreateSyncParams<'a> {
2013            big_sync_handle: BigHandle,
2014            sync_handle: SyncHandle,
2015            encryption: EncryptionMode,
2016            broadcast_code: BroadcastCode,
2017            mase: u8,
2018            big_sync_timeout: u16,
2019            bis: &'a [u8],
2020        }
2021    }
2022}
2023
2024cmd! {
2025    /// LE BIG Terminate Sync command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-94cd26e9-d16d-2b51-a84e-90fca3d503a9)
2026    LeBigTerminateSync(LE, 0x006c) {
2027        Params = BigHandle;
2028        Return = BigHandle;
2029        Handle = BigHandle;
2030    }
2031}
2032
2033cmd! {
2034    BASE
2035    /// LE Setup ISO Data Path command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d93e717d-07ab-4342-fe66-c09383326a37)
2036    LeSetupIsoDataPath(LE, 0x006e) {
2037        Params<'a> = LeSetupIsoDataPathParams<'a>;
2038        Return = ConnHandle;
2039        Handle = ConnHandle;
2040    }
2041}
2042
2043impl<'a> LeSetupIsoDataPath<'a> {
2044    /// Create a new instance.
2045    pub fn new(
2046        handle: ConnHandle,
2047        data_path_direction: DataPathDirection,
2048        data_path_id: DataPathId,
2049        codec_id: CodecId,
2050        controller_delay: ExtDuration<1>,
2051        codec_configuration: &'a [u8],
2052    ) -> Self {
2053        Self(LeSetupIsoDataPathParams {
2054            handle,
2055            data_path_direction,
2056            data_path_id,
2057            codec_id,
2058            controller_delay,
2059            codec_configuration,
2060        })
2061    }
2062
2063    fn handle(&self) -> ConnHandle {
2064        self.0.handle
2065    }
2066}
2067
2068/// Parameters for LE Setup ISO Data Path command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html)
2069#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2070#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2071pub struct LeSetupIsoDataPathParams<'a> {
2072    /// Connection handle.
2073    pub handle: ConnHandle,
2074    /// Data path direction.
2075    pub data_path_direction: DataPathDirection,
2076    /// Data path ID.
2077    pub data_path_id: DataPathId,
2078    /// Codec ID.
2079    pub codec_id: CodecId,
2080    /// Controller delay.
2081    pub controller_delay: ExtDuration<1>,
2082    /// Codec configuration.
2083    pub codec_configuration: &'a [u8],
2084}
2085
2086impl WriteHci for LeSetupIsoDataPathParams<'_> {
2087    #[inline(always)]
2088    fn size(&self) -> usize {
2089        2 + 1 + 1 + 5 + 3 + 1 + self.codec_configuration.len()
2090    }
2091
2092    #[inline(always)]
2093    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2094        self.handle.write_hci(&mut writer)?;
2095        self.data_path_direction.write_hci(&mut writer)?;
2096        self.data_path_id.write_hci(&mut writer)?;
2097        self.codec_id.write_hci(&mut writer)?;
2098        self.controller_delay.write_hci(&mut writer)?;
2099        (self.codec_configuration.len() as u8).write_hci(&mut writer)?;
2100        writer.write_all(self.codec_configuration)
2101    }
2102
2103    #[inline(always)]
2104    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2105        self.handle.write_hci_async(&mut writer).await?;
2106        self.data_path_direction.write_hci_async(&mut writer).await?;
2107        self.data_path_id.write_hci_async(&mut writer).await?;
2108        self.codec_id.write_hci_async(&mut writer).await?;
2109        self.controller_delay.write_hci_async(&mut writer).await?;
2110        (self.codec_configuration.len() as u8)
2111            .write_hci_async(&mut writer)
2112            .await?;
2113        writer.write_all(self.codec_configuration).await
2114    }
2115}
2116
2117cmd! {
2118    /// LE Remove ISO Data Path command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-13ba6ab3-ba00-3bde-f665-cbe23031e3dd)
2119    LeRemoveIsoDataPath(LE, 0x006f) {
2120        LeRemoveIsoDataPathParams {
2121            data_path_direction: DataPathDirection,
2122        }
2123        Return = ConnHandle;
2124        Handle = handle: ConnHandle;
2125    }
2126}
2127
2128cmd! {
2129    /// LE ISO Transmit Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-7a343577-d006-456f-0351-9ff745b156ff)
2130    LeIsoTransmitTest(LE, 0x0070) {
2131        LeIsoTransmitTestParams {
2132            payload_type: PayloadType,
2133        }
2134        Return = ConnHandle;
2135        Handle = handle: ConnHandle;
2136    }
2137}
2138
2139cmd! {
2140    /// LE ISO Receive Test command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-ec377f99-b758-f458-701b-a2e7c02468b0)
2141    LeIsoReceiveTest(LE, 0x0071) {
2142        LeIsoReceiveTestParams {
2143            payload_type: PayloadType,
2144        }
2145        Return = ConnHandle;
2146        Handle = handle: ConnHandle;
2147    }
2148}
2149
2150cmd! {
2151    /// LE ISO Read Test Counters command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-11231b0e-6027-2024-f2dc-8338dfc3bf5b)
2152    LeIsoReadTestCounters(LE, 0x0072) {
2153        Params = ConnHandle;
2154        LeIsoReadTestCountersReturn {
2155            received_sdu_count: u32,
2156            missed_sdu_count: u32,
2157            failed_sdu_count: u32,
2158        }
2159        Handle = handle: ConnHandle;
2160    }
2161}
2162
2163cmd! {
2164    /// LE ISO Test End command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-a406d2c9-513e-03d9-854b-5bc0974373dc)
2165    LeIsoTestEnd(LE, 0x0073) {
2166        Params = ConnHandle;
2167        LeIsoTestEndReturn {
2168            received_sdu_count: u32,
2169            missed_sdu_count: u32,
2170            failed_sdu_count: u32,
2171        }
2172        Handle = handle: ConnHandle;
2173    }
2174}
2175
2176cmd! {
2177    /// LE Read ISO Link Quality command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4f70cb64-62e9-0b89-90ba-7f3c033f1f72)
2178    LeReadIsoLinkQuality(LE, 0x0075) {
2179        Params = ConnHandle;
2180        LeReadIsoLinkQualityReturn {
2181            tx_unacked_packets: u32,
2182            tx_flushed_packets: u32,
2183            tx_last_sdu_subevent_packets: u32,
2184            retx_packets: u32,
2185            crc_error_packets: u32,
2186            rx_unreceived_packets: u32,
2187            duplicate_packets: u32,
2188        }
2189        Handle = handle: ConnHandle;
2190    }
2191}
2192
2193// ============================================================================
2194// Missing test-mode commands
2195// ============================================================================
2196
2197cmd! {
2198    BASE
2199    /// LE Transmitter Test V3 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-15c2cfce-06a0-5da7-5cbb-45c1896cca8d)
2200    LeTransmitterTestV3(LE, 0x0050) {
2201        Params<'a> = LeTransmitterTestV3Params<'a>;
2202        Return = ();
2203    }
2204}
2205
2206impl<'a> LeTransmitterTestV3<'a> {
2207    /// Create a new instance.
2208    pub fn new(
2209        tx_channel: u8,
2210        test_data_length: u8,
2211        packet_payload: u8,
2212        phy: PhyKind,
2213        cte_length: u8,
2214        cte_type: CteKind,
2215        switching_pattern: &'a [u8],
2216    ) -> Self {
2217        Self(LeTransmitterTestV3Params {
2218            tx_channel,
2219            test_data_length,
2220            packet_payload,
2221            phy,
2222            cte_length,
2223            cte_type,
2224            switching_pattern,
2225        })
2226    }
2227}
2228
2229/// Parameters for LE Transmitter Test V3 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html)
2230#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2231#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2232pub struct LeTransmitterTestV3Params<'a> {
2233    /// TX channel.
2234    pub tx_channel: u8,
2235    /// Test data length.
2236    pub test_data_length: u8,
2237    /// Packet payload.
2238    pub packet_payload: u8,
2239    /// PHY.
2240    pub phy: PhyKind,
2241    /// CTE length.
2242    pub cte_length: u8,
2243    /// CTE type.
2244    pub cte_type: CteKind,
2245    /// Antenna switching pattern.
2246    pub switching_pattern: &'a [u8],
2247}
2248
2249impl WriteHci for LeTransmitterTestV3Params<'_> {
2250    #[inline(always)]
2251    fn size(&self) -> usize {
2252        1 + 1 + 1 + 1 + 1 + 1 + 1 + self.switching_pattern.len()
2253    }
2254
2255    #[inline(always)]
2256    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2257        self.tx_channel.write_hci(&mut writer)?;
2258        self.test_data_length.write_hci(&mut writer)?;
2259        self.packet_payload.write_hci(&mut writer)?;
2260        self.phy.write_hci(&mut writer)?;
2261        self.cte_length.write_hci(&mut writer)?;
2262        self.cte_type.write_hci(&mut writer)?;
2263        (self.switching_pattern.len() as u8).write_hci(&mut writer)?;
2264        writer.write_all(self.switching_pattern)
2265    }
2266
2267    #[inline(always)]
2268    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2269        self.tx_channel.write_hci_async(&mut writer).await?;
2270        self.test_data_length.write_hci_async(&mut writer).await?;
2271        self.packet_payload.write_hci_async(&mut writer).await?;
2272        self.phy.write_hci_async(&mut writer).await?;
2273        self.cte_length.write_hci_async(&mut writer).await?;
2274        self.cte_type.write_hci_async(&mut writer).await?;
2275        (self.switching_pattern.len() as u8)
2276            .write_hci_async(&mut writer)
2277            .await?;
2278        writer.write_all(self.switching_pattern).await
2279    }
2280}
2281
2282cmd! {
2283    BASE
2284    /// LE Receiver Test V3 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-d5d30b61-e8be-8fa5-a04b-7d505a74ea9d)
2285    LeReceiverTestV3(LE, 0x004f) {
2286        Params<'a> = LeReceiverTestV3Params<'a>;
2287        Return = ();
2288    }
2289}
2290
2291impl<'a> LeReceiverTestV3<'a> {
2292    /// Create a new instance.
2293    pub fn new(
2294        rx_channel: u8,
2295        phy: PhyKind,
2296        modulation_index: u8,
2297        expected_cte_length: u8,
2298        expected_cte_type: CteKind,
2299        slot_durations: u8,
2300        switching_pattern: &'a [u8],
2301    ) -> Self {
2302        Self(LeReceiverTestV3Params {
2303            rx_channel,
2304            phy,
2305            modulation_index,
2306            expected_cte_length,
2307            expected_cte_type,
2308            slot_durations,
2309            switching_pattern,
2310        })
2311    }
2312}
2313
2314/// Parameters for LE Receiver Test V3 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html)
2315#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2316#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2317pub struct LeReceiverTestV3Params<'a> {
2318    /// RX channel.
2319    pub rx_channel: u8,
2320    /// PHY. [`PhyKind::LeCodedS2`] is not valid for the receiver
2321    pub phy: PhyKind,
2322    /// Modulation index.
2323    pub modulation_index: u8,
2324    /// Expected CTE length.
2325    pub expected_cte_length: u8,
2326    /// Expected CTE type.
2327    pub expected_cte_type: CteKind,
2328    /// Slot durations.
2329    pub slot_durations: u8,
2330    /// Antenna switching pattern.
2331    pub switching_pattern: &'a [u8],
2332}
2333
2334impl WriteHci for LeReceiverTestV3Params<'_> {
2335    #[inline(always)]
2336    fn size(&self) -> usize {
2337        1 + 1 + 1 + 1 + 1 + 1 + 1 + self.switching_pattern.len()
2338    }
2339
2340    #[inline(always)]
2341    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2342        self.rx_channel.write_hci(&mut writer)?;
2343        self.phy.write_hci(&mut writer)?;
2344        self.modulation_index.write_hci(&mut writer)?;
2345        self.expected_cte_length.write_hci(&mut writer)?;
2346        self.expected_cte_type.write_hci(&mut writer)?;
2347        self.slot_durations.write_hci(&mut writer)?;
2348        (self.switching_pattern.len() as u8).write_hci(&mut writer)?;
2349        writer.write_all(self.switching_pattern)
2350    }
2351
2352    #[inline(always)]
2353    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
2354        self.rx_channel.write_hci_async(&mut writer).await?;
2355        self.phy.write_hci_async(&mut writer).await?;
2356        self.modulation_index.write_hci_async(&mut writer).await?;
2357        self.expected_cte_length.write_hci_async(&mut writer).await?;
2358        self.expected_cte_type.write_hci_async(&mut writer).await?;
2359        self.slot_durations.write_hci_async(&mut writer).await?;
2360        (self.switching_pattern.len() as u8)
2361            .write_hci_async(&mut writer)
2362            .await?;
2363        writer.write_all(self.switching_pattern).await
2364    }
2365}