bt_hci/cmd/
controller_baseband.rs

1//! Controller & Baseband 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-5ced811b-a6ce-701a-16b2-70f2d9795c05)
2
3use crate::cmd;
4use crate::param::{
5    BdAddr, ConnHandle, ConnHandleCompletedPackets, ControllerToHostFlowControl, Duration, EventMask, EventMaskPage2,
6    PowerLevelKind, Status,
7};
8
9cmd! {
10    /// 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-9cf88217-77b4-aeb6-61fb-d1129d48a67c)
11    SetEventMask(CONTROL_BASEBAND, 0x0001) {
12        Params = EventMask;
13        Return = ();
14    }
15}
16
17cmd! {
18    /// Reset command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-b0aaafb1-0601-865c-2703-4f4caa4dee2e)
19    Reset(CONTROL_BASEBAND, 0x0003) {
20        Params = ();
21        Return = ();
22    }
23}
24
25cmd! {
26    /// 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-7205a3ee-15c7-cc48-c512-a959b4e3f560)
27    ReadTransmitPowerLevel(CONTROL_BASEBAND, 0x002d) {
28        ReadTransmitPowerLevelParams {
29            kind: PowerLevelKind,
30        }
31        ReadTransmitPowerLevelReturn {
32            tx_power_level: i8,
33        }
34        Handle = handle: ConnHandle;
35    }
36}
37
38cmd! {
39    /// Set Controller To Host Flow Control command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-64d757fc-e1da-329f-6d6a-16453750f325)
40    SetControllerToHostFlowControl(CONTROL_BASEBAND, 0x0031) {
41        Params = ControllerToHostFlowControl;
42        Return = ();
43    }
44}
45
46cmd! {
47    /// Host 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-99748527-de87-bf9c-935d-baf7e3f35b12)
48    HostBufferSize(CONTROL_BASEBAND, 0x0033) {
49        HostBufferSizeParams {
50            host_acl_data_packet_len: u16,
51            host_sync_data_packet_len: u8,
52            host_total_acl_data_packets: u16,
53            host_total_sync_data_packets: u16,
54        }
55        Return = ();
56    }
57}
58
59cmd! {
60    /// Host Number Of Completed Packets command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-14569cb0-16b0-7dc0-a1d4-e5a4ef44d81a)
61    ///
62    /// *Note:* This command only returns a [`CommandComplete`](crate::event::CommandComplete) event on error. No event is generated on success.
63    HostNumberOfCompletedPackets(CONTROL_BASEBAND, 0x0035)  {
64        Params<'a> = &'a [ConnHandleCompletedPackets];
65        Return = ();
66    }
67}
68
69cmd! {
70    /// Set Event Mask Page 2 command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-4e91f200-b802-45d6-9282-fd03c0dfefbe)
71    SetEventMaskPage2(CONTROL_BASEBAND, 0x0063) {
72        Params = EventMaskPage2;
73        Return = ();
74    }
75}
76
77cmd! {
78    /// Read Authenticated Payload 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-36c940e9-a654-f07f-75cd-2cbcf2d6adf6)
79    ReadAuthenticatedPayloadTimeout(CONTROL_BASEBAND, 0x007b) {
80        Params = ConnHandle;
81        ReadAuthenticatedPayloadTimeoutReturn {
82            timeout: Duration<10_000>,
83        }
84        Handle = handle: ConnHandle;
85    }
86}
87
88cmd! {
89    /// Write Authenticated Payload 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-9bb1bb66-1857-83d8-8954-677f773225f9)
90    WriteAuthenticatedPayloadTimeout(CONTROL_BASEBAND, 0x007c) {
91        WriteAuthenticatedPayloadTimeoutParams {
92            timeout: Duration<10_000>,
93        }
94        Return = ConnHandle;
95        Handle = handle: ConnHandle;
96    }
97}
98
99cmd! {
100    /// Read Stored Link Key command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-9c3e0da9-138b-7641-6e84-d2d17c1f082e)
101    ///
102    /// Reads stored link keys for one or more devices, or all devices.
103    ReadStoredLinkKey(CONTROL_BASEBAND, 0x000d) {
104        ReadStoredLinkKeyParams {
105            bd_addr: BdAddr,
106            read_all: bool,
107        }
108        ReadStoredLinkKeyReturn {
109            status: Status,
110            max_num_keys: u8,
111            num_keys_read: u8,
112        }
113
114    }
115}