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