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