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