xref: /btstack/src/btstack_defines.h (revision e9c5f44ee8add45f6cd4be8b6faa9e09a2804fcc)
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 1111111T
1277  * @param subevent_code
1278  * @param clcc_idx
1279  * @param clcc_dir
1280  * @param clcc_status
1281  * @param clcc_mode
1282  * @param clcc_mpty
1283  * @param bnip_type
1284  * @param bnip_number
1285  */
1286 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1287 
1288 /**
1289  * @format 111T
1290  * @param subevent_code
1291  * @param status
1292  * @param bnip_type
1293  * @param bnip_number
1294  */
1295  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1296 
1297 /**
1298  * @format 1T
1299  * @param subevent_code
1300  * @param value
1301  */
1302 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1303 
1304 // ANCS Client
1305 
1306 /**
1307  * @format 1H
1308  * @param subevent_code
1309  * @param handle
1310  */
1311 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1312 
1313 /**
1314  * @format 1H2T
1315  * @param subevent_code
1316  * @param handle
1317  * @param attribute_id
1318  * @param text
1319  */
1320 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1321 
1322 /**
1323  * @format 1H
1324  * @param subevent_code
1325  * @param handle
1326  */
1327 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1328 
1329 
1330 /** AVDTP Subevent */
1331 
1332 /**
1333  * @format 1211
1334  * @param subevent_code
1335  * @param avdtp_cid
1336  * @param local_seid
1337  * @param signal_identifier
1338  */
1339 #define AVDTP_SUBEVENT_SIGNALING_ACCEPT                     0x01
1340 
1341 /**
1342  * @format 1211
1343  * @param subevent_code
1344  * @param avdtp_cid
1345  * @param local_seid
1346  * @param signal_identifier
1347  */
1348 #define AVDTP_SUBEVENT_SIGNALING_REJECT                     0x02
1349 
1350 /**
1351  * @format 1211
1352  * @param subevent_code
1353  * @param avdtp_cid
1354  * @param local_seid
1355  * @param signal_identifier
1356  */
1357 #define AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT             0x03
1358 
1359 /**
1360  * @format 12B1
1361  * @param subevent_code
1362  * @param avdtp_cid
1363  * @param bd_addr
1364  * @param status 0 == OK
1365  */
1366 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED     0x04
1367 
1368 /**
1369  * @format 12
1370  * @param subevent_code
1371  * @param avdtp_cid
1372  */
1373 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED        0x05
1374 
1375 /**
1376  * @format 121111
1377  * @param subevent_code
1378  * @param avdtp_cid
1379  * @param remote_seid        0x01 – 0x3E
1380  * @param in_use      0-not in use, 1-in use
1381  * @param media_type  0-audio, 1-video, 2-multimedia
1382  * @param sep_type    0-source, 1-sink
1383  */
1384 #define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND                  0x06
1385 
1386 /**
1387  * @format 121111111111
1388  * @param subevent_code
1389  * @param avdtp_cid
1390  * @param local_seid
1391  * @param remote_seid
1392  * @param media_type
1393  * @param sampling_frequency_bitmap
1394  * @param channel_mode_bitmap
1395  * @param block_length_bitmap
1396  * @param subbands_bitmap
1397  * @param allocation_method_bitmap
1398  * @param min_bitpool_value
1399  * @param max_bitpool_value
1400  */
1401 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY          0x07
1402 
1403 /**
1404  * @format 121112LV
1405  * @param subevent_code
1406  * @param avdtp_cid
1407  * @param local_seid
1408  * @param remote_seid
1409  * @param media_type
1410  * @param media_codec_type
1411  * @param media_codec_information_len
1412  * @param media_codec_information
1413  */
1414 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY        0x08
1415 
1416 
1417 /**
1418  * @format 1211
1419  * @param subevent_code
1420  * @param avdtp_cid
1421  * @param local_seid
1422  * @param remote_seid
1423  */
1424 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_TRANSPORT_CAPABILITY        0x09
1425 
1426 
1427 /**
1428  * @format 1211
1429  * @param subevent_code
1430  * @param avdtp_cid
1431  * @param local_seid
1432  * @param remote_seid
1433  */
1434 #define AVDTP_SUBEVENT_SIGNALING_REPORTING_CAPABILITY        0x0A
1435 
1436 
1437 /**
1438  * @format 1211111
1439  * @param subevent_code
1440  * @param avdtp_cid
1441  * @param local_seid
1442  * @param remote_seid
1443  * @param recovery_type
1444  * @param maximum_recovery_window_size
1445  * @param maximum_number_media_packets
1446  */
1447 #define AVDTP_SUBEVENT_SIGNALING_RECOVERY_CAPABILITY        0x0B
1448 
1449 
1450 /**
1451  * @format 12112LV
1452  * @param subevent_code
1453  * @param avdtp_cid
1454  * @param local_seid
1455  * @param remote_seid
1456  * @param cp_type
1457  * @param cp_type_value_len
1458  * @param cp_type_value
1459  */
1460 #define AVDTP_SUBEVENT_SIGNALING_CONTENT_PROTECTION_CAPABILITY        0x0C
1461 
1462 
1463 /**
1464  * @format 121111111111
1465  * @param subevent_code
1466  * @param avdtp_cid
1467  * @param local_seid
1468  * @param remote_seid
1469  * @param fragmentation
1470  * @param transport_identifiers_num
1471  * @param transport_session_identifier_1
1472  * @param transport_session_identifier_2
1473  * @param transport_session_identifier_3
1474  * @param tcid_1
1475  * @param tcid_2
1476  * @param tcid_3
1477  */
1478 #define AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY        0x0D
1479 
1480 
1481 /**
1482  * @format 1211
1483  * @param subevent_code
1484  * @param avdtp_cid
1485  * @param local_seid
1486  * @param remote_seid
1487  */
1488 #define AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY        0x0E
1489 
1490 
1491 /**
1492  * @format 1211111
1493  * @param subevent_code
1494  * @param avdtp_cid
1495  * @param local_seid
1496  * @param remote_seid
1497  * @param back_ch
1498  * @param media
1499  * @param recovery
1500  */
1501 #define AVDTP_SUBEVENT_SIGNALING_HEADER_COMPRESSION_CAPABILITY        0x0F
1502 
1503 
1504 /**
1505  * @format 12111121111111
1506  * @param subevent_code
1507  * @param avdtp_cid
1508  * @param local_seid
1509  * @param remote_seid
1510  * @param reconfigure
1511  * @param media_type
1512  * @param sampling_frequency
1513  * @param channel_mode
1514  * @param num_channels
1515  * @param block_length
1516  * @param subbands
1517  * @param allocation_method
1518  * @param min_bitpool_value
1519  * @param max_bitpool_value
1520  */
1521 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION        0x10
1522 
1523 /**
1524  * @format 1211112LV
1525  * @param subevent_code
1526  * @param avdtp_cid
1527  * @param local_seid
1528  * @param remote_seid
1529  * @param reconfigure
1530  * @param media_type
1531  * @param media_codec_type
1532  * @param media_codec_information_len
1533  * @param media_codec_information
1534  */
1535 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION        0x11
1536 
1537 /**
1538  * @format 12B111
1539  * @param subevent_code
1540  * @param avdtp_cid
1541  * @param bd_addr
1542  * @param local_seid
1543  * @param remote_seid
1544  * @param status 0 == OK
1545  */
1546 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED     0x12
1547 
1548 /**
1549  * @format 121
1550  * @param subevent_code
1551  * @param avdtp_cid
1552  * @param local_seid
1553  */
1554 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED        0x13
1555 
1556 /**
1557  * @format 1212
1558  * @param subevent_code
1559  * @param avdtp_cid
1560  * @param local_seid
1561  * @param sequence_number
1562  */
1563 #define AVDTP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW   0x14
1564 
1565 /**
1566  * @format 1211
1567  * @param subevent_code
1568  * @param avdtp_cid
1569  * @param local_seid
1570  * @param remote_seid
1571  */
1572 #define AVDTP_SUBEVENT_SIGNALING_CAPABILITY_DONE             0x15
1573 
1574 
1575 /**
1576  * @format 12
1577  * @param subevent_code
1578  * @param avdtp_cid
1579  */
1580 #define AVDTP_SUBEVENT_SIGNALING_SEP_DICOVERY_DONE           0x16
1581 
1582 
1583 /** A2DP Subevent */
1584 /* Stream goes through following states:
1585  * - OPEN         - indicated with A2DP_SUBEVENT_STREAM_ESTABLISHED event
1586  * - START        - indicated with A2DP_SUBEVENT_STREAM_STARTED event
1587  * - SUSPEND      - indicated with A2DP_SUBEVENT_STREAM_SUSPENDED event
1588  * - ABORT/STOP   - indicated with A2DP_SUBEVENT_STREAM_RELEASED event
1589 
1590  OPEN state will be followed by ABORT/STOP. Stream is ready but media transfer is not started.
1591  START can come only after the stream is OPENED, and indicates that media transfer is started.
1592  SUSPEND is optional, it pauses the stream.
1593  */
1594 
1595 /**
1596  * @format 121            Sent only by A2DP source.
1597  * @param subevent_code
1598  * @param a2dp_cid
1599  * @param local_seid
1600  */
1601 #define A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW         0x01
1602 
1603 /**
1604  * @format 12111121111111
1605  * @param subevent_code
1606  * @param a2dp_cid
1607  * @param int_seid
1608  * @param acp_seid
1609  * @param reconfigure
1610  * @param media_type
1611  * @param sampling_frequency
1612  * @param channel_mode
1613  * @param num_channels
1614  * @param block_length
1615  * @param subbands
1616  * @param allocation_method
1617  * @param min_bitpool_value
1618  * @param max_bitpool_value
1619  */
1620 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION      0x02
1621 
1622 /**
1623  * @format 1211112LV
1624  * @param subevent_code
1625  * @param a2dp_cid
1626  * @param int_seid
1627  * @param acp_seid
1628  * @param reconfigure
1629  * @param media_type
1630  * @param media_codec_type
1631  * @param media_codec_information_len
1632  * @param media_codec_information
1633  */
1634 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION    0x03
1635 
1636 /**
1637  * @format 12B111          Stream is opened byt not started.
1638  * @param subevent_code
1639  * @param a2dp_cid
1640  * @param bd_addr
1641  * @param local_seid
1642  * @param remote_seid
1643  * @param status
1644  */
1645 #define A2DP_SUBEVENT_STREAM_ESTABLISHED                           0x04
1646 
1647 /**
1648  * @format 121            Indicates that media transfer is started.
1649  * @param subevent_code
1650  * @param a2dp_cid
1651  * @param local_seid
1652  */
1653 #define A2DP_SUBEVENT_STREAM_STARTED                               0x05
1654 
1655 /**
1656  * @format 121           Stream is paused.
1657  * @param subevent_code
1658  * @param a2dp_cid
1659  * @param local_seid
1660  */
1661 #define A2DP_SUBEVENT_STREAM_SUSPENDED                              0x06
1662 
1663 /**
1664  * @format 121           Stream is stoped or aborted.
1665  * @param subevent_code
1666  * @param a2dp_cid
1667  * @param local_seid
1668  */
1669 #define A2DP_SUBEVENT_STREAM_STOPPED                                0x07
1670 
1671 /**
1672  * @format 121            Stream is released.
1673  * @param subevent_code
1674  * @param a2dp_cid
1675  * @param local_seid
1676  */
1677 #define A2DP_SUBEVENT_STREAM_RELEASED                               0x08
1678 
1679 /**
1680  * @format 1211
1681  * @param subevent_code
1682  * @param a2dp_cid
1683  * @param local_seid
1684  * @param signal_identifier
1685  */
1686 #define A2DP_SUBEVENT_COMMAND_ACCEPTED                              0x09
1687 
1688 /**
1689  * @format 1211
1690  * @param subevent_code
1691  * @param a2dp_cid
1692  * @param local_seid
1693  * @param signal_identifier
1694  */
1695 #define A2DP_SUBEVENT_COMMAND_REJECTED                              0x0A
1696 
1697 /**
1698  * @format 12B1
1699  * @param subevent_code
1700  * @param a2dp_cid
1701  * @param bd_addr
1702  * @param status 0 == OK
1703  */
1704 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED              0x0B
1705 
1706 /**
1707  * @format 12            Signaling channel is released.
1708  * @param subevent_code
1709  * @param a2dp_cid
1710  */
1711 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED                  0x0C
1712 
1713 /**
1714  * @format 1211          Stream was reconfigured
1715  * @param subevent_code
1716  * @param a2dp_cid
1717  * @param local_seid
1718  * @param status
1719  */
1720 #define A2DP_SUBEVENT_STREAM_RECONFIGURED                            0x0D
1721 
1722 /** AVRCP Subevent */
1723 
1724 /**
1725  * @format 11B2
1726  * @param subevent_code
1727  * @param status 0 == OK
1728  * @param bd_addr
1729  * @param avrcp_cid
1730  */
1731 #define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED                           0x01
1732 
1733 /**
1734  * @format 12
1735  * @param subevent_code
1736  * @param avrcp_cid
1737  */
1738 #define AVRCP_SUBEVENT_CONNECTION_RELEASED                              0x02
1739 
1740 /**
1741  * @format 12111
1742  * @param subevent_code
1743  * @param avrcp_cid
1744  * @param command_type
1745  * @param repeat_mode
1746  * @param shuffle_mode
1747  */
1748 #define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE                          0x03
1749 
1750 /**
1751  * @format 121441
1752  * @param subevent_code
1753  * @param avrcp_cid
1754  * @param command_type
1755  * @param song_length
1756  * @param song_position
1757  * @param play_status
1758  */
1759  #define AVRCP_SUBEVENT_PLAY_STATUS                                     0x04
1760 
1761 /**
1762  * @format 1211
1763  * @param subevent_code
1764  * @param avrcp_cid
1765  * @param command_type
1766  * @param play_status
1767  */
1768 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED             0x05
1769 
1770 /**
1771  * @format 121
1772  * @param subevent_code
1773  * @param avrcp_cid
1774  * @param command_type
1775  */
1776 #define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED                       0x06
1777 
1778 /**
1779  * @format 121
1780  * @param subevent_code
1781  * @param avrcp_cid
1782  * @param command_type
1783  */
1784 #define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED          0x07
1785 
1786 /**
1787  * @format 121
1788  * @param subevent_code
1789  * @param avrcp_cid
1790  * @param command_type
1791  */
1792 #define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED            0x08
1793 
1794 /**
1795  * @format 1211
1796  * @param subevent_code
1797  * @param avrcp_cid
1798  * @param command_type
1799  * @param absolute_volume
1800  */
1801 #define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED                       0x09
1802 
1803 /**
1804  * @format 1211
1805  * @param subevent_code
1806  * @param avrcp_cid
1807  * @param command_type
1808  * @param absolute_volume
1809  */
1810 #define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE                      0x0A
1811 
1812 /**
1813  * @format 1211
1814  * @param subevent_code
1815  * @param avrcp_cid
1816  * @param command_type
1817  * @param notification_id
1818  */
1819 #define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE                       0x0B
1820 
1821 /**
1822  * @format 1211
1823  * @param subevent_code
1824  * @param avrcp_cid
1825  * @param command_type
1826  * @param operation_id
1827  */
1828 #define AVRCP_SUBEVENT_OPERATION_START                                    0x0C
1829 
1830 /**
1831  * @format 1211
1832  * @param subevent_code
1833  * @param avrcp_cid
1834  * @param command_type
1835  * @param operation_id
1836  */
1837 #define AVRCP_SUBEVENT_OPERATION_COMPLETE                                 0x0D
1838 
1839 /**
1840  * @format 121
1841  * @param subevent_code
1842  * @param avrcp_cid
1843  * @param command_type
1844  */
1845 #define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE                   0x0E
1846 
1847 /**
1848  * @format 12
1849  * @param subevent_code
1850  * @param avrcp_cid
1851  */
1852 #define AVRCP_SUBEVENT_COMPANY_IDS_QUERY                                    0x0F
1853 
1854 /**
1855  * @format 12
1856  * @param subevent_code
1857  * @param avrcp_cid
1858  */
1859 #define AVRCP_SUBEVENT_EVENT_IDS_QUERY                                      0x10
1860 
1861 /**
1862  * @format 12
1863  * @param subevent_code
1864  * @param avrcp_cid
1865  */
1866 #define AVRCP_SUBEVENT_PLAY_STATUS_QUERY                                    0x11
1867 
1868 /**
1869  * @format 12111
1870  * @param subevent_code
1871  * @param avrcp_cid
1872  * @param operation_id
1873  * @param operands_length
1874  * @param operand
1875  */
1876 #define AVRCP_SUBEVENT_OPERATION                                            0x12
1877 
1878 /**
1879  * @format 1211
1880  * @param subevent_code
1881  * @param avrcp_cid
1882  * @param command_type
1883  * @param track
1884  */
1885 #define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO                                 0x13
1886 
1887 /**
1888  * @format 1211
1889  * @param subevent_code
1890  * @param avrcp_cid
1891  * @param command_type
1892  * @param total_tracks
1893  */
1894 #define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO                          0x14
1895 
1896 /**
1897  * @format 1214
1898  * @param subevent_code
1899  * @param avrcp_cid
1900  * @param command_type
1901  * @param song_length in ms
1902  */
1903 #define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO                        0x15
1904 
1905 /**
1906  * @format 121JV
1907  * @param subevent_code
1908  * @param avrcp_cid
1909  * @param command_type
1910  * @param value_len
1911  * @param value
1912  */
1913 #define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO                                 0x16
1914 
1915  /*
1916  * @format 121JV
1917  * @param subevent_code
1918  * @param avrcp_cid
1919  * @param command_type
1920  * @param value_len
1921  * @param value
1922  */
1923 #define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO                                0x17
1924 
1925  /*
1926  * @format 121JV
1927  * @param subevent_code
1928  * @param avrcp_cid
1929  * @param command_type
1930  * @param value_len
1931  * @param value
1932  */
1933 #define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO                                 0x18
1934 
1935  /*
1936  * @format 121JV
1937  * @param subevent_code
1938  * @param avrcp_cid
1939  * @param command_type
1940  * @param value_len
1941  * @param value
1942  */
1943 #define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO                                 0x19
1944 
1945 /*
1946  * @format 1211
1947  * @param subevent_code
1948  * @param avrcp_cid
1949  * @param command_type
1950  * @param status
1951  */
1952 #define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE                                  0x1A
1953 
1954 /**
1955  * @format 1B2
1956  * @param subevent_code
1957  * @param bd_addr
1958  * @param browsing_cid
1959  */
1960 #define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION                          0x1B
1961 
1962 /**
1963  * @format 11B2
1964  * @param subevent_code
1965  * @param status 0 == OK
1966  * @param bd_addr
1967  * @param browsing_cid
1968  */
1969 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED                        0x1C
1970 
1971 /**
1972  * @format 12
1973  * @param subevent_code
1974  * @param browsing_cid
1975  */
1976 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED                           0x1D
1977 
1978 /**
1979  * @format 12211
1980  * @param subevent_code
1981  * @param browsing_cid
1982  * @param uid_counter
1983  * @param browsing_status
1984  * @param bluetooth_status
1985  */
1986 #define AVRCP_SUBEVENT_BROWSING_DONE                                          0x1E
1987 
1988 /**
1989  * @format 1214
1990  * @param subevent_code
1991  * @param browsing_cid
1992  * @param scope
1993  * @param attr_bitmap
1994  */
1995 #define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS                              0x1F
1996 
1997 /**
1998  * @format 121
1999  * @param subevent_code
2000  * @param browsing_cid
2001  * @param scope
2002  */
2003 #define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS                           0x20
2004 
2005 /**
2006  * @format 1214
2007  * @param subevent_code
2008  * @param avrcp_cid
2009  * @param command_type
2010  * @param playback_position_ms
2011  */
2012 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED                      0x21
2013 
2014 
2015 /**
2016  * @format 121BH1
2017  * @param subevent_code
2018  * @param goep_cid
2019  * @param status
2020  * @param bd_addr
2021  * @param con_handle
2022  * @param incoming
2023  */
2024 #define GOEP_SUBEVENT_CONNECTION_OPENED                                    0x01
2025 
2026 /**
2027  * @format 12
2028  * @param subevent_code
2029  * @param goep_cid
2030 */
2031 #define GOEP_SUBEVENT_CONNECTION_CLOSED                                    0x02
2032 
2033 /**
2034  * @format 12
2035  * @param subevent_code
2036  * @param goep_cid
2037 */
2038 #define GOEP_SUBEVENT_CAN_SEND_NOW                                         0x03
2039 
2040 /**
2041  * @format 121BH1
2042  * @param subevent_code
2043  * @param pbap_cid
2044  * @param status
2045  * @param bd_addr
2046  * @param con_handle
2047  * @param incoming
2048  */
2049 #define PBAP_SUBEVENT_CONNECTION_OPENED                                    0x01
2050 
2051 /**
2052  * @format 12
2053  * @param subevent_code
2054  * @param goep_cid
2055 */
2056 #define PBAP_SUBEVENT_CONNECTION_CLOSED                                    0x02
2057 
2058 /**
2059  * @format 121
2060  * @param subevent_code
2061  * @param goep_cid
2062  * @param status
2063  */
2064 #define PBAP_SUBEVENT_OPERATION_COMPLETED                                  0x03
2065 
2066 /**
2067  * @format 1212
2068  * @param subevent_code
2069  * @param goep_cid
2070  * @param status
2071  * @param phoneboook_size
2072  */
2073 #define PBAP_SUBEVENT_PHONEBOOK_SIZE                                       0x04
2074 
2075 /**
2076  * @format 1211
2077  * @param subevent_code
2078  * @param goep_cid
2079  * @param user_id_required
2080  * @param full_access
2081  */
2082 #define PBAP_SUBEVENT_AUTHENTICATION_REQUEST                               0x05
2083 
2084 /**
2085  * @format 12JVJV
2086  * @param subevent_code
2087  * @param goep_cid
2088  * @param name_len
2089  * @param name
2090  * @param handle_len
2091  * @param handle
2092  */
2093 #define PBAP_SUBEVENT_CARD_RESULT                                          0x06
2094 
2095 
2096 // HID Meta Event Group
2097 
2098 /**
2099  * @format 121BH1
2100  * @param subevent_code
2101  * @param hid_cid
2102  * @param status
2103  * @param bd_addr
2104  * @param con_handle
2105  * @param incoming
2106  */
2107 #define HID_SUBEVENT_CONNECTION_OPENED                                     0x01
2108 
2109 /**
2110  * @format 12
2111  * @param subevent_code
2112  * @param hid_cid
2113 */
2114 #define HID_SUBEVENT_CONNECTION_CLOSED                                     0x02
2115 
2116 /**
2117  * @format 12
2118  * @param subevent_code
2119  * @param hid_cid
2120 */
2121 #define HID_SUBEVENT_CAN_SEND_NOW                                          0x03
2122 
2123 /**
2124  * @format 12
2125  * @param subevent_code
2126  * @param con_handle
2127 */
2128 #define HID_SUBEVENT_SUSPEND                                               0x04
2129 
2130 /**
2131  * @format 12
2132  * @param subevent_code
2133  * @param con_handle
2134 */
2135 #define HID_SUBEVENT_EXIT_SUSPEND                                          0x05
2136 
2137 
2138 // HIDS Meta Event Group
2139 
2140 /**
2141  * @format 12
2142  * @param subevent_code
2143  * @param con_handle
2144 */
2145 #define HIDS_SUBEVENT_CAN_SEND_NOW                                          0x01
2146 
2147 /**
2148  * @format 121
2149  * @param subevent_code
2150  * @param con_handle
2151  * @param protocol_mode
2152 */
2153 #define HIDS_SUBEVENT_PROTOCOL_MODE                                         0x02
2154 
2155 /**
2156  * @format 121
2157  * @param subevent_code
2158  * @param con_handle
2159  * @param enable
2160 */
2161 #define HIDS_SUBEVENT_BOOT_MOUSE_INPUT_REPORT_ENABLE                        0x03
2162 
2163 /**
2164  * @format 121
2165  * @param subevent_code
2166  * @param con_handle
2167  * @param enable
2168 */
2169 #define HIDS_SUBEVENT_BOOT_KEYBOARD_INPUT_REPORT_ENABLE                     0x04
2170 
2171 /**
2172  * @format 121
2173  * @param subevent_code
2174  * @param con_handle
2175  * @param enable
2176 */
2177 #define HIDS_SUBEVENT_INPUT_REPORT_ENABLE                                   0x05
2178 
2179 /**
2180  * @format 121
2181  * @param subevent_code
2182  * @param con_handle
2183  * @param enable
2184 */
2185 #define HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE                                  0x06
2186 
2187 /**
2188  * @format 121
2189  * @param subevent_code
2190  * @param con_handle
2191  * @param enable
2192 */
2193 #define HIDS_SUBEVENT_FEATURE_REPORT_ENABLE                                 0x07
2194 
2195 /**
2196  * @format 12
2197  * @param subevent_code
2198  * @param con_handle
2199 */
2200 #define HIDS_SUBEVENT_SUSPEND                                               0x08
2201 
2202 /**
2203  * @format 12
2204  * @param subevent_code
2205  * @param con_handle
2206 */
2207 #define HIDS_SUBEVENT_EXIT_SUSPEND                                          0x09
2208 
2209 /**
2210  * @format 1211
2211  * @param subevent_code
2212  * @param con_handle
2213  * @param measurement_type  // 0 - force magnitude, 1 - torque magnitude, see cycling_power_sensor_measurement_context_t
2214  * @param is_enhanced
2215 */
2216 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_START_CALIBRATION               0x01
2217 
2218 /**
2219  * @format 12
2220  * @param subevent_code
2221  * @param con_handle
2222 */
2223 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_BROADCAST_START                 0x02
2224 
2225 /**
2226  * @format 12
2227  * @param subevent_code
2228  * @param con_handle
2229 */
2230 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_BROADCAST_STOP                  0x03
2231 #endif
2232