xref: /btstack/src/btstack_defines.h (revision 52cab08964fb8e5c770bf702910cf55166b07fa7)
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 #include <stdint.h>
47 #include "btstack_linked_list.h"
48 
49 // TYPES
50 
51 // packet handler
52 typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
53 
54 // packet callback supporting multiple registrations
55 typedef struct {
56     btstack_linked_item_t    item;
57     btstack_packet_handler_t callback;
58 } btstack_packet_callback_registration_t;
59 
60 /**
61  * @brief 128 bit key used with AES128 in Security Manager
62  */
63 typedef uint8_t sm_key_t[16];
64 
65 // DEFINES
66 
67 #define DAEMON_EVENT_PACKET     0x05
68 
69 // L2CAP data
70 #define L2CAP_DATA_PACKET       0x06
71 
72 // RFCOMM data
73 #define RFCOMM_DATA_PACKET      0x07
74 
75 // Attribute protocol data
76 #define ATT_DATA_PACKET         0x08
77 
78 // Security Manager protocol data
79 #define SM_DATA_PACKET          0x09
80 
81 // SDP query result
82 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
83 #define SDP_CLIENT_PACKET       0x0a
84 
85 // BNEP data
86 #define BNEP_DATA_PACKET        0x0b
87 
88 // Unicast Connectionless Data
89 #define UCD_DATA_PACKET         0x0c
90 
91 // debug log messages
92 #define LOG_MESSAGE_PACKET      0xfc
93 
94 
95 // ERRORS
96 
97 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
98 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED              0x50
99 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH         0x51
100 #define BTSTACK_ACTIVATION_POWERON_FAILED                  0x52
101 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN                  0x53
102 #define BTSTACK_NOT_ACTIVATED                              0x54
103 #define BTSTACK_BUSY                                       0x55
104 #define BTSTACK_MEMORY_ALLOC_FAILED                        0x56
105 #define BTSTACK_ACL_BUFFERS_FULL                           0x57
106 
107 // l2cap errors - enumeration by the command that created them
108 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
109 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
110 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
111 
112 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL        0x63
113 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING           0x64
114 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM       0x65
115 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY  0x66
116 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
117 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT       0x68
118 
119 #define L2CAP_SERVICE_ALREADY_REGISTERED                   0x69
120 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU                  0x6A
121 
122 #define RFCOMM_MULTIPLEXER_STOPPED                         0x70
123 #define RFCOMM_CHANNEL_ALREADY_REGISTERED                  0x71
124 #define RFCOMM_NO_OUTGOING_CREDITS                         0x72
125 #define RFCOMM_AGGREGATE_FLOW_OFF                          0x73
126 #define RFCOMM_DATA_LEN_EXCEEDS_MTU                        0x74
127 
128 #define SDP_HANDLE_ALREADY_REGISTERED                      0x80
129 #define SDP_QUERY_INCOMPLETE                               0x81
130 #define SDP_SERVICE_NOT_FOUND                              0x82
131 #define SDP_HANDLE_INVALID                                 0x83
132 #define SDP_QUERY_BUSY                                     0x84
133 
134 #define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS            0x90
135 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT                0x91
136 
137 #define GATT_CLIENT_NOT_CONNECTED                          0x93
138 #define GATT_CLIENT_BUSY                                   0x94
139 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
140 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
141 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
142 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
143 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
144 
145 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
146 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
147 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
148 
149 // COMMANDS
150 
151 #define OGF_BTSTACK 0x3d
152 
153 // cmds for BTstack
154 // get state: @returns HCI_STATE
155 #define BTSTACK_GET_STATE                                  0x01
156 
157 // set power mode: param HCI_POWER_MODE
158 #define BTSTACK_SET_POWER_MODE                             0x02
159 
160 // set capture mode: param on
161 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
162 
163 // get BTstack version
164 #define BTSTACK_GET_VERSION                                0x04
165 
166 // get system Bluetooth state
167 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
168 
169 // set system Bluetooth state
170 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
171 
172 // enable inquiry scan for this client
173 #define BTSTACK_SET_DISCOVERABLE                           0x07
174 
175 // set global Bluetooth state
176 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
177 
178 // create l2cap channel: param bd_addr(48), psm (16)
179 #define L2CAP_CREATE_CHANNEL                               0x20
180 
181 // disconnect l2cap disconnect, param channel(16), reason(8)
182 #define L2CAP_DISCONNECT                                   0x21
183 
184 // register l2cap service: param psm(16), mtu (16)
185 #define L2CAP_REGISTER_SERVICE                             0x22
186 
187 // unregister l2cap disconnect, param psm(16)
188 #define L2CAP_UNREGISTER_SERVICE                           0x23
189 
190 // accept connection param bd_addr(48), dest cid (16)
191 #define L2CAP_ACCEPT_CONNECTION                            0x24
192 
193 // decline l2cap disconnect,param bd_addr(48), dest cid (16), reason(8)
194 #define L2CAP_DECLINE_CONNECTION                           0x25
195 
196 // create l2cap channel: param bd_addr(48), psm (16), mtu (16)
197 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
198 
199 // register SDP Service Record: service record (size)
200 #define SDP_REGISTER_SERVICE_RECORD                        0x30
201 
202 // unregister SDP Service Record
203 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
204 
205 // Get remote RFCOMM services
206 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
207 
208 // Get remote SDP services
209 #define SDP_CLIENT_QUERY_SERVICES                          0x33
210 
211 // RFCOMM "HCI" Commands
212 #define RFCOMM_CREATE_CHANNEL       0x40
213 #define RFCOMM_DISCONNECT     0x41
214 #define RFCOMM_REGISTER_SERVICE     0x42
215 #define RFCOMM_UNREGISTER_SERVICE   0x43
216 #define RFCOMM_ACCEPT_CONNECTION    0x44
217 #define RFCOMM_DECLINE_CONNECTION   0x45
218 #define RFCOMM_PERSISTENT_CHANNEL   0x46
219 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
220 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
221 #define RFCOMM_GRANT_CREDITS                 0x49
222 
223 // GAP Classic 0x50
224 #define GAP_DISCONNECT              0x50
225 
226 // GAP LE      0x60
227 #define GAP_LE_SCAN_START           0x60
228 #define GAP_LE_SCAN_STOP            0x61
229 #define GAP_LE_CONNECT              0x62
230 #define GAP_LE_CONNECT_CANCEL       0x63
231 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
232 
233 // GATT (Client) 0x70
234 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
235 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
236 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
237 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
238 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
239 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
240 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
241 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
242 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
243 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
244 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
245 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
246 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
247 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
248 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
249 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
250 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
251 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
252 #define GATT_GET_MTU                                             0x82
253 
254 
255 // EVENTS
256 
257 /**
258  * @format 1
259  * @param state
260  */
261 #define BTSTACK_EVENT_STATE                                0x60
262 
263 // data: event(8), len(8), nr hci connections
264 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
265 
266 /**
267  * @format
268  */
269 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
270 
271 /**
272  * @format 1
273  * @param discoverable
274  */
275 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
276 
277 // Daemon Events
278 
279 /**
280  * @format 112
281  * @param major
282  * @param minor
283  @ @param revision
284  */
285 #define DAEMON_EVENT_VERSION                               0x63
286 
287 // data: system bluetooth on/off (bool)
288 /**
289  * @format 1
290  * param system_bluetooth_enabled
291  */
292 #define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED              0x64
293 
294 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
295 
296 /*
297  * @format 1BT
298  * @param status == 0 to match read_remote_name_request
299  * @param address
300  * @param name
301  */
302 #define DAEMON_EVENT_REMOTE_NAME_CACHED                    0x65
303 
304 // internal daemon events
305 
306 // data: event(8)
307 #define DAEMON_EVENT_CONNECTION_OPENED                     0x67
308 
309 // data: event(8)
310 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x68
311 
312 
313 // additional HCI events
314 
315 /**
316  * @brief Outgoing packet
317  */
318 #define HCI_EVENT_TRANSPORT_PACKET_SENT                    0x6E
319 
320 /**
321  * @format B
322  * @param handle
323  */
324 #define HCI_EVENT_SCO_CAN_SEND_NOW                         0x6F
325 
326 // L2CAP EVENTS
327 
328 /**
329  * @format 1BH222222
330  * @param status
331  * @param address
332  * @param handle
333  * @param psm
334  * @param local_cid
335  * @param remote_cid
336  * @param local_mtu
337  * @param remote_mtu
338  * @param flush_timeout
339  */
340 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
341 
342 /*
343  * @format 2
344  * @param local_cid
345  */
346 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
347 
348 /**
349  * @format 1BH222
350  * @param status
351  * @param address
352  * @param handle
353  * @param psm
354  * @param local_cid
355  * @param remote_cid
356  */
357 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
358 
359 // ??
360 // data: event(8), len(8), handle(16)
361 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
362 
363 // ??
364 // data: event(8), len(8), local_cid(16), credits(8)
365 #define L2CAP_EVENT_CREDITS                                0x74
366 
367 /**
368  * @format 12
369  * @param status
370  * @param psm
371  */
372 #define L2CAP_EVENT_SERVICE_REGISTERED                     0x75
373 
374 /**
375  * @format H2222
376  * @param handle
377  * @param interval_min
378  * @param interval_max
379  * @param latencey
380  * @param timeout_multiplier
381  */
382 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
383 
384 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
385  /**
386   * @format H2
387   * @param handle
388   * @result
389   */
390 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
391 
392 /**
393  * @format 2
394  * @param local_cid
395  */
396 #define L2CAP_EVENT_CAN_SEND_NOW                           0x78
397 
398 // RFCOMM EVENTS
399 
400 /**
401  * @format 1B2122
402  * @param status
403  * @param bd_addr
404  * @param con_handle
405  * @param server_channel
406  * @param rfcomm_cid
407  * @param max_frame_size
408  */
409 #define RFCOMM_EVENT_CHANNEL_OPENED                 0x80
410 
411 /**
412  * @format 2
413  * @param rfcomm_cid
414  */
415 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
416 
417 /**
418  * @format B12
419  * @param bd_addr
420  * @param server_channel
421  * @param rfcomm_cid
422  */
423 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
424 
425 /**
426  * @format 21
427  * @param rfcomm_cid
428  * @param line_status
429  */
430 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
431 
432 /**
433  * @format 21
434  * @param rfcomm_cid
435  * @param credits
436  */
437 #define RFCOMM_EVENT_CREDITS                               0x84
438 
439 /**
440  * @format 11
441  * @param status
442  * @param channel_id
443  */
444 #define RFCOMM_EVENT_SERVICE_REGISTERED                    0x85
445 
446 /**
447  * @format 11
448  * @param status
449  * @param server_channel_id
450  */
451 #define RFCOMM_EVENT_PERSISTENT_CHANNEL                    0x86
452 
453 /**
454  * @format 21
455  * @param rfcomm_cid
456  * @param modem_status
457  */
458 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
459 
460  /**
461   * TODO: format for variable data 2?
462   * param rfcomm_cid
463   * param rpn_data
464   */
465 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
466 
467 /**
468  * @format 2
469  * @param rfcomm_cid
470  */
471 #define RFCOMM_EVENT_CAN_SEND_NOW                          0x89
472 
473 
474 /**
475   * @format 14
476   * @param status
477   * @param service_record_handle
478   */
479 #define SDP_EVENT_SERVICE_REGISTERED                             0x90
480 
481 /**
482  * @format 1
483  * @param status
484  */
485 #define SDP_EVENT_QUERY_COMPLETE                                 0x91
486 
487 /**
488  * @format 1T
489  * @param rfcomm_channel
490  * @param name
491  */
492 #define SDP_EVENT_QUERY_RFCOMM_SERVICE                           0x92
493 
494 /**
495  * @format 22221
496  * @param record_id
497  * @param attribute_id
498  * @param attribute_length
499  * @param data_offset
500  * @param data
501  */
502 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE                           0x93
503 
504 /**
505  * @format 22LV
506  * @param record_id
507  * @param attribute_id
508  * @param attribute_length
509  * @param attribute_value
510  */
511 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE                          0x94
512 
513 /**
514  * @format 224
515  * @param total_count
516  * @param record_index
517  * @param record_handle
518  * @note Not provided by daemon, only used for internal testing
519  */
520 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE                    0x95
521 
522 /**
523  * @format H1
524  * @param handle
525  * @param status
526  */
527 #define GATT_EVENT_QUERY_COMPLETE                                0xA0
528 
529 /**
530  * @format HX
531  * @param handle
532  * @param service
533  */
534 #define GATT_EVENT_SERVICE_QUERY_RESULT                          0xA1
535 
536 /**
537  * @format HY
538  * @param handle
539  * @param characteristic
540  */
541 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT                   0xA2
542 
543 /**
544  * @format H2X
545  * @param handle
546  * @param include_handle
547  * @param service
548  */
549 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
550 
551 /**
552  * @format HZ
553  * @param handle
554  * @param characteristic_descriptor
555  */
556 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
557 
558 /**
559  * @format H2LV
560  * @param handle
561  * @param value_handle
562  * @param value_length
563  * @param value
564  */
565 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
566 
567 /**
568  * @format H22LV
569  * @param handle
570  * @param value_handle
571  * @param value_offset
572  * @param value_length
573  * @param value
574  */
575 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
576 
577 /**
578  * @format H2LV
579  * @param handle
580  * @param value_handle
581  * @param value_length
582  * @param value
583  */
584 #define GATT_EVENT_NOTIFICATION                                  0xA7
585 
586 /**
587  * @format H2LV
588  * @param handle
589  * @param value_handle
590  * @param value_length
591  * @param value
592  */
593 #define GATT_EVENT_INDICATION                                    0xA8
594 
595 /**
596  * @format H2LV
597  * @param descriptor_handle
598  * @param descriptor_length
599  * @param descriptor
600  */
601 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
602 
603 /**
604  * @format H2LV
605  * @param handle
606  * @param descriptor_offset
607  * @param descriptor_length
608  * @param descriptor
609  */
610 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
611 
612 /**
613  * @format H2
614  * @param handle
615  * @param MTU
616  */
617 #define GATT_EVENT_MTU                                           0xAB
618 
619 /**
620  * @format H2
621  * @param handle
622  * @param MTU
623  */
624 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
625 
626  /**
627   * @format 1H2
628   * @param status
629   * @param conn_handle
630   * @param attribute_handle
631   */
632 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
633 
634 /**
635  * @format
636  */
637 #define ATT_EVENT_CAN_SEND_NOW                                   0xB7
638 
639 // TODO: daemon only event
640 
641 /**
642  * @format 12
643  * @param status
644  * @param service_uuid
645  */
646  #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
647 
648 /**
649  * @format 1222B
650  * @param status
651  * @param source_uuid
652  * @param destination_uuid
653  * @param mtu
654  * @param remote_address
655  */
656  #define BNEP_EVENT_OPEN_CHANNEL_COMPLETE                   0xC1
657 
658 /**
659  * @format 22B
660  * @param source_uuid
661  * @param destination_uuid
662  * @param remote_address
663  */
664  #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
665 
666 /**
667  * @format 22B1
668  * @param source_uuid
669  * @param destination_uuid
670  * @param remote_address
671  * @param channel_state
672  */
673 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
674 
675 /**
676  * @format 22B
677  * @param source_uuid
678  * @param destination_uuid
679  * @param remote_address
680  */
681  #define BNEP_EVENT_CAN_SEND_NOW                           0xC4
682 
683  /**
684   * @format H1B
685   * @param handle
686   * @param addr_type
687   * @param address
688   */
689 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
690 
691  /**
692   * @format H1B
693   * @param handle
694   * @param addr_type
695   * @param address
696   */
697 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
698 
699  /**
700   * @format H1B4
701   * @param handle
702   * @param addr_type
703   * @param address
704   * @param passkey
705   */
706 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
707 
708  /**
709   * @format H1B
710   * @param handle
711   * @param addr_type
712   * @param address
713   */
714 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
715 
716  /**
717   * @format H1B421
718   * @param handle
719   * @param addr_type
720   * @param address
721   */
722 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
723 
724  /**
725   * @format H1B
726   * @param handle
727   * @param addr_type
728   * @param address
729   */
730 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
731 
732  /**
733   * @format H1B
734   * @param handle
735   * @param addr_type
736   * @param address
737   */
738 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD6
739 
740  /**
741   * @format H1B
742   * @param handle
743   * @param addr_type
744   * @param address
745   */
746 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD7
747 
748  /**
749   * @format H1B2
750   * @param handle
751   * @param addr_type
752   * @param address
753   * @param le_device_db_index
754   */
755 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xD8
756 
757  /**
758   * @format H1B
759   * @param handle
760   * @param addr_type
761   * @param address
762   */
763 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xD9
764 
765  /**
766   * @format H1B1
767   * @param handle
768   * @param addr_type
769   * @param address
770   * @param authorization_result
771   */
772 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDA
773 
774 // GAP
775 
776 // data: event(8), len(8), hci_handle (16), security_level (8)
777 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
778 
779 // data: event(8), len(8), status (8), bd_addr(48)
780 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
781 
782 /**
783  * @format 11B1JV
784  * @param advertising_event_type
785  * @param address_type
786  * @param address
787  * @param rssi
788  * @param data_length
789  * @param data
790  */
791 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
792 
793 
794 // Meta Events, see below for sub events
795 #define HCI_EVENT_HSP_META                                 0xE8
796 #define HCI_EVENT_HFP_META                                 0xE9
797 #define HCI_EVENT_ANCS_META                                0xEA
798 
799 // Potential other meta groups
800  // #define HCI_EVENT_BNEP_META                                0xxx
801 // #define HCI_EVENT_GAP_META                                 0xxx
802 // #define HCI_EVENT_GATT_META                                0xxx
803 // #define HCI_EVENT_PAN_META                                 0xxx
804 // #define HCI_EVENT_SDP_META                                 0xxx
805 // #define HCI_EVENT_SM_META                                  0xxx
806 
807 
808 /** HSP Subevent */
809 
810 /**
811  * @format 11
812  * @param subevent_code
813  * @param status 0 == OK
814  */
815 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
816 
817 /**
818  * @format 11
819  * @param subevent_code
820  * @param status 0 == OK
821  */
822 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
823 
824 
825 /**
826  * @format 11H
827  * @param subevent_code
828  * @param status 0 == OK
829  * @param handle
830  */
831 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
832 
833 /**
834  * @format 11
835  * @param subevent_code
836  * @param status 0 == OK
837  */
838 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
839 
840 /**
841  * @format 1
842  * @param subevent_code
843  */
844 #define HSP_SUBEVENT_RING                                  0x05
845 
846 /**
847  * @format 11
848  * @param subevent_code
849  * @param gain Valid range: [0,15]
850  */
851 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
852 
853 /**
854  * @format 11
855  * @param subevent_code
856  * @param gain Valid range: [0,15]
857  */
858 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
859 
860 /**
861  * @format 1JV
862  * @param subevent_code
863  * @param value_length
864  * @param value
865  */
866 #define HSP_SUBEVENT_HS_COMMAND                            0x08
867 
868 /**
869  * @format 1JV
870  * @param subevent_code
871  * @param value_length
872  * @param value
873  */
874 #define HSP_SUBEVENT_AG_INDICATION                         0x09
875 
876 
877 /** HFP Subevent */
878 
879 /**
880  * @format 11
881  * @param subevent_code
882  * @param status 0 == OK
883  */
884 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
885 
886 /**
887  * @format 1
888  * @param subevent_code
889  */
890 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
891 
892 /**
893  * @format 11
894  * @param subevent_code
895  * @param status 0 == OK
896  */
897 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
898 
899 /**
900  * @format 1
901  * @param subevent_code
902  */
903 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
904 
905 /**
906  * @format 11
907  * @param subevent_code
908  * @param status 0 == OK
909  */
910 #define HFP_SUBEVENT_COMPLETE                              0x05
911 
912 /**
913  * @format 111T
914  * @param subevent_code
915  * @param indicator_index
916  * @param indicator_status
917  * @param indicator_name
918  */
919 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
920 
921 /**
922  * @format 1111T
923  * @param subevent_code
924  * @param network_operator_mode
925  * @param network_operator_format
926  * @param network_operator_name
927  */
928 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
929 
930 /**
931  * @format 11
932  * @param subevent_code
933  * @param error
934  */
935 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
936 
937 /**
938  * @format 11
939  * @param subevent_code
940  * @param status
941  */
942 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE               0x09
943 
944 /**
945  * @format 1
946  * @param subevent_code
947  */
948 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
949 
950 /**
951  * @format 1
952  * @param subevent_code
953  */
954 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
955 
956 /**
957  * @format 1
958  * @param subevent_code
959  */
960 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
961 
962 /**
963  * @format 1T
964  * @param subevent_code
965  * @param number
966  */
967 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
968 
969 /**
970  * @format 1
971  * @param subevent_code
972  */
973 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
974 
975 /**
976  * @format 1T
977  * @param subevent_code
978  * @param number
979  */
980 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
981 
982 /**
983  * @format 1T
984  * @param subevent_code
985  * @param dtmf code
986  */
987 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
988 
989 /**
990  * @format 1
991  * @param subevent_code
992  */
993  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
994 
995 /**
996  * @format 1
997  * @param subevent_code
998  */
999 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1000 
1001 /**
1002  * @format 1
1003  * @param subevent_code
1004  */
1005 #define HFP_SUBEVENT_RING                                     0x13
1006 
1007 /**
1008  * @format 111
1009  * @param subevent_code
1010  * @param status
1011  * @param gain
1012  */
1013  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1014 
1015 /**
1016  * @format 111
1017  * @param subevent_code
1018  * @param status
1019  * @param gain
1020  */
1021 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1022 
1023 /**
1024  * @format 11T
1025  * @param subevent_code
1026  * @param type
1027  * @param number
1028  */
1029 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1030 
1031 /**
1032  * @format 11T
1033  * @param subevent_code
1034  * @param type
1035  * @param number
1036  */
1037 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17
1038 
1039 /**
1040  * @format 111111T
1041  * @param subevent_code
1042  * @param clcc_idx
1043  * @param clcc_dir
1044  * @param clcc_status
1045  * @param clcc_mpty
1046  * @param bnip_type
1047  * @param bnip_number
1048  */
1049 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1050 
1051 /**
1052  * @format 111T
1053  * @param subevent_code
1054  * @param status
1055  * @param bnip_type
1056  * @param bnip_number
1057  */
1058  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1059 
1060 /**
1061  * @format 1T
1062  * @param subevent_code
1063  * @param value
1064  */
1065 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1066 
1067 // ANCS Client
1068 
1069 /**
1070  * @format 1H
1071  * @param subevent_code
1072  * @param handle
1073  */
1074 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1075 
1076 /**
1077  * @format 1H2T
1078  * @param subevent_code
1079  * @param handle
1080  * @param attribute_id
1081  * @param text
1082  */
1083 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1084 
1085 /**
1086  * @format 1H
1087  * @param subevent_code
1088  * @param handle
1089  */
1090 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1091 
1092 #endif
1093