xref: /btstack/src/btstack_defines.h (revision bc37f7b0d0a3eaa5763a873c5730bc14b849aaa0)
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 // TYPES
50 
51 // packet handler
52 typedef void (*btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
53 
54 // packet callback supporting multiple registrations
55 typedef struct {
56     btstack_linked_item_t    item;
57     btstack_packet_handler_t callback;
58 } btstack_packet_callback_registration_t;
59 
60 /**
61  * @brief 128 bit key used with AES128 in Security Manager
62  */
63 typedef uint8_t sm_key_t[16];
64 
65 // DEFINES
66 
67 #define DAEMON_EVENT_PACKET     0x05
68 
69 // L2CAP data
70 #define L2CAP_DATA_PACKET       0x06
71 
72 // RFCOMM data
73 #define RFCOMM_DATA_PACKET      0x07
74 
75 // Attribute protocol data
76 #define ATT_DATA_PACKET         0x08
77 
78 // Security Manager protocol data
79 #define SM_DATA_PACKET          0x09
80 
81 // SDP query result
82 // format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
83 #define SDP_CLIENT_PACKET       0x0a
84 
85 // BNEP data
86 #define BNEP_DATA_PACKET        0x0b
87 
88 // Unicast Connectionless Data
89 #define UCD_DATA_PACKET         0x0c
90 
91 // debug log messages
92 #define LOG_MESSAGE_PACKET      0xfc
93 
94 
95 // ERRORS
96 
97 // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
98 #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED              0x50
99 #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH         0x51
100 #define BTSTACK_ACTIVATION_POWERON_FAILED                  0x52
101 #define BTSTACK_ACTIVATION_FAILED_UNKNOWN                  0x53
102 #define BTSTACK_NOT_ACTIVATED                              0x54
103 #define BTSTACK_BUSY                                       0x55
104 #define BTSTACK_MEMORY_ALLOC_FAILED                        0x56
105 #define BTSTACK_ACL_BUFFERS_FULL                           0x57
106 
107 // l2cap errors - enumeration by the command that created them
108 #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
109 #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
110 #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
111 
112 #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL        0x63
113 #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING           0x64
114 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM       0x65
115 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY  0x66
116 #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
117 #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT       0x68
118 
119 #define L2CAP_SERVICE_ALREADY_REGISTERED                   0x69
120 #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU                  0x6A
121 #define L2CAP_SERVICE_DOES_NOT_EXIST                       0x6B
122 
123 #define RFCOMM_MULTIPLEXER_STOPPED                         0x70
124 #define RFCOMM_CHANNEL_ALREADY_REGISTERED                  0x71
125 #define RFCOMM_NO_OUTGOING_CREDITS                         0x72
126 #define RFCOMM_AGGREGATE_FLOW_OFF                          0x73
127 #define RFCOMM_DATA_LEN_EXCEEDS_MTU                        0x74
128 
129 #define SDP_HANDLE_ALREADY_REGISTERED                      0x80
130 #define SDP_QUERY_INCOMPLETE                               0x81
131 #define SDP_SERVICE_NOT_FOUND                              0x82
132 #define SDP_HANDLE_INVALID                                 0x83
133 #define SDP_QUERY_BUSY                                     0x84
134 
135 #define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS            0x90
136 #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT                0x91
137 
138 #define GATT_CLIENT_NOT_CONNECTED                          0x93
139 #define GATT_CLIENT_BUSY                                   0x94
140 #define GATT_CLIENT_IN_WRONG_STATE                         0x95
141 #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
142 #define GATT_CLIENT_VALUE_TOO_LONG                         0x97
143 #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
144 #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED   0x99
145 
146 #define BNEP_SERVICE_ALREADY_REGISTERED                    0xA0
147 #define BNEP_CHANNEL_NOT_CONNECTED                         0xA1
148 #define BNEP_DATA_LEN_EXCEEDS_MTU                          0xA2
149 
150 
151 
152 // DAEMON COMMANDS
153 
154 #define OGF_BTSTACK 0x3d
155 
156 // cmds for BTstack
157 // get state: @returns HCI_STATE
158 #define BTSTACK_GET_STATE                                  0x01
159 
160 // set power mode: param HCI_POWER_MODE
161 #define BTSTACK_SET_POWER_MODE                             0x02
162 
163 // set capture mode: param on
164 #define BTSTACK_SET_ACL_CAPTURE_MODE                       0x03
165 
166 // get BTstack version
167 #define BTSTACK_GET_VERSION                                0x04
168 
169 // get system Bluetooth state
170 #define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED               0x05
171 
172 // set system Bluetooth state
173 #define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED               0x06
174 
175 // enable inquiry scan for this client
176 #define BTSTACK_SET_DISCOVERABLE                           0x07
177 
178 // set global Bluetooth state
179 #define BTSTACK_SET_BLUETOOTH_ENABLED                      0x08
180 
181 // create l2cap channel: param bd_addr(48), psm (16)
182 #define L2CAP_CREATE_CHANNEL                               0x20
183 
184 // disconnect l2cap disconnect, param channel(16), reason(8)
185 #define L2CAP_DISCONNECT                                   0x21
186 
187 // register l2cap service: param psm(16), mtu (16)
188 #define L2CAP_REGISTER_SERVICE                             0x22
189 
190 // unregister l2cap disconnect, param psm(16)
191 #define L2CAP_UNREGISTER_SERVICE                           0x23
192 
193 // accept connection param bd_addr(48), dest cid (16)
194 #define L2CAP_ACCEPT_CONNECTION                            0x24
195 
196 // decline l2cap disconnect,param bd_addr(48), dest cid (16), reason(8)
197 #define L2CAP_DECLINE_CONNECTION                           0x25
198 
199 // create l2cap channel: param bd_addr(48), psm (16), mtu (16)
200 #define L2CAP_CREATE_CHANNEL_MTU                           0x26
201 
202 // register SDP Service Record: service record (size)
203 #define SDP_REGISTER_SERVICE_RECORD                        0x30
204 
205 // unregister SDP Service Record
206 #define SDP_UNREGISTER_SERVICE_RECORD                      0x31
207 
208 // Get remote RFCOMM services
209 #define SDP_CLIENT_QUERY_RFCOMM_SERVICES                   0x32
210 
211 // Get remote SDP services
212 #define SDP_CLIENT_QUERY_SERVICES                          0x33
213 
214 // RFCOMM "HCI" Commands
215 #define RFCOMM_CREATE_CHANNEL       0x40
216 #define RFCOMM_DISCONNECT     0x41
217 #define RFCOMM_REGISTER_SERVICE     0x42
218 #define RFCOMM_UNREGISTER_SERVICE   0x43
219 #define RFCOMM_ACCEPT_CONNECTION    0x44
220 #define RFCOMM_DECLINE_CONNECTION   0x45
221 #define RFCOMM_PERSISTENT_CHANNEL   0x46
222 #define RFCOMM_CREATE_CHANNEL_WITH_CREDITS   0x47
223 #define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48
224 #define RFCOMM_GRANT_CREDITS                 0x49
225 
226 // GAP Classic 0x50
227 #define GAP_DISCONNECT              0x50
228 
229 // GAP LE      0x60
230 #define GAP_LE_SCAN_START           0x60
231 #define GAP_LE_SCAN_STOP            0x61
232 #define GAP_LE_CONNECT              0x62
233 #define GAP_LE_CONNECT_CANCEL       0x63
234 #define GAP_LE_SET_SCAN_PARAMETERS  0x64
235 
236 // GATT (Client) 0x70
237 #define GATT_DISCOVER_ALL_PRIMARY_SERVICES                       0x70
238 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16                 0x71
239 #define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128                0x72
240 #define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE                  0x73
241 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE                0x74
242 #define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128     0x75
243 #define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS                 0x76
244 #define GATT_READ_VALUE_OF_CHARACTERISTIC                        0x77
245 #define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC                   0x78
246 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE      0x79
247 #define GATT_WRITE_VALUE_OF_CHARACTERISTIC                       0x7A
248 #define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC                  0x7B
249 #define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC         0x7C
250 #define GATT_READ_CHARACTERISTIC_DESCRIPTOR                      0X7D
251 #define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR                 0X7E
252 #define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR                     0X7F
253 #define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR                0X80
254 #define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION           0X81
255 #define GATT_GET_MTU                                             0x82
256 
257 
258 
259 // EVENTS
260 
261 /**
262  * @format 1
263  * @param state
264  */
265 #define BTSTACK_EVENT_STATE                                0x60
266 
267 // data: event(8), len(8), nr hci connections
268 #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED               0x61
269 
270 /**
271  * @format
272  */
273 #define BTSTACK_EVENT_POWERON_FAILED                       0x62
274 
275 /**
276  * @format 1
277  * @param discoverable
278  */
279 #define BTSTACK_EVENT_DISCOVERABLE_ENABLED                 0x66
280 
281 // Daemon Events
282 
283 /**
284  * @format 112
285  * @param major
286  * @param minor
287  @ @param revision
288  */
289 #define DAEMON_EVENT_VERSION                               0x63
290 
291 // data: system bluetooth on/off (bool)
292 /**
293  * @format 1
294  * param system_bluetooth_enabled
295  */
296 #define DAEMON_EVENT_SYSTEM_BLUETOOTH_ENABLED              0x64
297 
298 // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
299 
300 /*
301  * @format 1BT
302  * @param status == 0 to match read_remote_name_request
303  * @param address
304  * @param name
305  */
306 #define DAEMON_EVENT_REMOTE_NAME_CACHED                    0x65
307 
308 // internal - data: event(8)
309 #define DAEMON_EVENT_CONNECTION_OPENED                     0x67
310 
311 // internal - data: event(8)
312 #define DAEMON_EVENT_CONNECTION_CLOSED                     0x68
313 
314 // data: event(8), len(8), local_cid(16), credits(8)
315 #define DAEMON_EVENT_L2CAP_CREDITS                         0x74
316 
317 /**
318  * @format 12
319  * @param status
320  * @param psm
321  */
322 #define DAEMON_EVENT_L2CAP_SERVICE_REGISTERED              0x75
323 
324 /**
325  * @format 21
326  * @param rfcomm_cid
327  * @param credits
328  */
329 #define DAEMON_EVENT_RFCOMM_CREDITS                        0x84
330 
331 /**
332  * @format 11
333  * @param status
334  * @param channel_id
335  */
336 #define DAEMON_EVENT_RFCOMM_SERVICE_REGISTERED             0x85
337 
338 /**
339  * @format 11
340  * @param status
341  * @param server_channel_id
342  */
343 #define DAEMON_EVENT_RFCOMM_PERSISTENT_CHANNEL             0x86
344 
345 /**
346   * @format 14
347   * @param status
348   * @param service_record_handle
349   */
350 #define DAEMON_EVENT_SDP_SERVICE_REGISTERED                0x90
351 
352 
353 
354 // additional HCI events
355 
356 /**
357  * @brief Outgoing packet
358  */
359 #define HCI_EVENT_TRANSPORT_PACKET_SENT                    0x6E
360 
361 /**
362  * @format B
363  * @param handle
364  */
365 #define HCI_EVENT_SCO_CAN_SEND_NOW                         0x6F
366 
367 
368 // L2CAP EVENTS
369 
370 /**
371  * @format 1BH222222
372  * @param status
373  * @param address
374  * @param handle
375  * @param psm
376  * @param local_cid
377  * @param remote_cid
378  * @param local_mtu
379  * @param remote_mtu
380  * @param flush_timeout
381  */
382 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
383 
384 /*
385  * @format 2
386  * @param local_cid
387  */
388 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
389 
390 /**
391  * @format BH222
392  * @param address
393  * @param handle
394  * @param psm
395  * @param local_cid
396  * @param remote_cid
397  */
398 #define L2CAP_EVENT_INCOMING_CONNECTION                    0x72
399 
400 // ??
401 // data: event(8), len(8), handle(16)
402 #define L2CAP_EVENT_TIMEOUT_CHECK                          0x73
403 
404 /**
405  * @format H2222
406  * @param handle
407  * @param interval_min
408  * @param interval_max
409  * @param latencey
410  * @param timeout_multiplier
411  */
412 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST    0x76
413 
414 // data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
415  /**
416   * @format H2
417   * @param handle
418   * @result
419   */
420 #define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE   0x77
421 
422 /**
423  * @format 2
424  * @param local_cid
425  */
426 #define L2CAP_EVENT_CAN_SEND_NOW                           0x78
427 
428 // RFCOMM EVENTS
429 
430 /**
431  * @format 1B2122
432  * @param status
433  * @param bd_addr
434  * @param con_handle
435  * @param server_channel
436  * @param rfcomm_cid
437  * @param max_frame_size
438  */
439 #define RFCOMM_EVENT_CHANNEL_OPENED                        0x80
440 
441 /**
442  * @format 2
443  * @param rfcomm_cid
444  */
445 #define RFCOMM_EVENT_CHANNEL_CLOSED                        0x81
446 
447 /**
448  * @format B12
449  * @param bd_addr
450  * @param server_channel
451  * @param rfcomm_cid
452  */
453 #define RFCOMM_EVENT_INCOMING_CONNECTION                   0x82
454 
455 /**
456  * @format 21
457  * @param rfcomm_cid
458  * @param line_status
459  */
460 #define RFCOMM_EVENT_REMOTE_LINE_STATUS                    0x83
461 
462 /**
463  * @format 21
464  * @param rfcomm_cid
465  * @param modem_status
466  */
467 #define RFCOMM_EVENT_REMOTE_MODEM_STATUS                   0x87
468 
469  /**
470   * TODO: format for variable data 2?
471   * param rfcomm_cid
472   * param rpn_data
473   */
474 #define RFCOMM_EVENT_PORT_CONFIGURATION                    0x88
475 
476 /**
477  * @format 2
478  * @param rfcomm_cid
479  */
480 #define RFCOMM_EVENT_CAN_SEND_NOW                          0x89
481 
482 
483 /**
484  * @format 1
485  * @param status
486  */
487 #define SDP_EVENT_QUERY_COMPLETE                                 0x91
488 
489 /**
490  * @format 1T
491  * @param rfcomm_channel
492  * @param name
493  */
494 #define SDP_EVENT_QUERY_RFCOMM_SERVICE                           0x92
495 
496 /**
497  * @format 22221
498  * @param record_id
499  * @param attribute_id
500  * @param attribute_length
501  * @param data_offset
502  * @param data
503  */
504 #define SDP_EVENT_QUERY_ATTRIBUTE_BYTE                           0x93
505 
506 /**
507  * @format 22LV
508  * @param record_id
509  * @param attribute_id
510  * @param attribute_length
511  * @param attribute_value
512  */
513 #define SDP_EVENT_QUERY_ATTRIBUTE_VALUE                          0x94
514 
515 /**
516  * @format 224
517  * @param total_count
518  * @param record_index
519  * @param record_handle
520  * @note Not provided by daemon, only used for internal testing
521  */
522 #define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE                    0x95
523 
524 /**
525  * @format H1
526  * @param handle
527  * @param status
528  */
529 #define GATT_EVENT_QUERY_COMPLETE                                0xA0
530 
531 /**
532  * @format HX
533  * @param handle
534  * @param service
535  */
536 #define GATT_EVENT_SERVICE_QUERY_RESULT                          0xA1
537 
538 /**
539  * @format HY
540  * @param handle
541  * @param characteristic
542  */
543 #define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT                   0xA2
544 
545 /**
546  * @format H2X
547  * @param handle
548  * @param include_handle
549  * @param service
550  */
551 #define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT                 0xA3
552 
553 /**
554  * @format HZ
555  * @param handle
556  * @param characteristic_descriptor
557  */
558 #define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT   0xA4
559 
560 /**
561  * @format H2LV
562  * @param handle
563  * @param value_handle
564  * @param value_length
565  * @param value
566  */
567 #define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT             0xA5
568 
569 /**
570  * @format H22LV
571  * @param handle
572  * @param value_handle
573  * @param value_offset
574  * @param value_length
575  * @param value
576  */
577 #define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT        0xA6
578 
579 /**
580  * @format H2LV
581  * @param handle
582  * @param value_handle
583  * @param value_length
584  * @param value
585  */
586 #define GATT_EVENT_NOTIFICATION                                  0xA7
587 
588 /**
589  * @format H2LV
590  * @param handle
591  * @param value_handle
592  * @param value_length
593  * @param value
594  */
595 #define GATT_EVENT_INDICATION                                    0xA8
596 
597 /**
598  * @format H2LV
599  * @param descriptor_handle
600  * @param descriptor_length
601  * @param descriptor
602  */
603 #define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT        0xA9
604 
605 /**
606  * @format H2LV
607  * @param handle
608  * @param descriptor_offset
609  * @param descriptor_length
610  * @param descriptor
611  */
612 #define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT   0xAA
613 
614 /**
615  * @format H2
616  * @param handle
617  * @param MTU
618  */
619 #define GATT_EVENT_MTU                                           0xAB
620 
621 /**
622  * @format H2
623  * @param handle
624  * @param MTU
625  */
626 #define ATT_EVENT_MTU_EXCHANGE_COMPLETE                          0xB5
627 
628  /**
629   * @format 1H2
630   * @param status
631   * @param conn_handle
632   * @param attribute_handle
633   */
634 #define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE               0xB6
635 
636 /**
637  * @format
638  */
639 #define ATT_EVENT_CAN_SEND_NOW                                   0xB7
640 
641 // TODO: daemon only event
642 
643 /**
644  * @format 12
645  * @param status
646  * @param service_uuid
647  */
648  #define BNEP_EVENT_SERVICE_REGISTERED                      0xC0
649 
650 /**
651  * @format 12222B
652  * @param status
653  * @param bnep_cid
654  * @param source_uuid
655  * @param destination_uuid
656  * @param mtu
657  * @param remote_address
658  */
659  #define BNEP_EVENT_CHANNEL_OPENED                   0xC1
660 
661 /**
662  * @format 222B
663  * @param bnep_cid
664  * @param source_uuid
665  * @param destination_uuid
666  * @param remote_address
667  */
668  #define BNEP_EVENT_CHANNEL_CLOSED                          0xC2
669 
670 /**
671  * @format 222B1
672  * @param bnep_cid
673  * @param source_uuid
674  * @param destination_uuid
675  * @param remote_address
676  * @param channel_state
677  */
678 #define BNEP_EVENT_CHANNEL_TIMEOUT                         0xC3
679 
680 /**
681  * @format 222B
682  * @param bnep_cid
683  * @param source_uuid
684  * @param destination_uuid
685  * @param remote_address
686  */
687  #define BNEP_EVENT_CAN_SEND_NOW                           0xC4
688 
689  /**
690   * @format H1B
691   * @param handle
692   * @param addr_type
693   * @param address
694   */
695 #define SM_EVENT_JUST_WORKS_REQUEST                              0xD0
696 
697  /**
698   * @format H1B
699   * @param handle
700   * @param addr_type
701   * @param address
702   */
703 #define SM_EVENT_JUST_WORKS_CANCEL                               0xD1
704 
705  /**
706   * @format H1B4
707   * @param handle
708   * @param addr_type
709   * @param address
710   * @param passkey
711   */
712 #define SM_EVENT_PASSKEY_DISPLAY_NUMBER                          0xD2
713 
714  /**
715   * @format H1B
716   * @param handle
717   * @param addr_type
718   * @param address
719   */
720 #define SM_EVENT_PASSKEY_DISPLAY_CANCEL                          0xD3
721 
722  /**
723   * @format H1B421
724   * @param handle
725   * @param addr_type
726   * @param address
727   */
728 #define SM_EVENT_PASSKEY_INPUT_NUMBER                            0xD4
729 
730  /**
731   * @format H1B
732   * @param handle
733   * @param addr_type
734   * @param address
735   */
736 #define SM_EVENT_PASSKEY_INPUT_CANCEL                            0xD5
737 
738  /**
739   * @format H1B4
740   * @param handle
741   * @param addr_type
742   * @param address
743   * @param passkey
744   */
745 #define SM_EVENT_NUMERIC_COMPARISON_REQUEST                      0xD6
746 
747  /**
748   * @format H1B4
749   * @param handle
750   * @param addr_type
751   * @param address
752   */
753 #define SM_EVENT_NUMERIC_COMPARISON_CANCEL                       0xD7
754 
755  /**
756   * @format H1B
757   * @param handle
758   * @param addr_type
759   * @param address
760   */
761 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD8
762 
763  /**
764   * @format H1B
765   * @param handle
766   * @param addr_type
767   * @param address
768   */
769 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD9
770 
771  /**
772   * @format H1B2
773   * @param handle
774   * @param addr_type
775   * @param address
776   * @param le_device_db_index
777   */
778 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xDA
779 
780  /**
781   * @format H1B
782   * @param handle
783   * @param addr_type
784   * @param address
785   */
786 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xDB
787 
788  /**
789   * @format H1B1
790   * @param handle
791   * @param addr_type
792   * @param address
793   * @param authorization_result
794   */
795 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDC
796 
797  /**
798   * @format H1
799   * @param handle
800   * @param action see SM_KEYPRESS_*
801   */
802 #define SM_EVENT_KEYPRESS_NOTIFICATION                           0xDD
803 
804 
805 // GAP
806 
807 /**
808  * @format H1
809  * @param handle
810  * @param security_level
811  */
812 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
813 
814 /**
815  * @format 1B
816  * @param status
817  * @param address
818  */
819 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
820 
821 /**
822  * @format 11B1JV
823  * @param advertising_event_type
824  * @param address_type
825  * @param address
826  * @param rssi
827  * @param data_length
828  * @param data
829  */
830 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
831 
832 
833 // Meta Events, see below for sub events
834 #define HCI_EVENT_HSP_META                                 0xE8
835 #define HCI_EVENT_HFP_META                                 0xE9
836 #define HCI_EVENT_ANCS_META                                0xEA
837 #define HCI_EVENT_AVDTP_META                               0xEA
838 
839 // Potential other meta groups
840  // #define HCI_EVENT_BNEP_META                                0xxx
841 // #define HCI_EVENT_GAP_META                                 0xxx
842 // #define HCI_EVENT_GATT_META                                0xxx
843 // #define HCI_EVENT_PAN_META                                 0xxx
844 // #define HCI_EVENT_SDP_META                                 0xxx
845 // #define HCI_EVENT_SM_META                                  0xxx
846 
847 
848 /** HSP Subevent */
849 
850 /**
851  * @format 11
852  * @param subevent_code
853  * @param status 0 == OK
854  */
855 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
856 
857 /**
858  * @format 11
859  * @param subevent_code
860  * @param status 0 == OK
861  */
862 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
863 
864 
865 /**
866  * @format 11H
867  * @param subevent_code
868  * @param status 0 == OK
869  * @param handle
870  */
871 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
872 
873 /**
874  * @format 11
875  * @param subevent_code
876  * @param status 0 == OK
877  */
878 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
879 
880 /**
881  * @format 1
882  * @param subevent_code
883  */
884 #define HSP_SUBEVENT_RING                                  0x05
885 
886 /**
887  * @format 11
888  * @param subevent_code
889  * @param gain Valid range: [0,15]
890  */
891 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
892 
893 /**
894  * @format 11
895  * @param subevent_code
896  * @param gain Valid range: [0,15]
897  */
898 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
899 
900 /**
901  * @format 1JV
902  * @param subevent_code
903  * @param value_length
904  * @param value
905  */
906 #define HSP_SUBEVENT_HS_COMMAND                            0x08
907 
908 /**
909  * @format 1JV
910  * @param subevent_code
911  * @param value_length
912  * @param value
913  */
914 #define HSP_SUBEVENT_AG_INDICATION                         0x09
915 
916 
917 /** HFP Subevent */
918 
919 /**
920  * @format 11HB
921  * @param subevent_code
922  * @param status 0 == OK
923  * @param con_handle
924  * @param bd_addr
925  */
926 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
927 
928 /**
929  * @format 1
930  * @param subevent_code
931  */
932 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
933 
934 /**
935  * @format 11HB1
936  * @param subevent_code
937  * @param status 0 == OK
938  * @param handle
939  * @param bd_addr
940  * @param negotiated_codec
941  */
942 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
943 
944 /**
945  * @format 1
946  * @param subevent_code
947  */
948 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
949 
950 /**
951  * @format 11
952  * @param subevent_code
953  * @param status 0 == OK
954  */
955 #define HFP_SUBEVENT_COMPLETE                              0x05
956 
957 /**
958  * @format 111T
959  * @param subevent_code
960  * @param indicator_index
961  * @param indicator_status
962  * @param indicator_name
963  */
964 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
965 
966 /**
967  * @format 1111T
968  * @param subevent_code
969  * @param network_operator_mode
970  * @param network_operator_format
971  * @param network_operator_name
972  */
973 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
974 
975 /**
976  * @format 11
977  * @param subevent_code
978  * @param error
979  */
980 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
981 
982 /**
983  * @format 1
984  * @param subevent_code
985  */
986 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
987 
988 /**
989  * @format 1
990  * @param subevent_code
991  */
992 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
993 
994 /**
995  * @format 1
996  * @param subevent_code
997  */
998 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
999 
1000 /**
1001  * @format 1T
1002  * @param subevent_code
1003  * @param number
1004  */
1005 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
1006 
1007 /**
1008  * @format 1
1009  * @param subevent_code
1010  */
1011 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
1012 
1013 /**
1014  * @format 1T
1015  * @param subevent_code
1016  * @param number
1017  */
1018 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
1019 
1020 /**
1021  * @format 1T
1022  * @param subevent_code
1023  * @param dtmf code
1024  */
1025 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1026 
1027 /**
1028  * @format 1
1029  * @param subevent_code
1030  */
1031  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1032 
1033 /**
1034  * @format 1
1035  * @param subevent_code
1036  */
1037 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1038 
1039 /**
1040  * @format 1
1041  * @param subevent_code
1042  */
1043 #define HFP_SUBEVENT_RING                                     0x13
1044 
1045 /**
1046  * @format 111
1047  * @param subevent_code
1048  * @param status
1049  * @param gain
1050  */
1051  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1052 
1053 /**
1054  * @format 111
1055  * @param subevent_code
1056  * @param status
1057  * @param gain
1058  */
1059 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1060 
1061 /**
1062  * @format 11T
1063  * @param subevent_code
1064  * @param type
1065  * @param number
1066  */
1067 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1068 
1069 /**
1070  * @format 11T
1071  * @param subevent_code
1072  * @param type
1073  * @param number
1074  */
1075 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17
1076 
1077 /**
1078  * @format 111111T
1079  * @param subevent_code
1080  * @param clcc_idx
1081  * @param clcc_dir
1082  * @param clcc_status
1083  * @param clcc_mpty
1084  * @param bnip_type
1085  * @param bnip_number
1086  */
1087 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1088 
1089 /**
1090  * @format 111T
1091  * @param subevent_code
1092  * @param status
1093  * @param bnip_type
1094  * @param bnip_number
1095  */
1096  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1097 
1098 /**
1099  * @format 1T
1100  * @param subevent_code
1101  * @param value
1102  */
1103 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1104 
1105 // ANCS Client
1106 
1107 /**
1108  * @format 1H
1109  * @param subevent_code
1110  * @param handle
1111  */
1112 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1113 
1114 /**
1115  * @format 1H2T
1116  * @param subevent_code
1117  * @param handle
1118  * @param attribute_id
1119  * @param text
1120  */
1121 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1122 
1123 /**
1124  * @format 1H
1125  * @param subevent_code
1126  * @param handle
1127  */
1128 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1129 
1130 
1131 /** AVDTP Subevent */
1132 
1133 // /**
1134 //  * @format 11HB
1135 //  * @param subevent_code
1136 //  * @param status 0 == OK
1137 //  * @param con_handle
1138 //  * @param bd_addr
1139 //  */
1140 // #define AVDTP_SUBEVENT_CONNECTION_ESTABLISHED  0x01
1141 
1142 // /**
1143 //  * @format 1
1144 //  * @param subevent_code
1145 //  */
1146 // #define AVDTP_SUBEVENT_CONNECTION_RELEASED     0x02
1147 
1148 #endif
1149