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