xref: /btstack/src/btstack_defines.h (revision 4273e358491fe81afeec0fcfa7feb0ec3719b023)
1 /*
2  * Copyright (C) 2015 BlueKitchen GmbH
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holders nor the names of
14  *    contributors may be used to endorse or promote products derived
15  *    from this software without specific prior written permission.
16  * 4. Any redistribution, use, or modification is done solely for
17  *    personal benefit and not for any commercial purpose or for
18  *    monetary gain.
19  *
20  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * Please inquire about commercial licensing options at
34  * [email protected]
35  *
36  */
37 
38 /*
39  * btstack-defines.h
40  *
41  * BTstack definitions, events, and error codes */
42 
43 #ifndef __BTSTACK_DEFINES_H
44 #define __BTSTACK_DEFINES_H
45 
46 // DEFINES
47 
48 #define DAEMON_EVENT_PACKET     0x05
49 
50 // L2CAP data
51 #define L2CAP_DATA_PACKET       0x06
52 
53 // RFCOMM data
54 #define RFCOMM_DATA_PACKET      0x07
55 
56 // Attribute protocol data
57 #define ATT_DATA_PACKET         0x08
58 
59 // Security Manager protocol data
60 #define SM_DATA_PACKET          0x09
61 
62 // SDP query result
63 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
64 #define SDP_CLIENT_PACKET       0x0a
65 
66 // BNEP data
67 #define BNEP_DATA_PACKET        0x0b
68 
69 // Unicast Connectionless Data
70 #define UCD_DATA_PACKET         0x0c
71 
72 // debug log messages
73 #define LOG_MESSAGE_PACKET      0xfc
74 
75 
76 // ERRORS
77 
78 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
79 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED              0x50
80 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH         0x51
81 #define BTSTACK_ACTIVATION_POWERON_FAILED                  0x52
82 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN                  0x53
83 #define BTSTACK_NOT_ACTIVATED                              0x54
84 #define BTSTACK_BUSY                                       0x55
85 #define BTSTACK_MEMORY_ALLOC_FAILED                        0x56
86 #define BTSTACK_ACL_BUFFERS_FULL                           0x57
87 
88 // l2cap errors - enumeration by the command that created them
89 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
90 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
91 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
92 
93 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL        0x63
94 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING           0x64
95 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM       0x65
96 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY  0x66
97 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
98 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT       0x68
99 
100 #define L2CAP_SERVICE_ALREADY_REGISTERED                   0x69
101 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU                  0x6A
102 
103 #define RFCOMM_MULTIPLEXER_STOPPED                         0x70
104 #define RFCOMM_CHANNEL_ALREADY_REGISTERED                  0x71
105 #define RFCOMM_NO_OUTGOING_CREDITS                         0x72
106 #define RFCOMM_AGGREGATE_FLOW_OFF                          0x73
107 #define RFCOMM_DATA_LEN_EXCEEDS_MTU                        0x74
108 
109 #define SDP_HANDLE_ALREADY_REGISTERED                      0x80
110 #define SDP_QUERY_INCOMPLETE                               0x81
111 #define SDP_SERVICE_NOT_FOUND                              0x82
112 #define SDP_HANDLE_INVALID                                 0x83
113 
114 #define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS            0x90
115 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT                0x91
116 
117 #define GATT_CLIENT_NOT_CONNECTED                          0x93
118 #define GATT_CLIENT_BUSY                                   0x94
119 
120 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
121 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
122 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
123 
124 typedef enum {
125     BLE_PERIPHERAL_OK = 0xA0,
126     BLE_PERIPHERAL_IN_WRONG_STATE,
127     BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS,
128     BLE_PERIPHERAL_NOT_CONNECTED,
129     BLE_VALUE_TOO_LONG,
130     BLE_PERIPHERAL_BUSY,
131     BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED,
132     BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED
133 } le_command_status_t;
134 
135 // COMMANDS
136 
137 #define OGF_BTSTACK 0x3d
138 
139 // cmds for BTstack
140 // get state: @returns HCI_STATE
141 #define BTSTACK_GET_STATE                                  0x01
142 
143 // set power mode: @param HCI_POWER_MODE
144 #define BTSTACK_SET_POWER_MODE                             0x02
145 
146 // set capture mode: @param on
147 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
148 
149 // get BTstack version
150 #define BTSTACK_GET_VERSION                                0x04
151 
152 // get system Bluetooth state
153 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
154 
155 // set system Bluetooth state
156 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
157 
158 // enable inquiry scan for this client
159 #define BTSTACK_SET_DISCOVERABLE                           0x07
160 
161 // set global Bluetooth state
162 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
163 
164 // create l2cap channel: @param bd_addr(48), psm (16)
165 #define L2CAP_CREATE_CHANNEL                               0x20
166 
167 // disconnect l2cap disconnect, @param channel(16), reason(8)
168 #define L2CAP_DISCONNECT                                   0x21
169 
170 // register l2cap service: @param psm(16), mtu (16)
171 #define L2CAP_REGISTER_SERVICE                             0x22
172 
173 // unregister l2cap disconnect, @param psm(16)
174 #define L2CAP_UNREGISTER_SERVICE                           0x23
175 
176 // accept connection @param bd_addr(48), dest cid (16)
177 #define L2CAP_ACCEPT_CONNECTION                            0x24
178 
179 // decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8)
180 #define L2CAP_DECLINE_CONNECTION                           0x25
181 
182 // create l2cap channel: @param bd_addr(48), psm (16), mtu (16)
183 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
184 
185 // register SDP Service Record: service record (size)
186 #define SDP_REGISTER_SERVICE_RECORD                        0x30
187 
188 // unregister SDP Service Record
189 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
190 
191 // Get remote RFCOMM services
192 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
193 
194 // Get remote SDP services
195 #define SDP_CLIENT_QUERY_SERVICES                          0x33
196 
197 // RFCOMM "HCI" Commands
198 #define RFCOMM_CREATE_CHANNEL       0x40
199 #define RFCOMM_DISCONNECT     0x41
200 #define RFCOMM_REGISTER_SERVICE     0x42
201 #define RFCOMM_UNREGISTER_SERVICE   0x43
202 #define RFCOMM_ACCEPT_CONNECTION    0x44
203 #define RFCOMM_DECLINE_CONNECTION   0x45
204 #define RFCOMM_PERSISTENT_CHANNEL   0x46
205 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
206 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
207 #define RFCOMM_GRANT_CREDITS                 0x49
208 
209 // GAP Classic 0x50
210 #define GAP_DISCONNECT              0x50
211 
212 // GAP LE      0x60
213 #define GAP_LE_SCAN_START           0x60
214 #define GAP_LE_SCAN_STOP            0x61
215 #define GAP_LE_CONNECT              0x62
216 #define GAP_LE_CONNECT_CANCEL       0x63
217 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
218 
219 // GATT (Client) 0x70
220 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
221 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
222 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
223 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
224 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
225 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
226 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
227 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
228 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
229 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
230 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
231 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
232 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
233 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
234 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
235 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
236 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
237 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
238 #define GATT_GET_MTU                                             0x82
239 
240 
241 // EVENTS
242 
243 /**
244  * @format 1
245  * @param state
246  */
247 #define BTSTACK_EVENT_STATE                                0x60
248 
249 // data: event(8), len(8), nr hci connections
250 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
251 
252 /**
253  * @format
254  */
255 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
256 
257 /**
258  * @format 112
259  * @param major
260  * @param minor
261  @ @param revision
262  */
263 #define BTSTACK_EVENT_VERSION                              0x63
264 
265 // data: system bluetooth on/off (bool)
266 #define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED             0x64
267 
268 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
269 #define BTSTACK_EVENT_REMOTE_NAME_CACHED                   0x65
270 
271 // data: discoverable enabled (bool)
272 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
273 
274 // Daemon Events used internally
275 
276 // data: event(8)
277 #define DAEMON_EVENT_CONNECTION_OPENED                     0x68
278 
279 // data: event(8)
280 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x69
281 
282 // data: event(8), nr_connections(8)
283 #define DAEMON_NR_CONNECTIONS_CHANGED                      0x6A
284 
285 // data: event(8)
286 #define DAEMON_EVENT_NEW_RFCOMM_CREDITS                    0x6B
287 
288 // data: event(8)
289 #define DAEMON_EVENT_HCI_PACKET_SENT                       0x6C
290 
291 // L2CAP EVENTS
292 
293 // data: event (8), len(8), status (8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16), local_mtu(16), remote_mtu(16), flush_timeout(16)
294 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
295 
296 // data: event (8), len(8), channel (16)
297 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
298 
299 // data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16)
300 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
301 
302 // data: event(8), len(8), handle(16)
303 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
304 
305 // data: event(8), len(8), local_cid(16), credits(8)
306 #define L2CAP_EVENT_CREDITS                                0x74
307 
308 // data: event(8), len(8), status (8), psm (16)
309 #define L2CAP_EVENT_SERVICE_REGISTERED                     0x75
310 
311 // data: event(8), len(8), handle(16), interval min(16), interval max(16), latency(16), timeout multiplier(16)
312 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
313 
314 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
315 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
316 
317 // RFCOMM EVENTS
318 /**
319  * @format 1B2122
320  * @param status
321  * @param bd_addr
322  * @param con_handle
323  * @param server_channel
324  * @param rfcomm_cid
325  * @param max_frame_size
326  */
327 #define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE                 0x80
328 
329 /**
330  * @format 2
331  * @param rfcomm_cid
332  */
333 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
334 
335 /**
336  * @format B12
337  * @param bd_addr
338  * @param server_channel
339  * @param rfcomm_cid
340  */
341 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
342 
343 /**
344  * @format 21
345  * @param rfcomm_cid
346  * @param line_status
347  */
348 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
349 
350 /**
351  * @format 21
352  * @param rfcomm_cid
353  * @param credits
354  */
355 #define RFCOMM_EVENT_CREDITS                               0x84
356 
357 /**
358  * @format 11
359  * @param status
360  * @param channel_id
361  */
362 #define RFCOMM_EVENT_SERVICE_REGISTERED                    0x85
363 
364 /**
365  * @format 11
366  * @param status
367  * @param server_channel_id
368  */
369 #define RFCOMM_EVENT_PERSISTENT_CHANNEL                    0x86
370 
371 // data: event (8), len(8), rfcomm_cid (16), modem status (8)
372 
373 /**
374  * @format 21
375  * @param rfcomm_cid
376  * @param modem_status
377  */
378 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
379 
380 // data: event (8), len(8), rfcomm_cid (16), rpn_data_t (67)
381  /**
382   * TODO: format for variable data
383   * @param rfcomm_cid
384   * @param rpn_data
385   */
386 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
387 
388 
389 // data: event(8), len(8), status(8), service_record_handle(32)
390  /**
391   * @format 14
392   * @param status
393   * @param service_record_handle
394   */
395 #define SDP_SERVICE_REGISTERED                             0x90
396 
397 // data: event(8), len(8), status(8)
398 /**
399  * @format 1
400  * @param status
401  */
402 #define SDP_QUERY_COMPLETE                                 0x91
403 
404 // data: event(8), len(8), rfcomm channel(8), name(var)
405 /**
406  * @format 1T
407  * @param rfcomm_channel
408  * @param name
409  * @brief SDP_QUERY_RFCOMM_SERVICE 0x92
410  */
411 #define SDP_QUERY_RFCOMM_SERVICE                           0x92
412 
413 // data: event(8), len(8), record nr(16), attribute id(16), attribute value(var)
414 /**
415  * TODO: format for variable data
416  * @param record_nr
417  * @param attribute_id
418  * @param attribute_value
419  */
420 #define SDP_QUERY_ATTRIBUTE_VALUE                          0x93
421 
422 // not provided by daemon, only used for internal testing
423 #define SDP_QUERY_SERVICE_RECORD_HANDLE                    0x94
424 
425 /**
426  * @format H1
427  * @param handle
428  * @param status
429  */
430 #define GATT_QUERY_COMPLETE                                0xA0
431 
432 /**
433  * @format HX
434  * @param handle
435  * @param service
436  */
437 #define GATT_SERVICE_QUERY_RESULT                          0xA1
438 
439 /**
440  * @format HY
441  * @param handle
442  * @param characteristic
443  */
444 #define GATT_CHARACTERISTIC_QUERY_RESULT                   0xA2
445 
446 /**
447  * @format H2X
448  * @param handle
449  * @param include_handle
450  * @param service
451  */
452 #define GATT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
453 
454 /**
455  * @format HZ
456  * @param handle
457  * @param characteristic_descriptor
458  */
459 #define GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
460 
461 /**
462  * @format H2LV
463  * @param handle
464  * @param value_handle
465  * @param value_length
466  * @param value
467  */
468 #define GATT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
469 
470 /**
471  * @format H22LV
472  * @param handle
473  * @param value_handle
474  * @param value_offset
475  * @param value_length
476  * @param value
477  */
478 #define GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
479 
480 /**
481  * @format H2LV
482  * @param handle
483  * @param value_handle
484  * @param value_length
485  * @param value
486  */
487 #define GATT_NOTIFICATION                                  0xA7
488 
489 /**
490  * @format H2LV
491  * @param handle
492  * @param value_handle
493  * @param value_length
494  * @param value
495  */
496 #define GATT_INDICATION                                    0xA8
497 
498 /**
499  * @format H2LV
500  * @param descriptor_handle
501  * @param descriptor_length
502  * @param descriptor
503  */
504 #define GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
505 
506 /**
507  * @format H2LV
508  * @param handle
509  * @param descriptor_offset
510  * @param descriptor_length
511  * @param descriptor
512  */
513 #define GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
514 
515 /**
516  * @format H2
517  * @param handle
518  * @param MTU
519  */
520 #define GATT_MTU                                           0xAB
521 
522 /**
523  * @format H2
524  * @param handle
525  * @param MTU
526  */
527 #define ATT_MTU_EXCHANGE_COMPLETE                          0xB5
528 
529 // data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
530 #define ATT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
531 
532 
533 // data: event(8), len(8), status (8), bnep service uuid (16)
534 #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
535 
536 // data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
537 #define BNEP_EVENT_OPEN_CHANNEL_COMPLETE                   0xC1
538 
539 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
540 #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
541 
542 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48), channel state (8)
543 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
544 
545 // data: event(8), len(8)
546 #define BNEP_EVENT_READY_TO_SEND                           0xC4
547 
548  /**
549   * @format H1B
550   * @param handle
551   * @param addr_type
552   * @param address
553   */
554 #define SM_JUST_WORKS_REQUEST                              0xD0
555 
556  /**
557   * @format H1B
558   * @param handle
559   * @param addr_type
560   * @param address
561   */
562 #define SM_JUST_WORKS_CANCEL                               0xD1
563 
564  /**
565   * @format H1B4
566   * @param handle
567   * @param addr_type
568   * @param address
569   * @param passkey
570   */
571 #define SM_PASSKEY_DISPLAY_NUMBER                          0xD2
572 
573  /**
574   * @format H1B
575   * @param handle
576   * @param addr_type
577   * @param address
578   */
579 #define SM_PASSKEY_DISPLAY_CANCEL                          0xD3
580 
581  /**
582   * @format H1B421
583   * @param handle
584   * @param addr_type
585   * @param address
586   */
587 #define SM_PASSKEY_INPUT_NUMBER                            0xD4
588 
589  /**
590   * @format H1B
591   * @param handle
592   * @param addr_type
593   * @param address
594   */
595 #define SM_PASSKEY_INPUT_CANCEL                            0xD5
596 
597  /**
598   * @format H1B
599   * @param handle
600   * @param addr_type
601   * @param address
602   */
603 #define SM_IDENTITY_RESOLVING_STARTED                      0xD6
604 
605  /**
606   * @format H1B
607   * @param handle
608   * @param addr_type
609   * @param address
610   */
611 #define SM_IDENTITY_RESOLVING_FAILED                       0xD7
612 
613  /**
614   * @format H1B2
615   * @param handle
616   * @param addr_type
617   * @param address
618   * @param le_device_db_index
619   */
620 #define SM_IDENTITY_RESOLVING_SUCCEEDED                    0xD8
621 
622  /**
623   * @format H1B
624   * @param handle
625   * @param addr_type
626   * @param address
627   */
628 #define SM_AUTHORIZATION_REQUEST                           0xD9
629 
630  /**
631   * @format H1B1
632   * @param handle
633   * @param addr_type
634   * @param address
635   * @param authorization_result
636   */
637 #define SM_AUTHORIZATION_RESULT                            0xDA
638 
639 // GAP
640 
641 // data: event(8), len(8), hci_handle (16), security_level (8)
642 #define GAP_SECURITY_LEVEL                                 0xE0
643 
644 // data: event(8), len(8), status (8), bd_addr(48)
645 #define GAP_DEDICATED_BONDING_COMPLETED                    0xE1
646 
647 /**
648  * @format 11B1JV
649  * @param advertising_event_type
650  * @param address_type
651  * @param address
652  * @param rssi
653  * @param data_length
654  * @param data
655  */
656 #define GAP_LE_ADVERTISING_REPORT                          0xE2
657 
658 #define HCI_EVENT_HSP_META                                 0xE8
659 
660 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x01
661 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x02
662 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x03
663 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x04
664 #define HSP_SUBEVENT_HS_COMMAND                            0x05
665 #define HSP_SUBEVENT_AG_INDICATION                         0x06
666 #define HSP_SUBEVENT_ERROR                                 0x07
667 #define HSP_SUBEVENT_RING                                  0x08
668 
669 #define HCI_EVENT_HFP_META                                 0xE9
670 
671 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
672 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
673 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
674 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
675 #define HFP_SUBEVENT_COMPLETE                              0x05
676 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
677 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
678 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR          0x08
679 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE            0x09
680 #define HFP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x0A
681 
682 // ANCS Client
683 #define ANCS_CLIENT_CONNECTED                              0xF0
684 #define ANCS_CLIENT_NOTIFICATION                           0xF1
685 #define ANCS_CLIENT_DISCONNECTED                           0xF2
686 
687 // #define HCI_EVENT_HFP_META                                 0xxx
688 // #define HCI_EVENT_GATT_META                                0xxx
689 // #define HCI_EVENT_SDP_META                                 0xxx
690 // #define HCI_EVENT_ANCS_META                                0xxx
691 // #define HCI_EVENT_SM_META                                  0xxx
692 // #define HCI_EVENT_GAP_META                                 0xxx
693 // #define HCI_EVENT_BNEP_META                                0xxx
694 // #define HCI_EVENT_PAN_META                                 0xxx
695 
696 #endif
697