xref: /btstack/src/btstack_defines.h (revision 64697164ef72f7897f172a22b7b13afea33d105c)
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 
50 // UNUSED macro
51 #ifndef UNUSED
52 #define UNUSED(x) (void)(sizeof(x))
53 #endif
54 
55 // TYPES
56 
57 // packet handler
58 typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
59 
60 // packet callback supporting multiple registrations
61 typedef struct {
62     btstack_linked_item_t    item;
63     btstack_packet_handler_t callback;
64 } btstack_packet_callback_registration_t;
65 
66 // context callback supporting multiple registrations
67 typedef struct {
68   btstack_linked_item_t * item;
69   void (*callback)(void * context);
70   void * context;
71 } btstack_context_callback_registration_t;
72 
73 /**
74  * @brief 128 bit key used with AES128 in Security Manager
75  */
76 typedef uint8_t sm_key_t[16];
77 
78 // DEFINES
79 
80 // hci con handles (12 bit): 0x0000..0x0fff
81 #define HCI_CON_HANDLE_INVALID 0xffff
82 
83 
84 #define DAEMON_EVENT_PACKET     0x05
85 
86 // L2CAP data
87 #define L2CAP_DATA_PACKET       0x06
88 
89 // RFCOMM data
90 #define RFCOMM_DATA_PACKET      0x07
91 
92 // Attribute protocol data
93 #define ATT_DATA_PACKET         0x08
94 
95 // Security Manager protocol data
96 #define SM_DATA_PACKET          0x09
97 
98 // SDP query result - only used by daemon
99 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
100 #define SDP_CLIENT_PACKET       0x0a
101 
102 // BNEP data
103 #define BNEP_DATA_PACKET        0x0b
104 
105 // Unicast Connectionless Data
106 #define UCD_DATA_PACKET         0x0c
107 
108 // GOEP data
109 #define GOEP_DATA_PACKET        0x0d
110 
111 // PBAP data
112 #define PBAP_DATA_PACKET        0x0e
113 
114 // AVRCP browsing data
115 #define AVRCP_BROWSING_DATA_PACKET     0x0f
116 
117 
118 // debug log messages
119 #define LOG_MESSAGE_PACKET      0xfc
120 
121 
122 // ERRORS
123 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
124 
125 /* ENUM_START: BTSTACK_ERROR_CODE */
126 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED              0x50
127 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH         0x51
128 #define BTSTACK_ACTIVATION_POWERON_FAILED                  0x52
129 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN                  0x53
130 #define BTSTACK_NOT_ACTIVATED                              0x54
131 #define BTSTACK_BUSY                                       0x55
132 #define BTSTACK_MEMORY_ALLOC_FAILED                        0x56
133 #define BTSTACK_ACL_BUFFERS_FULL                           0x57
134 
135 // l2cap errors - enumeration by the command that created them
136 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
137 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
138 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
139 
140 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL        0x63
141 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING           0x64
142 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM       0x65
143 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY  0x66
144 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
145 #define L2CAP_CONNECTION_RESPONSE_RESULT_ERTM_NOT_SUPPORTED 0x68
146 // should be L2CAP_CONNECTION_RTX_TIMEOUT
147 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT       0x69
148 #define L2CAP_CONNECTION_BASEBAND_DISCONNECT               0x6A
149 #define L2CAP_SERVICE_ALREADY_REGISTERED                   0x6B
150 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU                  0x6C
151 #define L2CAP_SERVICE_DOES_NOT_EXIST                       0x6D
152 #define L2CAP_LOCAL_CID_DOES_NOT_EXIST                     0x6E
153 
154 #define RFCOMM_MULTIPLEXER_STOPPED                         0x70
155 #define RFCOMM_CHANNEL_ALREADY_REGISTERED                  0x71
156 #define RFCOMM_NO_OUTGOING_CREDITS                         0x72
157 #define RFCOMM_AGGREGATE_FLOW_OFF                          0x73
158 #define RFCOMM_DATA_LEN_EXCEEDS_MTU                        0x74
159 
160 #define SDP_HANDLE_ALREADY_REGISTERED                      0x80
161 #define SDP_QUERY_INCOMPLETE                               0x81
162 #define SDP_SERVICE_NOT_FOUND                              0x82
163 #define SDP_HANDLE_INVALID                                 0x83
164 #define SDP_QUERY_BUSY                                     0x84
165 
166 #define ATT_HANDLE_VALUE_INDICATION_IN_PROGRESS            0x90
167 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT                0x91
168 
169 #define GATT_CLIENT_NOT_CONNECTED                          0x93
170 #define GATT_CLIENT_BUSY                                   0x94
171 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
172 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
173 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
174 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
175 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
176 
177 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
178 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
179 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
180 
181 // OBEX ERRORS
182 #define OBEX_UNKNOWN_ERROR                                 0xB0
183 #define OBEX_CONNECT_FAILED                                0xB1
184 #define OBEX_DISCONNECTED                                  0xB2
185 #define OBEX_NOT_FOUND                                     0xB3
186 
187 #define AVDTP_SEID_DOES_NOT_EXIST                          0xC0
188 #define AVDTP_CONNECTION_DOES_NOT_EXIST                    0xC1
189 #define AVDTP_CONNECTION_IN_WRONG_STATE                    0xC2
190 #define AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE               0xC3
191 #define AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST               0xC4
192 #define AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST              0xC5
193 /* ENUM_END */
194 
195 // DAEMON COMMANDS
196 
197 #define OGF_BTSTACK 0x3d
198 
199 // cmds for BTstack
200 // get state: @returns HCI_STATE
201 #define BTSTACK_GET_STATE                                  0x01
202 
203 // set power mode: param HCI_POWER_MODE
204 #define BTSTACK_SET_POWER_MODE                             0x02
205 
206 // set capture mode: param on
207 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
208 
209 // get BTstack version
210 #define BTSTACK_GET_VERSION                                0x04
211 
212 // get system Bluetooth state
213 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
214 
215 // set system Bluetooth state
216 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
217 
218 // enable inquiry scan for this client
219 #define BTSTACK_SET_DISCOVERABLE                           0x07
220 
221 // set global Bluetooth state
222 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
223 
224 // create l2cap channel: param bd_addr(48), psm (16)
225 #define L2CAP_CREATE_CHANNEL                               0x20
226 
227 // disconnect l2cap disconnect, param channel(16), reason(8)
228 #define L2CAP_DISCONNECT                                   0x21
229 
230 // register l2cap service: param psm(16), mtu (16)
231 #define L2CAP_REGISTER_SERVICE                             0x22
232 
233 // unregister l2cap disconnect, param psm(16)
234 #define L2CAP_UNREGISTER_SERVICE                           0x23
235 
236 // accept connection param bd_addr(48), dest cid (16)
237 #define L2CAP_ACCEPT_CONNECTION                            0x24
238 
239 // decline l2cap disconnect,param bd_addr(48), dest cid (16), reason(8)
240 #define L2CAP_DECLINE_CONNECTION                           0x25
241 
242 // create l2cap channel: param bd_addr(48), psm (16), mtu (16)
243 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
244 
245 // register SDP Service Record: service record (size)
246 #define SDP_REGISTER_SERVICE_RECORD                        0x30
247 
248 // unregister SDP Service Record
249 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
250 
251 // Get remote RFCOMM services
252 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
253 
254 // Get remote SDP services
255 #define SDP_CLIENT_QUERY_SERVICES                          0x33
256 
257 // RFCOMM "HCI" Commands
258 #define RFCOMM_CREATE_CHANNEL       0x40
259 #define RFCOMM_DISCONNECT     0x41
260 #define RFCOMM_REGISTER_SERVICE     0x42
261 #define RFCOMM_UNREGISTER_SERVICE   0x43
262 #define RFCOMM_ACCEPT_CONNECTION    0x44
263 #define RFCOMM_DECLINE_CONNECTION   0x45
264 #define RFCOMM_PERSISTENT_CHANNEL   0x46
265 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
266 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
267 #define RFCOMM_GRANT_CREDITS                 0x49
268 
269 // GAP Classic 0x50
270 #define GAP_DISCONNECT              0x50
271 
272 // GAP LE      0x60
273 #define GAP_LE_SCAN_START           0x60
274 #define GAP_LE_SCAN_STOP            0x61
275 #define GAP_LE_CONNECT              0x62
276 #define GAP_LE_CONNECT_CANCEL       0x63
277 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
278 
279 // GATT (Client) 0x70
280 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
281 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
282 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
283 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
284 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
285 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
286 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
287 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
288 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
289 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
290 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
291 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
292 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
293 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
294 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
295 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
296 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
297 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
298 #define GATT_GET_MTU                                             0x82
299 
300 // ATT
301 
302 // ..
303 // Internal properties reuse some GATT Characteristic Properties fields
304 #define ATT_DB_FLAGS_READ_WITHOUT_AUTHENTICATION 0x0001
305 #define ATT_DB_PERSISTENT_WRITE_CCC              0x0010
306 
307 
308 // EVENTS
309 
310 /**
311  * @format 1
312  * @param state
313  */
314 #define BTSTACK_EVENT_STATE                                0x60
315 
316 /**
317  * @format 1
318  * @param number_connections
319  */
320 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
321 
322 /**
323  * @format
324  */
325 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
326 
327 /**
328  * @format 1
329  * @param discoverable
330  */
331 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
332 
333 // Daemon Events
334 
335 /**
336  * @format 112
337  * @param major
338  * @param minor
339  @ @param revision
340  */
341 #define DAEMON_EVENT_VERSION                               0x63
342 
343 // data: system bluetooth on/off (bool)
344 /**
345  * @format 1
346  * param system_bluetooth_enabled
347  */
348 #define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED              0x64
349 
350 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
351 
352 /*
353  * @format 1BT
354  * @param status == 0 to match read_remote_name_request
355  * @param address
356  * @param name
357  */
358 #define DAEMON_EVENT_REMOTE_NAME_CACHED                    0x65
359 
360 // internal - data: event(8)
361 #define DAEMON_EVENT_CONNECTION_OPENED                     0x67
362 
363 // internal - data: event(8)
364 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x68
365 
366 // data: event(8), len(8), local_cid(16), credits(8)
367 #define DAEMON_EVENT_L2CAP_CREDITS                         0x74
368 
369 /**
370  * @format 12
371  * @param status
372  * @param psm
373  */
374 #define DAEMON_EVENT_L2CAP_SERVICE_REGISTERED              0x75
375 
376 /**
377  * @format 21
378  * @param rfcomm_cid
379  * @param credits
380  */
381 #define DAEMON_EVENT_RFCOMM_CREDITS                        0x84
382 
383 /**
384  * @format 11
385  * @param status
386  * @param channel_id
387  */
388 #define DAEMON_EVENT_RFCOMM_SERVICE_REGISTERED             0x85
389 
390 /**
391  * @format 11
392  * @param status
393  * @param server_channel_id
394  */
395 #define DAEMON_EVENT_RFCOMM_PERSISTENT_CHANNEL             0x86
396 
397 /**
398   * @format 14
399   * @param status
400   * @param service_record_handle
401   */
402 #define DAEMON_EVENT_SDP_SERVICE_REGISTERED                0x90
403 
404 
405 
406 // additional HCI events
407 
408 /**
409  * @brief Indicates HCI transport enters/exits Sleep mode
410  * @format 1
411  * @param active
412  */
413 #define HCI_EVENT_TRANSPORT_SLEEP_MODE                     0x69
414 
415 /**
416  * @brief Outgoing packet
417  */
418 #define HCI_EVENT_TRANSPORT_PACKET_SENT                    0x6E
419 
420 /**
421  * @format B
422  * @param handle
423  */
424 #define HCI_EVENT_SCO_CAN_SEND_NOW                         0x6F
425 
426 
427 // L2CAP EVENTS
428 
429 /**
430  * @format 1BH2222221
431  * @param status
432  * @param address
433  * @param handle
434  * @param psm
435  * @param local_cid
436  * @param remote_cid
437  * @param local_mtu
438  * @param remote_mtu
439  * @param flush_timeout
440  * @param incoming
441  */
442 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
443 
444 /*
445  * @format 2
446  * @param local_cid
447  */
448 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
449 
450 /**
451  * @format BH222
452  * @param address
453  * @param handle
454  * @param psm
455  * @param local_cid
456  * @param remote_cid
457  */
458 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
459 
460 // ??
461 // data: event(8), len(8), handle(16)
462 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
463 
464 /**
465  * @format H2222
466  * @param handle
467  * @param interval_min
468  * @param interval_max
469  * @param latencey
470  * @param timeout_multiplier
471  */
472 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
473 
474 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
475  /**
476   * @format H2
477   * @param handle
478   * @param result
479   */
480 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
481 
482 /**
483  * @format 2
484  * @param local_cid
485  */
486 #define L2CAP_EVENT_CAN_SEND_NOW                           0x78
487 
488 // LE Data Channels
489 
490 /**
491  * @format 1BH2222
492  * @param address_type
493  * @param address
494  * @param handle
495  * @param psm
496  * @param local_cid
497  * @param remote_cid
498  * @param remote_mtu
499  */
500 #define L2CAP_EVENT_LE_INCOMING_CONNECTION                 0x79
501 
502 /**
503  * @format 11BH122222
504  * @param status
505  * @param address_type
506  * @param address
507  * @param handle
508  * @param incoming
509  * @param psm
510  * @param local_cid
511  * @param remote_cid
512  * @param local_mtu
513  * @param remote_mtu
514  */
515 #define L2CAP_EVENT_LE_CHANNEL_OPENED                      0x7a
516 
517 /*
518  * @format 2
519  * @param local_cid
520  */
521 #define L2CAP_EVENT_LE_CHANNEL_CLOSED                      0x7b
522 
523 /*
524  * @format 2
525  * @param local_cid
526  */
527 #define L2CAP_EVENT_LE_CAN_SEND_NOW                        0x7c
528 
529 /*
530  * @format 2
531  * @param local_cid
532  */
533 #define L2CAP_EVENT_LE_PACKET_SENT                         0x7d
534 
535 
536 // RFCOMM EVENTS
537 
538 /**
539  * @format 1B21221
540  * @param status
541  * @param bd_addr
542  * @param con_handle
543  * @param server_channel
544  * @param rfcomm_cid
545  * @param max_frame_size
546  * @param incoming
547  */
548 #define RFCOMM_EVENT_CHANNEL_OPENED                        0x80
549 
550 /**
551  * @format 2
552  * @param rfcomm_cid
553  */
554 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
555 
556 /**
557  * @format B12
558  * @param bd_addr
559  * @param server_channel
560  * @param rfcomm_cid
561  */
562 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
563 
564 /**
565  * @format 21
566  * @param rfcomm_cid
567  * @param line_status
568  */
569 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
570 
571 /**
572  * @format 21
573  * @param rfcomm_cid
574  * @param modem_status
575  */
576 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
577 
578  /**
579   * TODO: format for variable data 2?
580   * param rfcomm_cid
581   * param rpn_data
582   */
583 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
584 
585 /**
586  * @format 2
587  * @param rfcomm_cid
588  */
589 #define RFCOMM_EVENT_CAN_SEND_NOW                          0x89
590 
591 
592 /**
593  * @format 1
594  * @param status
595  */
596 #define SDP_EVENT_QUERY_COMPLETE                                 0x91
597 
598 /**
599  * @format 1T
600  * @param rfcomm_channel
601  * @param name
602  */
603 #define SDP_EVENT_QUERY_RFCOMM_SERVICE                           0x92
604 
605 /**
606  * @format 22221
607  * @param record_id
608  * @param attribute_id
609  * @param attribute_length
610  * @param data_offset
611  * @param data
612  */
613 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE                           0x93
614 
615 /**
616  * @format 22LV
617  * @param record_id
618  * @param attribute_id
619  * @param attribute_length
620  * @param attribute_value
621  */
622 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE                          0x94
623 
624 /**
625  * @format 224
626  * @param total_count
627  * @param record_index
628  * @param record_handle
629  * @note Not provided by daemon, only used for internal testing
630  */
631 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE                    0x95
632 
633 /**
634  * @format H1
635  * @param handle
636  * @param status
637  */
638 #define GATT_EVENT_QUERY_COMPLETE                                0xA0
639 
640 /**
641  * @format HX
642  * @param handle
643  * @param service
644  */
645 #define GATT_EVENT_SERVICE_QUERY_RESULT                          0xA1
646 
647 /**
648  * @format HY
649  * @param handle
650  * @param characteristic
651  */
652 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT                   0xA2
653 
654 /**
655  * @format H2X
656  * @param handle
657  * @param include_handle
658  * @param service
659  */
660 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
661 
662 /**
663  * @format HZ
664  * @param handle
665  * @param characteristic_descriptor
666  */
667 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
668 
669 /**
670  * @format H2LV
671  * @param handle
672  * @param value_handle
673  * @param value_length
674  * @param value
675  */
676 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
677 
678 /**
679  * @format H22LV
680  * @param handle
681  * @param value_handle
682  * @param value_offset
683  * @param value_length
684  * @param value
685  */
686 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
687 
688 /**
689  * @format H2LV
690  * @param handle
691  * @param value_handle
692  * @param value_length
693  * @param value
694  */
695 #define GATT_EVENT_NOTIFICATION                                  0xA7
696 
697 /**
698  * @format H2LV
699  * @param handle
700  * @param value_handle
701  * @param value_length
702  * @param value
703  */
704 #define GATT_EVENT_INDICATION                                    0xA8
705 
706 /**
707  * @format H2LV
708  * @param handle
709  * @param descriptor_handle
710  * @param descriptor_length
711  * @param descriptor
712  */
713 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
714 
715 /**
716  * @format H2LV
717  * @param handle
718  * @param descriptor_offset
719  * @param descriptor_length
720  * @param descriptor
721  */
722 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
723 
724 /**
725  * @format H2
726  * @param handle
727  * @param MTU
728  */
729 #define GATT_EVENT_MTU                                           0xAB
730 
731 /**
732  * @format H
733  * @param handle
734  */
735 #define GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE                    0xAC
736 
737 /**
738  * @format H2
739  * @param handle
740  * @param MTU
741  */
742 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
743 
744  /**
745   * @format 1H2
746   * @param status
747   * @param conn_handle
748   * @param attribute_handle
749   */
750 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
751 
752 /**
753  * @format
754  */
755 #define ATT_EVENT_CAN_SEND_NOW                                   0xB7
756 
757 // TODO: daemon only event
758 
759 /**
760  * @format 12
761  * @param status
762  * @param service_uuid
763  */
764  #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
765 
766 /**
767  * @format 12222B
768  * @param status
769  * @param bnep_cid
770  * @param source_uuid
771  * @param destination_uuid
772  * @param mtu
773  * @param remote_address
774  */
775  #define BNEP_EVENT_CHANNEL_OPENED                   0xC1
776 
777 /**
778  * @format 222B
779  * @param bnep_cid
780  * @param source_uuid
781  * @param destination_uuid
782  * @param remote_address
783  */
784  #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
785 
786 /**
787  * @format 222B1
788  * @param bnep_cid
789  * @param source_uuid
790  * @param destination_uuid
791  * @param remote_address
792  * @param channel_state
793  */
794 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
795 
796 /**
797  * @format 222B
798  * @param bnep_cid
799  * @param source_uuid
800  * @param destination_uuid
801  * @param remote_address
802  */
803  #define BNEP_EVENT_CAN_SEND_NOW                           0xC4
804 
805  /**
806   * @format H1B
807   * @param handle
808   * @param addr_type
809   * @param address
810   */
811 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
812 
813  /**
814   * @format H1B
815   * @param handle
816   * @param addr_type
817   * @param address
818   */
819 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
820 
821  /**
822   * @format H1B4
823   * @param handle
824   * @param addr_type
825   * @param address
826   * @param passkey
827   */
828 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
829 
830  /**
831   * @format H1B
832   * @param handle
833   * @param addr_type
834   * @param address
835   */
836 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
837 
838  /**
839   * @format H1B
840   * @param handle
841   * @param addr_type
842   * @param address
843   */
844 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
845 
846  /**
847   * @format H1B
848   * @param handle
849   * @param addr_type
850   * @param address
851   */
852 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
853 
854  /**
855   * @format H1B4
856   * @param handle
857   * @param addr_type
858   * @param address
859   * @param passkey
860   */
861 #define SM_EVENT_NUMERIC_COMPARISON_REQUEST                      0xD6
862 
863  /**
864   * @format H1B
865   * @param handle
866   * @param addr_type
867   * @param address
868   */
869 #define SM_EVENT_NUMERIC_COMPARISON_CANCEL                       0xD7
870 
871  /**
872   * @format H1B
873   * @param handle
874   * @param addr_type
875   * @param address
876   */
877 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD8
878 
879  /**
880   * @format H1B
881   * @param handle
882   * @param addr_type
883   * @param address
884   */
885 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD9
886 
887  /**
888   * @brief Identify resolving succeeded
889   *
890   * @format H1B1B2
891   * @param handle
892   * @param addr_type
893   * @param address
894   * @param identity_addr_type
895   * @param identity_address
896   * @param index
897   *
898   */
899 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xDA
900 
901  /**
902   * @format H1B
903   * @param handle
904   * @param addr_type
905   * @param address
906   */
907 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xDB
908 
909  /**
910   * @format H1B1
911   * @param handle
912   * @param addr_type
913   * @param address
914   * @param authorization_result
915   */
916 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDC
917 
918  /**
919   * @format H1
920   * @param handle
921   * @param action see SM_KEYPRESS_*
922   */
923 #define SM_EVENT_KEYPRESS_NOTIFICATION                           0xDD
924 
925  /**
926   * @brief Emitted during pairing to inform app about address used as identity
927   *
928   * @format H1B1B1
929   * @param handle
930   * @param addr_type
931   * @param address
932   * @param identity_addr_type
933   * @param identity_address
934   * @param index
935   */
936 #define SM_EVENT_IDENTITY_CREATED                                0xDE
937 
938  /**
939   * @brief Emitted to inform app that pairing is complete. Possible status values:
940   *        ERROR_CODE_SUCCESS                            -> pairing success
941   *        ERROR_CODE_CONNECTION_TIMEOUT                 -> timeout
942   *        ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION  -> disconnect
943   *        ERROR_CODE_AUTHENTICATION_FAILURE             -> SM protocol error, see reason field with SM_REASON_* from bluetooth.h
944   *
945   * @format H1B11
946   * @param handle
947   * @param addr_type
948   * @param address
949   * @param status
950   * @param reason if status == ERROR_CODE_AUTHENTICATION_FAILURE
951   */
952 #define SM_EVENT_PAIRING_COMPLETE                                0xDF
953 
954 
955 // GAP
956 
957 /**
958  * @format H1
959  * @param handle
960  * @param security_level
961  */
962 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
963 
964 /**
965  * @format 1B
966  * @param status
967  * @param address
968  */
969 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
970 
971 /**
972  * @format 11B1JV
973  * @param advertising_event_type
974  * @param address_type
975  * @param address
976  * @param rssi
977  * @param data_length
978  * @param data
979  */
980 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
981 
982  /**
983  * @format B132111JV
984  * @param bd_addr
985  * @param page_scan_repetition_mode
986  * @param class_of_device
987  * @param clock_offset
988  * @param rssi_available
989  * @param rssi
990  * @param name_available
991  * @param name_len
992  * @param name
993  */
994 #define GAP_EVENT_INQUIRY_RESULT                              0xE3
995 
996 /**
997  * @format 1
998  * @param status
999  */
1000 #define GAP_EVENT_INQUIRY_COMPLETE                            0xE4
1001 
1002 
1003 // Meta Events, see below for sub events
1004 #define HCI_EVENT_HSP_META                                 0xE8
1005 #define HCI_EVENT_HFP_META                                 0xE9
1006 #define HCI_EVENT_ANCS_META                                0xEA
1007 #define HCI_EVENT_AVDTP_META                               0xEB
1008 #define HCI_EVENT_AVRCP_META                               0xEC
1009 #define HCI_EVENT_GOEP_META                                0xED
1010 #define HCI_EVENT_PBAP_META                                0xEE
1011 #define HCI_EVENT_HID_META                                 0xEF
1012 #define HCI_EVENT_A2DP_META                                0xF0
1013 #define HCI_EVENT_HIDS_META                                0xF1
1014 
1015 // Potential other meta groups
1016 // #define HCI_EVENT_BNEP_META                                0xxx
1017 // #define HCI_EVENT_GAP_META                                 0xxx
1018 // #define HCI_EVENT_GATT_META                                0xxx
1019 // #define HCI_EVENT_PAN_META                                 0xxx
1020 // #define HCI_EVENT_SDP_META                                 0xxx
1021 // #define HCI_EVENT_SM_META                                  0xxx
1022 
1023 
1024 /** HSP Subevent */
1025 
1026 /**
1027  * @format 11
1028  * @param subevent_code
1029  * @param status 0 == OK
1030  */
1031 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
1032 
1033 /**
1034  * @format 11
1035  * @param subevent_code
1036  * @param status 0 == OK
1037  */
1038 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
1039 
1040 
1041 /**
1042  * @format 11H
1043  * @param subevent_code
1044  * @param status 0 == OK
1045  * @param handle
1046  */
1047 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
1048 
1049 /**
1050  * @format 11
1051  * @param subevent_code
1052  * @param status 0 == OK
1053  */
1054 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
1055 
1056 /**
1057  * @format 1
1058  * @param subevent_code
1059  */
1060 #define HSP_SUBEVENT_RING                                  0x05
1061 
1062 /**
1063  * @format 11
1064  * @param subevent_code
1065  * @param gain Valid range: [0,15]
1066  */
1067 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
1068 
1069 /**
1070  * @format 11
1071  * @param subevent_code
1072  * @param gain Valid range: [0,15]
1073  */
1074 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
1075 
1076 /**
1077  * @format 1JV
1078  * @param subevent_code
1079  * @param value_length
1080  * @param value
1081  */
1082 #define HSP_SUBEVENT_HS_COMMAND                            0x08
1083 
1084 /**
1085  * @format 1JV
1086  * @param subevent_code
1087  * @param value_length
1088  * @param value
1089  */
1090 #define HSP_SUBEVENT_AG_INDICATION                         0x09
1091 
1092 
1093 /** HFP Subevent */
1094 
1095 /**
1096  * @format 11HB
1097  * @param subevent_code
1098  * @param status 0 == OK
1099  * @param con_handle
1100  * @param bd_addr
1101  */
1102 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
1103 
1104 /**
1105  * @format 1
1106  * @param subevent_code
1107  */
1108 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
1109 
1110 /**
1111  * @format 11HB1
1112  * @param subevent_code
1113  * @param status 0 == OK
1114  * @param handle
1115  * @param bd_addr
1116  * @param negotiated_codec
1117  */
1118 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
1119 
1120 /**
1121  * @format 1
1122  * @param subevent_code
1123  */
1124 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
1125 
1126 /**
1127  * @format 11
1128  * @param subevent_code
1129  * @param status 0 == OK
1130  */
1131 #define HFP_SUBEVENT_COMPLETE                              0x05
1132 
1133 /**
1134  * @format 111T
1135  * @param subevent_code
1136  * @param indicator_index
1137  * @param indicator_status
1138  * @param indicator_name
1139  */
1140 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
1141 
1142 /**
1143  * @format 111T
1144  * @param subevent_code
1145  * @param network_operator_mode
1146  * @param network_operator_format
1147  * @param network_operator_name
1148  */
1149 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
1150 
1151 /**
1152  * @format 11
1153  * @param subevent_code
1154  * @param error
1155  */
1156 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
1157 
1158 /**
1159  * @format 1
1160  * @param subevent_code
1161  */
1162 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
1163 
1164 /**
1165  * @format 1
1166  * @param subevent_code
1167  */
1168 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
1169 
1170 /**
1171  * @format 1
1172  * @param subevent_code
1173  */
1174 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
1175 
1176 /**
1177  * @format 1T
1178  * @param subevent_code
1179  * @param number
1180  */
1181 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
1182 
1183 /**
1184  * @format 1
1185  * @param subevent_code
1186  */
1187 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
1188 
1189 /**
1190  * @format 1T
1191  * @param subevent_code
1192  * @param number
1193  */
1194 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
1195 
1196 /**
1197  * @format 1T
1198  * @param subevent_code
1199  * @param dtmf code
1200  */
1201 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1202 
1203 /**
1204  * @format 1
1205  * @param subevent_code
1206  */
1207  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1208 
1209 /**
1210  * @format 1
1211  * @param subevent_code
1212  */
1213 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1214 
1215 /**
1216  * @format 1
1217  * @param subevent_code
1218  */
1219 #define HFP_SUBEVENT_RING                                     0x13
1220 
1221 /**
1222  * @format 111
1223  * @param subevent_code
1224  * @param status
1225  * @param gain
1226  */
1227  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1228 
1229 /**
1230  * @format 111
1231  * @param subevent_code
1232  * @param status
1233  * @param gain
1234  */
1235 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1236 
1237 /**
1238  * @format 11T
1239  * @param subevent_code
1240  * @param type
1241  * @param number
1242  */
1243 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1244 
1245 /**
1246  * @format 11T
1247  * @param subevent_code
1248  * @param type
1249  * @param number
1250  */
1251 #define HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION 0x17
1252 
1253 /**
1254  * @format 111111T
1255  * @param subevent_code
1256  * @param clcc_idx
1257  * @param clcc_dir
1258  * @param clcc_status
1259  * @param clcc_mpty
1260  * @param bnip_type
1261  * @param bnip_number
1262  */
1263 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1264 
1265 /**
1266  * @format 111T
1267  * @param subevent_code
1268  * @param status
1269  * @param bnip_type
1270  * @param bnip_number
1271  */
1272  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1273 
1274 /**
1275  * @format 1T
1276  * @param subevent_code
1277  * @param value
1278  */
1279 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1280 
1281 // ANCS Client
1282 
1283 /**
1284  * @format 1H
1285  * @param subevent_code
1286  * @param handle
1287  */
1288 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1289 
1290 /**
1291  * @format 1H2T
1292  * @param subevent_code
1293  * @param handle
1294  * @param attribute_id
1295  * @param text
1296  */
1297 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1298 
1299 /**
1300  * @format 1H
1301  * @param subevent_code
1302  * @param handle
1303  */
1304 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1305 
1306 
1307 /** AVDTP Subevent */
1308 
1309 /**
1310  * @format 1211
1311  * @param subevent_code
1312  * @param avdtp_cid
1313  * @param local_seid
1314  * @param signal_identifier
1315  */
1316 #define AVDTP_SUBEVENT_SIGNALING_ACCEPT                     0x01
1317 
1318 /**
1319  * @format 1211
1320  * @param subevent_code
1321  * @param avdtp_cid
1322  * @param local_seid
1323  * @param signal_identifier
1324  */
1325 #define AVDTP_SUBEVENT_SIGNALING_REJECT                     0x02
1326 
1327 /**
1328  * @format 1211
1329  * @param subevent_code
1330  * @param avdtp_cid
1331  * @param local_seid
1332  * @param signal_identifier
1333  */
1334 #define AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT             0x03
1335 
1336 /**
1337  * @format 12B1
1338  * @param subevent_code
1339  * @param avdtp_cid
1340  * @param bd_addr
1341  * @param status 0 == OK
1342  */
1343 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED     0x04
1344 
1345 /**
1346  * @format 12
1347  * @param subevent_code
1348  * @param avdtp_cid
1349  */
1350 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED        0x05
1351 
1352 /**
1353  * @format 121111
1354  * @param subevent_code
1355  * @param avdtp_cid
1356  * @param remote_seid        0x01 – 0x3E
1357  * @param in_use      0-not in use, 1-in use
1358  * @param media_type  0-audio, 1-video, 2-multimedia
1359  * @param sep_type    0-source, 1-sink
1360  */
1361 #define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND                  0x06
1362 
1363 /**
1364  * @format 121111111111
1365  * @param subevent_code
1366  * @param avdtp_cid
1367  * @param local_seid
1368  * @param remote_seid
1369  * @param media_type
1370  * @param sampling_frequency_bitmap
1371  * @param channel_mode_bitmap
1372  * @param block_length_bitmap
1373  * @param subbands_bitmap
1374  * @param allocation_method_bitmap
1375  * @param min_bitpool_value
1376  * @param max_bitpool_value
1377  */
1378 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY          0x07
1379 
1380 /**
1381  * @format 121112LV
1382  * @param subevent_code
1383  * @param avdtp_cid
1384  * @param local_seid
1385  * @param remote_seid
1386  * @param media_type
1387  * @param media_codec_type
1388  * @param media_codec_information_len
1389  * @param media_codec_information
1390  */
1391 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY        0x08
1392 
1393 
1394 /**
1395  * @format 1211
1396  * @param subevent_code
1397  * @param avdtp_cid
1398  * @param local_seid
1399  * @param remote_seid
1400  */
1401 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_TRANSPORT_CAPABILITY        0x09
1402 
1403 
1404 /**
1405  * @format 1211
1406  * @param subevent_code
1407  * @param avdtp_cid
1408  * @param local_seid
1409  * @param remote_seid
1410  */
1411 #define AVDTP_SUBEVENT_SIGNALING_REPORTING_CAPABILITY        0x0A
1412 
1413 
1414 /**
1415  * @format 1211111
1416  * @param subevent_code
1417  * @param avdtp_cid
1418  * @param local_seid
1419  * @param remote_seid
1420  * @param recovery_type
1421  * @param maximum_recovery_window_size
1422  * @param maximum_number_media_packets
1423  */
1424 #define AVDTP_SUBEVENT_SIGNALING_RECOVERY_CAPABILITY        0x0B
1425 
1426 
1427 /**
1428  * @format 12112LV
1429  * @param subevent_code
1430  * @param avdtp_cid
1431  * @param local_seid
1432  * @param remote_seid
1433  * @param cp_type
1434  * @param cp_type_value_len
1435  * @param cp_type_value
1436  */
1437 #define AVDTP_SUBEVENT_SIGNALING_CONTENT_PROTECTION_CAPABILITY        0x0C
1438 
1439 
1440 /**
1441  * @format 121111111111
1442  * @param subevent_code
1443  * @param avdtp_cid
1444  * @param local_seid
1445  * @param remote_seid
1446  * @param fragmentation
1447  * @param transport_identifiers_num
1448  * @param transport_session_identifier_1
1449  * @param transport_session_identifier_2
1450  * @param transport_session_identifier_3
1451  * @param tcid_1
1452  * @param tcid_2
1453  * @param tcid_3
1454  */
1455 #define AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY        0x0D
1456 
1457 
1458 /**
1459  * @format 1211
1460  * @param subevent_code
1461  * @param avdtp_cid
1462  * @param local_seid
1463  * @param remote_seid
1464  */
1465 #define AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY        0x0E
1466 
1467 
1468 /**
1469  * @format 1211111
1470  * @param subevent_code
1471  * @param avdtp_cid
1472  * @param local_seid
1473  * @param remote_seid
1474  * @param back_ch
1475  * @param media
1476  * @param recovery
1477  */
1478 #define AVDTP_SUBEVENT_SIGNALING_HEADER_COMPRESSION_CAPABILITY        0x0F
1479 
1480 
1481 /**
1482  * @format 12111121111111
1483  * @param subevent_code
1484  * @param avdtp_cid
1485  * @param local_seid
1486  * @param remote_seid
1487  * @param reconfigure
1488  * @param media_type
1489  * @param sampling_frequency
1490  * @param channel_mode
1491  * @param num_channels
1492  * @param block_length
1493  * @param subbands
1494  * @param allocation_method
1495  * @param min_bitpool_value
1496  * @param max_bitpool_value
1497  */
1498 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION        0x10
1499 
1500 /**
1501  * @format 1211112LV
1502  * @param subevent_code
1503  * @param avdtp_cid
1504  * @param local_seid
1505  * @param remote_seid
1506  * @param reconfigure
1507  * @param media_type
1508  * @param media_codec_type
1509  * @param media_codec_information_len
1510  * @param media_codec_information
1511  */
1512 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION        0x11
1513 
1514 /**
1515  * @format 12B111
1516  * @param subevent_code
1517  * @param avdtp_cid
1518  * @param bd_addr
1519  * @param local_seid
1520  * @param remote_seid
1521  * @param status 0 == OK
1522  */
1523 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED     0x12
1524 
1525 /**
1526  * @format 121
1527  * @param subevent_code
1528  * @param avdtp_cid
1529  * @param local_seid
1530  */
1531 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED        0x13
1532 
1533 /**
1534  * @format 1212
1535  * @param subevent_code
1536  * @param avdtp_cid
1537  * @param local_seid
1538  * @param sequence_number
1539  */
1540 #define AVDTP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW   0x14
1541 
1542 /**
1543  * @format 1211
1544  * @param subevent_code
1545  * @param avdtp_cid
1546  * @param local_seid
1547  * @param remote_seid
1548  */
1549 #define AVDTP_SUBEVENT_SIGNALING_CAPABILITY_DONE             0x15
1550 
1551 
1552 
1553 /** A2DP Subevent */
1554 /* Stream goes through following states:
1555  * - OPEN         - indicated with A2DP_SUBEVENT_STREAM_ESTABLISHED event
1556  * - START        - indicated with A2DP_SUBEVENT_STREAM_STARTED event
1557  * - SUSPEND      - indicated with A2DP_SUBEVENT_STREAM_SUSPENDED event
1558  * - ABORT/STOP   - indicated with A2DP_SUBEVENT_STREAM_RELEASED event
1559 
1560  OPEN state will be followed by ABORT/STOP. Stream is ready but media transfer is not started.
1561  START can come only after the stream is OPENED, and indicates that media transfer is started.
1562  SUSPEND is optional, it pauses the stream.
1563  */
1564 
1565 /**
1566  * @format 121            Sent only by A2DP source.
1567  * @param subevent_code
1568  * @param a2dp_cid
1569  * @param local_seid
1570  */
1571 #define A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW         0x01
1572 
1573 /**
1574  * @format 12111121111111
1575  * @param subevent_code
1576  * @param a2dp_cid
1577  * @param int_seid
1578  * @param acp_seid
1579  * @param reconfigure
1580  * @param media_type
1581  * @param sampling_frequency
1582  * @param channel_mode
1583  * @param num_channels
1584  * @param block_length
1585  * @param subbands
1586  * @param allocation_method
1587  * @param min_bitpool_value
1588  * @param max_bitpool_value
1589  */
1590 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION      0x02
1591 
1592 /**
1593  * @format 1211112LV
1594  * @param subevent_code
1595  * @param a2dp_cid
1596  * @param int_seid
1597  * @param acp_seid
1598  * @param reconfigure
1599  * @param media_type
1600  * @param media_codec_type
1601  * @param media_codec_information_len
1602  * @param media_codec_information
1603  */
1604 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION    0x03
1605 
1606 /**
1607  * @format 12B111          Stream is opened byt not started.
1608  * @param subevent_code
1609  * @param a2dp_cid
1610  * @param bd_addr
1611  * @param local_seid
1612  * @param remote_seid
1613  * @param status
1614  */
1615 #define A2DP_SUBEVENT_STREAM_ESTABLISHED                           0x04
1616 
1617 /**
1618  * @format 121            Indicates that media transfer is started.
1619  * @param subevent_code
1620  * @param a2dp_cid
1621  * @param local_seid
1622  */
1623 #define A2DP_SUBEVENT_STREAM_STARTED                               0x05
1624 
1625 /**
1626  * @format 121           Stream is paused.
1627  * @param subevent_code
1628  * @param a2dp_cid
1629  * @param local_seid
1630  */
1631 #define A2DP_SUBEVENT_STREAM_SUSPENDED                              0x06
1632 
1633 /**
1634  * @format 121           Stream is stoped or aborted.
1635  * @param subevent_code
1636  * @param a2dp_cid
1637  * @param local_seid
1638  */
1639 #define A2DP_SUBEVENT_STREAM_STOPPED                                0x07
1640 
1641 /**
1642  * @format 121            Stream is released.
1643  * @param subevent_code
1644  * @param a2dp_cid
1645  * @param local_seid
1646  */
1647 #define A2DP_SUBEVENT_STREAM_RELEASED                               0x08
1648 
1649 /**
1650  * @format 1211
1651  * @param subevent_code
1652  * @param a2dp_cid
1653  * @param local_seid
1654  * @param signal_identifier
1655  */
1656 #define A2DP_SUBEVENT_COMMAND_ACCEPTED                              0x09
1657 
1658 /**
1659  * @format 1211
1660  * @param subevent_code
1661  * @param a2dp_cid
1662  * @param local_seid
1663  * @param signal_identifier
1664  */
1665 #define A2DP_SUBEVENT_COMMAND_REJECTED                              0x0A
1666 
1667 /**
1668  * @format 12B1
1669  * @param subevent_code
1670  * @param a2dp_cid
1671  * @param bd_addr
1672  * @param status 0 == OK
1673  */
1674 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED              0x0B
1675 
1676 /**
1677  * @format 12            Signaling channel is released.
1678  * @param subevent_code
1679  * @param a2dp_cid
1680  */
1681 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED                  0x0C
1682 
1683 
1684 /** AVRCP Subevent */
1685 
1686 /**
1687  * @format 11B2
1688  * @param subevent_code
1689  * @param status 0 == OK
1690  * @param bd_addr
1691  * @param avrcp_cid
1692  */
1693 #define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED                           0x01
1694 
1695 /**
1696  * @format 12
1697  * @param subevent_code
1698  * @param avrcp_cid
1699  */
1700 #define AVRCP_SUBEVENT_CONNECTION_RELEASED                              0x02
1701 
1702 /**
1703  * @format 12111
1704  * @param subevent_code
1705  * @param avrcp_cid
1706  * @param command_type
1707  * @param repeat_mode
1708  * @param shuffle_mode
1709  */
1710 #define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE                          0x03
1711 
1712 /**
1713  * @format 121441
1714  * @param subevent_code
1715  * @param avrcp_cid
1716  * @param command_type
1717  * @param song_length
1718  * @param song_position
1719  * @param play_status
1720  */
1721  #define AVRCP_SUBEVENT_PLAY_STATUS                                     0x04
1722 
1723 /**
1724  * @format 1211
1725  * @param subevent_code
1726  * @param avrcp_cid
1727  * @param command_type
1728  * @param play_status
1729  */
1730 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED             0x05
1731 
1732 /**
1733  * @format 121
1734  * @param subevent_code
1735  * @param avrcp_cid
1736  * @param command_type
1737  */
1738 #define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED                       0x06
1739 
1740 /**
1741  * @format 121
1742  * @param subevent_code
1743  * @param avrcp_cid
1744  * @param command_type
1745  */
1746 #define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED          0x07
1747 
1748 /**
1749  * @format 121
1750  * @param subevent_code
1751  * @param avrcp_cid
1752  * @param command_type
1753  */
1754 #define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED            0x08
1755 
1756 /**
1757  * @format 1211
1758  * @param subevent_code
1759  * @param avrcp_cid
1760  * @param command_type
1761  * @param absolute_volume
1762  */
1763 #define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED                       0x09
1764 
1765 /**
1766  * @format 1211
1767  * @param subevent_code
1768  * @param avrcp_cid
1769  * @param command_type
1770  * @param absolute_volume
1771  */
1772 #define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE                      0x0A
1773 
1774 /**
1775  * @format 1211
1776  * @param subevent_code
1777  * @param avrcp_cid
1778  * @param command_type
1779  * @param notification_id
1780  */
1781 #define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE                       0x0B
1782 
1783 /**
1784  * @format 1211
1785  * @param subevent_code
1786  * @param avrcp_cid
1787  * @param command_type
1788  * @param operation_id
1789  */
1790 #define AVRCP_SUBEVENT_OPERATION_START                                    0x0C
1791 
1792 /**
1793  * @format 1211
1794  * @param subevent_code
1795  * @param avrcp_cid
1796  * @param command_type
1797  * @param operation_id
1798  */
1799 #define AVRCP_SUBEVENT_OPERATION_COMPLETE                                 0x0D
1800 
1801 /**
1802  * @format 121
1803  * @param subevent_code
1804  * @param avrcp_cid
1805  * @param command_type
1806  */
1807 #define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE                   0x0E
1808 
1809 /**
1810  * @format 12
1811  * @param subevent_code
1812  * @param avrcp_cid
1813  */
1814 #define AVRCP_SUBEVENT_COMPANY_IDS_QUERY                                    0x0F
1815 
1816 /**
1817  * @format 12
1818  * @param subevent_code
1819  * @param avrcp_cid
1820  */
1821 #define AVRCP_SUBEVENT_EVENT_IDS_QUERY                                      0x10
1822 
1823 /**
1824  * @format 12
1825  * @param subevent_code
1826  * @param avrcp_cid
1827  */
1828 #define AVRCP_SUBEVENT_PLAY_STATUS_QUERY                                    0x11
1829 
1830 /**
1831  * @format 12111
1832  * @param subevent_code
1833  * @param avrcp_cid
1834  * @param operation_id
1835  * @param operands_length
1836  * @param operand
1837  */
1838 #define AVRCP_SUBEVENT_OPERATION                                            0x12
1839 
1840 /**
1841  * @format 1211
1842  * @param subevent_code
1843  * @param avrcp_cid
1844  * @param command_type
1845  * @param track
1846  */
1847 #define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO                                 0x13
1848 
1849 /**
1850  * @format 1211
1851  * @param subevent_code
1852  * @param avrcp_cid
1853  * @param command_type
1854  * @param total_tracks
1855  */
1856 #define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO                          0x14
1857 
1858 /**
1859  * @format 1214
1860  * @param subevent_code
1861  * @param avrcp_cid
1862  * @param command_type
1863  * @param song_length in ms
1864  */
1865 #define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO                        0x15
1866 
1867 /**
1868  * @format 121JV
1869  * @param subevent_code
1870  * @param avrcp_cid
1871  * @param command_type
1872  * @param value_len
1873  * @param value
1874  */
1875 #define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO                                 0x16
1876 
1877  /*
1878  * @format 121JV
1879  * @param subevent_code
1880  * @param avrcp_cid
1881  * @param command_type
1882  * @param value_len
1883  * @param value
1884  */
1885 #define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO                                0x17
1886 
1887  /*
1888  * @format 121JV
1889  * @param subevent_code
1890  * @param avrcp_cid
1891  * @param command_type
1892  * @param value_len
1893  * @param value
1894  */
1895 #define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO                                 0x18
1896 
1897  /*
1898  * @format 121JV
1899  * @param subevent_code
1900  * @param avrcp_cid
1901  * @param command_type
1902  * @param value_len
1903  * @param value
1904  */
1905 #define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO                                 0x19
1906 
1907 /*
1908  * @format 1211
1909  * @param subevent_code
1910  * @param avrcp_cid
1911  * @param command_type
1912  * @param status
1913  */
1914 #define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE                                  0x1A
1915 
1916 /**
1917  * @format 1B2
1918  * @param subevent_code
1919  * @param bd_addr
1920  * @param browsing_cid
1921  */
1922 #define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION                          0x1B
1923 
1924 /**
1925  * @format 11B2
1926  * @param subevent_code
1927  * @param status 0 == OK
1928  * @param bd_addr
1929  * @param browsing_cid
1930  */
1931 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED                        0x1C
1932 
1933 /**
1934  * @format 12
1935  * @param subevent_code
1936  * @param browsing_cid
1937  */
1938 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED                            0x1D
1939 
1940 
1941 /**
1942  * @format 1211
1943  * @param subevent_code
1944  * @param browsing_cid
1945  * @param browsing_status
1946  * @param bluetooth_status
1947  */
1948 #define AVRCP_SUBEVENT_BROWSING_MEDIA_ITEM_DONE                                0x1E
1949 
1950 
1951 /**
1952  * @format 121BH1
1953  * @param subevent_code
1954  * @param goep_cid
1955  * @param status
1956  * @param bd_addr
1957  * @param con_handle
1958  * @param incoming
1959  */
1960 #define GOEP_SUBEVENT_CONNECTION_OPENED                                    0x01
1961 
1962 /**
1963  * @format 12
1964  * @param subevent_code
1965  * @param goep_cid
1966 */
1967 #define GOEP_SUBEVENT_CONNECTION_CLOSED                                    0x02
1968 
1969 /**
1970  * @format 12
1971  * @param subevent_code
1972  * @param goep_cid
1973 */
1974 #define GOEP_SUBEVENT_CAN_SEND_NOW                                         0x03
1975 
1976 /**
1977  * @format 121BH1
1978  * @param subevent_code
1979  * @param pbap_cid
1980  * @param status
1981  * @param bd_addr
1982  * @param con_handle
1983  * @param incoming
1984  */
1985 #define PBAP_SUBEVENT_CONNECTION_OPENED                                    0x01
1986 
1987 /**
1988  * @format 12
1989  * @param subevent_code
1990  * @param goep_cid
1991 */
1992 #define PBAP_SUBEVENT_CONNECTION_CLOSED                                    0x02
1993 
1994 /**
1995  * @format 121
1996  * @param subevent_code
1997  * @param goep_cid
1998  * @param status
1999  */
2000 #define PBAP_SUBEVENT_OPERATION_COMPLETED                                  0x03
2001 
2002 // HID Meta Event Group
2003 
2004 /**
2005  * @format 121BH1
2006  * @param subevent_code
2007  * @param hid_cid
2008  * @param status
2009  * @param bd_addr
2010  * @param con_handle
2011  * @param incoming
2012  */
2013 #define HID_SUBEVENT_CONNECTION_OPENED                                     0x01
2014 
2015 /**
2016  * @format 12
2017  * @param subevent_code
2018  * @param hid_cid
2019 */
2020 #define HID_SUBEVENT_CONNECTION_CLOSED                                     0x02
2021 
2022 /**
2023  * @format 12
2024  * @param subevent_code
2025  * @param hid_cid
2026 */
2027 #define HID_SUBEVENT_CAN_SEND_NOW                                          0x03
2028 
2029 // HIDS Meta Event Group
2030 
2031 /**
2032  * @format 12
2033  * @param subevent_code
2034  * @param con_handle
2035 */
2036 #define HIDS_SUBEVENT_CAN_SEND_NOW                                          0x01
2037 
2038 /**
2039  * @format 121
2040  * @param subevent_code
2041  * @param con_handle
2042  * @param protocol_mode
2043 */
2044 #define HIDS_SUBEVENT_PROTOCOL_MODE                                         0x02
2045 
2046 /**
2047  * @format 121
2048  * @param subevent_code
2049  * @param con_handle
2050  * @param enable
2051 */
2052 #define HIDS_SUBEVENT_BOOT_MOUSE_INPUT_REPORT_ENABLE                        0x03
2053 
2054 /**
2055  * @format 121
2056  * @param subevent_code
2057  * @param con_handle
2058  * @param enable
2059 */
2060 #define HIDS_SUBEVENT_BOOT_KEYBOARD_INPUT_REPORT_ENABLE                     0x04
2061 
2062 /**
2063  * @format 121
2064  * @param subevent_code
2065  * @param con_handle
2066  * @param enable
2067 */
2068 #define HIDS_SUBEVENT_INPUT_REPORT_ENABLE                                   0x05
2069 
2070 #endif
2071