xref: /btstack/src/bluetooth.h (revision 47f4e325b46b246459bd0cfec73b70132e3f84d7)
1*47f4e325SMatthias Ringwald /*
2*47f4e325SMatthias Ringwald  * Copyright (C) 2015 BlueKitchen GmbH
3*47f4e325SMatthias Ringwald  *
4*47f4e325SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*47f4e325SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*47f4e325SMatthias Ringwald  * are met:
7*47f4e325SMatthias Ringwald  *
8*47f4e325SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*47f4e325SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*47f4e325SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*47f4e325SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*47f4e325SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*47f4e325SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*47f4e325SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*47f4e325SMatthias Ringwald  *    from this software without specific prior written permission.
16*47f4e325SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17*47f4e325SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18*47f4e325SMatthias Ringwald  *    monetary gain.
19*47f4e325SMatthias Ringwald  *
20*47f4e325SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21*47f4e325SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*47f4e325SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23*47f4e325SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24*47f4e325SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25*47f4e325SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26*47f4e325SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27*47f4e325SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28*47f4e325SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29*47f4e325SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30*47f4e325SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*47f4e325SMatthias Ringwald  * SUCH DAMAGE.
32*47f4e325SMatthias Ringwald  *
33*47f4e325SMatthias Ringwald  * Please inquire about commercial licensing options at
34*47f4e325SMatthias Ringwald  * [email protected]
35*47f4e325SMatthias Ringwald  *
36*47f4e325SMatthias Ringwald  */
37*47f4e325SMatthias Ringwald 
38*47f4e325SMatthias Ringwald /*
39*47f4e325SMatthias Ringwald  * bluetooth.h
40*47f4e325SMatthias Ringwald  *
41*47f4e325SMatthias Ringwald  * Numbers defined or derived from the official Bluetooth specification
42*47f4e325SMatthias Ringwald  */
43*47f4e325SMatthias Ringwald 
44*47f4e325SMatthias Ringwald #ifndef __BLUETOOTH_H
45*47f4e325SMatthias Ringwald #define __BLUETOOTH_H
46*47f4e325SMatthias Ringwald 
47*47f4e325SMatthias Ringwald #include <stdint.h>
48*47f4e325SMatthias Ringwald 
49*47f4e325SMatthias Ringwald /**
50*47f4e325SMatthias Ringwald  * HCI Transport
51*47f4e325SMatthias Ringwald  */
52*47f4e325SMatthias Ringwald 
53*47f4e325SMatthias Ringwald /**
54*47f4e325SMatthias Ringwald  * packet types - used in BTstack and over the H4 UART interface
55*47f4e325SMatthias Ringwald  */
56*47f4e325SMatthias Ringwald #define HCI_COMMAND_DATA_PACKET 0x01
57*47f4e325SMatthias Ringwald #define HCI_ACL_DATA_PACKET     0x02
58*47f4e325SMatthias Ringwald #define HCI_SCO_DATA_PACKET     0x03
59*47f4e325SMatthias Ringwald #define HCI_EVENT_PACKET        0x04
60*47f4e325SMatthias Ringwald 
61*47f4e325SMatthias Ringwald /**
62*47f4e325SMatthias Ringwald  * HCI Layer
63*47f4e325SMatthias Ringwald  */
64*47f4e325SMatthias Ringwald 
65*47f4e325SMatthias Ringwald //
66*47f4e325SMatthias Ringwald // Error Codes
67*47f4e325SMatthias Ringwald //
68*47f4e325SMatthias Ringwald 
69*47f4e325SMatthias Ringwald // from Bluetooth Core Specification
70*47f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_HCI_COMMAND                     0x01
71*47f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER           0x02
72*47f4e325SMatthias Ringwald #define ERROR_CODE_HARDWARE_FAILURE                        0x03
73*47f4e325SMatthias Ringwald #define ERROR_CODE_PAGE_TIMEOUT                            0x04
74*47f4e325SMatthias Ringwald #define ERROR_CODE_AUTHENTICATION_FAILURE                          0x05
75*47f4e325SMatthias Ringwald #define ERROR_CODE_PIN_OR_KEY_MISSING                      0x06
76*47f4e325SMatthias Ringwald #define ERROR_CODE_MEMORY_CAPACITY_EXCEEDED                    0x07
77*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TIMEOUT                      0x08
78*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_LIMIT_EXCEEDED               0x09
79*47f4e325SMatthias Ringwald #define ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED  0x0A
80*47f4e325SMatthias Ringwald #define ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS           0x0B
81*47f4e325SMatthias Ringwald #define ERROR_CODE_COMMAND_DISALLOWED                      0x0C
82*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D
83*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS  0x0E
84*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F
85*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED      0x10
86*47f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE  0x11
87*47f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS          0x12
88*47f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION       0x13
89*47f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14
90*47f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF     0x15
91*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST     0x16
92*47f4e325SMatthias Ringwald #define ERROR_CODE_REPEATED_ATTEMPTS                       0x17
93*47f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_NOT_ALLOWED                     0x18
94*47f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_LMP_PDU                         0x19
95*47f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_REMOTE_FEATURE_UNSUPPORTED_LMP_FEATURE 0x1A
96*47f4e325SMatthias Ringwald #define ERROR_CODE_SCO_OFFSET_REJECTED                     0x1B
97*47f4e325SMatthias Ringwald #define ERROR_CODE_SCO_INTERVAL_REJECTED                   0x1C
98*47f4e325SMatthias Ringwald #define ERROR_CODE_SCO_AIR_MODE_REJECTED                   0x1D
99*47f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_LMP_PARAMETERS_INVALID_LL_PARAMETERS 0x1E
100*47f4e325SMatthias Ringwald #define ERROR_CODE_UNSPECIFIED_ERROR                       0x1F
101*47f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_LMP_PARAMETER_VALUE_UNSUPPORTED_LL_PARAMETER_VALUE 0x20
102*47f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_CHANGE_NOT_ALLOWED                 0x21
103*47f4e325SMatthias Ringwald #define ERROR_CODE_LMP_RESPONSE_TIMEOUT_LL_RESPONSE_TIMEOUT 0x22
104*47f4e325SMatthias Ringwald #define ERROR_CODE_LMP_ERROR_TRANSACTION_COLLISION         0x23
105*47f4e325SMatthias Ringwald #define ERROR_CODE_LMP_PDU_NOT_ALLOWED                     0x24
106*47f4e325SMatthias Ringwald #define ERROR_CODE_ENCRYPTION_MODE_NOT_ACCEPTABLE          0x25
107*47f4e325SMatthias Ringwald #define ERROR_CODE_LINK_KEY_CANNOT_BE_CHANGED              0x26
108*47f4e325SMatthias Ringwald #define ERROR_CODE_REQUESTED_QOS_NOT_SUPPORTED             0x27
109*47f4e325SMatthias Ringwald #define ERROR_CODE_INSTANT_PASSED                          0x28
110*47f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED     0x29
111*47f4e325SMatthias Ringwald #define ERROR_CODE_DIFFERENT_TRANSACTION_COLLISION         0x2A
112*47f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED                                0x2B
113*47f4e325SMatthias Ringwald #define ERROR_CODE_QOS_UNACCEPTABLE_PARAMETER              0x2C
114*47f4e325SMatthias Ringwald #define ERROR_CODE_QOS_REJECTED                            0x2D
115*47f4e325SMatthias Ringwald #define ERROR_CODE_CHANNEL_CLASSIFICATION_NOT_SUPPORTED    0x2E
116*47f4e325SMatthias Ringwald #define ERROR_CODE_INSUFFICIENT_SECURITY                   0x2F
117*47f4e325SMatthias Ringwald #define ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE        0x30
118*47f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED
119*47f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_PENDING                     0x32
120*47f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED
121*47f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED_SLOT_VIOLATION                 0x34
122*47f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_FAILED                      0x35
123*47f4e325SMatthias Ringwald #define ERROR_CODE_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE     0x36
124*47f4e325SMatthias Ringwald #define ERROR_CODE_SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37
125*47f4e325SMatthias Ringwald #define ERROR_CODE_HOST_BUSY_PAIRING                       0x38
126*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39
127*47f4e325SMatthias Ringwald #define ERROR_CODE_CONTROLLER_BUSY                         0x3A
128*47f4e325SMatthias Ringwald #define ERROR_CODE_UNACCEPTABLE_CONNECTION_PARAMETERS      0x3B
129*47f4e325SMatthias Ringwald #define ERROR_CODE_DIRECTED_ADVERTISING_TIMEOUT            0x3C
130*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D
131*47f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_FAILED_TO_BE_ESTABLISHED     0x3E
132*47f4e325SMatthias Ringwald #define ERROR_CODE_MAC_CONNECTION_FAILED                   0x3F
133*47f4e325SMatthias Ringwald #define ERROR_CODE_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40
134*47f4e325SMatthias Ringwald 
135*47f4e325SMatthias Ringwald 
136*47f4e325SMatthias Ringwald /**
137*47f4e325SMatthias Ringwald  * Default INQ Mode
138*47f4e325SMatthias Ringwald  */
139*47f4e325SMatthias Ringwald #define HCI_INQUIRY_LAP 0x9E8B33L  // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
140*47f4e325SMatthias Ringwald 
141*47f4e325SMatthias Ringwald /**
142*47f4e325SMatthias Ringwald  * SSP IO Capabilities
143*47f4e325SMatthias Ringwald  */
144*47f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_ONLY   0
145*47f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_YES_NO 1
146*47f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_KEYBOARD_ONLY  2
147*47f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT 3
148*47f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_UNKNOWN 0xff
149*47f4e325SMatthias Ringwald 
150*47f4e325SMatthias Ringwald 
151*47f4e325SMatthias Ringwald /**
152*47f4e325SMatthias Ringwald  * SSP Authentication Requirements, see IO Capability Request Reply Commmand
153*47f4e325SMatthias Ringwald  */
154*47f4e325SMatthias Ringwald 
155*47f4e325SMatthias Ringwald // Numeric comparison with automatic accept allowed.
156*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_NO_BONDING 0x00
157*47f4e325SMatthias Ringwald 
158*47f4e325SMatthias Ringwald // Use IO Capabilities to deter- mine authentication procedure
159*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_NO_BONDING 0x01
160*47f4e325SMatthias Ringwald 
161*47f4e325SMatthias Ringwald // Numeric compar- ison with automatic accept allowed.
162*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING 0x02
163*47f4e325SMatthias Ringwald 
164*47f4e325SMatthias Ringwald // Use IO Capabilities to determine authentication procedure
165*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_DEDICATED_BONDING 0x03
166*47f4e325SMatthias Ringwald 
167*47f4e325SMatthias Ringwald // Numeric Compari- son with automatic accept allowed.
168*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING 0x04
169*47f4e325SMatthias Ringwald 
170*47f4e325SMatthias Ringwald // . Use IO capabilities to determine authentication procedure.
171*47f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_GENERAL_BONDING 0x05
172*47f4e325SMatthias Ringwald 
173*47f4e325SMatthias Ringwald 
174*47f4e325SMatthias Ringwald // Events from host controller to host
175*47f4e325SMatthias Ringwald 
176*47f4e325SMatthias Ringwald /**
177*47f4e325SMatthias Ringwald  * @format 1
178*47f4e325SMatthias Ringwald  * @param status
179*47f4e325SMatthias Ringwald  */
180*47f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_COMPLETE                         0x01
181*47f4e325SMatthias Ringwald // no format yet, can contain multiple results
182*47f4e325SMatthias Ringwald 
183*47f4e325SMatthias Ringwald /**
184*47f4e325SMatthias Ringwald  * @format 1B11132
185*47f4e325SMatthias Ringwald  * @param num_responses
186*47f4e325SMatthias Ringwald  * @param bd_addr
187*47f4e325SMatthias Ringwald  * @param page_scan_repetition_mode
188*47f4e325SMatthias Ringwald  * @param reserved1
189*47f4e325SMatthias Ringwald  * @param reserved2
190*47f4e325SMatthias Ringwald  * @param class_of_device
191*47f4e325SMatthias Ringwald  * @param clock_offset
192*47f4e325SMatthias Ringwald  */
193*47f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_RESULT                           0x02
194*47f4e325SMatthias Ringwald 
195*47f4e325SMatthias Ringwald /**
196*47f4e325SMatthias Ringwald  * @format 12B11
197*47f4e325SMatthias Ringwald  * @param status
198*47f4e325SMatthias Ringwald  * @param connection_handle
199*47f4e325SMatthias Ringwald  * @param bd_addr
200*47f4e325SMatthias Ringwald  * @param link_type
201*47f4e325SMatthias Ringwald  * @param encryption_enabled
202*47f4e325SMatthias Ringwald  */
203*47f4e325SMatthias Ringwald #define HCI_EVENT_CONNECTION_COMPLETE                      0x03
204*47f4e325SMatthias Ringwald /**
205*47f4e325SMatthias Ringwald  * @format B31
206*47f4e325SMatthias Ringwald  * @param bd_addr
207*47f4e325SMatthias Ringwald  * @param class_of_device
208*47f4e325SMatthias Ringwald  * @param link_type
209*47f4e325SMatthias Ringwald  */
210*47f4e325SMatthias Ringwald #define HCI_EVENT_CONNECTION_REQUEST                       0x04
211*47f4e325SMatthias Ringwald /**
212*47f4e325SMatthias Ringwald  * @format 121
213*47f4e325SMatthias Ringwald  * @param status
214*47f4e325SMatthias Ringwald  * @param connection_handle
215*47f4e325SMatthias Ringwald  * @param reason
216*47f4e325SMatthias Ringwald  */
217*47f4e325SMatthias Ringwald #define HCI_EVENT_DISCONNECTION_COMPLETE                   0x05
218*47f4e325SMatthias Ringwald /**
219*47f4e325SMatthias Ringwald  * @format 12
220*47f4e325SMatthias Ringwald  * @param status
221*47f4e325SMatthias Ringwald  * @param connection_handle
222*47f4e325SMatthias Ringwald  */
223*47f4e325SMatthias Ringwald #define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT            0x06
224*47f4e325SMatthias Ringwald /**
225*47f4e325SMatthias Ringwald  * @format 1BN
226*47f4e325SMatthias Ringwald  * @param status
227*47f4e325SMatthias Ringwald  * @param bd_addr
228*47f4e325SMatthias Ringwald  * @param remote_name
229*47f4e325SMatthias Ringwald  */
230*47f4e325SMatthias Ringwald #define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE             0x07
231*47f4e325SMatthias Ringwald /**
232*47f4e325SMatthias Ringwald  * @format 121
233*47f4e325SMatthias Ringwald  * @param status
234*47f4e325SMatthias Ringwald  * @param connection_handle
235*47f4e325SMatthias Ringwald  * @param encryption_enabled
236*47f4e325SMatthias Ringwald  */
237*47f4e325SMatthias Ringwald #define HCI_EVENT_ENCRYPTION_CHANGE                        0x08
238*47f4e325SMatthias Ringwald /**
239*47f4e325SMatthias Ringwald  * @format 12
240*47f4e325SMatthias Ringwald  * @param status
241*47f4e325SMatthias Ringwald  * @param connection_handle
242*47f4e325SMatthias Ringwald  */
243*47f4e325SMatthias Ringwald #define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE      0x09
244*47f4e325SMatthias Ringwald /**
245*47f4e325SMatthias Ringwald  * @format 121
246*47f4e325SMatthias Ringwald  * @param status
247*47f4e325SMatthias Ringwald  * @param connection_handle
248*47f4e325SMatthias Ringwald  * @param key_flag
249*47f4e325SMatthias Ringwald  */
250*47f4e325SMatthias Ringwald #define HCI_EVENT_MASTER_LINK_KEY_COMPLETE                 0x0A
251*47f4e325SMatthias Ringwald #define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE  0x0B
252*47f4e325SMatthias Ringwald #define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C
253*47f4e325SMatthias Ringwald #define HCI_EVENT_QOS_SETUP_COMPLETE                       0x0D
254*47f4e325SMatthias Ringwald 
255*47f4e325SMatthias Ringwald /**
256*47f4e325SMatthias Ringwald  * @format 12R
257*47f4e325SMatthias Ringwald  * @param num_hci_command_packets
258*47f4e325SMatthias Ringwald  * @param command_opcode
259*47f4e325SMatthias Ringwald  * @param return_parameters
260*47f4e325SMatthias Ringwald  */
261*47f4e325SMatthias Ringwald #define HCI_EVENT_COMMAND_COMPLETE                         0x0E
262*47f4e325SMatthias Ringwald /**
263*47f4e325SMatthias Ringwald  * @format 112
264*47f4e325SMatthias Ringwald  * @param status
265*47f4e325SMatthias Ringwald  * @param num_hci_command_packets
266*47f4e325SMatthias Ringwald  * @param command_opcode
267*47f4e325SMatthias Ringwald  */
268*47f4e325SMatthias Ringwald #define HCI_EVENT_COMMAND_STATUS                           0x0F
269*47f4e325SMatthias Ringwald 
270*47f4e325SMatthias Ringwald /**
271*47f4e325SMatthias Ringwald  * @format 121
272*47f4e325SMatthias Ringwald  * @param hardware_code
273*47f4e325SMatthias Ringwald  */
274*47f4e325SMatthias Ringwald #define HCI_EVENT_HARDWARE_ERROR                           0x10
275*47f4e325SMatthias Ringwald 
276*47f4e325SMatthias Ringwald #define HCI_EVENT_FLUSH_OCCURED                            0x11
277*47f4e325SMatthias Ringwald 
278*47f4e325SMatthias Ringwald /**
279*47f4e325SMatthias Ringwald  * @format 1B1
280*47f4e325SMatthias Ringwald  * @param status
281*47f4e325SMatthias Ringwald  * @param bd_addr
282*47f4e325SMatthias Ringwald  * @param role
283*47f4e325SMatthias Ringwald  */
284*47f4e325SMatthias Ringwald #define HCI_EVENT_ROLE_CHANGE                              0x12
285*47f4e325SMatthias Ringwald 
286*47f4e325SMatthias Ringwald #define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS              0x13
287*47f4e325SMatthias Ringwald #define HCI_EVENT_MODE_CHANGE_EVENT                        0x14
288*47f4e325SMatthias Ringwald #define HCI_EVENT_RETURN_LINK_KEYS                         0x15
289*47f4e325SMatthias Ringwald #define HCI_EVENT_PIN_CODE_REQUEST                         0x16
290*47f4e325SMatthias Ringwald #define HCI_EVENT_LINK_KEY_REQUEST                         0x17
291*47f4e325SMatthias Ringwald #define HCI_EVENT_LINK_KEY_NOTIFICATION                    0x18
292*47f4e325SMatthias Ringwald #define HCI_EVENT_DATA_BUFFER_OVERFLOW                     0x1A
293*47f4e325SMatthias Ringwald #define HCI_EVENT_MAX_SLOTS_CHANGED                        0x1B
294*47f4e325SMatthias Ringwald #define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE               0x1C
295*47f4e325SMatthias Ringwald #define HCI_EVENT_PACKET_TYPE_CHANGED                      0x1D
296*47f4e325SMatthias Ringwald 
297*47f4e325SMatthias Ringwald /**
298*47f4e325SMatthias Ringwald  * @format 1B11321
299*47f4e325SMatthias Ringwald  * @param num_responses
300*47f4e325SMatthias Ringwald  * @param bd_addr
301*47f4e325SMatthias Ringwald  * @param page_scan_repetition_mode
302*47f4e325SMatthias Ringwald  * @param reserved
303*47f4e325SMatthias Ringwald  * @param class_of_device
304*47f4e325SMatthias Ringwald  * @param clock_offset
305*47f4e325SMatthias Ringwald  * @param rssi
306*47f4e325SMatthias Ringwald  */
307*47f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI                 0x22
308*47f4e325SMatthias Ringwald 
309*47f4e325SMatthias Ringwald /**
310*47f4e325SMatthias Ringwald  * @format 1HB111221
311*47f4e325SMatthias Ringwald  * @param status
312*47f4e325SMatthias Ringwald  * @param handle
313*47f4e325SMatthias Ringwald  * @param bd_addr
314*47f4e325SMatthias Ringwald  * @param link_type
315*47f4e325SMatthias Ringwald  * @param transmission_interval
316*47f4e325SMatthias Ringwald  * @param retransmission_interval
317*47f4e325SMatthias Ringwald  * @param rx_packet_length
318*47f4e325SMatthias Ringwald  * @param tx_packet_length
319*47f4e325SMatthias Ringwald  * @param air_mode
320*47f4e325SMatthias Ringwald  */
321*47f4e325SMatthias Ringwald #define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE          0x2C
322*47f4e325SMatthias Ringwald 
323*47f4e325SMatthias Ringwald // TODO: serialize extended_inquiry_response and provide parser
324*47f4e325SMatthias Ringwald /**
325*47f4e325SMatthias Ringwald  * @format 1B11321
326*47f4e325SMatthias Ringwald  * @param num_responses
327*47f4e325SMatthias Ringwald  * @param bd_addr
328*47f4e325SMatthias Ringwald  * @param page_scan_repetition_mode
329*47f4e325SMatthias Ringwald  * @param reserved
330*47f4e325SMatthias Ringwald  * @param class_of_device
331*47f4e325SMatthias Ringwald  * @param clock_offset
332*47f4e325SMatthias Ringwald  * @param rssi
333*47f4e325SMatthias Ringwald  */
334*47f4e325SMatthias Ringwald #define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE                0x2F
335*47f4e325SMatthias Ringwald 
336*47f4e325SMatthias Ringwald  /**
337*47f4e325SMatthias Ringwald   * @format 1H
338*47f4e325SMatthias Ringwald   * @param status
339*47f4e325SMatthias Ringwald   * @param handle
340*47f4e325SMatthias Ringwald   */
341*47f4e325SMatthias Ringwald #define HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE          0x30
342*47f4e325SMatthias Ringwald 
343*47f4e325SMatthias Ringwald #define HCI_EVENT_IO_CAPABILITY_REQUEST                    0x31
344*47f4e325SMatthias Ringwald #define HCI_EVENT_IO_CAPABILITY_RESPONSE                   0x32
345*47f4e325SMatthias Ringwald #define HCI_EVENT_USER_CONFIRMATION_REQUEST                0x33
346*47f4e325SMatthias Ringwald #define HCI_EVENT_USER_PASSKEY_REQUEST                     0x34
347*47f4e325SMatthias Ringwald #define HCI_EVENT_REMOTE_OOB_DATA_REQUEST                  0x35
348*47f4e325SMatthias Ringwald #define HCI_EVENT_SIMPLE_PAIRING_COMPLETE                  0x36
349*47f4e325SMatthias Ringwald 
350*47f4e325SMatthias Ringwald #define HCI_EVENT_LE_META                                  0x3E
351*47f4e325SMatthias Ringwald 
352*47f4e325SMatthias Ringwald /**
353*47f4e325SMatthias Ringwald  * @format 11211B2221
354*47f4e325SMatthias Ringwald  * @param subevent_code
355*47f4e325SMatthias Ringwald  * @param status
356*47f4e325SMatthias Ringwald  * @param connection_handle
357*47f4e325SMatthias Ringwald  * @param role
358*47f4e325SMatthias Ringwald  * @param peer_address_type
359*47f4e325SMatthias Ringwald  * @param peer_address
360*47f4e325SMatthias Ringwald  * @param conn_interval
361*47f4e325SMatthias Ringwald  * @param conn_latency
362*47f4e325SMatthias Ringwald  * @param supervision_timeout
363*47f4e325SMatthias Ringwald  * @param master_clock_accuracy
364*47f4e325SMatthias Ringwald  */
365*47f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_COMPLETE                0x01
366*47f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_ADVERTISING_REPORT                 0x02
367*47f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE         0x03
368*47f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
369*47f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST              0x05
370*47f4e325SMatthias Ringwald 
371*47f4e325SMatthias Ringwald // last used HCI_EVENT in 2.1 is 0x3d
372*47f4e325SMatthias Ringwald // last used HCI_EVENT in 4.1 is 0x57
373*47f4e325SMatthias Ringwald 
374*47f4e325SMatthias Ringwald /**
375*47f4e325SMatthias Ringwald  * L2CAP Layer
376*47f4e325SMatthias Ringwald  */
377*47f4e325SMatthias Ringwald 
378*47f4e325SMatthias Ringwald // Fixed PSM numbers
379*47f4e325SMatthias Ringwald #define PSM_SDP           0x01
380*47f4e325SMatthias Ringwald #define PSM_RFCOMM 		  0x03
381*47f4e325SMatthias Ringwald #define PSM_BNEP   	      0x0F
382*47f4e325SMatthias Ringwald #define PSM_HID_CONTROL   0x11
383*47f4e325SMatthias Ringwald #define PSM_HID_INTERRUPT 0x13
384*47f4e325SMatthias Ringwald 
385*47f4e325SMatthias Ringwald 
386*47f4e325SMatthias Ringwald 
387*47f4e325SMatthias Ringwald 
388*47f4e325SMatthias Ringwald #endif