xref: /btstack/src/btstack_defines.h (revision 7f1690cf27ca04545945f16bd57a2ec52ce35927)
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 // RFCOMM EVENTS
547 
548 /**
549  * @format 1B21221
550  * @param status
551  * @param bd_addr
552  * @param con_handle
553  * @param server_channel
554  * @param rfcomm_cid
555  * @param max_frame_size
556  * @param incoming
557  */
558 #define RFCOMM_EVENT_CHANNEL_OPENED                        0x80
559 
560 /**
561  * @format 2
562  * @param rfcomm_cid
563  */
564 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
565 
566 /**
567  * @format B12
568  * @param bd_addr
569  * @param server_channel
570  * @param rfcomm_cid
571  */
572 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
573 
574 /**
575  * @format 21
576  * @param rfcomm_cid
577  * @param line_status
578  */
579 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
580 
581 /**
582  * @format 21
583  * @param rfcomm_cid
584  * @param modem_status
585  */
586 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
587 
588  /**
589   * TODO: format for variable data 2?
590   * param rfcomm_cid
591   * param rpn_data
592   */
593 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
594 
595 /**
596  * @format 2
597  * @param rfcomm_cid
598  */
599 #define RFCOMM_EVENT_CAN_SEND_NOW                          0x89
600 
601 
602 /**
603  * @format 1
604  * @param status
605  */
606 #define SDP_EVENT_QUERY_COMPLETE                                 0x91
607 
608 /**
609  * @format 1T
610  * @param rfcomm_channel
611  * @param name
612  */
613 #define SDP_EVENT_QUERY_RFCOMM_SERVICE                           0x92
614 
615 /**
616  * @format 22221
617  * @param record_id
618  * @param attribute_id
619  * @param attribute_length
620  * @param data_offset
621  * @param data
622  */
623 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE                           0x93
624 
625 /**
626  * @format 22LV
627  * @param record_id
628  * @param attribute_id
629  * @param attribute_length
630  * @param attribute_value
631  */
632 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE                          0x94
633 
634 /**
635  * @format 224
636  * @param total_count
637  * @param record_index
638  * @param record_handle
639  * @note Not provided by daemon, only used for internal testing
640  */
641 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE                    0x95
642 
643 /**
644  * @format H1
645  * @param handle
646  * @param status
647  */
648 #define GATT_EVENT_QUERY_COMPLETE                                0xA0
649 
650 /**
651  * @format HX
652  * @param handle
653  * @param service
654  */
655 #define GATT_EVENT_SERVICE_QUERY_RESULT                          0xA1
656 
657 /**
658  * @format HY
659  * @param handle
660  * @param characteristic
661  */
662 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT                   0xA2
663 
664 /**
665  * @format H2X
666  * @param handle
667  * @param include_handle
668  * @param service
669  */
670 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
671 
672 /**
673  * @format HZ
674  * @param handle
675  * @param characteristic_descriptor
676  */
677 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
678 
679 /**
680  * @format H2LV
681  * @param handle
682  * @param value_handle
683  * @param value_length
684  * @param value
685  */
686 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
687 
688 /**
689  * @format H22LV
690  * @param handle
691  * @param value_handle
692  * @param value_offset
693  * @param value_length
694  * @param value
695  */
696 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
697 
698 /**
699  * @format H2LV
700  * @param handle
701  * @param value_handle
702  * @param value_length
703  * @param value
704  */
705 #define GATT_EVENT_NOTIFICATION                                  0xA7
706 
707 /**
708  * @format H2LV
709  * @param handle
710  * @param value_handle
711  * @param value_length
712  * @param value
713  */
714 #define GATT_EVENT_INDICATION                                    0xA8
715 
716 /**
717  * @format H2LV
718  * @param handle
719  * @param descriptor_handle
720  * @param descriptor_length
721  * @param descriptor
722  */
723 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
724 
725 /**
726  * @format H2LV
727  * @param handle
728  * @param descriptor_offset
729  * @param descriptor_length
730  * @param descriptor
731  */
732 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
733 
734 /**
735  * @format H2
736  * @param handle
737  * @param MTU
738  */
739 #define GATT_EVENT_MTU                                           0xAB
740 
741 /**
742  * @format H
743  * @param handle
744  */
745 #define GATT_EVENT_CAN_WRITE_WITHOUT_RESPONSE                    0xAC
746 
747 /**
748  * @format H2
749  * @param handle
750  * @param MTU
751  */
752 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
753 
754  /**
755   * @format 1H2
756   * @param status
757   * @param conn_handle
758   * @param attribute_handle
759   */
760 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
761 
762 /**
763  * @format
764  */
765 #define ATT_EVENT_CAN_SEND_NOW                                   0xB7
766 
767 // TODO: daemon only event
768 
769 /**
770  * @format 12
771  * @param status
772  * @param service_uuid
773  */
774  #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
775 
776 /**
777  * @format 12222B
778  * @param status
779  * @param bnep_cid
780  * @param source_uuid
781  * @param destination_uuid
782  * @param mtu
783  * @param remote_address
784  */
785  #define BNEP_EVENT_CHANNEL_OPENED                   0xC1
786 
787 /**
788  * @format 222B
789  * @param bnep_cid
790  * @param source_uuid
791  * @param destination_uuid
792  * @param remote_address
793  */
794  #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
795 
796 /**
797  * @format 222B1
798  * @param bnep_cid
799  * @param source_uuid
800  * @param destination_uuid
801  * @param remote_address
802  * @param channel_state
803  */
804 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
805 
806 /**
807  * @format 222B
808  * @param bnep_cid
809  * @param source_uuid
810  * @param destination_uuid
811  * @param remote_address
812  */
813  #define BNEP_EVENT_CAN_SEND_NOW                           0xC4
814 
815  /**
816   * @format H1B
817   * @param handle
818   * @param addr_type
819   * @param address
820   */
821 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
822 
823  /**
824   * @format H1B
825   * @param handle
826   * @param addr_type
827   * @param address
828   */
829 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
830 
831  /**
832   * @format H1B4
833   * @param handle
834   * @param addr_type
835   * @param address
836   * @param passkey
837   */
838 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
839 
840  /**
841   * @format H1B
842   * @param handle
843   * @param addr_type
844   * @param address
845   */
846 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
847 
848  /**
849   * @format H1B
850   * @param handle
851   * @param addr_type
852   * @param address
853   */
854 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
855 
856  /**
857   * @format H1B
858   * @param handle
859   * @param addr_type
860   * @param address
861   */
862 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
863 
864  /**
865   * @format H1B4
866   * @param handle
867   * @param addr_type
868   * @param address
869   * @param passkey
870   */
871 #define SM_EVENT_NUMERIC_COMPARISON_REQUEST                      0xD6
872 
873  /**
874   * @format H1B
875   * @param handle
876   * @param addr_type
877   * @param address
878   */
879 #define SM_EVENT_NUMERIC_COMPARISON_CANCEL                       0xD7
880 
881  /**
882   * @format H1B
883   * @param handle
884   * @param addr_type
885   * @param address
886   */
887 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD8
888 
889  /**
890   * @format H1B
891   * @param handle
892   * @param addr_type
893   * @param address
894   */
895 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD9
896 
897  /**
898   * @brief Identify resolving succeeded
899   *
900   * @format H1B1B2
901   * @param handle
902   * @param addr_type
903   * @param address
904   * @param identity_addr_type
905   * @param identity_address
906   * @param index
907   *
908   */
909 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xDA
910 
911  /**
912   * @format H1B
913   * @param handle
914   * @param addr_type
915   * @param address
916   */
917 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xDB
918 
919  /**
920   * @format H1B1
921   * @param handle
922   * @param addr_type
923   * @param address
924   * @param authorization_result
925   */
926 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDC
927 
928  /**
929   * @format H1
930   * @param handle
931   * @param action see SM_KEYPRESS_*
932   */
933 #define SM_EVENT_KEYPRESS_NOTIFICATION                           0xDD
934 
935  /**
936   * @brief Emitted during pairing to inform app about address used as identity
937   *
938   * @format H1B1B2
939   * @param handle
940   * @param addr_type
941   * @param address
942   * @param identity_addr_type
943   * @param identity_address
944   * @param index
945   */
946 #define SM_EVENT_IDENTITY_CREATED                                0xDE
947 
948  /**
949   * @brief Emitted to inform app that pairing is complete. Possible status values:
950   *        ERROR_CODE_SUCCESS                            -> pairing success
951   *        ERROR_CODE_CONNECTION_TIMEOUT                 -> timeout
952   *        ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION  -> disconnect
953   *        ERROR_CODE_AUTHENTICATION_FAILURE             -> SM protocol error, see reason field with SM_REASON_* from bluetooth.h
954   *
955   * @format H1B11
956   * @param handle
957   * @param addr_type
958   * @param address
959   * @param status
960   * @param reason if status == ERROR_CODE_AUTHENTICATION_FAILURE
961   */
962 #define SM_EVENT_PAIRING_COMPLETE                                0xDF
963 
964 
965 // GAP
966 
967 /**
968  * @format H1
969  * @param handle
970  * @param security_level
971  */
972 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
973 
974 /**
975  * @format 1B
976  * @param status
977  * @param address
978  */
979 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
980 
981 /**
982  * @format 11B1JV
983  * @param advertising_event_type
984  * @param address_type
985  * @param address
986  * @param rssi
987  * @param data_length
988  * @param data
989  */
990 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
991 
992  /**
993  * @format B132111JV
994  * @param bd_addr
995  * @param page_scan_repetition_mode
996  * @param class_of_device
997  * @param clock_offset
998  * @param rssi_available
999  * @param rssi
1000  * @param name_available
1001  * @param name_len
1002  * @param name
1003  */
1004 #define GAP_EVENT_INQUIRY_RESULT                              0xE3
1005 
1006 /**
1007  * @format 1
1008  * @param status
1009  */
1010 #define GAP_EVENT_INQUIRY_COMPLETE                            0xE4
1011 
1012 
1013 // Meta Events, see below for sub events
1014 #define HCI_EVENT_HSP_META                                 0xE8
1015 #define HCI_EVENT_HFP_META                                 0xE9
1016 #define HCI_EVENT_ANCS_META                                0xEA
1017 #define HCI_EVENT_AVDTP_META                               0xEB
1018 #define HCI_EVENT_AVRCP_META                               0xEC
1019 #define HCI_EVENT_GOEP_META                                0xED
1020 #define HCI_EVENT_PBAP_META                                0xEE
1021 #define HCI_EVENT_HID_META                                 0xEF
1022 #define HCI_EVENT_A2DP_META                                0xF0
1023 #define HCI_EVENT_HIDS_META                                0xF1
1024 #define HCI_EVENT_GATTSERVICE_META                         0xF2
1025 
1026 // Potential other meta groups
1027 // #define HCI_EVENT_BNEP_META                                0xxx
1028 // #define HCI_EVENT_GAP_META                                 0xxx
1029 // #define HCI_EVENT_GATT_META                                0xxx
1030 // #define HCI_EVENT_PAN_META                                 0xxx
1031 // #define HCI_EVENT_SDP_META                                 0xxx
1032 // #define HCI_EVENT_SM_META                                  0xxx
1033 
1034 
1035 /** HSP Subevent */
1036 
1037 /**
1038  * @format 11
1039  * @param subevent_code
1040  * @param status 0 == OK
1041  */
1042 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
1043 
1044 /**
1045  * @format 11
1046  * @param subevent_code
1047  * @param status 0 == OK
1048  */
1049 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
1050 
1051 
1052 /**
1053  * @format 11H
1054  * @param subevent_code
1055  * @param status 0 == OK
1056  * @param handle
1057  */
1058 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
1059 
1060 /**
1061  * @format 11
1062  * @param subevent_code
1063  * @param status 0 == OK
1064  */
1065 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
1066 
1067 /**
1068  * @format 1
1069  * @param subevent_code
1070  */
1071 #define HSP_SUBEVENT_RING                                  0x05
1072 
1073 /**
1074  * @format 11
1075  * @param subevent_code
1076  * @param gain Valid range: [0,15]
1077  */
1078 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
1079 
1080 /**
1081  * @format 11
1082  * @param subevent_code
1083  * @param gain Valid range: [0,15]
1084  */
1085 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
1086 
1087 /**
1088  * @format 1JV
1089  * @param subevent_code
1090  * @param value_length
1091  * @param value
1092  */
1093 #define HSP_SUBEVENT_HS_COMMAND                            0x08
1094 
1095 /**
1096  * @format 1JV
1097  * @param subevent_code
1098  * @param value_length
1099  * @param value
1100  */
1101 #define HSP_SUBEVENT_AG_INDICATION                         0x09
1102 
1103 
1104 /** HFP Subevent */
1105 
1106 /**
1107  * @format 11HB
1108  * @param subevent_code
1109  * @param status 0 == OK
1110  * @param con_handle
1111  * @param bd_addr
1112  */
1113 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
1114 
1115 /**
1116  * @format 1
1117  * @param subevent_code
1118  */
1119 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
1120 
1121 /**
1122  * @format 11HB1
1123  * @param subevent_code
1124  * @param status 0 == OK
1125  * @param handle
1126  * @param bd_addr
1127  * @param negotiated_codec
1128  */
1129 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
1130 
1131 /**
1132  * @format 1
1133  * @param subevent_code
1134  */
1135 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
1136 
1137 /**
1138  * @format 11
1139  * @param subevent_code
1140  * @param status 0 == OK
1141  */
1142 #define HFP_SUBEVENT_COMPLETE                              0x05
1143 
1144 /**
1145  * @format 11111111T
1146  * @param subevent_code
1147  * @param indicator_index
1148  * @param indicator_status
1149  * @param indicator_min_range
1150  * @param indicator_max_range
1151  * @param indicator_mandatory
1152  * @param indicator_enabled
1153  * @param indicator_status_changed
1154  * @param indicator_name
1155  */
1156 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
1157 
1158 /**
1159  * @format 111T
1160  * @param subevent_code
1161  * @param network_operator_mode
1162  * @param network_operator_format
1163  * @param network_operator_name
1164  */
1165 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
1166 
1167 /**
1168  * @format 11
1169  * @param subevent_code
1170  * @param error
1171  */
1172 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
1173 
1174 /**
1175  * @format 1
1176  * @param subevent_code
1177  */
1178 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
1179 
1180 /**
1181  * @format 1
1182  * @param subevent_code
1183  */
1184 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
1185 
1186 /**
1187  * @format 1
1188  * @param subevent_code
1189  */
1190 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
1191 
1192 /**
1193  * @format 1T
1194  * @param subevent_code
1195  * @param number
1196  */
1197 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
1198 
1199 /**
1200  * @format 1
1201  * @param subevent_code
1202  */
1203 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
1204 
1205 /**
1206  * @format 1T
1207  * @param subevent_code
1208  * @param number
1209  */
1210 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
1211 
1212 /**
1213  * @format 1T
1214  * @param subevent_code
1215  * @param dtmf code
1216  */
1217 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1218 
1219 /**
1220  * @format 1
1221  * @param subevent_code
1222  */
1223  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1224 
1225 /**
1226  * @format 1
1227  * @param subevent_code
1228  */
1229 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1230 
1231 /**
1232  * @format 1
1233  * @param subevent_code
1234  */
1235 #define HFP_SUBEVENT_RING                                     0x13
1236 
1237 /**
1238  * @format 111
1239  * @param subevent_code
1240  * @param status
1241  * @param gain
1242  */
1243  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1244 
1245 /**
1246  * @format 111
1247  * @param subevent_code
1248  * @param status
1249  * @param gain
1250  */
1251 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1252 
1253 /**
1254  * @format 11T
1255  * @param subevent_code
1256  * @param type
1257  * @param number
1258  */
1259 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1260 
1261 /**
1262  * @format 11T
1263  * @param subevent_code
1264  * @param type
1265  * @param number
1266  */
1267 #define HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION 0x17
1268 
1269 /**
1270  * @format 111111T
1271  * @param subevent_code
1272  * @param clcc_idx
1273  * @param clcc_dir
1274  * @param clcc_status
1275  * @param clcc_mpty
1276  * @param bnip_type
1277  * @param bnip_number
1278  */
1279 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1280 
1281 /**
1282  * @format 111T
1283  * @param subevent_code
1284  * @param status
1285  * @param bnip_type
1286  * @param bnip_number
1287  */
1288  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1289 
1290 /**
1291  * @format 1T
1292  * @param subevent_code
1293  * @param value
1294  */
1295 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1296 
1297 // ANCS Client
1298 
1299 /**
1300  * @format 1H
1301  * @param subevent_code
1302  * @param handle
1303  */
1304 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1305 
1306 /**
1307  * @format 1H2T
1308  * @param subevent_code
1309  * @param handle
1310  * @param attribute_id
1311  * @param text
1312  */
1313 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1314 
1315 /**
1316  * @format 1H
1317  * @param subevent_code
1318  * @param handle
1319  */
1320 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1321 
1322 
1323 /** AVDTP Subevent */
1324 
1325 /**
1326  * @format 1211
1327  * @param subevent_code
1328  * @param avdtp_cid
1329  * @param local_seid
1330  * @param signal_identifier
1331  */
1332 #define AVDTP_SUBEVENT_SIGNALING_ACCEPT                     0x01
1333 
1334 /**
1335  * @format 1211
1336  * @param subevent_code
1337  * @param avdtp_cid
1338  * @param local_seid
1339  * @param signal_identifier
1340  */
1341 #define AVDTP_SUBEVENT_SIGNALING_REJECT                     0x02
1342 
1343 /**
1344  * @format 1211
1345  * @param subevent_code
1346  * @param avdtp_cid
1347  * @param local_seid
1348  * @param signal_identifier
1349  */
1350 #define AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT             0x03
1351 
1352 /**
1353  * @format 12B1
1354  * @param subevent_code
1355  * @param avdtp_cid
1356  * @param bd_addr
1357  * @param status 0 == OK
1358  */
1359 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED     0x04
1360 
1361 /**
1362  * @format 12
1363  * @param subevent_code
1364  * @param avdtp_cid
1365  */
1366 #define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED        0x05
1367 
1368 /**
1369  * @format 121111
1370  * @param subevent_code
1371  * @param avdtp_cid
1372  * @param remote_seid        0x01 – 0x3E
1373  * @param in_use      0-not in use, 1-in use
1374  * @param media_type  0-audio, 1-video, 2-multimedia
1375  * @param sep_type    0-source, 1-sink
1376  */
1377 #define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND                  0x06
1378 
1379 /**
1380  * @format 121111111111
1381  * @param subevent_code
1382  * @param avdtp_cid
1383  * @param local_seid
1384  * @param remote_seid
1385  * @param media_type
1386  * @param sampling_frequency_bitmap
1387  * @param channel_mode_bitmap
1388  * @param block_length_bitmap
1389  * @param subbands_bitmap
1390  * @param allocation_method_bitmap
1391  * @param min_bitpool_value
1392  * @param max_bitpool_value
1393  */
1394 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY          0x07
1395 
1396 /**
1397  * @format 121112LV
1398  * @param subevent_code
1399  * @param avdtp_cid
1400  * @param local_seid
1401  * @param remote_seid
1402  * @param media_type
1403  * @param media_codec_type
1404  * @param media_codec_information_len
1405  * @param media_codec_information
1406  */
1407 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY        0x08
1408 
1409 
1410 /**
1411  * @format 1211
1412  * @param subevent_code
1413  * @param avdtp_cid
1414  * @param local_seid
1415  * @param remote_seid
1416  */
1417 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_TRANSPORT_CAPABILITY        0x09
1418 
1419 
1420 /**
1421  * @format 1211
1422  * @param subevent_code
1423  * @param avdtp_cid
1424  * @param local_seid
1425  * @param remote_seid
1426  */
1427 #define AVDTP_SUBEVENT_SIGNALING_REPORTING_CAPABILITY        0x0A
1428 
1429 
1430 /**
1431  * @format 1211111
1432  * @param subevent_code
1433  * @param avdtp_cid
1434  * @param local_seid
1435  * @param remote_seid
1436  * @param recovery_type
1437  * @param maximum_recovery_window_size
1438  * @param maximum_number_media_packets
1439  */
1440 #define AVDTP_SUBEVENT_SIGNALING_RECOVERY_CAPABILITY        0x0B
1441 
1442 
1443 /**
1444  * @format 12112LV
1445  * @param subevent_code
1446  * @param avdtp_cid
1447  * @param local_seid
1448  * @param remote_seid
1449  * @param cp_type
1450  * @param cp_type_value_len
1451  * @param cp_type_value
1452  */
1453 #define AVDTP_SUBEVENT_SIGNALING_CONTENT_PROTECTION_CAPABILITY        0x0C
1454 
1455 
1456 /**
1457  * @format 121111111111
1458  * @param subevent_code
1459  * @param avdtp_cid
1460  * @param local_seid
1461  * @param remote_seid
1462  * @param fragmentation
1463  * @param transport_identifiers_num
1464  * @param transport_session_identifier_1
1465  * @param transport_session_identifier_2
1466  * @param transport_session_identifier_3
1467  * @param tcid_1
1468  * @param tcid_2
1469  * @param tcid_3
1470  */
1471 #define AVDTP_SUBEVENT_SIGNALING_MULTIPLEXING_CAPABILITY        0x0D
1472 
1473 
1474 /**
1475  * @format 1211
1476  * @param subevent_code
1477  * @param avdtp_cid
1478  * @param local_seid
1479  * @param remote_seid
1480  */
1481 #define AVDTP_SUBEVENT_SIGNALING_DELAY_REPORTING_CAPABILITY        0x0E
1482 
1483 
1484 /**
1485  * @format 1211111
1486  * @param subevent_code
1487  * @param avdtp_cid
1488  * @param local_seid
1489  * @param remote_seid
1490  * @param back_ch
1491  * @param media
1492  * @param recovery
1493  */
1494 #define AVDTP_SUBEVENT_SIGNALING_HEADER_COMPRESSION_CAPABILITY        0x0F
1495 
1496 
1497 /**
1498  * @format 12111121111111
1499  * @param subevent_code
1500  * @param avdtp_cid
1501  * @param local_seid
1502  * @param remote_seid
1503  * @param reconfigure
1504  * @param media_type
1505  * @param sampling_frequency
1506  * @param channel_mode
1507  * @param num_channels
1508  * @param block_length
1509  * @param subbands
1510  * @param allocation_method
1511  * @param min_bitpool_value
1512  * @param max_bitpool_value
1513  */
1514 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION        0x10
1515 
1516 /**
1517  * @format 1211112LV
1518  * @param subevent_code
1519  * @param avdtp_cid
1520  * @param local_seid
1521  * @param remote_seid
1522  * @param reconfigure
1523  * @param media_type
1524  * @param media_codec_type
1525  * @param media_codec_information_len
1526  * @param media_codec_information
1527  */
1528 #define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION        0x11
1529 
1530 /**
1531  * @format 12B111
1532  * @param subevent_code
1533  * @param avdtp_cid
1534  * @param bd_addr
1535  * @param local_seid
1536  * @param remote_seid
1537  * @param status 0 == OK
1538  */
1539 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_ESTABLISHED     0x12
1540 
1541 /**
1542  * @format 121
1543  * @param subevent_code
1544  * @param avdtp_cid
1545  * @param local_seid
1546  */
1547 #define AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED        0x13
1548 
1549 /**
1550  * @format 1212
1551  * @param subevent_code
1552  * @param avdtp_cid
1553  * @param local_seid
1554  * @param sequence_number
1555  */
1556 #define AVDTP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW   0x14
1557 
1558 /**
1559  * @format 1211
1560  * @param subevent_code
1561  * @param avdtp_cid
1562  * @param local_seid
1563  * @param remote_seid
1564  */
1565 #define AVDTP_SUBEVENT_SIGNALING_CAPABILITY_DONE             0x15
1566 
1567 
1568 /**
1569  * @format 12
1570  * @param subevent_code
1571  * @param avdtp_cid
1572  */
1573 #define AVDTP_SUBEVENT_SIGNALING_SEP_DICOVERY_DONE           0x16
1574 
1575 
1576 /** A2DP Subevent */
1577 /* Stream goes through following states:
1578  * - OPEN         - indicated with A2DP_SUBEVENT_STREAM_ESTABLISHED event
1579  * - START        - indicated with A2DP_SUBEVENT_STREAM_STARTED event
1580  * - SUSPEND      - indicated with A2DP_SUBEVENT_STREAM_SUSPENDED event
1581  * - ABORT/STOP   - indicated with A2DP_SUBEVENT_STREAM_RELEASED event
1582 
1583  OPEN state will be followed by ABORT/STOP. Stream is ready but media transfer is not started.
1584  START can come only after the stream is OPENED, and indicates that media transfer is started.
1585  SUSPEND is optional, it pauses the stream.
1586  */
1587 
1588 /**
1589  * @format 121            Sent only by A2DP source.
1590  * @param subevent_code
1591  * @param a2dp_cid
1592  * @param local_seid
1593  */
1594 #define A2DP_SUBEVENT_STREAMING_CAN_SEND_MEDIA_PACKET_NOW         0x01
1595 
1596 /**
1597  * @format 12111121111111
1598  * @param subevent_code
1599  * @param a2dp_cid
1600  * @param int_seid
1601  * @param acp_seid
1602  * @param reconfigure
1603  * @param media_type
1604  * @param sampling_frequency
1605  * @param channel_mode
1606  * @param num_channels
1607  * @param block_length
1608  * @param subbands
1609  * @param allocation_method
1610  * @param min_bitpool_value
1611  * @param max_bitpool_value
1612  */
1613 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION      0x02
1614 
1615 /**
1616  * @format 1211112LV
1617  * @param subevent_code
1618  * @param a2dp_cid
1619  * @param int_seid
1620  * @param acp_seid
1621  * @param reconfigure
1622  * @param media_type
1623  * @param media_codec_type
1624  * @param media_codec_information_len
1625  * @param media_codec_information
1626  */
1627 #define A2DP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION    0x03
1628 
1629 /**
1630  * @format 12B111          Stream is opened byt not started.
1631  * @param subevent_code
1632  * @param a2dp_cid
1633  * @param bd_addr
1634  * @param local_seid
1635  * @param remote_seid
1636  * @param status
1637  */
1638 #define A2DP_SUBEVENT_STREAM_ESTABLISHED                           0x04
1639 
1640 /**
1641  * @format 121            Indicates that media transfer is started.
1642  * @param subevent_code
1643  * @param a2dp_cid
1644  * @param local_seid
1645  */
1646 #define A2DP_SUBEVENT_STREAM_STARTED                               0x05
1647 
1648 /**
1649  * @format 121           Stream is paused.
1650  * @param subevent_code
1651  * @param a2dp_cid
1652  * @param local_seid
1653  */
1654 #define A2DP_SUBEVENT_STREAM_SUSPENDED                              0x06
1655 
1656 /**
1657  * @format 121           Stream is stoped or aborted.
1658  * @param subevent_code
1659  * @param a2dp_cid
1660  * @param local_seid
1661  */
1662 #define A2DP_SUBEVENT_STREAM_STOPPED                                0x07
1663 
1664 /**
1665  * @format 121            Stream is released.
1666  * @param subevent_code
1667  * @param a2dp_cid
1668  * @param local_seid
1669  */
1670 #define A2DP_SUBEVENT_STREAM_RELEASED                               0x08
1671 
1672 /**
1673  * @format 1211
1674  * @param subevent_code
1675  * @param a2dp_cid
1676  * @param local_seid
1677  * @param signal_identifier
1678  */
1679 #define A2DP_SUBEVENT_COMMAND_ACCEPTED                              0x09
1680 
1681 /**
1682  * @format 1211
1683  * @param subevent_code
1684  * @param a2dp_cid
1685  * @param local_seid
1686  * @param signal_identifier
1687  */
1688 #define A2DP_SUBEVENT_COMMAND_REJECTED                              0x0A
1689 
1690 /**
1691  * @format 12B1
1692  * @param subevent_code
1693  * @param a2dp_cid
1694  * @param bd_addr
1695  * @param status 0 == OK
1696  */
1697 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED              0x0B
1698 
1699 /**
1700  * @format 12            Signaling channel is released.
1701  * @param subevent_code
1702  * @param a2dp_cid
1703  */
1704 #define A2DP_SUBEVENT_SIGNALING_CONNECTION_RELEASED                  0x0C
1705 
1706 /**
1707  * @format 1211          Stream was reconfigured
1708  * @param subevent_code
1709  * @param a2dp_cid
1710  * @param local_seid
1711  * @param status
1712  */
1713 #define A2DP_SUBEVENT_STREAM_RECONFIGURED                            0x0D
1714 
1715 /** AVRCP Subevent */
1716 
1717 /**
1718  * @format 11B2
1719  * @param subevent_code
1720  * @param status 0 == OK
1721  * @param bd_addr
1722  * @param avrcp_cid
1723  */
1724 #define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED                           0x01
1725 
1726 /**
1727  * @format 12
1728  * @param subevent_code
1729  * @param avrcp_cid
1730  */
1731 #define AVRCP_SUBEVENT_CONNECTION_RELEASED                              0x02
1732 
1733 /**
1734  * @format 12111
1735  * @param subevent_code
1736  * @param avrcp_cid
1737  * @param command_type
1738  * @param repeat_mode
1739  * @param shuffle_mode
1740  */
1741 #define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE                          0x03
1742 
1743 /**
1744  * @format 121441
1745  * @param subevent_code
1746  * @param avrcp_cid
1747  * @param command_type
1748  * @param song_length
1749  * @param song_position
1750  * @param play_status
1751  */
1752  #define AVRCP_SUBEVENT_PLAY_STATUS                                     0x04
1753 
1754 /**
1755  * @format 1211
1756  * @param subevent_code
1757  * @param avrcp_cid
1758  * @param command_type
1759  * @param play_status
1760  */
1761 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED             0x05
1762 
1763 /**
1764  * @format 121
1765  * @param subevent_code
1766  * @param avrcp_cid
1767  * @param command_type
1768  */
1769 #define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED                       0x06
1770 
1771 /**
1772  * @format 121
1773  * @param subevent_code
1774  * @param avrcp_cid
1775  * @param command_type
1776  */
1777 #define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED          0x07
1778 
1779 /**
1780  * @format 121
1781  * @param subevent_code
1782  * @param avrcp_cid
1783  * @param command_type
1784  */
1785 #define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED            0x08
1786 
1787 /**
1788  * @format 1211
1789  * @param subevent_code
1790  * @param avrcp_cid
1791  * @param command_type
1792  * @param absolute_volume
1793  */
1794 #define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED                       0x09
1795 
1796 /**
1797  * @format 1211
1798  * @param subevent_code
1799  * @param avrcp_cid
1800  * @param command_type
1801  * @param absolute_volume
1802  */
1803 #define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE                      0x0A
1804 
1805 /**
1806  * @format 1211
1807  * @param subevent_code
1808  * @param avrcp_cid
1809  * @param command_type
1810  * @param notification_id
1811  */
1812 #define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE                       0x0B
1813 
1814 /**
1815  * @format 1211
1816  * @param subevent_code
1817  * @param avrcp_cid
1818  * @param command_type
1819  * @param operation_id
1820  */
1821 #define AVRCP_SUBEVENT_OPERATION_START                                    0x0C
1822 
1823 /**
1824  * @format 1211
1825  * @param subevent_code
1826  * @param avrcp_cid
1827  * @param command_type
1828  * @param operation_id
1829  */
1830 #define AVRCP_SUBEVENT_OPERATION_COMPLETE                                 0x0D
1831 
1832 /**
1833  * @format 121
1834  * @param subevent_code
1835  * @param avrcp_cid
1836  * @param command_type
1837  */
1838 #define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE                   0x0E
1839 
1840 /**
1841  * @format 12
1842  * @param subevent_code
1843  * @param avrcp_cid
1844  */
1845 #define AVRCP_SUBEVENT_COMPANY_IDS_QUERY                                    0x0F
1846 
1847 /**
1848  * @format 12
1849  * @param subevent_code
1850  * @param avrcp_cid
1851  */
1852 #define AVRCP_SUBEVENT_EVENT_IDS_QUERY                                      0x10
1853 
1854 /**
1855  * @format 12
1856  * @param subevent_code
1857  * @param avrcp_cid
1858  */
1859 #define AVRCP_SUBEVENT_PLAY_STATUS_QUERY                                    0x11
1860 
1861 /**
1862  * @format 12111
1863  * @param subevent_code
1864  * @param avrcp_cid
1865  * @param operation_id
1866  * @param operands_length
1867  * @param operand
1868  */
1869 #define AVRCP_SUBEVENT_OPERATION                                            0x12
1870 
1871 /**
1872  * @format 1211
1873  * @param subevent_code
1874  * @param avrcp_cid
1875  * @param command_type
1876  * @param track
1877  */
1878 #define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO                                 0x13
1879 
1880 /**
1881  * @format 1211
1882  * @param subevent_code
1883  * @param avrcp_cid
1884  * @param command_type
1885  * @param total_tracks
1886  */
1887 #define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO                          0x14
1888 
1889 /**
1890  * @format 1214
1891  * @param subevent_code
1892  * @param avrcp_cid
1893  * @param command_type
1894  * @param song_length in ms
1895  */
1896 #define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO                        0x15
1897 
1898 /**
1899  * @format 121JV
1900  * @param subevent_code
1901  * @param avrcp_cid
1902  * @param command_type
1903  * @param value_len
1904  * @param value
1905  */
1906 #define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO                                 0x16
1907 
1908  /*
1909  * @format 121JV
1910  * @param subevent_code
1911  * @param avrcp_cid
1912  * @param command_type
1913  * @param value_len
1914  * @param value
1915  */
1916 #define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO                                0x17
1917 
1918  /*
1919  * @format 121JV
1920  * @param subevent_code
1921  * @param avrcp_cid
1922  * @param command_type
1923  * @param value_len
1924  * @param value
1925  */
1926 #define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO                                 0x18
1927 
1928  /*
1929  * @format 121JV
1930  * @param subevent_code
1931  * @param avrcp_cid
1932  * @param command_type
1933  * @param value_len
1934  * @param value
1935  */
1936 #define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO                                 0x19
1937 
1938 /*
1939  * @format 1211
1940  * @param subevent_code
1941  * @param avrcp_cid
1942  * @param command_type
1943  * @param status
1944  */
1945 #define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE                                  0x1A
1946 
1947 /**
1948  * @format 1B2
1949  * @param subevent_code
1950  * @param bd_addr
1951  * @param browsing_cid
1952  */
1953 #define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION                          0x1B
1954 
1955 /**
1956  * @format 11B2
1957  * @param subevent_code
1958  * @param status 0 == OK
1959  * @param bd_addr
1960  * @param browsing_cid
1961  */
1962 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED                        0x1C
1963 
1964 /**
1965  * @format 12
1966  * @param subevent_code
1967  * @param browsing_cid
1968  */
1969 #define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED                           0x1D
1970 
1971 /**
1972  * @format 12211
1973  * @param subevent_code
1974  * @param browsing_cid
1975  * @param uid_counter
1976  * @param browsing_status
1977  * @param bluetooth_status
1978  */
1979 #define AVRCP_SUBEVENT_BROWSING_DONE                                          0x1E
1980 
1981 /**
1982  * @format 1214
1983  * @param subevent_code
1984  * @param browsing_cid
1985  * @param scope
1986  * @param attr_bitmap
1987  */
1988 #define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS                              0x1F
1989 
1990 /**
1991  * @format 121
1992  * @param subevent_code
1993  * @param browsing_cid
1994  * @param scope
1995  */
1996 #define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS                           0x20
1997 
1998 /**
1999  * @format 1214
2000  * @param subevent_code
2001  * @param avrcp_cid
2002  * @param command_type
2003  * @param playback_position_ms
2004  */
2005 #define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED                      0x21
2006 
2007 
2008 /**
2009  * @format 121BH1
2010  * @param subevent_code
2011  * @param goep_cid
2012  * @param status
2013  * @param bd_addr
2014  * @param con_handle
2015  * @param incoming
2016  */
2017 #define GOEP_SUBEVENT_CONNECTION_OPENED                                    0x01
2018 
2019 /**
2020  * @format 12
2021  * @param subevent_code
2022  * @param goep_cid
2023 */
2024 #define GOEP_SUBEVENT_CONNECTION_CLOSED                                    0x02
2025 
2026 /**
2027  * @format 12
2028  * @param subevent_code
2029  * @param goep_cid
2030 */
2031 #define GOEP_SUBEVENT_CAN_SEND_NOW                                         0x03
2032 
2033 /**
2034  * @format 121BH1
2035  * @param subevent_code
2036  * @param pbap_cid
2037  * @param status
2038  * @param bd_addr
2039  * @param con_handle
2040  * @param incoming
2041  */
2042 #define PBAP_SUBEVENT_CONNECTION_OPENED                                    0x01
2043 
2044 /**
2045  * @format 12
2046  * @param subevent_code
2047  * @param goep_cid
2048 */
2049 #define PBAP_SUBEVENT_CONNECTION_CLOSED                                    0x02
2050 
2051 /**
2052  * @format 121
2053  * @param subevent_code
2054  * @param goep_cid
2055  * @param status
2056  */
2057 #define PBAP_SUBEVENT_OPERATION_COMPLETED                                  0x03
2058 
2059 /**
2060  * @format 1212
2061  * @param subevent_code
2062  * @param goep_cid
2063  * @param status
2064  * @param phoneboook_size
2065  */
2066 #define PBAP_SUBEVENT_PHONEBOOK_SIZE                                       0x04
2067 
2068 /**
2069  * @format 1211
2070  * @param subevent_code
2071  * @param goep_cid
2072  * @param user_id_required
2073  * @param full_access
2074  */
2075 #define PBAP_SUBEVENT_AUTHENTICATION_REQUEST                               0x05
2076 
2077 /**
2078  * @format 12JVJV
2079  * @param subevent_code
2080  * @param goep_cid
2081  * @param name_len
2082  * @param name
2083  * @param handle_len
2084  * @param handle
2085  */
2086 #define PBAP_SUBEVENT_CARD_RESULT                                          0x06
2087 
2088 
2089 // HID Meta Event Group
2090 
2091 /**
2092  * @format 121BH1
2093  * @param subevent_code
2094  * @param hid_cid
2095  * @param status
2096  * @param bd_addr
2097  * @param con_handle
2098  * @param incoming
2099  */
2100 #define HID_SUBEVENT_CONNECTION_OPENED                                     0x01
2101 
2102 /**
2103  * @format 12
2104  * @param subevent_code
2105  * @param hid_cid
2106 */
2107 #define HID_SUBEVENT_CONNECTION_CLOSED                                     0x02
2108 
2109 /**
2110  * @format 12
2111  * @param subevent_code
2112  * @param hid_cid
2113 */
2114 #define HID_SUBEVENT_CAN_SEND_NOW                                          0x03
2115 
2116 /**
2117  * @format 12
2118  * @param subevent_code
2119  * @param con_handle
2120 */
2121 #define HID_SUBEVENT_SUSPEND                                               0x04
2122 
2123 /**
2124  * @format 12
2125  * @param subevent_code
2126  * @param con_handle
2127 */
2128 #define HID_SUBEVENT_EXIT_SUSPEND                                          0x05
2129 
2130 
2131 // HIDS Meta Event Group
2132 
2133 /**
2134  * @format 12
2135  * @param subevent_code
2136  * @param con_handle
2137 */
2138 #define HIDS_SUBEVENT_CAN_SEND_NOW                                          0x01
2139 
2140 /**
2141  * @format 121
2142  * @param subevent_code
2143  * @param con_handle
2144  * @param protocol_mode
2145 */
2146 #define HIDS_SUBEVENT_PROTOCOL_MODE                                         0x02
2147 
2148 /**
2149  * @format 121
2150  * @param subevent_code
2151  * @param con_handle
2152  * @param enable
2153 */
2154 #define HIDS_SUBEVENT_BOOT_MOUSE_INPUT_REPORT_ENABLE                        0x03
2155 
2156 /**
2157  * @format 121
2158  * @param subevent_code
2159  * @param con_handle
2160  * @param enable
2161 */
2162 #define HIDS_SUBEVENT_BOOT_KEYBOARD_INPUT_REPORT_ENABLE                     0x04
2163 
2164 /**
2165  * @format 121
2166  * @param subevent_code
2167  * @param con_handle
2168  * @param enable
2169 */
2170 #define HIDS_SUBEVENT_INPUT_REPORT_ENABLE                                   0x05
2171 
2172 /**
2173  * @format 121
2174  * @param subevent_code
2175  * @param con_handle
2176  * @param enable
2177 */
2178 #define HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE                                  0x06
2179 
2180 /**
2181  * @format 121
2182  * @param subevent_code
2183  * @param con_handle
2184  * @param enable
2185 */
2186 #define HIDS_SUBEVENT_FEATURE_REPORT_ENABLE                                 0x07
2187 
2188 /**
2189  * @format 12
2190  * @param subevent_code
2191  * @param con_handle
2192 */
2193 #define HIDS_SUBEVENT_SUSPEND                                               0x08
2194 
2195 /**
2196  * @format 12
2197  * @param subevent_code
2198  * @param con_handle
2199 */
2200 #define HIDS_SUBEVENT_EXIT_SUSPEND                                          0x09
2201 
2202 /**
2203  * @format 1211
2204  * @param subevent_code
2205  * @param con_handle
2206  * @param measurement_type  // 0 - force magnitude, 1 - torque magnitude, see cycling_power_sensor_measurement_context_t
2207  * @param is_enhanced
2208 */
2209 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_START_CALIBRATION               0x01
2210 
2211 /**
2212  * @format 12
2213  * @param subevent_code
2214  * @param con_handle
2215 */
2216 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_BROADCAST_START                 0x02
2217 
2218 /**
2219  * @format 12
2220  * @param subevent_code
2221  * @param con_handle
2222 */
2223 #define GATTSERVICE_SUBEVENT_CYCLING_POWER_BROADCAST_STOP                  0x03
2224 #endif
2225