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