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