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