xref: /btstack/src/btstack_defines.h (revision 1884f13fb9884b15dacdfc04d9536827c4949e99)
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 #define ATT_HANDLE_VALUE_INDICATION_DISCONNECT             0x92
169 
170 #define GATT_CLIENT_NOT_CONNECTED                          0x93
171 #define GATT_CLIENT_BUSY                                   0x94
172 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
173 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
174 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
175 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
176 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
177 
178 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
179 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
180 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
181 
182 // OBEX ERRORS
183 #define OBEX_UNKNOWN_ERROR                                 0xB0
184 #define OBEX_CONNECT_FAILED                                0xB1
185 #define OBEX_DISCONNECTED                                  0xB2
186 #define OBEX_NOT_FOUND                                     0xB3
187 
188 #define AVDTP_SEID_DOES_NOT_EXIST                          0xC0
189 #define AVDTP_CONNECTION_DOES_NOT_EXIST                    0xC1
190 #define AVDTP_CONNECTION_IN_WRONG_STATE                    0xC2
191 #define AVDTP_STREAM_ENDPOINT_IN_WRONG_STATE               0xC3
192 #define AVDTP_STREAM_ENDPOINT_DOES_NOT_EXIST               0xC4
193 #define AVDTP_MEDIA_CONNECTION_DOES_NOT_EXIST              0xC5
194 /* ENUM_END */
195 
196 // DAEMON COMMANDS
197 
198 #define OGF_BTSTACK 0x3d
199 
200 // cmds for BTstack
201 // get state: @returns HCI_STATE
202 #define BTSTACK_GET_STATE                                  0x01
203 
204 // set power mode: param HCI_POWER_MODE
205 #define BTSTACK_SET_POWER_MODE                             0x02
206 
207 // set capture mode: param on
208 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
209 
210 // get BTstack version
211 #define BTSTACK_GET_VERSION                                0x04
212 
213 // get system Bluetooth state
214 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
215 
216 // set system Bluetooth state
217 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
218 
219 // enable inquiry scan for this client
220 #define BTSTACK_SET_DISCOVERABLE                           0x07
221 
222 // set global Bluetooth state
223 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
224 
225 // create l2cap channel: param bd_addr(48), psm (16)
226 #define L2CAP_CREATE_CHANNEL                               0x20
227 
228 // disconnect l2cap disconnect, param channel(16), reason(8)
229 #define L2CAP_DISCONNECT                                   0x21
230 
231 // register l2cap service: param psm(16), mtu (16)
232 #define L2CAP_REGISTER_SERVICE                             0x22
233 
234 // unregister l2cap disconnect, param psm(16)
235 #define L2CAP_UNREGISTER_SERVICE                           0x23
236 
237 // accept connection param bd_addr(48), dest cid (16)
238 #define L2CAP_ACCEPT_CONNECTION                            0x24
239 
240 // decline l2cap disconnect,param bd_addr(48), dest cid (16), reason(8)
241 #define L2CAP_DECLINE_CONNECTION                           0x25
242 
243 // create l2cap channel: param bd_addr(48), psm (16), mtu (16)
244 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
245 
246 // register SDP Service Record: service record (size)
247 #define SDP_REGISTER_SERVICE_RECORD                        0x30
248 
249 // unregister SDP Service Record
250 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
251 
252 // Get remote RFCOMM services
253 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
254 
255 // Get remote SDP services
256 #define SDP_CLIENT_QUERY_SERVICES                          0x33
257 
258 // RFCOMM "HCI" Commands
259 #define RFCOMM_CREATE_CHANNEL       0x40
260 #define RFCOMM_DISCONNECT     0x41
261 #define RFCOMM_REGISTER_SERVICE     0x42
262 #define RFCOMM_UNREGISTER_SERVICE   0x43
263 #define RFCOMM_ACCEPT_CONNECTION    0x44
264 #define RFCOMM_DECLINE_CONNECTION   0x45
265 #define RFCOMM_PERSISTENT_CHANNEL   0x46
266 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
267 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
268 #define RFCOMM_GRANT_CREDITS                 0x49
269 
270 // GAP Classic 0x50
271 #define GAP_DISCONNECT              0x50
272 
273 // GAP LE      0x60
274 #define GAP_LE_SCAN_START           0x60
275 #define GAP_LE_SCAN_STOP            0x61
276 #define GAP_LE_CONNECT              0x62
277 #define GAP_LE_CONNECT_CANCEL       0x63
278 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
279 
280 // GATT (Client) 0x70
281 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
282 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
283 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
284 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
285 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
286 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
287 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
288 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
289 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
290 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
291 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
292 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
293 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
294 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
295 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
296 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
297 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
298 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
299 #define GATT_GET_MTU                                             0x82
300 
301 // ATT
302 
303 // ..
304 // Internal properties reuse some GATT Characteristic Properties fields
305 #define ATT_DB_VERSION                                     0x01
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 H
732  * @param handle
733  */
734 #define GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE                    0xAC
735 
736 /**
737  * @format H2
738  * @param handle
739  * @param MTU
740  */
741 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
742 
743  /**
744   * @format 1H2
745   * @param status
746   * @param conn_handle
747   * @param attribute_handle
748   */
749 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
750 
751 /**
752  * @format
753  */
754 #define ATT_EVENT_CAN_SEND_NOW                                   0xB7
755 
756 // TODO: daemon only event
757 
758 /**
759  * @format 12
760  * @param status
761  * @param service_uuid
762  */
763  #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
764 
765 /**
766  * @format 12222B
767  * @param status
768  * @param bnep_cid
769  * @param source_uuid
770  * @param destination_uuid
771  * @param mtu
772  * @param remote_address
773  */
774  #define BNEP_EVENT_CHANNEL_OPENED                   0xC1
775 
776 /**
777  * @format 222B
778  * @param bnep_cid
779  * @param source_uuid
780  * @param destination_uuid
781  * @param remote_address
782  */
783  #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
784 
785 /**
786  * @format 222B1
787  * @param bnep_cid
788  * @param source_uuid
789  * @param destination_uuid
790  * @param remote_address
791  * @param channel_state
792  */
793 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
794 
795 /**
796  * @format 222B
797  * @param bnep_cid
798  * @param source_uuid
799  * @param destination_uuid
800  * @param remote_address
801  */
802  #define BNEP_EVENT_CAN_SEND_NOW                           0xC4
803 
804  /**
805   * @format H1B
806   * @param handle
807   * @param addr_type
808   * @param address
809   */
810 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
811 
812  /**
813   * @format H1B
814   * @param handle
815   * @param addr_type
816   * @param address
817   */
818 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
819 
820  /**
821   * @format H1B4
822   * @param handle
823   * @param addr_type
824   * @param address
825   * @param passkey
826   */
827 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
828 
829  /**
830   * @format H1B
831   * @param handle
832   * @param addr_type
833   * @param address
834   */
835 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
836 
837  /**
838   * @format H1B
839   * @param handle
840   * @param addr_type
841   * @param address
842   */
843 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
844 
845  /**
846   * @format H1B
847   * @param handle
848   * @param addr_type
849   * @param address
850   */
851 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
852 
853  /**
854   * @format H1B4
855   * @param handle
856   * @param addr_type
857   * @param address
858   * @param passkey
859   */
860 #define SM_EVENT_NUMERIC_COMPARISON_REQUEST                      0xD6
861 
862  /**
863   * @format H1B
864   * @param handle
865   * @param addr_type
866   * @param address
867   */
868 #define SM_EVENT_NUMERIC_COMPARISON_CANCEL                       0xD7
869 
870  /**
871   * @format H1B
872   * @param handle
873   * @param addr_type
874   * @param address
875   */
876 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD8
877 
878  /**
879   * @format H1B
880   * @param handle
881   * @param addr_type
882   * @param address
883   */
884 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD9
885 
886  /**
887   * @brief Identify resolving succeeded
888   *
889   * @format H1B1B2
890   * @param handle
891   * @param addr_type
892   * @param address
893   * @param identity_addr_type
894   * @param identity_address
895   * @param index
896   *
897   */
898 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xDA
899 
900  /**
901   * @format H1B
902   * @param handle
903   * @param addr_type
904   * @param address
905   */
906 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xDB
907 
908  /**
909   * @format H1B1
910   * @param handle
911   * @param addr_type
912   * @param address
913   * @param authorization_result
914   */
915 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDC
916 
917  /**
918   * @format H1
919   * @param handle
920   * @param action see SM_KEYPRESS_*
921   */
922 #define SM_EVENT_KEYPRESS_NOTIFICATION                           0xDD
923 
924  /**
925   * @brief Emitted during pairing to inform app about address used as identity
926   *
927   * @format H1B1B1
928   * @param handle
929   * @param addr_type
930   * @param address
931   * @param identity_addr_type
932   * @param identity_address
933   * @param index
934   */
935 #define SM_EVENT_IDENTITY_CREATED                                0xDE
936 
937  /**
938   * @brief Emitted to inform app that pairing is complete. Possible status values:
939   *        ERROR_CODE_SUCCESS                            -> pairing success
940   *        ERROR_CODE_CONNECTION_TIMEOUT                 -> timeout
941   *        ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION  -> disconnect
942   *        ERROR_CODE_AUTHENTICATION_FAILURE             -> SM protocol error, see reason field with SM_REASON_* from bluetooth.h
943   *
944   * @format H1B11
945   * @param handle
946   * @param addr_type
947   * @param address
948   * @param status
949   * @param reason if status == ERROR_CODE_AUTHENTICATION_FAILURE
950   */
951 #define SM_EVENT_PAIRING_COMPLETE                                0xDF
952 
953 
954 // GAP
955 
956 /**
957  * @format H1
958  * @param handle
959  * @param security_level
960  */
961 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
962 
963 /**
964  * @format 1B
965  * @param status
966  * @param address
967  */
968 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
969 
970 /**
971  * @format 11B1JV
972  * @param advertising_event_type
973  * @param address_type
974  * @param address
975  * @param rssi
976  * @param data_length
977  * @param data
978  */
979 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
980 
981  /**
982  * @format B132111JV
983  * @param bd_addr
984  * @param page_scan_repetition_mode
985  * @param class_of_device
986  * @param clock_offset
987  * @param rssi_available
988  * @param rssi
989  * @param name_available
990  * @param name_len
991  * @param name
992  */
993 #define GAP_EVENT_INQUIRY_RESULT                              0xE3
994 
995 /**
996  * @format 1
997  * @param status
998  */
999 #define GAP_EVENT_INQUIRY_COMPLETE                            0xE4
1000 
1001 
1002 // Meta Events, see below for sub events
1003 #define HCI_EVENT_HSP_META                                 0xE8
1004 #define HCI_EVENT_HFP_META                                 0xE9
1005 #define HCI_EVENT_ANCS_META                                0xEA
1006 #define HCI_EVENT_AVDTP_META                               0xEB
1007 #define HCI_EVENT_AVRCP_META                               0xEC
1008 #define HCI_EVENT_GOEP_META                                0xED
1009 #define HCI_EVENT_PBAP_META                                0xEE
1010 #define HCI_EVENT_HID_META                                 0xEF
1011 #define HCI_EVENT_A2DP_META                                0xF0
1012 #define HCI_EVENT_HIDS_META                                0xF1
1013 
1014 // Potential other meta groups
1015 // #define HCI_EVENT_BNEP_META                                0xxx
1016 // #define HCI_EVENT_GAP_META                                 0xxx
1017 // #define HCI_EVENT_GATT_META                                0xxx
1018 // #define HCI_EVENT_PAN_META                                 0xxx
1019 // #define HCI_EVENT_SDP_META                                 0xxx
1020 // #define HCI_EVENT_SM_META                                  0xxx
1021 
1022 
1023 /** HSP Subevent */
1024 
1025 /**
1026  * @format 11
1027  * @param subevent_code
1028  * @param status 0 == OK
1029  */
1030 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
1031 
1032 /**
1033  * @format 11
1034  * @param subevent_code
1035  * @param status 0 == OK
1036  */
1037 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
1038 
1039 
1040 /**
1041  * @format 11H
1042  * @param subevent_code
1043  * @param status 0 == OK
1044  * @param handle
1045  */
1046 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
1047 
1048 /**
1049  * @format 11
1050  * @param subevent_code
1051  * @param status 0 == OK
1052  */
1053 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
1054 
1055 /**
1056  * @format 1
1057  * @param subevent_code
1058  */
1059 #define HSP_SUBEVENT_RING                                  0x05
1060 
1061 /**
1062  * @format 11
1063  * @param subevent_code
1064  * @param gain Valid range: [0,15]
1065  */
1066 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
1067 
1068 /**
1069  * @format 11
1070  * @param subevent_code
1071  * @param gain Valid range: [0,15]
1072  */
1073 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
1074 
1075 /**
1076  * @format 1JV
1077  * @param subevent_code
1078  * @param value_length
1079  * @param value
1080  */
1081 #define HSP_SUBEVENT_HS_COMMAND                            0x08
1082 
1083 /**
1084  * @format 1JV
1085  * @param subevent_code
1086  * @param value_length
1087  * @param value
1088  */
1089 #define HSP_SUBEVENT_AG_INDICATION                         0x09
1090 
1091 
1092 /** HFP Subevent */
1093 
1094 /**
1095  * @format 11HB
1096  * @param subevent_code
1097  * @param status 0 == OK
1098  * @param con_handle
1099  * @param bd_addr
1100  */
1101 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
1102 
1103 /**
1104  * @format 1
1105  * @param subevent_code
1106  */
1107 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
1108 
1109 /**
1110  * @format 11HB1
1111  * @param subevent_code
1112  * @param status 0 == OK
1113  * @param handle
1114  * @param bd_addr
1115  * @param negotiated_codec
1116  */
1117 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
1118 
1119 /**
1120  * @format 1
1121  * @param subevent_code
1122  */
1123 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
1124 
1125 /**
1126  * @format 11
1127  * @param subevent_code
1128  * @param status 0 == OK
1129  */
1130 #define HFP_SUBEVENT_COMPLETE                              0x05
1131 
1132 /**
1133  * @format 111T
1134  * @param subevent_code
1135  * @param indicator_index
1136  * @param indicator_status
1137  * @param indicator_name
1138  */
1139 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
1140 
1141 /**
1142  * @format 111T
1143  * @param subevent_code
1144  * @param network_operator_mode
1145  * @param network_operator_format
1146  * @param network_operator_name
1147  */
1148 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
1149 
1150 /**
1151  * @format 11
1152  * @param subevent_code
1153  * @param error
1154  */
1155 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
1156 
1157 /**
1158  * @format 1
1159  * @param subevent_code
1160  */
1161 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
1162 
1163 /**
1164  * @format 1
1165  * @param subevent_code
1166  */
1167 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
1168 
1169 /**
1170  * @format 1
1171  * @param subevent_code
1172  */
1173 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
1174 
1175 /**
1176  * @format 1T
1177  * @param subevent_code
1178  * @param number
1179  */
1180 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
1181 
1182 /**
1183  * @format 1
1184  * @param subevent_code
1185  */
1186 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
1187 
1188 /**
1189  * @format 1T
1190  * @param subevent_code
1191  * @param number
1192  */
1193 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
1194 
1195 /**
1196  * @format 1T
1197  * @param subevent_code
1198  * @param dtmf code
1199  */
1200 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1201 
1202 /**
1203  * @format 1
1204  * @param subevent_code
1205  */
1206  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1207 
1208 /**
1209  * @format 1
1210  * @param subevent_code
1211  */
1212 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1213 
1214 /**
1215  * @format 1
1216  * @param subevent_code
1217  */
1218 #define HFP_SUBEVENT_RING                                     0x13
1219 
1220 /**
1221  * @format 111
1222  * @param subevent_code
1223  * @param status
1224  * @param gain
1225  */
1226  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1227 
1228 /**
1229  * @format 111
1230  * @param subevent_code
1231  * @param status
1232  * @param gain
1233  */
1234 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1235 
1236 /**
1237  * @format 11T
1238  * @param subevent_code
1239  * @param type
1240  * @param number
1241  */
1242 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1243 
1244 /**
1245  * @format 11T
1246  * @param subevent_code
1247  * @param type
1248  * @param number
1249  */
1250 #define HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION 0x17
1251 
1252 /**
1253  * @format 111111T
1254  * @param subevent_code
1255  * @param clcc_idx
1256  * @param clcc_dir
1257  * @param clcc_status
1258  * @param clcc_mpty
1259  * @param bnip_type
1260  * @param bnip_number
1261  */
1262 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1263 
1264 /**
1265  * @format 111T
1266  * @param subevent_code
1267  * @param status
1268  * @param bnip_type
1269  * @param bnip_number
1270  */
1271  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1272 
1273 /**
1274  * @format 1T
1275  * @param subevent_code
1276  * @param value
1277  */
1278 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1279 
1280 // ANCS Client
1281 
1282 /**
1283  * @format 1H
1284  * @param subevent_code
1285  * @param handle
1286  */
1287 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1288 
1289 /**
1290  * @format 1H2T
1291  * @param subevent_code
1292  * @param handle
1293  * @param attribute_id
1294  * @param text
1295  */
1296 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1297 
1298 /**
1299  * @format 1H
1300  * @param subevent_code
1301  * @param handle
1302  */
1303 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1304 
1305 
1306 /** AVDTP Subevent */
1307 
1308 /**
1309  * @format 1211
1310  * @param subevent_code
1311  * @param avdtp_cid
1312  * @param local_seid
1313  * @param signal_identifier
1314  */
1315 #define AVDTP_SUBEVENT_SIGNALING_ACCEPT                     0x01
1316 
1317 /**
1318  * @format 1211
1319  * @param subevent_code
1320  * @param avdtp_cid
1321  * @param local_seid
1322  * @param signal_identifier
1323  */
1324 #define AVDTP_SUBEVENT_SIGNALING_REJECT                     0x02
1325 
1326 /**
1327  * @format 1211
1328  * @param subevent_code
1329  * @param avdtp_cid
1330  * @param local_seid
1331  * @param signal_identifier
1332  */
1333 #define AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT             0x03
1334 
1335 /**
1336  * @format 12B1
1337  * @param subevent_code
1338  * @param avdtp_cid
1339  * @param bd_addr
1340  * @param status 0 == OK
1341  */
1342 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED     0x04
1343 
1344 /**
1345  * @format 12
1346  * @param subevent_code
1347  * @param avdtp_cid
1348  */
1349 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED        0x05
1350 
1351 /**
1352  * @format 121111
1353  * @param subevent_code
1354  * @param avdtp_cid
1355  * @param remote_seid        0x01 – 0x3E
1356  * @param in_use      0-not in use, 1-in use
1357  * @param media_type  0-audio, 1-video, 2-multimedia
1358  * @param sep_type    0-source, 1-sink
1359  */
1360 #define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND                  0x06
1361 
1362 /**
1363  * @format 121111111111
1364  * @param subevent_code
1365  * @param avdtp_cid
1366  * @param local_seid
1367  * @param remote_seid
1368  * @param media_type
1369  * @param sampling_frequency_bitmap
1370  * @param channel_mode_bitmap
1371  * @param block_length_bitmap
1372  * @param subbands_bitmap
1373  * @param allocation_method_bitmap
1374  * @param min_bitpool_value
1375  * @param max_bitpool_value
1376  */
1377 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY          0x07
1378 
1379 /**
1380  * @format 121112LV
1381  * @param subevent_code
1382  * @param avdtp_cid
1383  * @param local_seid
1384  * @param remote_seid
1385  * @param media_type
1386  * @param media_codec_type
1387  * @param media_codec_information_len
1388  * @param media_codec_information
1389  */
1390 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY        0x08
1391 
1392 
1393 /**
1394  * @format 1211
1395  * @param subevent_code
1396  * @param avdtp_cid
1397  * @param local_seid
1398  * @param remote_seid
1399  */
1400 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_TRANSPORT_CAPABILITY        0x09
1401 
1402 
1403 /**
1404  * @format 1211
1405  * @param subevent_code
1406  * @param avdtp_cid
1407  * @param local_seid
1408  * @param remote_seid
1409  */
1410 #define AVDTP_SUBEVENT_SIGNALING_REPORTING_CAPABILITY        0x0A
1411 
1412 
1413 /**
1414  * @format 1211111
1415  * @param subevent_code
1416  * @param avdtp_cid
1417  * @param local_seid
1418  * @param remote_seid
1419  * @param recovery_type
1420  * @param maximum_recovery_window_size
1421  * @param maximum_number_media_packets
1422  */
1423 #define AVDTP_SUBEVENT_SIGNALING_RECOVERY_CAPABILITY        0x0B
1424 
1425 
1426 /**
1427  * @format 12112LV
1428  * @param subevent_code
1429  * @param avdtp_cid
1430  * @param local_seid
1431  * @param remote_seid
1432  * @param cp_type
1433  * @param cp_type_value_len
1434  * @param cp_type_value
1435  */
1436 #define AVDTP_SUBEVENT_SIGNALING_CONTENT_PROTECTION_CAPABILITY        0x0C
1437 
1438 
1439 /**
1440  * @format 121111111111
1441  * @param subevent_code
1442  * @param avdtp_cid
1443  * @param local_seid
1444  * @param remote_seid
1445  * @param fragmentation
1446  * @param transport_identifiers_num
1447  * @param transport_session_identifier_1
1448  * @param transport_session_identifier_2
1449  * @param transport_session_identifier_3
1450  * @param tcid_1
1451  * @param tcid_2
1452  * @param tcid_3
1453  */
1454 #define AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY        0x0D
1455 
1456 
1457 /**
1458  * @format 1211
1459  * @param subevent_code
1460  * @param avdtp_cid
1461  * @param local_seid
1462  * @param remote_seid
1463  */
1464 #define AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY        0x0E
1465 
1466 
1467 /**
1468  * @format 1211111
1469  * @param subevent_code
1470  * @param avdtp_cid
1471  * @param local_seid
1472  * @param remote_seid
1473  * @param back_ch
1474  * @param media
1475  * @param recovery
1476  */
1477 #define AVDTP_SUBEVENT_SIGNALING_HEADER_COMPRESSION_CAPABILITY        0x0F
1478 
1479 
1480 /**
1481  * @format 12111121111111
1482  * @param subevent_code
1483  * @param avdtp_cid
1484  * @param local_seid
1485  * @param remote_seid
1486  * @param reconfigure
1487  * @param media_type
1488  * @param sampling_frequency
1489  * @param channel_mode
1490  * @param num_channels
1491  * @param block_length
1492  * @param subbands
1493  * @param allocation_method
1494  * @param min_bitpool_value
1495  * @param max_bitpool_value
1496  */
1497 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION        0x10
1498 
1499 /**
1500  * @format 1211112LV
1501  * @param subevent_code
1502  * @param avdtp_cid
1503  * @param local_seid
1504  * @param remote_seid
1505  * @param reconfigure
1506  * @param media_type
1507  * @param media_codec_type
1508  * @param media_codec_information_len
1509  * @param media_codec_information
1510  */
1511 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION        0x11
1512 
1513 /**
1514  * @format 12B111
1515  * @param subevent_code
1516  * @param avdtp_cid
1517  * @param bd_addr
1518  * @param local_seid
1519  * @param remote_seid
1520  * @param status 0 == OK
1521  */
1522 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED     0x12
1523 
1524 /**
1525  * @format 121
1526  * @param subevent_code
1527  * @param avdtp_cid
1528  * @param local_seid
1529  */
1530 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED        0x13
1531 
1532 /**
1533  * @format 1212
1534  * @param subevent_code
1535  * @param avdtp_cid
1536  * @param local_seid
1537  * @param sequence_number
1538  */
1539 #define AVDTP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW   0x14
1540 
1541 /**
1542  * @format 1211
1543  * @param subevent_code
1544  * @param avdtp_cid
1545  * @param local_seid
1546  * @param remote_seid
1547  */
1548 #define AVDTP_SUBEVENT_SIGNALING_CAPABILITY_DONE             0x15
1549 
1550 
1551 /**
1552  * @format 12
1553  * @param subevent_code
1554  * @param avdtp_cid
1555  */
1556 #define AVDTP_SUBEVENT_SIGNALING_SEP_DICOVERY_DONE           0x16
1557 
1558 
1559 /** A2DP Subevent */
1560 /* Stream goes through following states:
1561  * - OPEN         - indicated with A2DP_SUBEVENT_STREAM_ESTABLISHED event
1562  * - START        - indicated with A2DP_SUBEVENT_STREAM_STARTED event
1563  * - SUSPEND      - indicated with A2DP_SUBEVENT_STREAM_SUSPENDED event
1564  * - ABORT/STOP   - indicated with A2DP_SUBEVENT_STREAM_RELEASED event
1565 
1566  OPEN state will be followed by ABORT/STOP. Stream is ready but media transfer is not started.
1567  START can come only after the stream is OPENED, and indicates that media transfer is started.
1568  SUSPEND is optional, it pauses the stream.
1569  */
1570 
1571 /**
1572  * @format 121            Sent only by A2DP source.
1573  * @param subevent_code
1574  * @param a2dp_cid
1575  * @param local_seid
1576  */
1577 #define A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW         0x01
1578 
1579 /**
1580  * @format 12111121111111
1581  * @param subevent_code
1582  * @param a2dp_cid
1583  * @param int_seid
1584  * @param acp_seid
1585  * @param reconfigure
1586  * @param media_type
1587  * @param sampling_frequency
1588  * @param channel_mode
1589  * @param num_channels
1590  * @param block_length
1591  * @param subbands
1592  * @param allocation_method
1593  * @param min_bitpool_value
1594  * @param max_bitpool_value
1595  */
1596 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION      0x02
1597 
1598 /**
1599  * @format 1211112LV
1600  * @param subevent_code
1601  * @param a2dp_cid
1602  * @param int_seid
1603  * @param acp_seid
1604  * @param reconfigure
1605  * @param media_type
1606  * @param media_codec_type
1607  * @param media_codec_information_len
1608  * @param media_codec_information
1609  */
1610 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION    0x03
1611 
1612 /**
1613  * @format 12B111          Stream is opened byt not started.
1614  * @param subevent_code
1615  * @param a2dp_cid
1616  * @param bd_addr
1617  * @param local_seid
1618  * @param remote_seid
1619  * @param status
1620  */
1621 #define A2DP_SUBEVENT_STREAM_ESTABLISHED                           0x04
1622 
1623 /**
1624  * @format 121            Indicates that media transfer is started.
1625  * @param subevent_code
1626  * @param a2dp_cid
1627  * @param local_seid
1628  */
1629 #define A2DP_SUBEVENT_STREAM_STARTED                               0x05
1630 
1631 /**
1632  * @format 121           Stream is paused.
1633  * @param subevent_code
1634  * @param a2dp_cid
1635  * @param local_seid
1636  */
1637 #define A2DP_SUBEVENT_STREAM_SUSPENDED                              0x06
1638 
1639 /**
1640  * @format 121           Stream is stoped or aborted.
1641  * @param subevent_code
1642  * @param a2dp_cid
1643  * @param local_seid
1644  */
1645 #define A2DP_SUBEVENT_STREAM_STOPPED                                0x07
1646 
1647 /**
1648  * @format 121            Stream is released.
1649  * @param subevent_code
1650  * @param a2dp_cid
1651  * @param local_seid
1652  */
1653 #define A2DP_SUBEVENT_STREAM_RELEASED                               0x08
1654 
1655 /**
1656  * @format 1211
1657  * @param subevent_code
1658  * @param a2dp_cid
1659  * @param local_seid
1660  * @param signal_identifier
1661  */
1662 #define A2DP_SUBEVENT_COMMAND_ACCEPTED                              0x09
1663 
1664 /**
1665  * @format 1211
1666  * @param subevent_code
1667  * @param a2dp_cid
1668  * @param local_seid
1669  * @param signal_identifier
1670  */
1671 #define A2DP_SUBEVENT_COMMAND_REJECTED                              0x0A
1672 
1673 /**
1674  * @format 12B1
1675  * @param subevent_code
1676  * @param a2dp_cid
1677  * @param bd_addr
1678  * @param status 0 == OK
1679  */
1680 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED              0x0B
1681 
1682 /**
1683  * @format 12            Signaling channel is released.
1684  * @param subevent_code
1685  * @param a2dp_cid
1686  */
1687 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED                  0x0C
1688 
1689 
1690 /** AVRCP Subevent */
1691 
1692 /**
1693  * @format 11B2
1694  * @param subevent_code
1695  * @param status 0 == OK
1696  * @param bd_addr
1697  * @param avrcp_cid
1698  */
1699 #define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED                           0x01
1700 
1701 /**
1702  * @format 12
1703  * @param subevent_code
1704  * @param avrcp_cid
1705  */
1706 #define AVRCP_SUBEVENT_CONNECTION_RELEASED                              0x02
1707 
1708 /**
1709  * @format 12111
1710  * @param subevent_code
1711  * @param avrcp_cid
1712  * @param command_type
1713  * @param repeat_mode
1714  * @param shuffle_mode
1715  */
1716 #define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE                          0x03
1717 
1718 /**
1719  * @format 121441
1720  * @param subevent_code
1721  * @param avrcp_cid
1722  * @param command_type
1723  * @param song_length
1724  * @param song_position
1725  * @param play_status
1726  */
1727  #define AVRCP_SUBEVENT_PLAY_STATUS                                     0x04
1728 
1729 /**
1730  * @format 1211
1731  * @param subevent_code
1732  * @param avrcp_cid
1733  * @param command_type
1734  * @param play_status
1735  */
1736 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED             0x05
1737 
1738 /**
1739  * @format 121
1740  * @param subevent_code
1741  * @param avrcp_cid
1742  * @param command_type
1743  */
1744 #define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED                       0x06
1745 
1746 /**
1747  * @format 121
1748  * @param subevent_code
1749  * @param avrcp_cid
1750  * @param command_type
1751  */
1752 #define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED          0x07
1753 
1754 /**
1755  * @format 121
1756  * @param subevent_code
1757  * @param avrcp_cid
1758  * @param command_type
1759  */
1760 #define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED            0x08
1761 
1762 /**
1763  * @format 1211
1764  * @param subevent_code
1765  * @param avrcp_cid
1766  * @param command_type
1767  * @param absolute_volume
1768  */
1769 #define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED                       0x09
1770 
1771 /**
1772  * @format 1211
1773  * @param subevent_code
1774  * @param avrcp_cid
1775  * @param command_type
1776  * @param absolute_volume
1777  */
1778 #define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE                      0x0A
1779 
1780 /**
1781  * @format 1211
1782  * @param subevent_code
1783  * @param avrcp_cid
1784  * @param command_type
1785  * @param notification_id
1786  */
1787 #define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE                       0x0B
1788 
1789 /**
1790  * @format 1211
1791  * @param subevent_code
1792  * @param avrcp_cid
1793  * @param command_type
1794  * @param operation_id
1795  */
1796 #define AVRCP_SUBEVENT_OPERATION_START                                    0x0C
1797 
1798 /**
1799  * @format 1211
1800  * @param subevent_code
1801  * @param avrcp_cid
1802  * @param command_type
1803  * @param operation_id
1804  */
1805 #define AVRCP_SUBEVENT_OPERATION_COMPLETE                                 0x0D
1806 
1807 /**
1808  * @format 121
1809  * @param subevent_code
1810  * @param avrcp_cid
1811  * @param command_type
1812  */
1813 #define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE                   0x0E
1814 
1815 /**
1816  * @format 12
1817  * @param subevent_code
1818  * @param avrcp_cid
1819  */
1820 #define AVRCP_SUBEVENT_COMPANY_IDS_QUERY                                    0x0F
1821 
1822 /**
1823  * @format 12
1824  * @param subevent_code
1825  * @param avrcp_cid
1826  */
1827 #define AVRCP_SUBEVENT_EVENT_IDS_QUERY                                      0x10
1828 
1829 /**
1830  * @format 12
1831  * @param subevent_code
1832  * @param avrcp_cid
1833  */
1834 #define AVRCP_SUBEVENT_PLAY_STATUS_QUERY                                    0x11
1835 
1836 /**
1837  * @format 12111
1838  * @param subevent_code
1839  * @param avrcp_cid
1840  * @param operation_id
1841  * @param operands_length
1842  * @param operand
1843  */
1844 #define AVRCP_SUBEVENT_OPERATION                                            0x12
1845 
1846 /**
1847  * @format 1211
1848  * @param subevent_code
1849  * @param avrcp_cid
1850  * @param command_type
1851  * @param track
1852  */
1853 #define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO                                 0x13
1854 
1855 /**
1856  * @format 1211
1857  * @param subevent_code
1858  * @param avrcp_cid
1859  * @param command_type
1860  * @param total_tracks
1861  */
1862 #define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO                          0x14
1863 
1864 /**
1865  * @format 1214
1866  * @param subevent_code
1867  * @param avrcp_cid
1868  * @param command_type
1869  * @param song_length in ms
1870  */
1871 #define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO                        0x15
1872 
1873 /**
1874  * @format 121JV
1875  * @param subevent_code
1876  * @param avrcp_cid
1877  * @param command_type
1878  * @param value_len
1879  * @param value
1880  */
1881 #define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO                                 0x16
1882 
1883  /*
1884  * @format 121JV
1885  * @param subevent_code
1886  * @param avrcp_cid
1887  * @param command_type
1888  * @param value_len
1889  * @param value
1890  */
1891 #define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO                                0x17
1892 
1893  /*
1894  * @format 121JV
1895  * @param subevent_code
1896  * @param avrcp_cid
1897  * @param command_type
1898  * @param value_len
1899  * @param value
1900  */
1901 #define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO                                 0x18
1902 
1903  /*
1904  * @format 121JV
1905  * @param subevent_code
1906  * @param avrcp_cid
1907  * @param command_type
1908  * @param value_len
1909  * @param value
1910  */
1911 #define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO                                 0x19
1912 
1913 /*
1914  * @format 1211
1915  * @param subevent_code
1916  * @param avrcp_cid
1917  * @param command_type
1918  * @param status
1919  */
1920 #define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE                                  0x1A
1921 
1922 /**
1923  * @format 1B2
1924  * @param subevent_code
1925  * @param bd_addr
1926  * @param browsing_cid
1927  */
1928 #define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION                          0x1B
1929 
1930 /**
1931  * @format 11B2
1932  * @param subevent_code
1933  * @param status 0 == OK
1934  * @param bd_addr
1935  * @param browsing_cid
1936  */
1937 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED                        0x1C
1938 
1939 /**
1940  * @format 12
1941  * @param subevent_code
1942  * @param browsing_cid
1943  */
1944 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED                            0x1D
1945 
1946 /**
1947  * @format 12211
1948  * @param subevent_code
1949  * @param browsing_cid
1950  * @param uid_counter
1951  * @param browsing_status
1952  * @param bluetooth_status
1953  */
1954 #define AVRCP_SUBEVENT_BROWSING_DONE                                          0x1E
1955 
1956 /**
1957  * @format 1214
1958  * @param subevent_code
1959  * @param browsing_cid
1960  * @param scope
1961  * @param attr_bitmap
1962  */
1963 #define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS                             0x1F
1964 
1965 /**
1966  * @format 121
1967  * @param subevent_code
1968  * @param browsing_cid
1969  * @param scope
1970  */
1971 #define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS                             0x20
1972 
1973 /**
1974  * @format 121BH1
1975  * @param subevent_code
1976  * @param goep_cid
1977  * @param status
1978  * @param bd_addr
1979  * @param con_handle
1980  * @param incoming
1981  */
1982 #define GOEP_SUBEVENT_CONNECTION_OPENED                                    0x01
1983 
1984 /**
1985  * @format 12
1986  * @param subevent_code
1987  * @param goep_cid
1988 */
1989 #define GOEP_SUBEVENT_CONNECTION_CLOSED                                    0x02
1990 
1991 /**
1992  * @format 12
1993  * @param subevent_code
1994  * @param goep_cid
1995 */
1996 #define GOEP_SUBEVENT_CAN_SEND_NOW                                         0x03
1997 
1998 /**
1999  * @format 121BH1
2000  * @param subevent_code
2001  * @param pbap_cid
2002  * @param status
2003  * @param bd_addr
2004  * @param con_handle
2005  * @param incoming
2006  */
2007 #define PBAP_SUBEVENT_CONNECTION_OPENED                                    0x01
2008 
2009 /**
2010  * @format 12
2011  * @param subevent_code
2012  * @param goep_cid
2013 */
2014 #define PBAP_SUBEVENT_CONNECTION_CLOSED                                    0x02
2015 
2016 /**
2017  * @format 121
2018  * @param subevent_code
2019  * @param goep_cid
2020  * @param status
2021  */
2022 #define PBAP_SUBEVENT_OPERATION_COMPLETED                                  0x03
2023 
2024 // HID Meta Event Group
2025 
2026 /**
2027  * @format 121BH1
2028  * @param subevent_code
2029  * @param hid_cid
2030  * @param status
2031  * @param bd_addr
2032  * @param con_handle
2033  * @param incoming
2034  */
2035 #define HID_SUBEVENT_CONNECTION_OPENED                                     0x01
2036 
2037 /**
2038  * @format 12
2039  * @param subevent_code
2040  * @param hid_cid
2041 */
2042 #define HID_SUBEVENT_CONNECTION_CLOSED                                     0x02
2043 
2044 /**
2045  * @format 12
2046  * @param subevent_code
2047  * @param hid_cid
2048 */
2049 #define HID_SUBEVENT_CAN_SEND_NOW                                          0x03
2050 
2051 // HIDS Meta Event Group
2052 
2053 /**
2054  * @format 12
2055  * @param subevent_code
2056  * @param con_handle
2057 */
2058 #define HIDS_SUBEVENT_CAN_SEND_NOW                                          0x01
2059 
2060 /**
2061  * @format 121
2062  * @param subevent_code
2063  * @param con_handle
2064  * @param protocol_mode
2065 */
2066 #define HIDS_SUBEVENT_PROTOCOL_MODE                                         0x02
2067 
2068 /**
2069  * @format 121
2070  * @param subevent_code
2071  * @param con_handle
2072  * @param enable
2073 */
2074 #define HIDS_SUBEVENT_BOOT_MOUSE_INPUT_REPORT_ENABLE                        0x03
2075 
2076 /**
2077  * @format 121
2078  * @param subevent_code
2079  * @param con_handle
2080  * @param enable
2081 */
2082 #define HIDS_SUBEVENT_BOOT_KEYBOARD_INPUT_REPORT_ENABLE                     0x04
2083 
2084 /**
2085  * @format 121
2086  * @param subevent_code
2087  * @param con_handle
2088  * @param enable
2089 */
2090 #define HIDS_SUBEVENT_INPUT_REPORT_ENABLE                                   0x05
2091 
2092 #endif
2093