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