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, AllPhys,
5    BdAddr, ChannelMap, ConnHandle, ConnIntervalGroup, CteKind, CteMask, Duration, DurationU8, ExtDuration,
6    FilterDuplicates, InitiatingPhy, LeDataRelatedAddrChangeReasons, LeEventMask, LeFeatureMask,
7    LePeriodicAdvCreateSyncOptions, LePeriodicAdvReceiveEnable, LePeriodicAdvSubeventData,
8    LePeriodicAdvSyncTransferMode, LeScanKind, Operation, PeriodicAdvProps, PhyKind, PhyMask, PhyOptions, PhyParams,
9    PrivacyMode, RemoteConnectionParamsRejectReason, ScanningFilterPolicy, ScanningPhy, SpacingTypes,
10    SwitchingSamplingRates, SyncHandle,
11};
12use crate::{cmd, WriteHci};
13
14cmd! {
15    /// 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)
16    LeSetEventMask(LE, 0x0001) {
17        Params = LeEventMask;
18        Return = ();
19    }
20}
21
22cmd! {
23    /// 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)
24    LeReadBufferSize(LE, 0x0002) {
25        Params = ();
26        LeReadBufferSizeReturn {
27            le_acl_data_packet_length: u16,
28            total_num_le_acl_data_packets: u8,
29        }
30    }
31}
32
33cmd! {
34    /// 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)
35    LeReadLocalSupportedFeatures(LE, 0x0003) {
36        Params = ();
37        Return = LeFeatureMask;
38    }
39}
40
41cmd! {
42    /// 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)
43    LeSetRandomAddr(LE, 0x0005) {
44        Params = BdAddr;
45        Return = ();
46    }
47}
48
49cmd! {
50    /// 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)
51    LeSetAdvParams(LE, 0x0006) {
52        LeSetAdvParamsParams {
53            adv_interval_min: Duration<625>,
54            adv_interval_max: Duration<625>,
55            adv_kind: AdvKind,
56            own_addr_kind: AddrKind,
57            peer_addr_kind: AddrKind,
58            peer_addr: BdAddr,
59            adv_channel_map: AdvChannelMap,
60            adv_filter_policy: AdvFilterPolicy,
61        }
62        Return = ();
63    }
64}
65
66cmd! {
67    /// 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)
68    LeReadAdvPhysicalChannelTxPower(LE, 0x0007) {
69        Params = ();
70        Return = i8;
71    }
72}
73
74cmd! {
75    /// 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)
76    LeSetAdvData(LE, 0x0008) {
77        LeSetAdvDataParams {
78            data_len: u8,
79            data: [u8; 31],
80        }
81        Return = ();
82    }
83}
84
85cmd! {
86    /// 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)
87    LeSetScanResponseData(LE, 0x0009) {
88        LeSetScanResponseDataParams {
89            data_len: u8,
90            data: [u8; 31],
91        }
92        Return = ();
93    }
94}
95
96cmd! {
97    /// 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)
98    LeSetAdvEnable(LE, 0x000a) {
99        Params = bool;
100        Return = ();
101    }
102}
103
104cmd! {
105    /// 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)
106    LeSetScanParams(LE, 0x000b) {
107        LeSetScanParamsParams {
108            le_scan_kind: LeScanKind,
109            le_scan_interval: Duration<10_000>,
110            le_scan_window: Duration<10_000>,
111            own_addr_kind: AddrKind,
112            scanning_filter_policy: ScanningFilterPolicy,
113        }
114        Return = ();
115    }
116}
117
118cmd! {
119    /// 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)
120    LeSetScanEnable(LE, 0x000c) {
121        LeSetScanEnableParams {
122            enable: bool,
123            filter_duplicates: bool,
124        }
125        Return = ();
126    }
127}
128
129cmd! {
130    /// 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)
131    LeCreateConn(LE, 0x000d) {
132        LeCreateConnParams {
133            le_scan_interval: Duration<10_000>,
134            le_scan_window: Duration<10_000>,
135            use_filter_accept_list: bool,
136            peer_addr_kind: AddrKind,
137            peer_addr: BdAddr,
138            own_addr_kind: AddrKind,
139            conn_interval_min: Duration<1_250>,
140            conn_interval_max: Duration<1_250>,
141            max_latency: u16,
142            supervision_timeout: Duration<10_000>,
143            min_ce_length: Duration<625>,
144            max_ce_length: Duration<625>,
145        }
146    }
147}
148
149cmd! {
150    /// 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)
151    LeCreateConnCancel(LE, 0x000e) {
152        Params = ();
153        Return = ();
154    }
155}
156
157cmd! {
158    /// 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)
159    LeReadFilterAcceptListSize(LE, 0x000f) {
160        Params = ();
161        Return = u8;
162    }
163}
164
165cmd! {
166    /// 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)
167    LeClearFilterAcceptList(LE, 0x0010) {
168        Params = ();
169        Return = ();
170    }
171}
172
173cmd! {
174    /// 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)
175    LeAddDeviceToFilterAcceptList(LE, 0x0011) {
176        LeAddDeviceToFilterAcceptListParams {
177            addr_kind: AddrKind,
178            addr: BdAddr,
179        }
180        Return = ();
181    }
182}
183
184cmd! {
185    /// 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)
186    LeRemoveDeviceFromFilterAcceptList(LE, 0x0012) {
187        LeRemoveDeviceFromFilterAcceptListParams {
188            addr_kind: AddrKind,
189            addr: BdAddr,
190        }
191        Return = ();
192    }
193}
194
195cmd! {
196    /// 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)
197    LeConnUpdate(LE, 0x0013) {
198        LeConnUpdateParams {
199            handle: ConnHandle,
200            conn_interval_min: Duration<1_250>,
201            conn_interval_max: Duration<1_250>,
202            max_latency: u16,
203            supervision_timeout: Duration<10_000>,
204            min_ce_length: Duration<625>,
205            max_ce_length: Duration<625>,
206        }
207    }
208}
209
210cmd! {
211    /// 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)
212    LeSetHostChannelClassification(LE, 0x0014) {
213        Params = ChannelMap;
214        Return = ();
215    }
216}
217
218cmd! {
219    /// 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)
220    LeReadChannelMap(LE, 0x0015) {
221        Params = ConnHandle;
222        LeReadChannelMapReturn {
223            channel_map: ChannelMap,
224        }
225        Handle = handle: ConnHandle;
226    }
227}
228
229cmd! {
230    /// 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)
231    LeReadRemoteFeatures(LE, 0x0016) {
232        Params = ConnHandle;
233    }
234}
235
236cmd! {
237    /// 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)
238    LeEncrypt(LE, 0x0017) {
239        LeEncryptParams {
240            key: [u8; 16],
241            plaintext: [u8; 16],
242        }
243        Return = [u8; 16];
244    }
245}
246
247cmd! {
248    /// 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)
249    LeRand(LE, 0x0018) {
250        Params = ();
251        Return = [u8; 8];
252    }
253}
254
255cmd! {
256    /// 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)
257    LeEnableEncryption(LE, 0x0019) {
258        LeEnableEncryptionParams {
259            handle: ConnHandle,
260            random: [u8; 8],
261            encrypted_diversifier: u16,
262            long_term_key: [u8; 16],
263        }
264    }
265}
266
267cmd! {
268    /// 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)
269    LeRemoteConnectionParameterRequestReply(LE, 0x0020) {
270        LeRemoteConnectionParameterRequestReplyParams {
271            handle: ConnHandle,
272            interval_min: Duration<1_250>,
273            interval_max: Duration<1_250>,
274            max_latency: u16,
275            supervision_timeout: Duration<10_000>,
276            min_ce_length: Duration<625>,
277            max_ce_length: Duration<625>,
278        }
279    }
280}
281
282cmd! {
283    /// 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)
284    LeRemoteConnectionParameterRequestNegativeReply(LE, 0x0021) {
285        LeRemoteConnectionParameterRequestNegativeReplyParams {
286            handle: ConnHandle,
287            reason: RemoteConnectionParamsRejectReason,
288        }
289    }
290}
291
292cmd! {
293    /// 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)
294    LeLongTermKeyRequestReply(LE, 0x001a) {
295        LeLongTermKeyRequestReplyParams {
296            long_term_key: [u8; 16],
297        }
298        Return = ConnHandle;
299        Handle = handle: ConnHandle;
300    }
301}
302
303cmd! {
304    /// 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)
305    LeLongTermKeyRequestNegativeReply(LE, 0x001b) {
306        Params = ConnHandle;
307        Return = ConnHandle;
308        Handle = ConnHandle;
309    }
310}
311
312cmd! {
313    /// 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)
314    LeReadSupportedStates(LE, 0x001c) {
315        Params = ();
316        Return = [u8; 8];
317    }
318}
319
320cmd! {
321    /// 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)
322    LeTestEnd(LE, 0x001f) {
323        Params = ();
324        Return = u16;
325    }
326}
327
328cmd! {
329    /// 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)
330    LeSetDataLength(LE, 0x0022) {
331        LeSetDataLengthParams {
332            tx_octets: u16,
333            tx_time: u16,
334        }
335        Return = ConnHandle;
336        Handle = handle: ConnHandle;
337    }
338}
339
340cmd! {
341    /// 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)
342    LeReadSuggestedDefaultDataLength(LE, 0x0023) {
343        Params = ();
344        LeReadSuggestedDefaultDataLengthReturn {
345            suggested_max_tx_octets: u16,
346            suggested_max_tx_time: u16,
347        }
348    }
349}
350
351cmd! {
352    /// 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)
353    LeWriteSuggestedDefaultDataLength(LE, 0x0024) {
354        LeWriteSuggestedDefaultDataLengthParams {
355            suggested_max_tx_octets: u16,
356            suggested_max_tx_time: u16,
357        }
358        Return = ();
359    }
360}
361
362cmd! {
363    /// 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)
364    LeAddDeviceToResolvingList(LE, 0x0027) {
365        LeAddDeviceToResolvingListParams {
366            peer_id_addr_kind: AddrKind,
367            peer_id_addr: BdAddr,
368            peer_irk: [u8; 16],
369            local_irk: [u8; 16],
370        }
371        Return = ();
372    }
373}
374
375cmd! {
376    /// 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)
377    LeRemoveDeviceFromResolvingList(LE, 0x0028) {
378        LeRemoveDeviceFromResolvingListParams {
379            peer_id_addr_kind: AddrKind,
380            peer_id_addr: BdAddr,
381        }
382        Return = ();
383    }
384}
385
386cmd! {
387    /// 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)
388    LeClearResolvingList(LE, 0x0029) {
389        Params = ();
390        Return = ();
391    }
392}
393
394cmd! {
395    /// 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)
396    LeReadResolvingListSize(LE, 0x002a) {
397        Params = ();
398        Return = u8;
399    }
400}
401
402cmd! {
403    /// 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)
404    LeSetAddrResolutionEnable(LE, 0x002d) {
405        Params = bool;
406        Return = ();
407    }
408}
409
410cmd! {
411    /// 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)
412    LeSetResolvablePrivateAddrTimeout(LE, 0x002e) {
413        Params = Duration<1_000_000>;
414        Return = ();
415    }
416}
417
418cmd! {
419    /// 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)
420    LeReadMaxDataLength(LE, 0x002f) {
421        Params = ();
422        LeReadMaxDataLengthReturn {
423            supported_max_tx_octets: u16,
424            supported_max_tx_time: u16,
425            supported_max_rx_octets: u16,
426            supported_max_rx_time: u16,
427        }
428    }
429}
430
431cmd! {
432    /// 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)
433    LeReadPhy(LE, 0x0030) {
434        Params = ConnHandle;
435        LeReadPhyReturn {
436            tx_phy: PhyKind,
437            rx_phy: PhyKind,
438        }
439        Handle = handle: ConnHandle;
440    }
441}
442
443cmd! {
444    /// 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)
445    LeSetDefaultPhy(LE, 0x0031) {
446        LeSetDefaultPhyParams {
447            all_phys: AllPhys,
448            tx_phys: PhyMask,
449            rx_phys: PhyMask,
450        }
451        Return = ();
452    }
453}
454
455cmd! {
456    /// 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)
457    LeSetPhy(LE, 0x0032) {
458        LeSetPhyParams {
459            handle: ConnHandle,
460            all_phys: AllPhys,
461            tx_phys: PhyMask,
462            rx_phys: PhyMask,
463            phy_options: PhyOptions,
464        }
465    }
466}
467
468cmd! {
469    /// 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)
470    LeSetAdvSetRandomAddr(LE, 0x0035) {
471        LeSetAdvSetRandomAddrParams {
472            adv_handle: AdvHandle,
473            random_addr: BdAddr,
474        }
475        Return = ();
476    }
477}
478
479cmd! {
480    /// 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)
481    LeSetExtAdvParams(LE, 0x0036) {
482        LeSetExtAdvParamsParams {
483                adv_handle: AdvHandle,
484                adv_event_props: AdvEventProps,
485                primary_adv_interval_min: ExtDuration<625>,
486                primary_adv_interval_max: ExtDuration<625>,
487                primary_adv_channel_map: AdvChannelMap,
488                own_addr_kind: AddrKind,
489                peer_addr_kind: AddrKind,
490                peer_addr: BdAddr,
491                adv_filter_policy: AdvFilterPolicy,
492                adv_tx_power: i8,
493                primary_adv_phy: PhyKind,
494                secondary_adv_max_skip: u8,
495                secondary_adv_phy: PhyKind,
496                adv_sid: u8,
497                scan_request_notification_enable: bool,
498        }
499        Return = i8;
500    }
501}
502
503cmd! {
504    /// 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)
505    LeSetExtAdvParamsV2(LE, 0x007F) {
506        LeSetExtAdvParamsV2Params {
507                adv_handle: AdvHandle,
508                adv_event_props: AdvEventProps,
509                primary_adv_interval_min: ExtDuration<625>,
510                primary_adv_interval_max: ExtDuration<625>,
511                primary_adv_channel_map: AdvChannelMap,
512                own_addr_kind: AddrKind,
513                peer_addr_kind: AddrKind,
514                peer_addr: BdAddr,
515                adv_filter_policy: AdvFilterPolicy,
516                adv_tx_power: i8,
517                primary_adv_phy: PhyKind,
518                secondary_adv_max_skip: u8,
519                secondary_adv_phy: PhyKind,
520                adv_sid: u8,
521                scan_request_notification_enable: bool,
522                primary_adv_phy_options: AdvPhyOptions,
523                secondary_adv_phy_options: AdvPhyOptions,
524        }
525        Return = i8;
526    }
527}
528
529cmd! {
530    /// 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)
531    LeSetExtAdvData(LE, 0x0037) {
532        LeSetExtAdvDataParams<'d> {
533            adv_handle: AdvHandle,
534            operation: Operation,
535            fragment_preference: bool,
536            adv_data: &'d [u8],
537        }
538        Return = ();
539    }
540}
541
542cmd! {
543    /// 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)
544    LeSetExtScanResponseData(LE, 0x0038) {
545        LeSetExtScanResponseDataParams<'d> {
546            adv_handle: AdvHandle,
547            operation: Operation,
548            fragment_preference: bool,
549            scan_response_data: &'d [u8],
550        }
551        Return = ();
552    }
553}
554
555cmd! {
556    /// 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)
557    LeSetExtAdvEnable(LE, 0x0039) {
558        LeSetExtAdvEnableParams<'a> {
559            enable: bool,
560            sets: &'a [AdvSet],
561        }
562        Return = ();
563    }
564}
565
566cmd! {
567    /// 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)
568    LeReadMaxAdvDataLength(LE, 0x003a) {
569        Params = ();
570        Return = u16;
571    }
572}
573
574cmd! {
575    /// 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)
576    LeReadNumberOfSupportedAdvSets(LE, 0x003b) {
577        Params = ();
578        Return = u8;
579    }
580}
581
582cmd! {
583    /// 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)
584    LeRemoveAdvSet(LE, 0x003c) {
585        Params = AdvHandle;
586        Return = ();
587    }
588}
589
590cmd! {
591    /// 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)
592    LeClearAdvSets(LE, 0x003d) {
593        Params = ();
594        Return = ();
595    }
596}
597
598cmd! {
599    /// 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)
600    LeSetPeriodicAdvParams(LE, 0x003e) {
601        LeSetPeriodicAdvParamsParams {
602            adv_handle: AdvHandle,
603            periodic_adv_interval_min: Duration<1_250>,
604            periodic_adv_interval_max: Duration<1_250>,
605            periodic_adv_props: PeriodicAdvProps,
606        }
607        Return = ();
608    }
609}
610
611cmd! {
612    /// 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)
613    LeSetPeriodicAdvParamsV2(LE, 0x0086) {
614        LeSetPeriodicAdvParamsV2Params {
615            periodic_adv_interval_min: Duration<1_250>,
616            periodic_adv_interval_max: Duration<1_250>,
617            periodic_adv_props: PeriodicAdvProps,
618            num_subevents: u8,
619            subevent_interval: u8, // * 1.25ms
620            response_slot_delay: u8, // * 1.25ms
621            response_slot_spacing: u8, // * 0.125ms
622            num_response_slots: u8,
623        }
624        Return = AdvHandle;
625        Handle = adv_handle: AdvHandle;
626    }
627}
628
629cmd! {
630    /// 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)
631    LeSetPeriodicAdvData(LE, 0x003f) {
632        LeSetPeriodicAdvDataParams<'a> {
633            adv_handle: AdvHandle,
634            operation: Operation,
635            adv_data: &'a [u8],
636        }
637        Return = ();
638    }
639}
640
641cmd! {
642    /// 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)
643    LeSetPeriodicAdvEnable(LE, 0x0040) {
644        LeSetPeriodicAdvEnableParams {
645            enable: bool,
646            adv_handle: AdvHandle,
647        }
648        Return = ();
649    }
650}
651
652crate::cmd! {
653    BASE
654    /// 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)
655    LeSetExtScanParams(LE, 0x0041) {
656        Params = LeSetExtScanParamsParams;
657        Return = ();
658      }
659}
660
661impl LeSetExtScanParams {
662    /// Create a new instance of scan parameters.
663    pub fn new(
664        own_addr_kind: AddrKind,
665        scanning_filter_policy: ScanningFilterPolicy,
666        scanning_phys: PhyParams<ScanningPhy>,
667    ) -> Self {
668        Self(LeSetExtScanParamsParams {
669            own_addr_kind,
670            scanning_filter_policy,
671            scanning_phys,
672        })
673    }
674}
675
676/// 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)
677#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
678#[cfg_attr(feature = "defmt", derive(defmt::Format))]
679pub struct LeSetExtScanParamsParams {
680    /// Kind of address for self.
681    pub own_addr_kind: AddrKind,
682    /// Scanning filter policy.
683    pub scanning_filter_policy: ScanningFilterPolicy,
684    /// Phys used when scanning.
685    pub scanning_phys: PhyParams<ScanningPhy>,
686}
687
688impl WriteHci for LeSetExtScanParamsParams {
689    #[inline(always)]
690    fn size(&self) -> usize {
691        self.own_addr_kind.size() + self.scanning_filter_policy.size() + self.scanning_phys.size()
692    }
693
694    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
695        self.own_addr_kind.write_hci(&mut writer)?;
696        self.scanning_filter_policy.write_hci(&mut writer)?;
697        self.scanning_phys.write_hci(writer)
698    }
699
700    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
701        self.own_addr_kind.write_hci_async(&mut writer).await?;
702        self.scanning_filter_policy.write_hci_async(&mut writer).await?;
703        self.scanning_phys.write_hci_async(writer).await
704    }
705}
706
707cmd! {
708    /// 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)
709    LeSetExtScanEnable(LE, 0x0042) {
710        LeSetExtScanEnableParams {
711            enable: bool,
712            filter_duplicates: FilterDuplicates,
713            duration: Duration<10_000>,
714            period: Duration<1_280_000>,
715        }
716        Return = ();
717    }
718}
719
720crate::cmd! {
721    BASE
722    /// 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)
723    LeExtCreateConn(LE, 0x0043) {
724        Params = LeExtCreateConnParams;
725    }
726}
727
728impl LeExtCreateConn {
729    /// Create a new instance of this command.
730    pub fn new(
731        initiator_filter_policy: bool,
732        own_addr_kind: AddrKind,
733        peer_addr_kind: AddrKind,
734        peer_addr: BdAddr,
735        initiating_phys: PhyParams<InitiatingPhy>,
736    ) -> Self {
737        Self(LeExtCreateConnParams {
738            initiator_filter_policy,
739            own_addr_kind,
740            peer_addr_kind,
741            peer_addr,
742            initiating_phys,
743        })
744    }
745}
746
747/// 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)
748#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
749#[cfg_attr(feature = "defmt", derive(defmt::Format))]
750pub struct LeExtCreateConnParams {
751    /// Should use the initiator filter policy or not.
752    pub initiator_filter_policy: bool,
753    /// What kind of address for self.
754    pub own_addr_kind: AddrKind,
755    /// What kind of address for peer.
756    pub peer_addr_kind: AddrKind,
757    /// The peer address to connect to.
758    pub peer_addr: BdAddr,
759    /// Which phys used for connecting.
760    pub initiating_phys: PhyParams<InitiatingPhy>,
761}
762
763impl WriteHci for LeExtCreateConnParams {
764    #[inline(always)]
765    fn size(&self) -> usize {
766        self.initiator_filter_policy.size()
767            + self.own_addr_kind.size()
768            + self.peer_addr_kind.size()
769            + self.peer_addr.size()
770            + self.initiating_phys.size()
771    }
772
773    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
774        self.initiator_filter_policy.write_hci(&mut writer)?;
775        self.own_addr_kind.write_hci(&mut writer)?;
776        self.peer_addr_kind.write_hci(&mut writer)?;
777        self.peer_addr.write_hci(&mut writer)?;
778        self.initiating_phys.write_hci(writer)
779    }
780
781    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
782        self.initiator_filter_policy.write_hci_async(&mut writer).await?;
783        self.own_addr_kind.write_hci_async(&mut writer).await?;
784        self.peer_addr_kind.write_hci_async(&mut writer).await?;
785        self.peer_addr.write_hci_async(&mut writer).await?;
786        self.initiating_phys.write_hci_async(writer).await
787    }
788}
789
790cmd! {
791    BASE
792    /// 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)
793    LeExtCreateConnV2(LE, 0x0085) {
794        Params = LeExtCreateConnV2Params;
795    }
796}
797
798impl LeExtCreateConnV2 {
799    /// Create a new instance.
800    pub fn new(
801        adv_handle: AdvHandle,
802        subevent: u8,
803        initiator_filter_policy: bool,
804        own_addr_kind: AddrKind,
805        peer_addr_kind: AddrKind,
806        peer_addr: BdAddr,
807        initiating_phys: PhyParams<InitiatingPhy>,
808    ) -> Self {
809        Self(LeExtCreateConnV2Params {
810            adv_handle,
811            subevent,
812            initiator_filter_policy,
813            own_addr_kind,
814            peer_addr_kind,
815            peer_addr,
816            initiating_phys,
817        })
818    }
819}
820
821/// 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)
822#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
823#[cfg_attr(feature = "defmt", derive(defmt::Format))]
824pub struct LeExtCreateConnV2Params {
825    /// The advertising handle to use.
826    pub adv_handle: AdvHandle,
827    /// Use connection sub-events.
828    pub subevent: u8,
829    /// Should use the initiator filter policy or not.
830    pub initiator_filter_policy: bool,
831    /// What kind of address for self.
832    pub own_addr_kind: AddrKind,
833    /// What kind of address for peer.
834    pub peer_addr_kind: AddrKind,
835    /// The peer address to connect to.
836    pub peer_addr: BdAddr,
837    /// Which phys used for connecting.
838    pub initiating_phys: PhyParams<InitiatingPhy>,
839}
840
841impl WriteHci for LeExtCreateConnV2Params {
842    #[inline(always)]
843    fn size(&self) -> usize {
844        self.adv_handle.size()
845            + self.subevent.size()
846            + self.initiator_filter_policy.size()
847            + self.own_addr_kind.size()
848            + self.peer_addr_kind.size()
849            + self.peer_addr.size()
850            + self.initiating_phys.size()
851    }
852
853    fn write_hci<W: embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
854        self.adv_handle.write_hci(&mut writer)?;
855        self.subevent.write_hci(&mut writer)?;
856        self.initiator_filter_policy.write_hci(&mut writer)?;
857        self.own_addr_kind.write_hci(&mut writer)?;
858        self.peer_addr_kind.write_hci(&mut writer)?;
859        self.peer_addr.write_hci(&mut writer)?;
860        self.initiating_phys.write_hci(writer)
861    }
862
863    async fn write_hci_async<W: embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
864        self.adv_handle.write_hci_async(&mut writer).await?;
865        self.subevent.write_hci_async(&mut writer).await?;
866        self.initiator_filter_policy.write_hci_async(&mut writer).await?;
867        self.own_addr_kind.write_hci_async(&mut writer).await?;
868        self.peer_addr_kind.write_hci_async(&mut writer).await?;
869        self.peer_addr.write_hci_async(&mut writer).await?;
870        self.initiating_phys.write_hci_async(writer).await
871    }
872}
873
874cmd! {
875    /// 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)
876    LePeriodicAdvCreateSync(LE, 0x0044) {
877        LePeriodicAdvCreateSyncParams {
878            options: LePeriodicAdvCreateSyncOptions,
879            adv_sid: u8,
880            adv_addr_kind: AddrKind,
881            adv_addr: BdAddr,
882            skip: u16,
883            sync_timeout: Duration<10_000>,
884            sync_cte_kind: CteMask,
885        }
886    }
887}
888
889cmd! {
890    /// 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)
891    LePeriodicAdvCreateSyncCancel(LE, 0x0045) {
892        Params = ();
893        Return = ();
894    }
895}
896
897cmd! {
898    /// 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)
899    LePeriodicAdvTerminateSync(LE, 0x0046) {
900        Params = SyncHandle;
901        Return = ();
902    }
903}
904
905cmd! {
906    /// 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)
907    LeAddDeviceToPeriodicAdvList(LE, 0x0047) {
908        LeAddDeviceToPeriodicAdvListParams {
909            adv_addr_kind: AddrKind,
910            adv_addr: BdAddr,
911            adv_sid: u8,
912        }
913        Return = ();
914    }
915}
916
917cmd! {
918    /// 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)
919    LeRemoveDeviceFromPeriodicAdvList(LE, 0x0048) {
920        LeRemoveDeviceFromPeriodicAdvListParams {
921            adv_addr_kind: AddrKind,
922            adv_addr: BdAddr,
923            adv_sid: u8,
924        }
925        Return = ();
926    }
927}
928
929cmd! {
930    /// 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)
931    LeClearPeriodicAdvList(LE, 0x0049) {
932        Params = ();
933        Return = ();
934    }
935}
936
937cmd! {
938    /// 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)
939    LeReadPeriodicAdvListSize(LE, 0x004a) {
940        Params = ();
941        Return = u8;
942    }
943}
944
945cmd! {
946    /// 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)
947    LeReadTransmitPower(LE, 0x004b) {
948        Params = ();
949        LeReadTransmitPowerReturn {
950            min_tx_power: i8,
951            max_tx_power: i8,
952        }
953    }
954}
955
956cmd! {
957    /// 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)
958    LeReadRfPathCompensation(LE, 0x004c) {
959        Params = ();
960        LeReadRfPathCompensationReturn {
961            rf_tx_path_compensation_value: i16,
962            rf_rx_path_compenstaion_value: i16,
963        }
964    }
965}
966
967cmd! {
968    /// 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)
969    LeWriteRfPathCompensation(LE, 0x004d) {
970        LeWriteRfPathCompensationParams {
971            rf_tx_path_compensation_value: i16,
972            rf_rx_path_compensation_value: i16,
973        }
974        Return = ();
975    }
976}
977
978cmd! {
979    /// 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)
980    LeSetPrivacyMode(LE, 0x004e) {
981        LeSetPrivacyModeParams {
982            peer_id_addr_kind: AddrKind,
983            peer_id_addr: BdAddr,
984            privacy_mode: PrivacyMode,
985        }
986        Return = ();
987    }
988}
989
990cmd! {
991    /// 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)
992    LeSetConnectionlessCteTransmitParams(LE, 0x0051) {
993        LeSetConnectionlessCteTransmitParamsParams<'a> {
994            adv_handle: AdvHandle,
995            cte_length: u8,
996            cte_kind: CteKind,
997            cte_count: u8,
998            switching_pattern: &'a [u8],
999        }
1000        Return = ();
1001    }
1002}
1003
1004cmd! {
1005    /// 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)
1006    LeSetConnectionlessCteTransmitEnable(LE, 0x0052) {
1007        LeSetConnectionlessCteTransmitEnableParams {
1008            adv_handle: AdvHandle,
1009            cte_enable: bool,
1010        }
1011        Return = ();
1012    }
1013}
1014
1015cmd! {
1016    /// 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)
1017    LeSetConnCteTransmitParams(LE, 0x0055) {
1018        LeSetConnCteTransmitParamsParams<'a> {
1019            cte_kinds: CteMask,
1020            switching_pattern: &'a [u8],
1021        }
1022        Return = ConnHandle;
1023        Handle = handle: ConnHandle;
1024    }
1025}
1026
1027cmd! {
1028    /// 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)
1029    LeConnCteResponseEnable(LE, 0x0057) {
1030        LeConnCteResponseEnableParams {
1031            enable: bool,
1032        }
1033        Return = ConnHandle;
1034        Handle = handle: ConnHandle;
1035    }
1036}
1037
1038cmd! {
1039    /// 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)
1040    LeReadAntennaInformation(LE, 0x0058) {
1041        Params = ();
1042        LeReadAntennaInformationReturn {
1043            supported_switching_sampling_rates: SwitchingSamplingRates,
1044            num_antennae: u8,
1045            max_switching_pattern_len: u8,
1046            max_cte_len: u8,
1047        }
1048    }
1049}
1050
1051cmd! {
1052    /// 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)
1053    LeSetPeriodicAdvReceiveEnable(LE, 0x0059) {
1054        LeSetPeriodicAdvReceiveEnableParams {
1055            sync_handle: SyncHandle,
1056            enable: LePeriodicAdvReceiveEnable,
1057        }
1058        Return = ();
1059    }
1060}
1061
1062cmd! {
1063    /// 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)
1064    LePeriodicAdvSyncTransfer(LE, 0x005a) {
1065        LePeriodicAdvSyncTransferParams {
1066            service_data: u16,
1067            sync_handle: SyncHandle,
1068        }
1069        Return = ConnHandle;
1070        Handle = handle: ConnHandle;
1071    }
1072}
1073
1074cmd! {
1075    /// 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)
1076    LePeriodicAdvSetInfoTransfer(LE, 0x005b) {
1077        LePeriodicAdvSetInfoTransferParams {
1078            service_data: u16,
1079            adv_handle: AdvHandle,
1080        }
1081        Return = ConnHandle;
1082        Handle = handle: ConnHandle;
1083    }
1084}
1085
1086cmd! {
1087    /// 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)
1088    LeSetPeriodicAdvSyncTransferParams(LE, 0x005c) {
1089        LeSetPeriodicAdvSyncTransferParamsParams {
1090            mode: LePeriodicAdvSyncTransferMode,
1091            skip: u16,
1092            sync_timeout: Duration<10_000>,
1093            cte_kind: CteMask,
1094        }
1095        Return = ConnHandle;
1096        Handle = handle: ConnHandle;
1097    }
1098}
1099
1100cmd! {
1101    /// 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)
1102    LeSetDefaultPeriodicAdvSyncTransferParams(LE, 0x005d) {
1103        LeSetDefaultPeriodicAdvSyncTransferParamsParams {
1104            mode: LePeriodicAdvSyncTransferMode,
1105            skip: u16,
1106            sync_timeout: Duration<10_000>,
1107            cte_kind: CteMask,
1108        }
1109        Return = ();
1110    }
1111}
1112
1113cmd! {
1114    /// 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)
1115    LeRequestPeerSca(LE, 0x006d) {
1116        Params = ConnHandle;
1117    }
1118}
1119
1120cmd! {
1121    /// 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)
1122    LeSetHostFeature(LE, 0x0074) {
1123        LeSetHostFeatureParams {
1124            bit_number: u8,
1125            bit_value: u8,
1126        }
1127        Return = ();
1128    }
1129}
1130
1131cmd! {
1132    /// 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)
1133    LeEnhancedReadTransmitPowerLevel(LE, 0x0076) {
1134        LeEnhancedReadTransmitPowerLevelParams {
1135            phy: PhyKind,
1136        }
1137        LeEnhancedReadTransmitPowerLevelReturn {
1138            phy: PhyKind,
1139            current_tx_power_level: i8,
1140            max_tx_power_level: i8,
1141        }
1142        Handle = handle: ConnHandle;
1143    }
1144}
1145
1146cmd! {
1147    /// 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)
1148    LeReadRemoteTransmitPowerLevel(LE, 0x0077) {
1149        LeReadRemoteTransmitPowerLevelParams {
1150            handle: ConnHandle,
1151            phy: PhyKind,
1152        }
1153    }
1154}
1155
1156cmd! {
1157    /// 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)
1158    LeSetPathLossReportingParams(LE, 0x0078) {
1159        LeSetPathLossReportingParamsParams {
1160            high_threshold: i8,
1161            high_hysteresis: i8,
1162            low_threshold: i8,
1163            low_hysteresis: i8,
1164            min_time_spent: u16,
1165        }
1166        Return = ConnHandle;
1167        Handle = handle: ConnHandle;
1168    }
1169}
1170
1171cmd! {
1172    /// 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)
1173    LeSetPathLossReportingEnable(LE, 0x0079) {
1174        LeSetPathLossReportingEnableParams {
1175            enable: bool,
1176        }
1177        Return = ConnHandle;
1178        Handle = handle: ConnHandle;
1179    }
1180}
1181
1182cmd! {
1183    /// 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)
1184    LeSetTransmitPowerReportingEnable(LE, 0x007a) {
1185        LeSetTransmitPowerReportingEnableParams {
1186            local_enable: bool,
1187            remote_enable: bool,
1188        }
1189        Return = ConnHandle;
1190        Handle = handle: ConnHandle;
1191    }
1192}
1193
1194cmd! {
1195    /// 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)
1196    LeSetDataRelatedAddrChanges(LE, 0x007c) {
1197        LeSetDataRelatedAddrChangesParams {
1198            adv_handle: AdvHandle,
1199            change_reasons: LeDataRelatedAddrChangeReasons,
1200        }
1201        Return = ();
1202    }
1203}
1204
1205cmd! {
1206    /// 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)
1207    LeSetDefaultSubrate(LE, 0x007d) {
1208        LeSetDefaultSubrateParams {
1209            subrate_min: u16,
1210            subrate_max: u16,
1211            max_latency: u16,
1212            continuation_number: u16,
1213            supervision_timeout: Duration<10_000>,
1214        }
1215        Return = ();
1216    }
1217}
1218
1219cmd! {
1220    /// 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)
1221    LeSubrateRequest(LE, 0x007e) {
1222        LeSubrateRequestParams {
1223            handle: ConnHandle,
1224            subrate_min: u16,
1225            subrate_max: u16,
1226            max_latency: u16,
1227            continuation_number: u16,
1228            supervision_timeout: Duration<10_000>,
1229        }
1230    }
1231}
1232
1233cmd! {
1234    BASE
1235    /// 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)
1236    LeSetPeriodicAdvSubeventData(LE, 0x0082) {
1237        Params<'a> = LeSetPeriodicAdvSubeventDataParams<'a, 'a>;
1238        Return = AdvHandle;
1239    }
1240}
1241
1242impl<'a> LeSetPeriodicAdvSubeventData<'a> {
1243    /// Create a new instance.
1244    pub fn new(adv_handle: AdvHandle, subevent: &'a [LePeriodicAdvSubeventData<'a>]) -> Self {
1245        Self(LeSetPeriodicAdvSubeventDataParams { adv_handle, subevent })
1246    }
1247}
1248
1249/// 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)
1250#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1251#[cfg_attr(feature = "defmt", derive(defmt::Format))]
1252pub struct LeSetPeriodicAdvSubeventDataParams<'a, 'b> {
1253    /// Which advertising handle to use.
1254    pub adv_handle: AdvHandle,
1255    /// List of sub events used.
1256    pub subevent: &'b [LePeriodicAdvSubeventData<'a>],
1257}
1258
1259impl WriteHci for LeSetPeriodicAdvSubeventDataParams<'_, '_> {
1260    #[inline(always)]
1261    fn size(&self) -> usize {
1262        self.adv_handle.size() + self.subevent.size()
1263    }
1264
1265    #[inline(always)]
1266    fn write_hci<W: ::embedded_io::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1267        self.adv_handle.write_hci(&mut writer)?;
1268        self.subevent.write_hci(&mut writer)?;
1269        Ok(())
1270    }
1271
1272    #[inline(always)]
1273    async fn write_hci_async<W: ::embedded_io_async::Write>(&self, mut writer: W) -> Result<(), W::Error> {
1274        self.adv_handle.write_hci_async(&mut writer).await?;
1275        self.subevent.write_hci_async(&mut writer).await?;
1276        Ok(())
1277    }
1278}
1279
1280cmd! {
1281    /// 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)
1282    LeSetPeriodicAdvResponseData(LE, 0x0083) {
1283        LeSetPeriodicAdvResponseDataParams<'a> {
1284            adv_handle: SyncHandle,
1285            request_event: u16,
1286            request_subevent: u8,
1287            response_subevent: u8,
1288            response_slot: u8,
1289            response_data: &'a [u8],
1290        }
1291        Return = SyncHandle;
1292    }
1293}
1294
1295cmd! {
1296    /// 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)
1297    LeSetPeriodicSyncSubevent(LE, 0x0084) {
1298        LeSetPeriodicSyncSubeventParams<'a> {
1299            adv_handle: SyncHandle,
1300            periodic_adv_props: PeriodicAdvProps,
1301            subevents: &'a [u8],
1302        }
1303        Return = SyncHandle;
1304    }
1305}
1306
1307cmd! {
1308    /// 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)
1309    LeSetHostFeatureV2(LE, 0x0097) {
1310        LeSetHostFeatureV2Params {
1311            bit_number: u16,
1312            bit_value: u8,
1313        }
1314        Return = ();
1315    }
1316}
1317
1318cmd! {
1319    /// 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)
1320    LeFrameSpaceUpdate(LE, 0x009D) {
1321        LeFrameSpaceUpdateParams {
1322            handle: ConnHandle,
1323            frame_space_min: Duration<1>,
1324            frame_space_max: Duration<1>,
1325            phy: PhyMask,
1326            spacing_types: SpacingTypes,
1327        }
1328        Return = ();
1329    }
1330}
1331
1332cmd! {
1333    /// 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)
1334    LeConnectionRateRequest(LE, 0x00A1) {
1335        LeConnectionRateRequestParams {
1336            handle: ConnHandle,
1337            conn_interval_min: Duration<125>,
1338            conn_interval_max: Duration<125>,
1339            subrate_min: u16,
1340            subrate_max: u16,
1341            max_latency: u16,
1342            continuation_number: u16,
1343            supervision_timeout: Duration<10_000>,
1344            min_ce_length: Duration<125>,
1345            max_ce_length: Duration<125>,
1346        }
1347        Return = ();
1348    }
1349}
1350
1351cmd! {
1352    /// 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)
1353    LeSetDefaultRateParameters(LE, 0x00A2) {
1354        LeSetDefaultRateParametersParams {
1355            conn_interval_min: Duration<125>,
1356            conn_interval_max: Duration<125>,
1357            subrate_min: u16,
1358            subrate_max: u16,
1359            max_latency: u16,
1360            continuation_number: u16,
1361            supervision_timeout: Duration<10_000>,
1362            min_ce_length: Duration<125>,
1363            max_ce_length: Duration<125>,
1364        }
1365        Return = ();
1366    }
1367}
1368
1369cmd! {
1370    /// 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)
1371    LeReadMinimumSupportedConnectionInterval(LE, 0x00A3) {
1372        Params = ();
1373        LeReadMinimumSupportedConnectionIntervalReturn {
1374            minimum_supported_connection_interval: DurationU8<125>,
1375            num_groups: u8,
1376            groups: [ConnIntervalGroup; 255],
1377        }
1378    }
1379}