xref: /btstack/src/btstack_defines.h (revision 616edd56bcd31feb1a533261862afdeab6d85517)
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 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
120 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
121 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
122 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
123 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
124 
125 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
126 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
127 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
128 
129 // COMMANDS
130 
131 #define OGF_BTSTACK 0x3d
132 
133 // cmds for BTstack
134 // get state: @returns HCI_STATE
135 #define BTSTACK_GET_STATE                                  0x01
136 
137 // set power mode: @param HCI_POWER_MODE
138 #define BTSTACK_SET_POWER_MODE                             0x02
139 
140 // set capture mode: @param on
141 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
142 
143 // get BTstack version
144 #define BTSTACK_GET_VERSION                                0x04
145 
146 // get system Bluetooth state
147 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
148 
149 // set system Bluetooth state
150 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
151 
152 // enable inquiry scan for this client
153 #define BTSTACK_SET_DISCOVERABLE                           0x07
154 
155 // set global Bluetooth state
156 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
157 
158 // create l2cap channel: @param bd_addr(48), psm (16)
159 #define L2CAP_CREATE_CHANNEL                               0x20
160 
161 // disconnect l2cap disconnect, @param channel(16), reason(8)
162 #define L2CAP_DISCONNECT                                   0x21
163 
164 // register l2cap service: @param psm(16), mtu (16)
165 #define L2CAP_REGISTER_SERVICE                             0x22
166 
167 // unregister l2cap disconnect, @param psm(16)
168 #define L2CAP_UNREGISTER_SERVICE                           0x23
169 
170 // accept connection @param bd_addr(48), dest cid (16)
171 #define L2CAP_ACCEPT_CONNECTION                            0x24
172 
173 // decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8)
174 #define L2CAP_DECLINE_CONNECTION                           0x25
175 
176 // create l2cap channel: @param bd_addr(48), psm (16), mtu (16)
177 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
178 
179 // register SDP Service Record: service record (size)
180 #define SDP_REGISTER_SERVICE_RECORD                        0x30
181 
182 // unregister SDP Service Record
183 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
184 
185 // Get remote RFCOMM services
186 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
187 
188 // Get remote SDP services
189 #define SDP_CLIENT_QUERY_SERVICES                          0x33
190 
191 // RFCOMM "HCI" Commands
192 #define RFCOMM_CREATE_CHANNEL       0x40
193 #define RFCOMM_DISCONNECT     0x41
194 #define RFCOMM_REGISTER_SERVICE     0x42
195 #define RFCOMM_UNREGISTER_SERVICE   0x43
196 #define RFCOMM_ACCEPT_CONNECTION    0x44
197 #define RFCOMM_DECLINE_CONNECTION   0x45
198 #define RFCOMM_PERSISTENT_CHANNEL   0x46
199 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
200 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
201 #define RFCOMM_GRANT_CREDITS                 0x49
202 
203 // GAP Classic 0x50
204 #define GAP_DISCONNECT              0x50
205 
206 // GAP LE      0x60
207 #define GAP_LE_SCAN_START           0x60
208 #define GAP_LE_SCAN_STOP            0x61
209 #define GAP_LE_CONNECT              0x62
210 #define GAP_LE_CONNECT_CANCEL       0x63
211 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
212 
213 // GATT (Client) 0x70
214 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
215 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
216 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
217 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
218 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
219 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
220 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
221 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
222 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
223 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
224 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
225 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
226 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
227 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
228 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
229 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
230 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
231 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
232 #define GATT_GET_MTU                                             0x82
233 
234 
235 // EVENTS
236 
237 /**
238  * @format 1
239  * @param state
240  */
241 #define BTSTACK_EVENT_STATE                                0x60
242 
243 // data: event(8), len(8), nr hci connections
244 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
245 
246 /**
247  * @format
248  */
249 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
250 
251 /**
252  * @format 112
253  * @param major
254  * @param minor
255  @ @param revision
256  */
257 #define BTSTACK_EVENT_VERSION                              0x63
258 
259 // data: system bluetooth on/off (bool)
260 #define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED             0x64
261 
262 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
263 #define BTSTACK_EVENT_REMOTE_NAME_CACHED                   0x65
264 
265 // data: discoverable enabled (bool)
266 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
267 
268 // Daemon Events used internally
269 
270 // data: event(8)
271 #define DAEMON_EVENT_CONNECTION_OPENED                     0x68
272 
273 // data: event(8)
274 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x69
275 
276 // data: event(8), nr_connections(8)
277 #define DAEMON_NR_CONNECTIONS_CHANGED                      0x6A
278 
279 // data: event(8)
280 #define DAEMON_EVENT_NEW_RFCOMM_CREDITS                    0x6B
281 
282 // data: event(8)
283 #define DAEMON_EVENT_HCI_PACKET_SENT                       0x6C
284 
285 // L2CAP EVENTS
286 
287 // 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)
288 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
289 
290 // data: event (8), len(8), channel (16)
291 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
292 
293 // data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16)
294 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
295 
296 // data: event(8), len(8), handle(16)
297 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
298 
299 // data: event(8), len(8), local_cid(16), credits(8)
300 #define L2CAP_EVENT_CREDITS                                0x74
301 
302 // data: event(8), len(8), status (8), psm (16)
303 #define L2CAP_EVENT_SERVICE_REGISTERED                     0x75
304 
305 // data: event(8), len(8), handle(16), interval min(16), interval max(16), latency(16), timeout multiplier(16)
306 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
307 
308 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
309 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
310 
311 // RFCOMM EVENTS
312 /**
313  * @format 1B2122
314  * @param status
315  * @param bd_addr
316  * @param con_handle
317  * @param server_channel
318  * @param rfcomm_cid
319  * @param max_frame_size
320  */
321 #define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE                 0x80
322 
323 /**
324  * @format 2
325  * @param rfcomm_cid
326  */
327 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
328 
329 /**
330  * @format B12
331  * @param bd_addr
332  * @param server_channel
333  * @param rfcomm_cid
334  */
335 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
336 
337 /**
338  * @format 21
339  * @param rfcomm_cid
340  * @param line_status
341  */
342 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
343 
344 /**
345  * @format 21
346  * @param rfcomm_cid
347  * @param credits
348  */
349 #define RFCOMM_EVENT_CREDITS                               0x84
350 
351 /**
352  * @format 11
353  * @param status
354  * @param channel_id
355  */
356 #define RFCOMM_EVENT_SERVICE_REGISTERED                    0x85
357 
358 /**
359  * @format 11
360  * @param status
361  * @param server_channel_id
362  */
363 #define RFCOMM_EVENT_PERSISTENT_CHANNEL                    0x86
364 
365 // data: event (8), len(8), rfcomm_cid (16), modem status (8)
366 
367 /**
368  * @format 21
369  * @param rfcomm_cid
370  * @param modem_status
371  */
372 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
373 
374 // data: event (8), len(8), rfcomm_cid (16), rpn_data_t (67)
375  /**
376   * TODO: format for variable data
377   * @param rfcomm_cid
378   * @param rpn_data
379   */
380 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
381 
382 
383 // data: event(8), len(8), status(8), service_record_handle(32)
384  /**
385   * @format 14
386   * @param status
387   * @param service_record_handle
388   */
389 #define SDP_SERVICE_REGISTERED                             0x90
390 
391 // data: event(8), len(8), status(8)
392 /**
393  * @format 1
394  * @param status
395  */
396 #define SDP_QUERY_COMPLETE                                 0x91
397 
398 // data: event(8), len(8), rfcomm channel(8), name(var)
399 /**
400  * @format 1T
401  * @param rfcomm_channel
402  * @param name
403  * @brief SDP_QUERY_RFCOMM_SERVICE 0x92
404  */
405 #define SDP_QUERY_RFCOMM_SERVICE                           0x92
406 
407 // data: event(8), len(8), record nr(16), attribute id(16), attribute value(var)
408 /**
409  * TODO: format for variable data
410  * @param record_nr
411  * @param attribute_id
412  * @param attribute_value
413  */
414 #define SDP_QUERY_ATTRIBUTE_VALUE                          0x93
415 
416 // not provided by daemon, only used for internal testing
417 #define SDP_QUERY_SERVICE_RECORD_HANDLE                    0x94
418 
419 /**
420  * @format H1
421  * @param handle
422  * @param status
423  */
424 #define GATT_QUERY_COMPLETE                                0xA0
425 
426 /**
427  * @format HX
428  * @param handle
429  * @param service
430  */
431 #define GATT_SERVICE_QUERY_RESULT                          0xA1
432 
433 /**
434  * @format HY
435  * @param handle
436  * @param characteristic
437  */
438 #define GATT_CHARACTERISTIC_QUERY_RESULT                   0xA2
439 
440 /**
441  * @format H2X
442  * @param handle
443  * @param include_handle
444  * @param service
445  */
446 #define GATT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
447 
448 /**
449  * @format HZ
450  * @param handle
451  * @param characteristic_descriptor
452  */
453 #define GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
454 
455 /**
456  * @format H2LV
457  * @param handle
458  * @param value_handle
459  * @param value_length
460  * @param value
461  */
462 #define GATT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
463 
464 /**
465  * @format H22LV
466  * @param handle
467  * @param value_handle
468  * @param value_offset
469  * @param value_length
470  * @param value
471  */
472 #define GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
473 
474 /**
475  * @format H2LV
476  * @param handle
477  * @param value_handle
478  * @param value_length
479  * @param value
480  */
481 #define GATT_NOTIFICATION                                  0xA7
482 
483 /**
484  * @format H2LV
485  * @param handle
486  * @param value_handle
487  * @param value_length
488  * @param value
489  */
490 #define GATT_INDICATION                                    0xA8
491 
492 /**
493  * @format H2LV
494  * @param descriptor_handle
495  * @param descriptor_length
496  * @param descriptor
497  */
498 #define GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
499 
500 /**
501  * @format H2LV
502  * @param handle
503  * @param descriptor_offset
504  * @param descriptor_length
505  * @param descriptor
506  */
507 #define GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
508 
509 /**
510  * @format H2
511  * @param handle
512  * @param MTU
513  */
514 #define GATT_MTU                                           0xAB
515 
516 /**
517  * @format H2
518  * @param handle
519  * @param MTU
520  */
521 #define ATT_MTU_EXCHANGE_COMPLETE                          0xB5
522 
523 // data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
524 #define ATT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
525 
526 
527 // data: event(8), len(8), status (8), bnep service uuid (16)
528 #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
529 
530 // data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
531 #define BNEP_EVENT_OPEN_CHANNEL_COMPLETE                   0xC1
532 
533 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
534 #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
535 
536 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48), channel state (8)
537 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
538 
539 // data: event(8), len(8)
540 #define BNEP_EVENT_READY_TO_SEND                           0xC4
541 
542  /**
543   * @format H1B
544   * @param handle
545   * @param addr_type
546   * @param address
547   */
548 #define SM_JUST_WORKS_REQUEST                              0xD0
549 
550  /**
551   * @format H1B
552   * @param handle
553   * @param addr_type
554   * @param address
555   */
556 #define SM_JUST_WORKS_CANCEL                               0xD1
557 
558  /**
559   * @format H1B4
560   * @param handle
561   * @param addr_type
562   * @param address
563   * @param passkey
564   */
565 #define SM_PASSKEY_DISPLAY_NUMBER                          0xD2
566 
567  /**
568   * @format H1B
569   * @param handle
570   * @param addr_type
571   * @param address
572   */
573 #define SM_PASSKEY_DISPLAY_CANCEL                          0xD3
574 
575  /**
576   * @format H1B421
577   * @param handle
578   * @param addr_type
579   * @param address
580   */
581 #define SM_PASSKEY_INPUT_NUMBER                            0xD4
582 
583  /**
584   * @format H1B
585   * @param handle
586   * @param addr_type
587   * @param address
588   */
589 #define SM_PASSKEY_INPUT_CANCEL                            0xD5
590 
591  /**
592   * @format H1B
593   * @param handle
594   * @param addr_type
595   * @param address
596   */
597 #define SM_IDENTITY_RESOLVING_STARTED                      0xD6
598 
599  /**
600   * @format H1B
601   * @param handle
602   * @param addr_type
603   * @param address
604   */
605 #define SM_IDENTITY_RESOLVING_FAILED                       0xD7
606 
607  /**
608   * @format H1B2
609   * @param handle
610   * @param addr_type
611   * @param address
612   * @param le_device_db_index
613   */
614 #define SM_IDENTITY_RESOLVING_SUCCEEDED                    0xD8
615 
616  /**
617   * @format H1B
618   * @param handle
619   * @param addr_type
620   * @param address
621   */
622 #define SM_AUTHORIZATION_REQUEST                           0xD9
623 
624  /**
625   * @format H1B1
626   * @param handle
627   * @param addr_type
628   * @param address
629   * @param authorization_result
630   */
631 #define SM_AUTHORIZATION_RESULT                            0xDA
632 
633 // GAP
634 
635 // data: event(8), len(8), hci_handle (16), security_level (8)
636 #define GAP_SECURITY_LEVEL                                 0xE0
637 
638 // data: event(8), len(8), status (8), bd_addr(48)
639 #define GAP_DEDICATED_BONDING_COMPLETED                    0xE1
640 
641 /**
642  * @format 11B1JV
643  * @param advertising_event_type
644  * @param address_type
645  * @param address
646  * @param rssi
647  * @param data_length
648  * @param data
649  */
650 #define GAP_LE_ADVERTISING_REPORT                          0xE2
651 
652 #define HCI_EVENT_HSP_META                                 0xE8
653 
654 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x01
655 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x02
656 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x03
657 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x04
658 #define HSP_SUBEVENT_HS_COMMAND                            0x05
659 #define HSP_SUBEVENT_AG_INDICATION                         0x06
660 #define HSP_SUBEVENT_ERROR                                 0x07
661 #define HSP_SUBEVENT_RING                                  0x08
662 
663 #define HCI_EVENT_HFP_META                                 0xE9
664 
665 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
666 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
667 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
668 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
669 #define HFP_SUBEVENT_COMPLETE                              0x05
670 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
671 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
672 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR          0x08
673 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE            0x09
674 #define HFP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x0A
675 
676 // ANCS Client
677 #define ANCS_CLIENT_CONNECTED                              0xF0
678 #define ANCS_CLIENT_NOTIFICATION                           0xF1
679 #define ANCS_CLIENT_DISCONNECTED                           0xF2
680 
681 // #define HCI_EVENT_HFP_META                                 0xxx
682 // #define HCI_EVENT_GATT_META                                0xxx
683 // #define HCI_EVENT_SDP_META                                 0xxx
684 // #define HCI_EVENT_ANCS_META                                0xxx
685 // #define HCI_EVENT_SM_META                                  0xxx
686 // #define HCI_EVENT_GAP_META                                 0xxx
687 // #define HCI_EVENT_BNEP_META                                0xxx
688 // #define HCI_EVENT_PAN_META                                 0xxx
689 
690 #endif
691