xref: /btstack/src/btstack_defines.h (revision 5611a760af48d1ce1beea59c7908be73bd2393f1)
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 /**
47  * Address types
48  * @note: BTstack uses a custom addr type to refer to classic ACL and SCO devices
49  */
50  typedef enum {
51     BD_ADDR_TYPE_LE_PUBLIC = 0,
52     BD_ADDR_TYPE_LE_RANDOM = 1,
53     BD_ADDR_TYPE_SCO       = 0xfe,
54     BD_ADDR_TYPE_CLASSIC   = 0xff,
55     BD_ADDR_TYPE_UNKNOWN   = 0xfe
56  } bd_addr_type_t;
57 
58 // DEFINES
59 
60 #define DAEMON_EVENT_PACKET     0x05
61 
62 // L2CAP data
63 #define L2CAP_DATA_PACKET       0x06
64 
65 // RFCOMM data
66 #define RFCOMM_DATA_PACKET      0x07
67 
68 // Attribute protocol data
69 #define ATT_DATA_PACKET         0x08
70 
71 // Security Manager protocol data
72 #define SM_DATA_PACKET          0x09
73 
74 // SDP query result
75 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
76 #define SDP_CLIENT_PACKET       0x0a
77 
78 // BNEP data
79 #define BNEP_DATA_PACKET        0x0b
80 
81 // Unicast Connectionless Data
82 #define UCD_DATA_PACKET         0x0c
83 
84 // debug log messages
85 #define LOG_MESSAGE_PACKET      0xfc
86 
87 
88 // ERRORS
89 
90 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
91 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED              0x50
92 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH         0x51
93 #define BTSTACK_ACTIVATION_POWERON_FAILED                  0x52
94 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN                  0x53
95 #define BTSTACK_NOT_ACTIVATED                              0x54
96 #define BTSTACK_BUSY                                       0x55
97 #define BTSTACK_MEMORY_ALLOC_FAILED                        0x56
98 #define BTSTACK_ACL_BUFFERS_FULL                           0x57
99 
100 // l2cap errors - enumeration by the command that created them
101 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
102 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
103 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
104 
105 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL        0x63
106 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING           0x64
107 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM       0x65
108 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY  0x66
109 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
110 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT       0x68
111 
112 #define L2CAP_SERVICE_ALREADY_REGISTERED                   0x69
113 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU                  0x6A
114 
115 #define RFCOMM_MULTIPLEXER_STOPPED                         0x70
116 #define RFCOMM_CHANNEL_ALREADY_REGISTERED                  0x71
117 #define RFCOMM_NO_OUTGOING_CREDITS                         0x72
118 #define RFCOMM_AGGREGATE_FLOW_OFF                          0x73
119 #define RFCOMM_DATA_LEN_EXCEEDS_MTU                        0x74
120 
121 #define SDP_HANDLE_ALREADY_REGISTERED                      0x80
122 #define SDP_QUERY_INCOMPLETE                               0x81
123 #define SDP_SERVICE_NOT_FOUND                              0x82
124 #define SDP_HANDLE_INVALID                                 0x83
125 
126 #define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS            0x90
127 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT                0x91
128 
129 #define GATT_CLIENT_NOT_CONNECTED                          0x93
130 #define GATT_CLIENT_BUSY                                   0x94
131 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
132 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
133 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
134 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
135 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
136 
137 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
138 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
139 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
140 
141 // COMMANDS
142 
143 #define OGF_BTSTACK 0x3d
144 
145 // cmds for BTstack
146 // get state: @returns HCI_STATE
147 #define BTSTACK_GET_STATE                                  0x01
148 
149 // set power mode: @param HCI_POWER_MODE
150 #define BTSTACK_SET_POWER_MODE                             0x02
151 
152 // set capture mode: @param on
153 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
154 
155 // get BTstack version
156 #define BTSTACK_GET_VERSION                                0x04
157 
158 // get system Bluetooth state
159 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
160 
161 // set system Bluetooth state
162 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
163 
164 // enable inquiry scan for this client
165 #define BTSTACK_SET_DISCOVERABLE                           0x07
166 
167 // set global Bluetooth state
168 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
169 
170 // create l2cap channel: @param bd_addr(48), psm (16)
171 #define L2CAP_CREATE_CHANNEL                               0x20
172 
173 // disconnect l2cap disconnect, @param channel(16), reason(8)
174 #define L2CAP_DISCONNECT                                   0x21
175 
176 // register l2cap service: @param psm(16), mtu (16)
177 #define L2CAP_REGISTER_SERVICE                             0x22
178 
179 // unregister l2cap disconnect, @param psm(16)
180 #define L2CAP_UNREGISTER_SERVICE                           0x23
181 
182 // accept connection @param bd_addr(48), dest cid (16)
183 #define L2CAP_ACCEPT_CONNECTION                            0x24
184 
185 // decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8)
186 #define L2CAP_DECLINE_CONNECTION                           0x25
187 
188 // create l2cap channel: @param bd_addr(48), psm (16), mtu (16)
189 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
190 
191 // register SDP Service Record: service record (size)
192 #define SDP_REGISTER_SERVICE_RECORD                        0x30
193 
194 // unregister SDP Service Record
195 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
196 
197 // Get remote RFCOMM services
198 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
199 
200 // Get remote SDP services
201 #define SDP_CLIENT_QUERY_SERVICES                          0x33
202 
203 // RFCOMM "HCI" Commands
204 #define RFCOMM_CREATE_CHANNEL       0x40
205 #define RFCOMM_DISCONNECT     0x41
206 #define RFCOMM_REGISTER_SERVICE     0x42
207 #define RFCOMM_UNREGISTER_SERVICE   0x43
208 #define RFCOMM_ACCEPT_CONNECTION    0x44
209 #define RFCOMM_DECLINE_CONNECTION   0x45
210 #define RFCOMM_PERSISTENT_CHANNEL   0x46
211 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
212 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
213 #define RFCOMM_GRANT_CREDITS                 0x49
214 
215 // GAP Classic 0x50
216 #define GAP_DISCONNECT              0x50
217 
218 // GAP LE      0x60
219 #define GAP_LE_SCAN_START           0x60
220 #define GAP_LE_SCAN_STOP            0x61
221 #define GAP_LE_CONNECT              0x62
222 #define GAP_LE_CONNECT_CANCEL       0x63
223 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
224 
225 // GATT (Client) 0x70
226 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
227 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
228 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
229 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
230 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
231 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
232 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
233 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
234 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
235 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
236 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
237 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
238 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
239 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
240 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
241 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
242 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
243 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
244 #define GATT_GET_MTU                                             0x82
245 
246 
247 // EVENTS
248 
249 /**
250  * @format 1
251  * @param state
252  */
253 #define BTSTACK_EVENT_STATE                                0x60
254 
255 // data: event(8), len(8), nr hci connections
256 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
257 
258 /**
259  * @format
260  */
261 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
262 
263 /**
264  * @format 112
265  * @param major
266  * @param minor
267  @ @param revision
268  */
269 #define BTSTACK_EVENT_VERSION                              0x63
270 
271 // data: system bluetooth on/off (bool)
272 #define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED             0x64
273 
274 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
275 #define BTSTACK_EVENT_REMOTE_NAME_CACHED                   0x65
276 
277 // data: discoverable enabled (bool)
278 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
279 
280 // Daemon Events used internally
281 
282 // data: event(8)
283 #define DAEMON_EVENT_CONNECTION_OPENED                     0x68
284 
285 // data: event(8)
286 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x69
287 
288 // data: event(8), nr_connections(8)
289 #define DAEMON_NR_CONNECTIONS_CHANGED                      0x6A
290 
291 // data: event(8)
292 #define DAEMON_EVENT_NEW_RFCOMM_CREDITS                    0x6B
293 
294 // data: event(8)
295 #define DAEMON_EVENT_HCI_PACKET_SENT                       0x6C
296 
297 // L2CAP EVENTS
298 
299 // 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)
300 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
301 
302 // data: event (8), len(8), channel (16)
303 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
304 
305 // data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16)
306 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
307 
308 // data: event(8), len(8), handle(16)
309 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
310 
311 // data: event(8), len(8), local_cid(16), credits(8)
312 #define L2CAP_EVENT_CREDITS                                0x74
313 
314 // data: event(8), len(8), status (8), psm (16)
315 #define L2CAP_EVENT_SERVICE_REGISTERED                     0x75
316 
317 // data: event(8), len(8), handle(16), interval min(16), interval max(16), latency(16), timeout multiplier(16)
318 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
319 
320 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
321 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
322 
323 // RFCOMM EVENTS
324 /**
325  * @format 1B2122
326  * @param status
327  * @param bd_addr
328  * @param con_handle
329  * @param server_channel
330  * @param rfcomm_cid
331  * @param max_frame_size
332  */
333 #define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE                 0x80
334 
335 /**
336  * @format 2
337  * @param rfcomm_cid
338  */
339 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
340 
341 /**
342  * @format B12
343  * @param bd_addr
344  * @param server_channel
345  * @param rfcomm_cid
346  */
347 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
348 
349 /**
350  * @format 21
351  * @param rfcomm_cid
352  * @param line_status
353  */
354 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
355 
356 /**
357  * @format 21
358  * @param rfcomm_cid
359  * @param credits
360  */
361 #define RFCOMM_EVENT_CREDITS                               0x84
362 
363 /**
364  * @format 11
365  * @param status
366  * @param channel_id
367  */
368 #define RFCOMM_EVENT_SERVICE_REGISTERED                    0x85
369 
370 /**
371  * @format 11
372  * @param status
373  * @param server_channel_id
374  */
375 #define RFCOMM_EVENT_PERSISTENT_CHANNEL                    0x86
376 
377 /**
378  * @format 21
379  * @param rfcomm_cid
380  * @param modem_status
381  */
382 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
383 
384  /**
385   * TODO: format for variable data 2?
386   * @param rfcomm_cid
387   * @param rpn_data
388   */
389 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
390 
391 /**
392   * @format 14
393   * @param status
394   * @param service_record_handle
395   */
396 #define SDP_EVENT_SERVICE_REGISTERED                             0x90
397 
398 /**
399  * @format 1
400  * @param status
401  */
402 #define SDP_EVENT_QUERY_COMPLETE                                 0x91
403 
404 /**
405  * @format 1T
406  * @param rfcomm_channel
407  * @param name
408  */
409 #define SDP_EVENT_QUERY_RFCOMM_SERVICE                           0x92
410 
411 /**
412  * @format 22221
413  * @param record_id
414  * @param attribute_id
415  * @param attribute_length
416  * @param data_offset
417  * @param data
418  */
419 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE                           0x93
420 
421 /**
422  * @format 22LV
423  * @param record_id
424  * @param attribute_id
425  * @param attribute_length
426  * @param attribute_value
427  */
428 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE                          0x94
429 
430 /**
431  * @format 224
432  * @param total_count
433  * @param record_index
434  * @param record_handle
435  * @note Not provided by daemon, only used for internal testing
436  */
437 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE                    0x95
438 
439 /**
440  * @format H1
441  * @param handle
442  * @param status
443  */
444 #define GATT_EVENT_QUERY_COMPLETE                                0xA0
445 
446 /**
447  * @format HX
448  * @param handle
449  * @param service
450  */
451 #define GATT_EVENT_SERVICE_QUERY_RESULT                          0xA1
452 
453 /**
454  * @format HY
455  * @param handle
456  * @param characteristic
457  */
458 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT                   0xA2
459 
460 /**
461  * @format H2X
462  * @param handle
463  * @param include_handle
464  * @param service
465  */
466 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
467 
468 /**
469  * @format HZ
470  * @param handle
471  * @param characteristic_descriptor
472  */
473 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
474 
475 /**
476  * @format H2LV
477  * @param handle
478  * @param value_handle
479  * @param value_length
480  * @param value
481  */
482 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
483 
484 /**
485  * @format H22LV
486  * @param handle
487  * @param value_handle
488  * @param value_offset
489  * @param value_length
490  * @param value
491  */
492 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
493 
494 /**
495  * @format H2LV
496  * @param handle
497  * @param value_handle
498  * @param value_length
499  * @param value
500  */
501 #define GATT_EVENT_NOTIFICATION                                  0xA7
502 
503 /**
504  * @format H2LV
505  * @param handle
506  * @param value_handle
507  * @param value_length
508  * @param value
509  */
510 #define GATT_EVENT_INDICATION                                    0xA8
511 
512 /**
513  * @format H2LV
514  * @param descriptor_handle
515  * @param descriptor_length
516  * @param descriptor
517  */
518 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
519 
520 /**
521  * @format H2LV
522  * @param handle
523  * @param descriptor_offset
524  * @param descriptor_length
525  * @param descriptor
526  */
527 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
528 
529 /**
530  * @format H2
531  * @param handle
532  * @param MTU
533  */
534 #define GATT_EVENT_MTU                                           0xAB
535 
536 /**
537  * @format H2
538  * @param handle
539  * @param MTU
540  */
541 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
542 
543 // data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
544 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
545 
546 
547 // data: event(8), len(8), status (8), bnep service uuid (16)
548 #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
549 
550 // data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
551 #define BNEP_EVENT_OPEN_CHANNEL_COMPLETE                   0xC1
552 
553 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
554 #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
555 
556 // data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48), channel state (8)
557 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
558 
559 // data: event(8), len(8)
560 #define BNEP_EVENT_READY_TO_SEND                           0xC4
561 
562  /**
563   * @format H1B
564   * @param handle
565   * @param addr_type
566   * @param address
567   */
568 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
569 
570  /**
571   * @format H1B
572   * @param handle
573   * @param addr_type
574   * @param address
575   */
576 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
577 
578  /**
579   * @format H1B4
580   * @param handle
581   * @param addr_type
582   * @param address
583   * @param passkey
584   */
585 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
586 
587  /**
588   * @format H1B
589   * @param handle
590   * @param addr_type
591   * @param address
592   */
593 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
594 
595  /**
596   * @format H1B421
597   * @param handle
598   * @param addr_type
599   * @param address
600   */
601 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
602 
603  /**
604   * @format H1B
605   * @param handle
606   * @param addr_type
607   * @param address
608   */
609 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
610 
611  /**
612   * @format H1B
613   * @param handle
614   * @param addr_type
615   * @param address
616   */
617 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD6
618 
619  /**
620   * @format H1B
621   * @param handle
622   * @param addr_type
623   * @param address
624   */
625 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD7
626 
627  /**
628   * @format H1B2
629   * @param handle
630   * @param addr_type
631   * @param address
632   * @param le_device_db_index
633   */
634 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xD8
635 
636  /**
637   * @format H1B
638   * @param handle
639   * @param addr_type
640   * @param address
641   */
642 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xD9
643 
644  /**
645   * @format H1B1
646   * @param handle
647   * @param addr_type
648   * @param address
649   * @param authorization_result
650   */
651 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDA
652 
653 // GAP
654 
655 // data: event(8), len(8), hci_handle (16), security_level (8)
656 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
657 
658 // data: event(8), len(8), status (8), bd_addr(48)
659 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
660 
661 /**
662  * @format 11B1JV
663  * @param advertising_event_type
664  * @param address_type
665  * @param address
666  * @param rssi
667  * @param data_length
668  * @param data
669  */
670 #define GAP_LE_EVENT_ADVERTISING_REPORT                          0xE2
671 
672 #define HCI_EVENT_HSP_META                                 0xE8
673 
674 #define HSP_SUBEVENT_ERROR                                 0x01
675 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x02
676 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x03
677 #define HSP_SUBEVENT_RING                                  0x04
678 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x05
679 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x06
680 #define HSP_SUBEVENT_HS_COMMAND                            0x07
681 #define HSP_SUBEVENT_AG_INDICATION                         0x08
682 
683 #define HCI_EVENT_HFP_META                                 0xE9
684 
685 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
686 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
687 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
688 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
689 #define HFP_SUBEVENT_COMPLETE                              0x05
690 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
691 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
692 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR          0x08
693 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE            0x09
694 #define HFP_SUBEVENT_START_RINGINIG                        0x0A
695 #define HFP_SUBEVENT_STOP_RINGINIG                         0x0B
696 #define HFP_SUBEVENT_CALL_TERMINATED                       0x0C
697 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                0x0D
698 #define HFP_SUBEVENT_REDIAL_LAST_NUMBER                    0x0E
699 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG            0x0F
700 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                  0x10
701 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                   0x11
702 #define HFP_SUBEVENT_TRANSMIT_STATUS_OF_CURRENT_CALL       0x12
703 #define HFP_SUBEVENT_CALL_ANSWERED                         0x13
704 #define HFP_SUBEVENT_CONFERENCE_CALL                       0x14
705 #define HFP_SUBEVENT_RING                                  0x15
706 #define HFP_SUBEVENT_SPEAKER_VOLUME                        0x16
707 #define HFP_SUBEVENT_MICROPHONE_VOLUME                     0x17
708 
709 // ANCS Client
710 
711 /**
712  * @format H
713  * @param handle
714  */
715 #define ANCS_EVENT_CLIENT_CONNECTED                              0xF0
716 
717 /**
718  * @format H2T
719  * @param handle
720  * @param attribute_id
721  * @param text
722  */
723 #define ANCS_EVENT_CLIENT_NOTIFICATION                           0xF1
724 
725 /**
726  * @format H
727  * @param handle
728  */
729 #define ANCS_EVENT_CLIENT_DISCONNECTED                           0xF2
730 
731 // #define HCI_EVENT_HFP_META                                 0xxx
732 // #define HCI_EVENT_GATT_META                                0xxx
733 // #define HCI_EVENT_SDP_META                                 0xxx
734 // #define HCI_EVENT_ANCS_META                                0xxx
735 // #define HCI_EVENT_SM_META                                  0xxx
736 // #define HCI_EVENT_GAP_META                                 0xxx
737 // #define HCI_EVENT_BNEP_META                                0xxx
738 // #define HCI_EVENT_PAN_META                                 0xxx
739 
740 #endif
741