xref: /btstack/src/btstack_defines.h (revision 1bf28f67a5f7e94bb05e16aae80e8013e969eac0)
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 DAEMON_EVENT_RFCOMM_SERVICE_REGISTERED             0x85
336 
337 /**
338  * @format 11
339  * @param status
340  * @param server_channel_id
341  */
342 #define DAEMON_EVENT_RFCOMM_PERSISTENT_CHANNEL             0x86
343 
344 /**
345   * @format 14
346   * @param status
347   * @param service_record_handle
348   */
349 #define DAEMON_EVENT_SDP_SERVICE_REGISTERED                0x90
350 
351 
352 
353 // additional HCI events
354 
355 /**
356  * @brief Outgoing packet
357  */
358 #define HCI_EVENT_TRANSPORT_PACKET_SENT                    0x6E
359 
360 /**
361  * @format B
362  * @param handle
363  */
364 #define HCI_EVENT_SCO_CAN_SEND_NOW                         0x6F
365 
366 
367 // L2CAP EVENTS
368 
369 /**
370  * @format 1BH222222
371  * @param status
372  * @param address
373  * @param handle
374  * @param psm
375  * @param local_cid
376  * @param remote_cid
377  * @param local_mtu
378  * @param remote_mtu
379  * @param flush_timeout
380  */
381 #define L2CAP_EVENT_CHANNEL_OPENED                         0x70
382 
383 /*
384  * @format 2
385  * @param local_cid
386  */
387 #define L2CAP_EVENT_CHANNEL_CLOSED                         0x71
388 
389 /**
390  * @format BH222
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 H1B4
739   * @param handle
740   * @param addr_type
741   * @param address
742   * @param passkey
743   */
744 #define SM_EVENT_NUMERIC_COMPARISON_REQUEST                      0xD6
745 
746  /**
747   * @format H1B4
748   * @param handle
749   * @param addr_type
750   * @param address
751   */
752 #define SM_EVENT_NUMERIC_COMPARISON_CANCEL                       0xD7
753 
754  /**
755   * @format H1B
756   * @param handle
757   * @param addr_type
758   * @param address
759   */
760 #define SM_EVENT_IDENTITY_RESOLVING_STARTED                      0xD8
761 
762  /**
763   * @format H1B
764   * @param handle
765   * @param addr_type
766   * @param address
767   */
768 #define SM_EVENT_IDENTITY_RESOLVING_FAILED                       0xD9
769 
770  /**
771   * @format H1B2
772   * @param handle
773   * @param addr_type
774   * @param address
775   * @param le_device_db_index
776   */
777 #define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED                    0xDA
778 
779  /**
780   * @format H1B
781   * @param handle
782   * @param addr_type
783   * @param address
784   */
785 #define SM_EVENT_AUTHORIZATION_REQUEST                           0xDB
786 
787  /**
788   * @format H1B1
789   * @param handle
790   * @param addr_type
791   * @param address
792   * @param authorization_result
793   */
794 #define SM_EVENT_AUTHORIZATION_RESULT                            0xDC
795 
796  /**
797   * @format H1
798   * @param handle
799   * @param action see SM_KEYPRESS_*
800   */
801 #define SM_EVENT_KEYPRESS_NOTIFICATION                           0xDD
802 
803 
804 // GAP
805 
806 /**
807  * @format H1
808  * @param handle
809  * @param security_level
810  */
811 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
812 
813 /**
814  * @format 1B
815  * @param status
816  * @param address
817  */
818 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
819 
820 /**
821  * @format 11B1JV
822  * @param advertising_event_type
823  * @param address_type
824  * @param address
825  * @param rssi
826  * @param data_length
827  * @param data
828  */
829 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
830 
831 
832 // Meta Events, see below for sub events
833 #define HCI_EVENT_HSP_META                                 0xE8
834 #define HCI_EVENT_HFP_META                                 0xE9
835 #define HCI_EVENT_ANCS_META                                0xEA
836 
837 // Potential other meta groups
838  // #define HCI_EVENT_BNEP_META                                0xxx
839 // #define HCI_EVENT_GAP_META                                 0xxx
840 // #define HCI_EVENT_GATT_META                                0xxx
841 // #define HCI_EVENT_PAN_META                                 0xxx
842 // #define HCI_EVENT_SDP_META                                 0xxx
843 // #define HCI_EVENT_SM_META                                  0xxx
844 
845 
846 /** HSP Subevent */
847 
848 /**
849  * @format 11
850  * @param subevent_code
851  * @param status 0 == OK
852  */
853 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
854 
855 /**
856  * @format 11
857  * @param subevent_code
858  * @param status 0 == OK
859  */
860 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
861 
862 
863 /**
864  * @format 11H
865  * @param subevent_code
866  * @param status 0 == OK
867  * @param handle
868  */
869 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
870 
871 /**
872  * @format 11
873  * @param subevent_code
874  * @param status 0 == OK
875  */
876 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
877 
878 /**
879  * @format 1
880  * @param subevent_code
881  */
882 #define HSP_SUBEVENT_RING                                  0x05
883 
884 /**
885  * @format 11
886  * @param subevent_code
887  * @param gain Valid range: [0,15]
888  */
889 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
890 
891 /**
892  * @format 11
893  * @param subevent_code
894  * @param gain Valid range: [0,15]
895  */
896 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
897 
898 /**
899  * @format 1JV
900  * @param subevent_code
901  * @param value_length
902  * @param value
903  */
904 #define HSP_SUBEVENT_HS_COMMAND                            0x08
905 
906 /**
907  * @format 1JV
908  * @param subevent_code
909  * @param value_length
910  * @param value
911  */
912 #define HSP_SUBEVENT_AG_INDICATION                         0x09
913 
914 
915 /** HFP Subevent */
916 
917 /**
918  * @format 11H
919  * @param subevent_code
920  * @param status 0 == OK
921  * @param con_handle
922  */
923 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
924 
925 /**
926  * @format 1
927  * @param subevent_code
928  */
929 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
930 
931 /**
932  * @format 11H
933  * @param subevent_code
934  * @param status 0 == OK
935  * @param handle
936  */
937 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
938 
939 /**
940  * @format 1
941  * @param subevent_code
942  */
943 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
944 
945 /**
946  * @format 11
947  * @param subevent_code
948  * @param status 0 == OK
949  */
950 #define HFP_SUBEVENT_COMPLETE                              0x05
951 
952 /**
953  * @format 111T
954  * @param subevent_code
955  * @param indicator_index
956  * @param indicator_status
957  * @param indicator_name
958  */
959 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
960 
961 /**
962  * @format 1111T
963  * @param subevent_code
964  * @param network_operator_mode
965  * @param network_operator_format
966  * @param network_operator_name
967  */
968 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
969 
970 /**
971  * @format 11
972  * @param subevent_code
973  * @param error
974  */
975 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
976 
977 /**
978  * @format 11
979  * @param subevent_code
980  * @param status
981  */
982 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE               0x09
983 
984 /**
985  * @format 1
986  * @param subevent_code
987  */
988 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
989 
990 /**
991  * @format 1
992  * @param subevent_code
993  */
994 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
995 
996 /**
997  * @format 1
998  * @param subevent_code
999  */
1000 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
1001 
1002 /**
1003  * @format 1T
1004  * @param subevent_code
1005  * @param number
1006  */
1007 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
1008 
1009 /**
1010  * @format 1
1011  * @param subevent_code
1012  */
1013 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
1014 
1015 /**
1016  * @format 1T
1017  * @param subevent_code
1018  * @param number
1019  */
1020 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
1021 
1022 /**
1023  * @format 1T
1024  * @param subevent_code
1025  * @param dtmf code
1026  */
1027 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1028 
1029 /**
1030  * @format 1
1031  * @param subevent_code
1032  */
1033  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1034 
1035 /**
1036  * @format 1
1037  * @param subevent_code
1038  */
1039 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1040 
1041 /**
1042  * @format 1
1043  * @param subevent_code
1044  */
1045 #define HFP_SUBEVENT_RING                                     0x13
1046 
1047 /**
1048  * @format 111
1049  * @param subevent_code
1050  * @param status
1051  * @param gain
1052  */
1053  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1054 
1055 /**
1056  * @format 111
1057  * @param subevent_code
1058  * @param status
1059  * @param gain
1060  */
1061 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1062 
1063 /**
1064  * @format 11T
1065  * @param subevent_code
1066  * @param type
1067  * @param number
1068  */
1069 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1070 
1071 /**
1072  * @format 11T
1073  * @param subevent_code
1074  * @param type
1075  * @param number
1076  */
1077 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17
1078 
1079 /**
1080  * @format 111111T
1081  * @param subevent_code
1082  * @param clcc_idx
1083  * @param clcc_dir
1084  * @param clcc_status
1085  * @param clcc_mpty
1086  * @param bnip_type
1087  * @param bnip_number
1088  */
1089 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1090 
1091 /**
1092  * @format 111T
1093  * @param subevent_code
1094  * @param status
1095  * @param bnip_type
1096  * @param bnip_number
1097  */
1098  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1099 
1100 /**
1101  * @format 1T
1102  * @param subevent_code
1103  * @param value
1104  */
1105 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1106 
1107 // ANCS Client
1108 
1109 /**
1110  * @format 1H
1111  * @param subevent_code
1112  * @param handle
1113  */
1114 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1115 
1116 /**
1117  * @format 1H2T
1118  * @param subevent_code
1119  * @param handle
1120  * @param attribute_id
1121  * @param text
1122  */
1123 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1124 
1125 /**
1126  * @format 1H
1127  * @param subevent_code
1128  * @param handle
1129  */
1130 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1131 
1132 #endif
1133