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