xref: /btstack/src/btstack_defines.h (revision b3fcedb9c9ccbcc9680da165cd86f394be5d84a8)
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 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 /**
782  * @format H1
783  * @param handle
784  * @param security_level
785  */
786 #define GAP_EVENT_SECURITY_LEVEL                                 0xE0
787 
788 /**
789  * @format 1B
790  * @param status
791  * @param address
792  */
793 #define GAP_EVENT_DEDICATED_BONDING_COMPLETED                    0xE1
794 
795 /**
796  * @format 11B1JV
797  * @param advertising_event_type
798  * @param address_type
799  * @param address
800  * @param rssi
801  * @param data_length
802  * @param data
803  */
804 #define GAP_EVENT_ADVERTISING_REPORT                          0xE2
805 
806 
807 // Meta Events, see below for sub events
808 #define HCI_EVENT_HSP_META                                 0xE8
809 #define HCI_EVENT_HFP_META                                 0xE9
810 #define HCI_EVENT_ANCS_META                                0xEA
811 
812 // Potential other meta groups
813  // #define HCI_EVENT_BNEP_META                                0xxx
814 // #define HCI_EVENT_GAP_META                                 0xxx
815 // #define HCI_EVENT_GATT_META                                0xxx
816 // #define HCI_EVENT_PAN_META                                 0xxx
817 // #define HCI_EVENT_SDP_META                                 0xxx
818 // #define HCI_EVENT_SM_META                                  0xxx
819 
820 
821 /** HSP Subevent */
822 
823 /**
824  * @format 11
825  * @param subevent_code
826  * @param status 0 == OK
827  */
828 #define HSP_SUBEVENT_RFCOMM_CONNECTION_COMPLETE             0x01
829 
830 /**
831  * @format 11
832  * @param subevent_code
833  * @param status 0 == OK
834  */
835 #define HSP_SUBEVENT_RFCOMM_DISCONNECTION_COMPLETE           0x02
836 
837 
838 /**
839  * @format 11H
840  * @param subevent_code
841  * @param status 0 == OK
842  * @param handle
843  */
844 #define HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE             0x03
845 
846 /**
847  * @format 11
848  * @param subevent_code
849  * @param status 0 == OK
850  */
851 #define HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE          0x04
852 
853 /**
854  * @format 1
855  * @param subevent_code
856  */
857 #define HSP_SUBEVENT_RING                                  0x05
858 
859 /**
860  * @format 11
861  * @param subevent_code
862  * @param gain Valid range: [0,15]
863  */
864 #define HSP_SUBEVENT_MICROPHONE_GAIN_CHANGED               0x06
865 
866 /**
867  * @format 11
868  * @param subevent_code
869  * @param gain Valid range: [0,15]
870  */
871 #define HSP_SUBEVENT_SPEAKER_GAIN_CHANGED                  0x07
872 
873 /**
874  * @format 1JV
875  * @param subevent_code
876  * @param value_length
877  * @param value
878  */
879 #define HSP_SUBEVENT_HS_COMMAND                            0x08
880 
881 /**
882  * @format 1JV
883  * @param subevent_code
884  * @param value_length
885  * @param value
886  */
887 #define HSP_SUBEVENT_AG_INDICATION                         0x09
888 
889 
890 /** HFP Subevent */
891 
892 /**
893  * @format 11H
894  * @param subevent_code
895  * @param status 0 == OK
896  * @param con_handle
897  */
898 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED  0x01
899 
900 /**
901  * @format 1
902  * @param subevent_code
903  */
904 #define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED     0x02
905 
906 /**
907  * @format 11
908  * @param subevent_code
909  * @param status 0 == OK
910  */
911 #define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED          0x03
912 
913 /**
914  * @format 1
915  * @param subevent_code
916  */
917 #define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED             0x04
918 
919 /**
920  * @format 11
921  * @param subevent_code
922  * @param status 0 == OK
923  */
924 #define HFP_SUBEVENT_COMPLETE                              0x05
925 
926 /**
927  * @format 111T
928  * @param subevent_code
929  * @param indicator_index
930  * @param indicator_status
931  * @param indicator_name
932  */
933 #define HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED           0x06
934 
935 /**
936  * @format 1111T
937  * @param subevent_code
938  * @param network_operator_mode
939  * @param network_operator_format
940  * @param network_operator_name
941  */
942 #define HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED              0x07
943 
944 /**
945  * @format 11
946  * @param subevent_code
947  * @param error
948  */
949 #define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR             0x08
950 
951 /**
952  * @format 11
953  * @param subevent_code
954  * @param status
955  */
956 #define HFP_SUBEVENT_CODECS_CONNECTION_COMPLETE               0x09
957 
958 /**
959  * @format 1
960  * @param subevent_code
961  */
962 #define HFP_SUBEVENT_START_RINGINIG                           0x0A
963 
964 /**
965  * @format 1
966  * @param subevent_code
967  */
968 #define HFP_SUBEVENT_STOP_RINGINIG                            0x0B
969 
970 /**
971  * @format 1
972  * @param subevent_code
973  */
974 #define HFP_SUBEVENT_CALL_TERMINATED                          0x0C
975 
976 /**
977  * @format 1T
978  * @param subevent_code
979  * @param number
980  */
981 #define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER                   0x0D
982 
983 /**
984  * @format 1
985  * @param subevent_code
986  */
987 #define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG               0x0E
988 
989 /**
990  * @format 1T
991  * @param subevent_code
992  * @param number
993  */
994 #define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG                     0x0F
995 
996 /**
997  * @format 1T
998  * @param subevent_code
999  * @param dtmf code
1000  */
1001 #define HFP_SUBEVENT_TRANSMIT_DTMF_CODES                      0x10
1002 
1003 /**
1004  * @format 1
1005  * @param subevent_code
1006  */
1007  #define HFP_SUBEVENT_CALL_ANSWERED                            0x11
1008 
1009 /**
1010  * @format 1
1011  * @param subevent_code
1012  */
1013 #define HFP_SUBEVENT_CONFERENCE_CALL                          0x12
1014 
1015 /**
1016  * @format 1
1017  * @param subevent_code
1018  */
1019 #define HFP_SUBEVENT_RING                                     0x13
1020 
1021 /**
1022  * @format 111
1023  * @param subevent_code
1024  * @param status
1025  * @param gain
1026  */
1027  #define HFP_SUBEVENT_SPEAKER_VOLUME                           0x14
1028 
1029 /**
1030  * @format 111
1031  * @param subevent_code
1032  * @param status
1033  * @param gain
1034  */
1035 #define HFP_SUBEVENT_MICROPHONE_VOLUME                        0x15
1036 
1037 /**
1038  * @format 11T
1039  * @param subevent_code
1040  * @param type
1041  * @param number
1042  */
1043 #define HFP_SUBEVENT_CALL_WAITING_NOTIFICATION                0x16
1044 
1045 /**
1046  * @format 11T
1047  * @param subevent_code
1048  * @param type
1049  * @param number
1050  */
1051 #define HFP_SUBEVENT_CALLING_LINE_INDETIFICATION_NOTIFICATION 0x17
1052 
1053 /**
1054  * @format 111111T
1055  * @param subevent_code
1056  * @param clcc_idx
1057  * @param clcc_dir
1058  * @param clcc_status
1059  * @param clcc_mpty
1060  * @param bnip_type
1061  * @param bnip_number
1062  */
1063 #define HFP_SUBEVENT_ENHANCED_CALL_STATUS                     0x18
1064 
1065 /**
1066  * @format 111T
1067  * @param subevent_code
1068  * @param status
1069  * @param bnip_type
1070  * @param bnip_number
1071  */
1072  #define HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION            0x19
1073 
1074 /**
1075  * @format 1T
1076  * @param subevent_code
1077  * @param value
1078  */
1079 #define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS                 0x1A
1080 
1081 // ANCS Client
1082 
1083 /**
1084  * @format 1H
1085  * @param subevent_code
1086  * @param handle
1087  */
1088 #define ANCS_SUBEVENT_CLIENT_CONNECTED                              0xF0
1089 
1090 /**
1091  * @format 1H2T
1092  * @param subevent_code
1093  * @param handle
1094  * @param attribute_id
1095  * @param text
1096  */
1097 #define ANCS_SUBEVENT_CLIENT_NOTIFICATION                           0xF1
1098 
1099 /**
1100  * @format 1H
1101  * @param subevent_code
1102  * @param handle
1103  */
1104 #define ANCS_SUBEVENT_CLIENT_DISCONNECTED                           0xF2
1105 
1106 #endif
1107