Skip to main content

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, DataPathDirection, DataPathId,
6    Duration, EventMask, EventMaskPage2, 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}
116
117cmd! {
118    /// Read Connection Accept 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-c273cd12-19e3-f637-987e-c7c2f6f1f334)
119    ReadConnectionAcceptTimeout(CONTROL_BASEBAND, 0x0015) {
120        Params = ();
121        Return = Duration<625>;
122    }
123}
124
125cmd! {
126    /// Write Connection Accept 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-70c4664c-429c-c90d-2acf-7af43001c656)
127    WriteConnectionAceeptTimeout(CONTROL_BASEBAND, 0x0016) {
128        Params = Duration<625>;
129        Return = ();
130    }
131}
132
133cmd! {
134    /// Read AFH Channel Assessment 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-20cc4548-ff1e-0102-0f8a-593746e3f3b4)
135    ReadAfhChannelAssessmentMode(CONTROL_BASEBAND, 0x0048) {
136        Params = ();
137        Return = bool;
138    }
139}
140
141cmd! {
142    /// Write AFH Channel Assessment 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-80994aff-be68-6510-c995-df5de4a66db9)
143    WriteAfhChannelAssessmentMode(CONTROL_BASEBAND, 0x0049) {
144        Params = bool;
145        Return = ();
146    }
147}
148
149cmd! {
150    /// Set Ecosystem Base Interval command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-3d0ee297-3672-5e33-2838-4ec63069a7a1)
151    SetEcosystemBaseInterval(CONTROL_BASEBAND, 0x0082) {
152        Params = Duration<1250>;
153        Return = ();
154    }
155}
156
157cmd! {
158    /// Configure Data Path command [📖](https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-54/out/en/host-controller-interface/host-controller-interface-functional-specification.html#UUID-6bb7b4d9-f5a2-8baa-e113-473f14c4baa0)
159    ConfigureDataPath(CONTROL_BASEBAND, 0x0083) {
160        ConfigureDataPathParams<'a> {
161            data_path_direction: DataPathDirection,
162            data_path_id: DataPathId,
163            vendor_specific_config: &'a [u8],
164        }
165        Return = ();
166    }
167}