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