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