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