ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
hci.h
Go to the documentation of this file.
1 /*
2  *
3  * BlueZ - Bluetooth protocol stack for Linux
4  *
5  * Copyright (C) 2000-2001 Qualcomm Incorporated
6  * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
7  * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 #ifndef __HCI_H
27 #define __HCI_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/socket.h>
34 
35 #define HCI_MAX_DEV 16
36 
37 #define HCI_MAX_ACL_SIZE (1492 + 4)
38 #define HCI_MAX_SCO_SIZE 255
39 #define HCI_MAX_EVENT_SIZE 260
40 #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
41 
42 /* HCI dev events */
43 #define HCI_DEV_REG 1
44 #define HCI_DEV_UNREG 2
45 #define HCI_DEV_UP 3
46 #define HCI_DEV_DOWN 4
47 #define HCI_DEV_SUSPEND 5
48 #define HCI_DEV_RESUME 6
49 
50 /* HCI bus types */
51 #define HCI_VIRTUAL 0
52 #define HCI_USB 1
53 #define HCI_PCCARD 2
54 #define HCI_UART 3
55 #define HCI_RS232 4
56 #define HCI_PCI 5
57 #define HCI_SDIO 6
58 
59 /* HCI controller types */
60 #define HCI_BREDR 0x00
61 #define HCI_AMP 0x01
62 
63 /* HCI device flags */
64 enum {
68 
74 
76 };
77 
78 /* LE address type */
79 enum {
82 };
83 
84 /* HCI ioctl defines */
85 #define HCIDEVUP _IOW('H', 201, int)
86 #define HCIDEVDOWN _IOW('H', 202, int)
87 #define HCIDEVRESET _IOW('H', 203, int)
88 #define HCIDEVRESTAT _IOW('H', 204, int)
89 
90 #define HCIGETDEVLIST _IOR('H', 210, int)
91 #define HCIGETDEVINFO _IOR('H', 211, int)
92 #define HCIGETCONNLIST _IOR('H', 212, int)
93 #define HCIGETCONNINFO _IOR('H', 213, int)
94 #define HCIGETAUTHINFO _IOR('H', 215, int)
95 
96 #define HCISETRAW _IOW('H', 220, int)
97 #define HCISETSCAN _IOW('H', 221, int)
98 #define HCISETAUTH _IOW('H', 222, int)
99 #define HCISETENCRYPT _IOW('H', 223, int)
100 #define HCISETPTYPE _IOW('H', 224, int)
101 #define HCISETLINKPOL _IOW('H', 225, int)
102 #define HCISETLINKMODE _IOW('H', 226, int)
103 #define HCISETACLMTU _IOW('H', 227, int)
104 #define HCISETSCOMTU _IOW('H', 228, int)
105 
106 #define HCIBLOCKADDR _IOW('H', 230, int)
107 #define HCIUNBLOCKADDR _IOW('H', 231, int)
108 
109 #define HCIINQUIRY _IOR('H', 240, int)
110 
111 #ifndef __NO_HCI_DEFS
112 
113 /* HCI Packet types */
114 #define HCI_COMMAND_PKT 0x01
115 #define HCI_ACLDATA_PKT 0x02
116 #define HCI_SCODATA_PKT 0x03
117 #define HCI_EVENT_PKT 0x04
118 #define HCI_VENDOR_PKT 0xff
119 
120 /* HCI Packet types */
121 #define HCI_2DH1 0x0002
122 #define HCI_3DH1 0x0004
123 #define HCI_DM1 0x0008
124 #define HCI_DH1 0x0010
125 #define HCI_2DH3 0x0100
126 #define HCI_3DH3 0x0200
127 #define HCI_DM3 0x0400
128 #define HCI_DH3 0x0800
129 #define HCI_2DH5 0x1000
130 #define HCI_3DH5 0x2000
131 #define HCI_DM5 0x4000
132 #define HCI_DH5 0x8000
133 
134 #define HCI_HV1 0x0020
135 #define HCI_HV2 0x0040
136 #define HCI_HV3 0x0080
137 
138 #define HCI_EV3 0x0008
139 #define HCI_EV4 0x0010
140 #define HCI_EV5 0x0020
141 #define HCI_2EV3 0x0040
142 #define HCI_3EV3 0x0080
143 #define HCI_2EV5 0x0100
144 #define HCI_3EV5 0x0200
145 
146 #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
147 #define ACL_PTYPE_MASK (HCI_DM1 | HCI_DH1 | HCI_DM3 | HCI_DH3 | HCI_DM5 | HCI_DH5)
148 
149 /* HCI Error codes */
150 #define HCI_UNKNOWN_COMMAND 0x01
151 #define HCI_NO_CONNECTION 0x02
152 #define HCI_HARDWARE_FAILURE 0x03
153 #define HCI_PAGE_TIMEOUT 0x04
154 #define HCI_AUTHENTICATION_FAILURE 0x05
155 #define HCI_PIN_OR_KEY_MISSING 0x06
156 #define HCI_MEMORY_FULL 0x07
157 #define HCI_CONNECTION_TIMEOUT 0x08
158 #define HCI_MAX_NUMBER_OF_CONNECTIONS 0x09
159 #define HCI_MAX_NUMBER_OF_SCO_CONNECTIONS 0x0a
160 #define HCI_ACL_CONNECTION_EXISTS 0x0b
161 #define HCI_COMMAND_DISALLOWED 0x0c
162 #define HCI_REJECTED_LIMITED_RESOURCES 0x0d
163 #define HCI_REJECTED_SECURITY 0x0e
164 #define HCI_REJECTED_PERSONAL 0x0f
165 #define HCI_HOST_TIMEOUT 0x10
166 #define HCI_UNSUPPORTED_FEATURE 0x11
167 #define HCI_INVALID_PARAMETERS 0x12
168 #define HCI_OE_USER_ENDED_CONNECTION 0x13
169 #define HCI_OE_LOW_RESOURCES 0x14
170 #define HCI_OE_POWER_OFF 0x15
171 #define HCI_CONNECTION_TERMINATED 0x16
172 #define HCI_REPEATED_ATTEMPTS 0x17
173 #define HCI_PAIRING_NOT_ALLOWED 0x18
174 #define HCI_UNKNOWN_LMP_PDU 0x19
175 #define HCI_UNSUPPORTED_REMOTE_FEATURE 0x1a
176 #define HCI_SCO_OFFSET_REJECTED 0x1b
177 #define HCI_SCO_INTERVAL_REJECTED 0x1c
178 #define HCI_AIR_MODE_REJECTED 0x1d
179 #define HCI_INVALID_LMP_PARAMETERS 0x1e
180 #define HCI_UNSPECIFIED_ERROR 0x1f
181 #define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE 0x20
182 #define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
183 #define HCI_LMP_RESPONSE_TIMEOUT 0x22
184 #define HCI_LMP_ERROR_TRANSACTION_COLLISION 0x23
185 #define HCI_LMP_PDU_NOT_ALLOWED 0x24
186 #define HCI_ENCRYPTION_MODE_NOT_ACCEPTED 0x25
187 #define HCI_UNIT_LINK_KEY_USED 0x26
188 #define HCI_QOS_NOT_SUPPORTED 0x27
189 #define HCI_INSTANT_PASSED 0x28
190 #define HCI_PAIRING_NOT_SUPPORTED 0x29
191 #define HCI_TRANSACTION_COLLISION 0x2a
192 #define HCI_QOS_UNACCEPTABLE_PARAMETER 0x2c
193 #define HCI_QOS_REJECTED 0x2d
194 #define HCI_CLASSIFICATION_NOT_SUPPORTED 0x2e
195 #define HCI_INSUFFICIENT_SECURITY 0x2f
196 #define HCI_PARAMETER_OUT_OF_RANGE 0x30
197 #define HCI_ROLE_SWITCH_PENDING 0x32
198 #define HCI_SLOT_VIOLATION 0x34
199 #define HCI_ROLE_SWITCH_FAILED 0x35
200 #define HCI_EIR_TOO_LARGE 0x36
201 #define HCI_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
202 #define HCI_HOST_BUSY_PAIRING 0x38
203 
204 /* ACL flags */
205 #define ACL_START_NO_FLUSH 0x00
206 #define ACL_CONT 0x01
207 #define ACL_START 0x02
208 #define ACL_ACTIVE_BCAST 0x04
209 #define ACL_PICO_BCAST 0x08
210 
211 /* Baseband links */
212 #define SCO_LINK 0x00
213 #define ACL_LINK 0x01
214 #define ESCO_LINK 0x02
215 
216 /* LMP features */
217 #define LMP_3SLOT 0x01
218 #define LMP_5SLOT 0x02
219 #define LMP_ENCRYPT 0x04
220 #define LMP_SOFFSET 0x08
221 #define LMP_TACCURACY 0x10
222 #define LMP_RSWITCH 0x20
223 #define LMP_HOLD 0x40
224 #define LMP_SNIFF 0x80
225 
226 #define LMP_PARK 0x01
227 #define LMP_RSSI 0x02
228 #define LMP_QUALITY 0x04
229 #define LMP_SCO 0x08
230 #define LMP_HV2 0x10
231 #define LMP_HV3 0x20
232 #define LMP_ULAW 0x40
233 #define LMP_ALAW 0x80
234 
235 #define LMP_CVSD 0x01
236 #define LMP_PSCHEME 0x02
237 #define LMP_PCONTROL 0x04
238 #define LMP_TRSP_SCO 0x08
239 #define LMP_BCAST_ENC 0x80
240 
241 #define LMP_EDR_ACL_2M 0x02
242 #define LMP_EDR_ACL_3M 0x04
243 #define LMP_ENH_ISCAN 0x08
244 #define LMP_ILACE_ISCAN 0x10
245 #define LMP_ILACE_PSCAN 0x20
246 #define LMP_RSSI_INQ 0x40
247 #define LMP_ESCO 0x80
248 
249 #define LMP_EV4 0x01
250 #define LMP_EV5 0x02
251 #define LMP_AFH_CAP_SLV 0x08
252 #define LMP_AFH_CLS_SLV 0x10
253 #define LMP_NO_BREDR 0x20
254 #define LMP_LE 0x40
255 #define LMP_EDR_3SLOT 0x80
256 
257 #define LMP_EDR_5SLOT 0x01
258 #define LMP_SNIFF_SUBR 0x02
259 #define LMP_PAUSE_ENC 0x04
260 #define LMP_AFH_CAP_MST 0x08
261 #define LMP_AFH_CLS_MST 0x10
262 #define LMP_EDR_ESCO_2M 0x20
263 #define LMP_EDR_ESCO_3M 0x40
264 #define LMP_EDR_3S_ESCO 0x80
265 
266 #define LMP_EXT_INQ 0x01
267 #define LMP_LE_BREDR 0x02
268 #define LMP_SIMPLE_PAIR 0x08
269 #define LMP_ENCAPS_PDU 0x10
270 #define LMP_ERR_DAT_REP 0x20
271 #define LMP_NFLUSH_PKTS 0x40
272 
273 #define LMP_LSTO 0x01
274 #define LMP_INQ_TX_PWR 0x02
275 #define LMP_EPC 0x04
276 #define LMP_EXT_FEAT 0x80
277 
278 /* Extended LMP features */
279 #define LMP_HOST_SSP 0x01
280 #define LMP_HOST_LE 0x02
281 #define LMP_HOST_LE_BREDR 0x04
282 
283 /* Link policies */
284 #define HCI_LP_RSWITCH 0x0001
285 #define HCI_LP_HOLD 0x0002
286 #define HCI_LP_SNIFF 0x0004
287 #define HCI_LP_PARK 0x0008
288 
289 /* Link mode */
290 #define HCI_LM_ACCEPT 0x8000
291 #define HCI_LM_MASTER 0x0001
292 #define HCI_LM_AUTH 0x0002
293 #define HCI_LM_ENCRYPT 0x0004
294 #define HCI_LM_TRUSTED 0x0008
295 #define HCI_LM_RELIABLE 0x0010
296 #define HCI_LM_SECURE 0x0020
297 
298 /* Link Key types */
299 #define HCI_LK_COMBINATION 0x00
300 #define HCI_LK_LOCAL_UNIT 0x01
301 #define HCI_LK_REMOTE_UNIT 0x02
302 #define HCI_LK_DEBUG_COMBINATION 0x03
303 #define HCI_LK_UNAUTH_COMBINATION 0x04
304 #define HCI_LK_AUTH_COMBINATION 0x05
305 #define HCI_LK_CHANGED_COMBINATION 0x06
306 #define HCI_LK_INVALID 0xFF
307 
308 /* ----- HCI Commands ----- */
309 
310 /* Link Control */
311 #define OGF_LINK_CTL 0x01
312 
313 #define OCF_INQUIRY 0x0001
314 typedef struct {
315  uint8_t lap[3];
316  uint8_t length; /* 1.28s units */
317  uint8_t num_rsp;
318 } __attribute__ ((packed)) inquiry_cp;
319 #define INQUIRY_CP_SIZE 5
320 
321 typedef struct {
322  uint8_t status;
323  bdaddr_t bdaddr;
324 } __attribute__ ((packed)) status_bdaddr_rp;
325 #define STATUS_BDADDR_RP_SIZE 7
326 
327 #define OCF_INQUIRY_CANCEL 0x0002
328 
329 #define OCF_PERIODIC_INQUIRY 0x0003
330 typedef struct {
331  uint16_t max_period; /* 1.28s units */
332  uint16_t min_period; /* 1.28s units */
333  uint8_t lap[3];
334  uint8_t length; /* 1.28s units */
335  uint8_t num_rsp;
336 } __attribute__ ((packed)) periodic_inquiry_cp;
337 #define PERIODIC_INQUIRY_CP_SIZE 9
338 
339 #define OCF_EXIT_PERIODIC_INQUIRY 0x0004
340 
341 #define OCF_CREATE_CONN 0x0005
342 typedef struct {
343  bdaddr_t bdaddr;
344  uint16_t pkt_type;
345  uint8_t pscan_rep_mode;
346  uint8_t pscan_mode;
347  uint16_t clock_offset;
348  uint8_t role_switch;
349 } __attribute__ ((packed)) create_conn_cp;
350 #define CREATE_CONN_CP_SIZE 13
351 
352 #define OCF_DISCONNECT 0x0006
353 typedef struct {
354  uint16_t handle;
355  uint8_t reason;
356 } __attribute__ ((packed)) disconnect_cp;
357 #define DISCONNECT_CP_SIZE 3
358 
359 #define OCF_ADD_SCO 0x0007
360 typedef struct {
361  uint16_t handle;
362  uint16_t pkt_type;
363 } __attribute__ ((packed)) add_sco_cp;
364 #define ADD_SCO_CP_SIZE 4
365 
366 #define OCF_CREATE_CONN_CANCEL 0x0008
367 typedef struct {
368  bdaddr_t bdaddr;
369 } __attribute__ ((packed)) create_conn_cancel_cp;
370 #define CREATE_CONN_CANCEL_CP_SIZE 6
371 
372 #define OCF_ACCEPT_CONN_REQ 0x0009
373 typedef struct {
374  bdaddr_t bdaddr;
375  uint8_t role;
376 } __attribute__ ((packed)) accept_conn_req_cp;
377 #define ACCEPT_CONN_REQ_CP_SIZE 7
378 
379 #define OCF_REJECT_CONN_REQ 0x000A
380 typedef struct {
381  bdaddr_t bdaddr;
382  uint8_t reason;
383 } __attribute__ ((packed)) reject_conn_req_cp;
384 #define REJECT_CONN_REQ_CP_SIZE 7
385 
386 #define OCF_LINK_KEY_REPLY 0x000B
387 typedef struct {
388  bdaddr_t bdaddr;
389  uint8_t link_key[16];
390 } __attribute__ ((packed)) link_key_reply_cp;
391 #define LINK_KEY_REPLY_CP_SIZE 22
392 
393 #define OCF_LINK_KEY_NEG_REPLY 0x000C
394 
395 #define OCF_PIN_CODE_REPLY 0x000D
396 typedef struct {
397  bdaddr_t bdaddr;
398  uint8_t pin_len;
399  uint8_t pin_code[16];
400 } __attribute__ ((packed)) pin_code_reply_cp;
401 #define PIN_CODE_REPLY_CP_SIZE 23
402 
403 #define OCF_PIN_CODE_NEG_REPLY 0x000E
404 
405 #define OCF_SET_CONN_PTYPE 0x000F
406 typedef struct {
407  uint16_t handle;
408  uint16_t pkt_type;
409 } __attribute__ ((packed)) set_conn_ptype_cp;
410 #define SET_CONN_PTYPE_CP_SIZE 4
411 
412 #define OCF_AUTH_REQUESTED 0x0011
413 typedef struct {
414  uint16_t handle;
415 } __attribute__ ((packed)) auth_requested_cp;
416 #define AUTH_REQUESTED_CP_SIZE 2
417 
418 #define OCF_SET_CONN_ENCRYPT 0x0013
419 typedef struct {
420  uint16_t handle;
421  uint8_t encrypt;
422 } __attribute__ ((packed)) set_conn_encrypt_cp;
423 #define SET_CONN_ENCRYPT_CP_SIZE 3
424 
425 #define OCF_CHANGE_CONN_LINK_KEY 0x0015
426 typedef struct {
427  uint16_t handle;
428 } __attribute__ ((packed)) change_conn_link_key_cp;
429 #define CHANGE_CONN_LINK_KEY_CP_SIZE 2
430 
431 #define OCF_MASTER_LINK_KEY 0x0017
432 typedef struct {
433  uint8_t key_flag;
434 } __attribute__ ((packed)) master_link_key_cp;
435 #define MASTER_LINK_KEY_CP_SIZE 1
436 
437 #define OCF_REMOTE_NAME_REQ 0x0019
438 typedef struct {
439  bdaddr_t bdaddr;
440  uint8_t pscan_rep_mode;
441  uint8_t pscan_mode;
442  uint16_t clock_offset;
443 } __attribute__ ((packed)) remote_name_req_cp;
444 #define REMOTE_NAME_REQ_CP_SIZE 10
445 
446 #define OCF_REMOTE_NAME_REQ_CANCEL 0x001A
447 typedef struct {
448  bdaddr_t bdaddr;
449 } __attribute__ ((packed)) remote_name_req_cancel_cp;
450 #define REMOTE_NAME_REQ_CANCEL_CP_SIZE 6
451 
452 #define OCF_READ_REMOTE_FEATURES 0x001B
453 typedef struct {
454  uint16_t handle;
455 } __attribute__ ((packed)) read_remote_features_cp;
456 #define READ_REMOTE_FEATURES_CP_SIZE 2
457 
458 #define OCF_READ_REMOTE_EXT_FEATURES 0x001C
459 typedef struct {
460  uint16_t handle;
461  uint8_t page_num;
462 } __attribute__ ((packed)) read_remote_ext_features_cp;
463 #define READ_REMOTE_EXT_FEATURES_CP_SIZE 3
464 
465 #define OCF_READ_REMOTE_VERSION 0x001D
466 typedef struct {
467  uint16_t handle;
468 } __attribute__ ((packed)) read_remote_version_cp;
469 #define READ_REMOTE_VERSION_CP_SIZE 2
470 
471 #define OCF_READ_CLOCK_OFFSET 0x001F
472 typedef struct {
473  uint16_t handle;
474 } __attribute__ ((packed)) read_clock_offset_cp;
475 #define READ_CLOCK_OFFSET_CP_SIZE 2
476 
477 #define OCF_READ_LMP_HANDLE 0x0020
478 
479 #define OCF_SETUP_SYNC_CONN 0x0028
480 typedef struct {
481  uint16_t handle;
482  uint32_t tx_bandwith;
483  uint32_t rx_bandwith;
484  uint16_t max_latency;
485  uint16_t voice_setting;
486  uint8_t retrans_effort;
487  uint16_t pkt_type;
488 } __attribute__ ((packed)) setup_sync_conn_cp;
489 #define SETUP_SYNC_CONN_CP_SIZE 17
490 
491 #define OCF_ACCEPT_SYNC_CONN_REQ 0x0029
492 typedef struct {
493  bdaddr_t bdaddr;
494  uint32_t tx_bandwith;
495  uint32_t rx_bandwith;
496  uint16_t max_latency;
497  uint16_t voice_setting;
498  uint8_t retrans_effort;
499  uint16_t pkt_type;
500 } __attribute__ ((packed)) accept_sync_conn_req_cp;
501 #define ACCEPT_SYNC_CONN_REQ_CP_SIZE 21
502 
503 #define OCF_REJECT_SYNC_CONN_REQ 0x002A
504 typedef struct {
505  bdaddr_t bdaddr;
506  uint8_t reason;
507 } __attribute__ ((packed)) reject_sync_conn_req_cp;
508 #define REJECT_SYNC_CONN_REQ_CP_SIZE 7
509 
510 #define OCF_IO_CAPABILITY_REPLY 0x002B
511 typedef struct {
512  bdaddr_t bdaddr;
513  uint8_t capability;
514  uint8_t oob_data;
515  uint8_t authentication;
516 } __attribute__ ((packed)) io_capability_reply_cp;
517 #define IO_CAPABILITY_REPLY_CP_SIZE 9
518 
519 #define OCF_USER_CONFIRM_REPLY 0x002C
520 typedef struct {
521  bdaddr_t bdaddr;
522 } __attribute__ ((packed)) user_confirm_reply_cp;
523 #define USER_CONFIRM_REPLY_CP_SIZE 6
524 
525 #define OCF_USER_CONFIRM_NEG_REPLY 0x002D
526 
527 #define OCF_USER_PASSKEY_REPLY 0x002E
528 typedef struct {
529  bdaddr_t bdaddr;
530  uint32_t passkey;
531 } __attribute__ ((packed)) user_passkey_reply_cp;
532 #define USER_PASSKEY_REPLY_CP_SIZE 10
533 
534 #define OCF_USER_PASSKEY_NEG_REPLY 0x002F
535 
536 #define OCF_REMOTE_OOB_DATA_REPLY 0x0030
537 typedef struct {
538  bdaddr_t bdaddr;
539  uint8_t hash[16];
540  uint8_t randomizer[16];
541 } __attribute__ ((packed)) remote_oob_data_reply_cp;
542 #define REMOTE_OOB_DATA_REPLY_CP_SIZE 38
543 
544 #define OCF_REMOTE_OOB_DATA_NEG_REPLY 0x0033
545 
546 #define OCF_IO_CAPABILITY_NEG_REPLY 0x0034
547 typedef struct {
548  bdaddr_t bdaddr;
549  uint8_t reason;
550 } __attribute__ ((packed)) io_capability_neg_reply_cp;
551 #define IO_CAPABILITY_NEG_REPLY_CP_SIZE 7
552 
553 #define OCF_CREATE_PHYSICAL_LINK 0x0035
554 typedef struct {
555  uint8_t handle;
556  uint8_t key_length;
557  uint8_t key_type;
558  uint8_t key[32];
559 } __attribute__ ((packed)) create_physical_link_cp;
560 #define CREATE_PHYSICAL_LINK_CP_SIZE 35
561 
562 #define OCF_ACCEPT_PHYSICAL_LINK 0x0036
563 typedef struct {
564  uint8_t handle;
565  uint8_t key_length;
566  uint8_t key_type;
567  uint8_t key[32];
568 } __attribute__ ((packed)) accept_physical_link_cp;
569 #define ACCEPT_PHYSICAL_LINK_CP_SIZE 35
570 
571 #define OCF_DISCONNECT_PHYSICAL_LINK 0x0037
572 typedef struct {
573  uint8_t handle;
574  uint8_t reason;
575 } __attribute__ ((packed)) disconnect_physical_link_cp;
576 #define DISCONNECT_PHYSICAL_LINK_CP_SIZE 2
577 
578 #define OCF_CREATE_LOGICAL_LINK 0x0038
579 typedef struct {
580  uint8_t handle;
581  uint8_t tx_flow[16];
582  uint8_t rx_flow[16];
583 } __attribute__ ((packed)) create_logical_link_cp;
584 #define CREATE_LOGICAL_LINK_CP_SIZE 33
585 
586 #define OCF_ACCEPT_LOGICAL_LINK 0x0039
587 
588 #define OCF_DISCONNECT_LOGICAL_LINK 0x003A
589 typedef struct {
590  uint16_t handle;
591 } __attribute__ ((packed)) disconnect_logical_link_cp;
592 #define DISCONNECT_LOGICAL_LINK_CP_SIZE 2
593 
594 #define OCF_LOGICAL_LINK_CANCEL 0x003B
595 typedef struct {
596  uint8_t handle;
597  uint8_t tx_flow_id;
598 } __attribute__ ((packed)) cancel_logical_link_cp;
599 #define LOGICAL_LINK_CANCEL_CP_SIZE 2
600 typedef struct {
601  uint8_t status;
602  uint8_t handle;
603  uint8_t tx_flow_id;
604 } __attribute__ ((packed)) cancel_logical_link_rp;
605 #define LOGICAL_LINK_CANCEL_RP_SIZE 3
606 
607 #define OCF_FLOW_SPEC_MODIFY 0x003C
608 
609 /* Link Policy */
610 #define OGF_LINK_POLICY 0x02
611 
612 #define OCF_HOLD_MODE 0x0001
613 typedef struct {
614  uint16_t handle;
615  uint16_t max_interval;
616  uint16_t min_interval;
617 } __attribute__ ((packed)) hold_mode_cp;
618 #define HOLD_MODE_CP_SIZE 6
619 
620 #define OCF_SNIFF_MODE 0x0003
621 typedef struct {
622  uint16_t handle;
623  uint16_t max_interval;
624  uint16_t min_interval;
625  uint16_t attempt;
626  uint16_t timeout;
627 } __attribute__ ((packed)) sniff_mode_cp;
628 #define SNIFF_MODE_CP_SIZE 10
629 
630 #define OCF_EXIT_SNIFF_MODE 0x0004
631 typedef struct {
632  uint16_t handle;
633 } __attribute__ ((packed)) exit_sniff_mode_cp;
634 #define EXIT_SNIFF_MODE_CP_SIZE 2
635 
636 #define OCF_PARK_MODE 0x0005
637 typedef struct {
638  uint16_t handle;
639  uint16_t max_interval;
640  uint16_t min_interval;
641 } __attribute__ ((packed)) park_mode_cp;
642 #define PARK_MODE_CP_SIZE 6
643 
644 #define OCF_EXIT_PARK_MODE 0x0006
645 typedef struct {
646  uint16_t handle;
647 } __attribute__ ((packed)) exit_park_mode_cp;
648 #define EXIT_PARK_MODE_CP_SIZE 2
649 
650 #define OCF_QOS_SETUP 0x0007
651 typedef struct {
652  uint8_t service_type; /* 1 = best effort */
653  uint32_t token_rate; /* Byte per seconds */
654  uint32_t peak_bandwidth; /* Byte per seconds */
655  uint32_t latency; /* Microseconds */
656  uint32_t delay_variation; /* Microseconds */
657 } __attribute__ ((packed)) hci_qos;
658 #define HCI_QOS_CP_SIZE 17
659 typedef struct {
660  uint16_t handle;
661  uint8_t flags; /* Reserved */
662  hci_qos qos;
663 } __attribute__ ((packed)) qos_setup_cp;
664 #define QOS_SETUP_CP_SIZE (3 + HCI_QOS_CP_SIZE)
665 
666 #define OCF_ROLE_DISCOVERY 0x0009
667 typedef struct {
668  uint16_t handle;
669 } __attribute__ ((packed)) role_discovery_cp;
670 #define ROLE_DISCOVERY_CP_SIZE 2
671 typedef struct {
672  uint8_t status;
673  uint16_t handle;
674  uint8_t role;
675 } __attribute__ ((packed)) role_discovery_rp;
676 #define ROLE_DISCOVERY_RP_SIZE 4
677 
678 #define OCF_SWITCH_ROLE 0x000B
679 typedef struct {
680  bdaddr_t bdaddr;
681  uint8_t role;
682 } __attribute__ ((packed)) switch_role_cp;
683 #define SWITCH_ROLE_CP_SIZE 7
684 
685 #define OCF_READ_LINK_POLICY 0x000C
686 typedef struct {
687  uint16_t handle;
688 } __attribute__ ((packed)) read_link_policy_cp;
689 #define READ_LINK_POLICY_CP_SIZE 2
690 typedef struct {
691  uint8_t status;
692  uint16_t handle;
693  uint16_t policy;
694 } __attribute__ ((packed)) read_link_policy_rp;
695 #define READ_LINK_POLICY_RP_SIZE 5
696 
697 #define OCF_WRITE_LINK_POLICY 0x000D
698 typedef struct {
699  uint16_t handle;
700  uint16_t policy;
701 } __attribute__ ((packed)) write_link_policy_cp;
702 #define WRITE_LINK_POLICY_CP_SIZE 4
703 typedef struct {
704  uint8_t status;
705  uint16_t handle;
706 } __attribute__ ((packed)) write_link_policy_rp;
707 #define WRITE_LINK_POLICY_RP_SIZE 3
708 
709 #define OCF_READ_DEFAULT_LINK_POLICY 0x000E
710 
711 #define OCF_WRITE_DEFAULT_LINK_POLICY 0x000F
712 
713 #define OCF_FLOW_SPECIFICATION 0x0010
714 
715 #define OCF_SNIFF_SUBRATING 0x0011
716 typedef struct {
717  uint16_t handle;
718  uint16_t max_latency;
721 } __attribute__ ((packed)) sniff_subrating_cp;
722 #define SNIFF_SUBRATING_CP_SIZE 8
723 
724 /* Host Controller and Baseband */
725 #define OGF_HOST_CTL 0x03
726 
727 #define OCF_SET_EVENT_MASK 0x0001
728 typedef struct {
729  uint8_t mask[8];
730 } __attribute__ ((packed)) set_event_mask_cp;
731 #define SET_EVENT_MASK_CP_SIZE 8
732 
733 #define OCF_RESET 0x0003
734 
735 #define OCF_SET_EVENT_FLT 0x0005
736 typedef struct {
737  uint8_t flt_type;
738  uint8_t cond_type;
739  uint8_t condition[0];
740 } __attribute__ ((packed)) set_event_flt_cp;
741 #define SET_EVENT_FLT_CP_SIZE 2
742 
743 /* Filter types */
744 #define FLT_CLEAR_ALL 0x00
745 #define FLT_INQ_RESULT 0x01
746 #define FLT_CONN_SETUP 0x02
747 /* INQ_RESULT Condition types */
748 #define INQ_RESULT_RETURN_ALL 0x00
749 #define INQ_RESULT_RETURN_CLASS 0x01
750 #define INQ_RESULT_RETURN_BDADDR 0x02
751 /* CONN_SETUP Condition types */
752 #define CONN_SETUP_ALLOW_ALL 0x00
753 #define CONN_SETUP_ALLOW_CLASS 0x01
754 #define CONN_SETUP_ALLOW_BDADDR 0x02
755 /* CONN_SETUP Conditions */
756 #define CONN_SETUP_AUTO_OFF 0x01
757 #define CONN_SETUP_AUTO_ON 0x02
758 
759 #define OCF_FLUSH 0x0008
760 
761 #define OCF_READ_PIN_TYPE 0x0009
762 typedef struct {
763  uint8_t status;
764  uint8_t pin_type;
765 } __attribute__ ((packed)) read_pin_type_rp;
766 #define READ_PIN_TYPE_RP_SIZE 2
767 
768 #define OCF_WRITE_PIN_TYPE 0x000A
769 typedef struct {
770  uint8_t pin_type;
771 } __attribute__ ((packed)) write_pin_type_cp;
772 #define WRITE_PIN_TYPE_CP_SIZE 1
773 
774 #define OCF_CREATE_NEW_UNIT_KEY 0x000B
775 
776 #define OCF_READ_STORED_LINK_KEY 0x000D
777 typedef struct {
778  bdaddr_t bdaddr;
779  uint8_t read_all;
780 } __attribute__ ((packed)) read_stored_link_key_cp;
781 #define READ_STORED_LINK_KEY_CP_SIZE 7
782 typedef struct {
783  uint8_t status;
784  uint16_t max_keys;
785  uint16_t num_keys;
786 } __attribute__ ((packed)) read_stored_link_key_rp;
787 #define READ_STORED_LINK_KEY_RP_SIZE 5
788 
789 #define OCF_WRITE_STORED_LINK_KEY 0x0011
790 typedef struct {
791  uint8_t num_keys;
792  /* variable length part */
793 } __attribute__ ((packed)) write_stored_link_key_cp;
794 #define WRITE_STORED_LINK_KEY_CP_SIZE 1
795 typedef struct {
796  uint8_t status;
797  uint8_t num_keys;
798 } __attribute__ ((packed)) write_stored_link_key_rp;
799 #define READ_WRITE_LINK_KEY_RP_SIZE 2
800 
801 #define OCF_DELETE_STORED_LINK_KEY 0x0012
802 typedef struct {
803  bdaddr_t bdaddr;
804  uint8_t delete_all;
805 } __attribute__ ((packed)) delete_stored_link_key_cp;
806 #define DELETE_STORED_LINK_KEY_CP_SIZE 7
807 typedef struct {
808  uint8_t status;
809  uint16_t num_keys;
810 } __attribute__ ((packed)) delete_stored_link_key_rp;
811 #define DELETE_STORED_LINK_KEY_RP_SIZE 3
812 
813 #define HCI_MAX_NAME_LENGTH 248
814 
815 #define OCF_CHANGE_LOCAL_NAME 0x0013
816 typedef struct {
817  uint8_t name[HCI_MAX_NAME_LENGTH];
818 } __attribute__ ((packed)) change_local_name_cp;
819 #define CHANGE_LOCAL_NAME_CP_SIZE 248
820 
821 #define OCF_READ_LOCAL_NAME 0x0014
822 typedef struct {
823  uint8_t status;
824  uint8_t name[HCI_MAX_NAME_LENGTH];
825 } __attribute__ ((packed)) read_local_name_rp;
826 #define READ_LOCAL_NAME_RP_SIZE 249
827 
828 #define OCF_READ_CONN_ACCEPT_TIMEOUT 0x0015
829 typedef struct {
830  uint8_t status;
831  uint16_t timeout;
832 } __attribute__ ((packed)) read_conn_accept_timeout_rp;
833 #define READ_CONN_ACCEPT_TIMEOUT_RP_SIZE 3
834 
835 #define OCF_WRITE_CONN_ACCEPT_TIMEOUT 0x0016
836 typedef struct {
837  uint16_t timeout;
838 } __attribute__ ((packed)) write_conn_accept_timeout_cp;
839 #define WRITE_CONN_ACCEPT_TIMEOUT_CP_SIZE 2
840 
841 #define OCF_READ_PAGE_TIMEOUT 0x0017
842 typedef struct {
843  uint8_t status;
844  uint16_t timeout;
845 } __attribute__ ((packed)) read_page_timeout_rp;
846 #define READ_PAGE_TIMEOUT_RP_SIZE 3
847 
848 #define OCF_WRITE_PAGE_TIMEOUT 0x0018
849 typedef struct {
850  uint16_t timeout;
851 } __attribute__ ((packed)) write_page_timeout_cp;
852 #define WRITE_PAGE_TIMEOUT_CP_SIZE 2
853 
854 #define OCF_READ_SCAN_ENABLE 0x0019
855 typedef struct {
856  uint8_t status;
857  uint8_t enable;
858 } __attribute__ ((packed)) read_scan_enable_rp;
859 #define READ_SCAN_ENABLE_RP_SIZE 2
860 
861 #define OCF_WRITE_SCAN_ENABLE 0x001A
862  #define SCAN_DISABLED 0x00
863  #define SCAN_INQUIRY 0x01
864  #define SCAN_PAGE 0x02
865 
866 #define OCF_READ_PAGE_ACTIVITY 0x001B
867 typedef struct {
868  uint8_t status;
869  uint16_t interval;
870  uint16_t window;
871 } __attribute__ ((packed)) read_page_activity_rp;
872 #define READ_PAGE_ACTIVITY_RP_SIZE 5
873 
874 #define OCF_WRITE_PAGE_ACTIVITY 0x001C
875 typedef struct {
876  uint16_t interval;
877  uint16_t window;
878 } __attribute__ ((packed)) write_page_activity_cp;
879 #define WRITE_PAGE_ACTIVITY_CP_SIZE 4
880 
881 #define OCF_READ_INQ_ACTIVITY 0x001D
882 typedef struct {
883  uint8_t status;
884  uint16_t interval;
885  uint16_t window;
886 } __attribute__ ((packed)) read_inq_activity_rp;
887 #define READ_INQ_ACTIVITY_RP_SIZE 5
888 
889 #define OCF_WRITE_INQ_ACTIVITY 0x001E
890 typedef struct {
891  uint16_t interval;
892  uint16_t window;
893 } __attribute__ ((packed)) write_inq_activity_cp;
894 #define WRITE_INQ_ACTIVITY_CP_SIZE 4
895 
896 #define OCF_READ_AUTH_ENABLE 0x001F
897 
898 #define OCF_WRITE_AUTH_ENABLE 0x0020
899  #define AUTH_DISABLED 0x00
900  #define AUTH_ENABLED 0x01
901 
902 #define OCF_READ_ENCRYPT_MODE 0x0021
903 
904 #define OCF_WRITE_ENCRYPT_MODE 0x0022
905  #define ENCRYPT_DISABLED 0x00
906  #define ENCRYPT_P2P 0x01
907  #define ENCRYPT_BOTH 0x02
908 
909 #define OCF_READ_CLASS_OF_DEV 0x0023
910 typedef struct {
911  uint8_t status;
912  uint8_t dev_class[3];
913 } __attribute__ ((packed)) read_class_of_dev_rp;
914 #define READ_CLASS_OF_DEV_RP_SIZE 4
915 
916 #define OCF_WRITE_CLASS_OF_DEV 0x0024
917 typedef struct {
918  uint8_t dev_class[3];
919 } __attribute__ ((packed)) write_class_of_dev_cp;
920 #define WRITE_CLASS_OF_DEV_CP_SIZE 3
921 
922 #define OCF_READ_VOICE_SETTING 0x0025
923 typedef struct {
924  uint8_t status;
925  uint16_t voice_setting;
926 } __attribute__ ((packed)) read_voice_setting_rp;
927 #define READ_VOICE_SETTING_RP_SIZE 3
928 
929 #define OCF_WRITE_VOICE_SETTING 0x0026
930 typedef struct {
931  uint16_t voice_setting;
932 } __attribute__ ((packed)) write_voice_setting_cp;
933 #define WRITE_VOICE_SETTING_CP_SIZE 2
934 
935 #define OCF_READ_AUTOMATIC_FLUSH_TIMEOUT 0x0027
936 
937 #define OCF_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0028
938 
939 #define OCF_READ_NUM_BROADCAST_RETRANS 0x0029
940 
941 #define OCF_WRITE_NUM_BROADCAST_RETRANS 0x002A
942 
943 #define OCF_READ_HOLD_MODE_ACTIVITY 0x002B
944 
945 #define OCF_WRITE_HOLD_MODE_ACTIVITY 0x002C
946 
947 #define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D
948 typedef struct {
949  uint16_t handle;
950  uint8_t type;
951 } __attribute__ ((packed)) read_transmit_power_level_cp;
952 #define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3
953 typedef struct {
954  uint8_t status;
955  uint16_t handle;
956  int8_t level;
957 } __attribute__ ((packed)) read_transmit_power_level_rp;
958 #define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4
959 
960 #define OCF_READ_SYNC_FLOW_ENABLE 0x002E
961 
962 #define OCF_WRITE_SYNC_FLOW_ENABLE 0x002F
963 
964 #define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031
965 
966 #define OCF_HOST_BUFFER_SIZE 0x0033
967 typedef struct {
968  uint16_t acl_mtu;
969  uint8_t sco_mtu;
970  uint16_t acl_max_pkt;
971  uint16_t sco_max_pkt;
972 } __attribute__ ((packed)) host_buffer_size_cp;
973 #define HOST_BUFFER_SIZE_CP_SIZE 7
974 
975 #define OCF_HOST_NUM_COMP_PKTS 0x0035
976 typedef struct {
977  uint8_t num_hndl;
978  /* variable length part */
979 } __attribute__ ((packed)) host_num_comp_pkts_cp;
980 #define HOST_NUM_COMP_PKTS_CP_SIZE 1
981 
982 #define OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
983 typedef struct {
984  uint8_t status;
985  uint16_t handle;
986  uint16_t timeout;
987 } __attribute__ ((packed)) read_link_supervision_timeout_rp;
988 #define READ_LINK_SUPERVISION_TIMEOUT_RP_SIZE 5
989 
990 #define OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
991 typedef struct {
992  uint16_t handle;
993  uint16_t timeout;
994 } __attribute__ ((packed)) write_link_supervision_timeout_cp;
995 #define WRITE_LINK_SUPERVISION_TIMEOUT_CP_SIZE 4
996 typedef struct {
997  uint8_t status;
998  uint16_t handle;
999 } __attribute__ ((packed)) write_link_supervision_timeout_rp;
1000 #define WRITE_LINK_SUPERVISION_TIMEOUT_RP_SIZE 3
1001 
1002 #define OCF_READ_NUM_SUPPORTED_IAC 0x0038
1003 
1004 #define MAX_IAC_LAP 0x40
1005 #define OCF_READ_CURRENT_IAC_LAP 0x0039
1006 typedef struct {
1007  uint8_t status;
1009  uint8_t lap[MAX_IAC_LAP][3];
1010 } __attribute__ ((packed)) read_current_iac_lap_rp;
1011 #define READ_CURRENT_IAC_LAP_RP_SIZE 2+3*MAX_IAC_LAP
1012 
1013 #define OCF_WRITE_CURRENT_IAC_LAP 0x003A
1014 typedef struct {
1015  uint8_t num_current_iac;
1016  uint8_t lap[MAX_IAC_LAP][3];
1017 } __attribute__ ((packed)) write_current_iac_lap_cp;
1018 #define WRITE_CURRENT_IAC_LAP_CP_SIZE 1+3*MAX_IAC_LAP
1019 
1020 #define OCF_READ_PAGE_SCAN_PERIOD_MODE 0x003B
1021 
1022 #define OCF_WRITE_PAGE_SCAN_PERIOD_MODE 0x003C
1023 
1024 #define OCF_READ_PAGE_SCAN_MODE 0x003D
1025 
1026 #define OCF_WRITE_PAGE_SCAN_MODE 0x003E
1027 
1028 #define OCF_SET_AFH_CLASSIFICATION 0x003F
1029 typedef struct {
1030  uint8_t map[10];
1031 } __attribute__ ((packed)) set_afh_classification_cp;
1032 #define SET_AFH_CLASSIFICATION_CP_SIZE 10
1033 typedef struct {
1034  uint8_t status;
1035 } __attribute__ ((packed)) set_afh_classification_rp;
1036 #define SET_AFH_CLASSIFICATION_RP_SIZE 1
1037 
1038 #define OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1039 typedef struct {
1040  uint8_t status;
1041  uint8_t type;
1042 } __attribute__ ((packed)) read_inquiry_scan_type_rp;
1043 #define READ_INQUIRY_SCAN_TYPE_RP_SIZE 2
1044 
1045 #define OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1046 typedef struct {
1047  uint8_t type;
1048 } __attribute__ ((packed)) write_inquiry_scan_type_cp;
1049 #define WRITE_INQUIRY_SCAN_TYPE_CP_SIZE 1
1050 typedef struct {
1051  uint8_t status;
1052 } __attribute__ ((packed)) write_inquiry_scan_type_rp;
1053 #define WRITE_INQUIRY_SCAN_TYPE_RP_SIZE 1
1054 
1055 #define OCF_READ_INQUIRY_MODE 0x0044
1056 typedef struct {
1057  uint8_t status;
1058  uint8_t mode;
1059 } __attribute__ ((packed)) read_inquiry_mode_rp;
1060 #define READ_INQUIRY_MODE_RP_SIZE 2
1061 
1062 #define OCF_WRITE_INQUIRY_MODE 0x0045
1063 typedef struct {
1064  uint8_t mode;
1065 } __attribute__ ((packed)) write_inquiry_mode_cp;
1066 #define WRITE_INQUIRY_MODE_CP_SIZE 1
1067 typedef struct {
1068  uint8_t status;
1069 } __attribute__ ((packed)) write_inquiry_mode_rp;
1070 #define WRITE_INQUIRY_MODE_RP_SIZE 1
1071 
1072 #define OCF_READ_PAGE_SCAN_TYPE 0x0046
1073 
1074 #define OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1075  #define PAGE_SCAN_TYPE_STANDARD 0x00
1076  #define PAGE_SCAN_TYPE_INTERLACED 0x01
1077 
1078 #define OCF_READ_AFH_MODE 0x0048
1079 typedef struct {
1080  uint8_t status;
1081  uint8_t mode;
1082 } __attribute__ ((packed)) read_afh_mode_rp;
1083 #define READ_AFH_MODE_RP_SIZE 2
1084 
1085 #define OCF_WRITE_AFH_MODE 0x0049
1086 typedef struct {
1087  uint8_t mode;
1088 } __attribute__ ((packed)) write_afh_mode_cp;
1089 #define WRITE_AFH_MODE_CP_SIZE 1
1090 typedef struct {
1091  uint8_t status;
1092 } __attribute__ ((packed)) write_afh_mode_rp;
1093 #define WRITE_AFH_MODE_RP_SIZE 1
1094 
1095 #define HCI_MAX_EIR_LENGTH 240
1096 
1097 #define OCF_READ_EXT_INQUIRY_RESPONSE 0x0051
1098 typedef struct {
1099  uint8_t status;
1100  uint8_t fec;
1101  uint8_t data[HCI_MAX_EIR_LENGTH];
1102 } __attribute__ ((packed)) read_ext_inquiry_response_rp;
1103 #define READ_EXT_INQUIRY_RESPONSE_RP_SIZE 242
1104 
1105 #define OCF_WRITE_EXT_INQUIRY_RESPONSE 0x0052
1106 typedef struct {
1107  uint8_t fec;
1108  uint8_t data[HCI_MAX_EIR_LENGTH];
1109 } __attribute__ ((packed)) write_ext_inquiry_response_cp;
1110 #define WRITE_EXT_INQUIRY_RESPONSE_CP_SIZE 241
1111 typedef struct {
1112  uint8_t status;
1113 } __attribute__ ((packed)) write_ext_inquiry_response_rp;
1114 #define WRITE_EXT_INQUIRY_RESPONSE_RP_SIZE 1
1115 
1116 #define OCF_REFRESH_ENCRYPTION_KEY 0x0053
1117 typedef struct {
1118  uint16_t handle;
1119 } __attribute__ ((packed)) refresh_encryption_key_cp;
1120 #define REFRESH_ENCRYPTION_KEY_CP_SIZE 2
1121 typedef struct {
1122  uint8_t status;
1123 } __attribute__ ((packed)) refresh_encryption_key_rp;
1124 #define REFRESH_ENCRYPTION_KEY_RP_SIZE 1
1125 
1126 #define OCF_READ_SIMPLE_PAIRING_MODE 0x0055
1127 typedef struct {
1128  uint8_t status;
1129  uint8_t mode;
1130 } __attribute__ ((packed)) read_simple_pairing_mode_rp;
1131 #define READ_SIMPLE_PAIRING_MODE_RP_SIZE 2
1132 
1133 #define OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056
1134 typedef struct {
1135  uint8_t mode;
1136 } __attribute__ ((packed)) write_simple_pairing_mode_cp;
1137 #define WRITE_SIMPLE_PAIRING_MODE_CP_SIZE 1
1138 typedef struct {
1139  uint8_t status;
1140 } __attribute__ ((packed)) write_simple_pairing_mode_rp;
1141 #define WRITE_SIMPLE_PAIRING_MODE_RP_SIZE 1
1142 
1143 #define OCF_READ_LOCAL_OOB_DATA 0x0057
1144 typedef struct {
1145  uint8_t status;
1146  uint8_t hash[16];
1147  uint8_t randomizer[16];
1148 } __attribute__ ((packed)) read_local_oob_data_rp;
1149 #define READ_LOCAL_OOB_DATA_RP_SIZE 33
1150 
1151 #define OCF_READ_INQ_RESPONSE_TX_POWER_LEVEL 0x0058
1152 typedef struct {
1153  uint8_t status;
1154  int8_t level;
1155 } __attribute__ ((packed)) read_inq_response_tx_power_level_rp;
1156 #define READ_INQ_RESPONSE_TX_POWER_LEVEL_RP_SIZE 2
1157 
1158 #define OCF_READ_INQUIRY_TRANSMIT_POWER_LEVEL 0x0058
1159 typedef struct {
1160  uint8_t status;
1161  int8_t level;
1162 } __attribute__ ((packed)) read_inquiry_transmit_power_level_rp;
1163 #define READ_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 2
1164 
1165 #define OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL 0x0059
1166 typedef struct {
1167  int8_t level;
1168 } __attribute__ ((packed)) write_inquiry_transmit_power_level_cp;
1169 #define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_CP_SIZE 1
1170 typedef struct {
1171  uint8_t status;
1172 } __attribute__ ((packed)) write_inquiry_transmit_power_level_rp;
1173 #define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 1
1174 
1175 #define OCF_READ_DEFAULT_ERROR_DATA_REPORTING 0x005A
1176 typedef struct {
1177  uint8_t status;
1178  uint8_t reporting;
1179 } __attribute__ ((packed)) read_default_error_data_reporting_rp;
1180 #define READ_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 2
1181 
1182 #define OCF_WRITE_DEFAULT_ERROR_DATA_REPORTING 0x005B
1183 typedef struct {
1184  uint8_t reporting;
1185 } __attribute__ ((packed)) write_default_error_data_reporting_cp;
1186 #define WRITE_DEFAULT_ERROR_DATA_REPORTING_CP_SIZE 1
1187 typedef struct {
1188  uint8_t status;
1189 } __attribute__ ((packed)) write_default_error_data_reporting_rp;
1190 #define WRITE_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 1
1191 
1192 #define OCF_ENHANCED_FLUSH 0x005F
1193 typedef struct {
1194  uint16_t handle;
1195  uint8_t type;
1196 } __attribute__ ((packed)) enhanced_flush_cp;
1197 #define ENHANCED_FLUSH_CP_SIZE 3
1198 
1199 #define OCF_SEND_KEYPRESS_NOTIFY 0x0060
1200 typedef struct {
1201  bdaddr_t bdaddr;
1202  uint8_t type;
1203 } __attribute__ ((packed)) send_keypress_notify_cp;
1204 #define SEND_KEYPRESS_NOTIFY_CP_SIZE 7
1205 typedef struct {
1206  uint8_t status;
1207 } __attribute__ ((packed)) send_keypress_notify_rp;
1208 #define SEND_KEYPRESS_NOTIFY_RP_SIZE 1
1209 
1210 #define OCF_READ_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0061
1211 typedef struct {
1212  uint8_t status;
1213  uint16_t timeout;
1214 } __attribute__ ((packed)) read_log_link_accept_timeout_rp;
1215 #define READ_LOGICAL_LINK_ACCEPT_TIMEOUT_RP_SIZE 3
1216 
1217 #define OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0062
1218 typedef struct {
1219  uint16_t timeout;
1220 } __attribute__ ((packed)) write_log_link_accept_timeout_cp;
1221 #define WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CP_SIZE 2
1222 
1223 #define OCF_SET_EVENT_MASK_PAGE_2 0x0063
1224 
1225 #define OCF_READ_LOCATION_DATA 0x0064
1226 
1227 #define OCF_WRITE_LOCATION_DATA 0x0065
1228 
1229 #define OCF_READ_FLOW_CONTROL_MODE 0x0066
1230 
1231 #define OCF_WRITE_FLOW_CONTROL_MODE 0x0067
1232 
1233 #define OCF_READ_ENHANCED_TRANSMIT_POWER_LEVEL 0x0068
1234 typedef struct {
1235  uint8_t status;
1236  uint16_t handle;
1237  int8_t level_gfsk;
1238  int8_t level_dqpsk;
1239  int8_t level_8dpsk;
1240 } __attribute__ ((packed)) read_enhanced_transmit_power_level_rp;
1241 #define READ_ENHANCED_TRANSMIT_POWER_LEVEL_RP_SIZE 6
1242 
1243 #define OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT 0x0069
1244 typedef struct {
1245  uint8_t status;
1246  uint32_t timeout;
1247 } __attribute__ ((packed)) read_best_effort_flush_timeout_rp;
1248 #define READ_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 5
1249 
1250 #define OCF_WRITE_BEST_EFFORT_FLUSH_TIMEOUT 0x006A
1251 typedef struct {
1252  uint16_t handle;
1253  uint32_t timeout;
1254 } __attribute__ ((packed)) write_best_effort_flush_timeout_cp;
1255 #define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CP_SIZE 6
1256 typedef struct {
1257  uint8_t status;
1258 } __attribute__ ((packed)) write_best_effort_flush_timeout_rp;
1259 #define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 1
1260 
1261 #define OCF_READ_LE_HOST_SUPPORTED 0x006C
1262 typedef struct {
1263  uint8_t status;
1264  uint8_t le;
1265  uint8_t simul;
1266 } __attribute__ ((packed)) read_le_host_supported_rp;
1267 #define READ_LE_HOST_SUPPORTED_RP_SIZE 3
1268 
1269 #define OCF_WRITE_LE_HOST_SUPPORTED 0x006D
1270 typedef struct {
1271  uint8_t le;
1272  uint8_t simul;
1273 } __attribute__ ((packed)) write_le_host_supported_cp;
1274 #define WRITE_LE_HOST_SUPPORTED_CP_SIZE 2
1275 
1276 /* Informational Parameters */
1277 #define OGF_INFO_PARAM 0x04
1278 
1279 #define OCF_READ_LOCAL_VERSION 0x0001
1280 typedef struct {
1281  uint8_t status;
1282  uint8_t hci_ver;
1283  uint16_t hci_rev;
1284  uint8_t lmp_ver;
1285  uint16_t manufacturer;
1286  uint16_t lmp_subver;
1287 } __attribute__ ((packed)) read_local_version_rp;
1288 #define READ_LOCAL_VERSION_RP_SIZE 9
1289 
1290 #define OCF_READ_LOCAL_COMMANDS 0x0002
1291 typedef struct {
1292  uint8_t status;
1293  uint8_t commands[64];
1294 } __attribute__ ((packed)) read_local_commands_rp;
1295 #define READ_LOCAL_COMMANDS_RP_SIZE 65
1296 
1297 #define OCF_READ_LOCAL_FEATURES 0x0003
1298 typedef struct {
1299  uint8_t status;
1300  uint8_t features[8];
1301 } __attribute__ ((packed)) read_local_features_rp;
1302 #define READ_LOCAL_FEATURES_RP_SIZE 9
1303 
1304 #define OCF_READ_LOCAL_EXT_FEATURES 0x0004
1305 typedef struct {
1306  uint8_t page_num;
1307 } __attribute__ ((packed)) read_local_ext_features_cp;
1308 #define READ_LOCAL_EXT_FEATURES_CP_SIZE 1
1309 typedef struct {
1310  uint8_t status;
1311  uint8_t page_num;
1312  uint8_t max_page_num;
1313  uint8_t features[8];
1314 } __attribute__ ((packed)) read_local_ext_features_rp;
1315 #define READ_LOCAL_EXT_FEATURES_RP_SIZE 11
1316 
1317 #define OCF_READ_BUFFER_SIZE 0x0005
1318 typedef struct {
1319  uint8_t status;
1320  uint16_t acl_mtu;
1321  uint8_t sco_mtu;
1322  uint16_t acl_max_pkt;
1323  uint16_t sco_max_pkt;
1324 } __attribute__ ((packed)) read_buffer_size_rp;
1325 #define READ_BUFFER_SIZE_RP_SIZE 8
1326 
1327 #define OCF_READ_COUNTRY_CODE 0x0007
1328 
1329 #define OCF_READ_BD_ADDR 0x0009
1330 typedef struct {
1331  uint8_t status;
1332  bdaddr_t bdaddr;
1333 } __attribute__ ((packed)) read_bd_addr_rp;
1334 #define READ_BD_ADDR_RP_SIZE 7
1335 
1336 #define OCF_READ_DATA_BLOCK_SIZE 0x000A
1337 typedef struct {
1338  uint8_t status;
1339  uint16_t max_acl_len;
1340  uint16_t data_block_len;
1341  uint16_t num_blocks;
1342 } __attribute__ ((packed)) read_data_block_size_rp;
1343 
1344 /* Status params */
1345 #define OGF_STATUS_PARAM 0x05
1346 
1347 #define OCF_READ_FAILED_CONTACT_COUNTER 0x0001
1348 typedef struct {
1349  uint8_t status;
1350  uint16_t handle;
1351  uint8_t counter;
1352 } __attribute__ ((packed)) read_failed_contact_counter_rp;
1353 #define READ_FAILED_CONTACT_COUNTER_RP_SIZE 4
1354 
1355 #define OCF_RESET_FAILED_CONTACT_COUNTER 0x0002
1356 typedef struct {
1357  uint8_t status;
1358  uint16_t handle;
1359 } __attribute__ ((packed)) reset_failed_contact_counter_rp;
1360 #define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 3
1361 
1362 #define OCF_READ_LINK_QUALITY 0x0003
1363 typedef struct {
1364  uint8_t status;
1365  uint16_t handle;
1366  uint8_t link_quality;
1367 } __attribute__ ((packed)) read_link_quality_rp;
1368 #define READ_LINK_QUALITY_RP_SIZE 4
1369 
1370 #define OCF_READ_RSSI 0x0005
1371 typedef struct {
1372  uint8_t status;
1373  uint16_t handle;
1374  int8_t rssi;
1375 } __attribute__ ((packed)) read_rssi_rp;
1376 #define READ_RSSI_RP_SIZE 4
1377 
1378 #define OCF_READ_AFH_MAP 0x0006
1379 typedef struct {
1380  uint8_t status;
1381  uint16_t handle;
1382  uint8_t mode;
1383  uint8_t map[10];
1384 } __attribute__ ((packed)) read_afh_map_rp;
1385 #define READ_AFH_MAP_RP_SIZE 14
1386 
1387 #define OCF_READ_CLOCK 0x0007
1388 typedef struct {
1389  uint16_t handle;
1390  uint8_t which_clock;
1391 } __attribute__ ((packed)) read_clock_cp;
1392 #define READ_CLOCK_CP_SIZE 3
1393 typedef struct {
1394  uint8_t status;
1395  uint16_t handle;
1396  uint32_t clock;
1397  uint16_t accuracy;
1398 } __attribute__ ((packed)) read_clock_rp;
1399 #define READ_CLOCK_RP_SIZE 9
1400 
1401 #define OCF_READ_LOCAL_AMP_INFO 0x0009
1402 typedef struct {
1403  uint8_t status;
1404  uint8_t amp_status;
1407  uint32_t min_latency;
1408  uint32_t max_pdu_size;
1410  uint16_t pal_caps;
1414 } __attribute__ ((packed)) read_local_amp_info_rp;
1415 #define READ_LOCAL_AMP_INFO_RP_SIZE 31
1416 
1417 #define OCF_READ_LOCAL_AMP_ASSOC 0x000A
1418 typedef struct {
1419  uint8_t handle;
1420  uint16_t length_so_far;
1421  uint16_t assoc_length;
1422 } __attribute__ ((packed)) read_local_amp_assoc_cp;
1423 #define READ_LOCAL_AMP_ASSOC_CP_SIZE 5
1424 typedef struct {
1425  uint8_t status;
1426  uint8_t handle;
1427  uint16_t length;
1428  uint8_t fragment[HCI_MAX_NAME_LENGTH];
1429 } __attribute__ ((packed)) read_local_amp_assoc_rp;
1430 #define READ_LOCAL_AMP_ASSOC_RP_SIZE 252
1431 
1432 #define OCF_WRITE_REMOTE_AMP_ASSOC 0x000B
1433 typedef struct {
1434  uint8_t handle;
1435  uint16_t length_so_far;
1437  uint8_t fragment[HCI_MAX_NAME_LENGTH];
1438 } __attribute__ ((packed)) write_remote_amp_assoc_cp;
1439 #define WRITE_REMOTE_AMP_ASSOC_CP_SIZE 253
1440 typedef struct {
1441  uint8_t status;
1442  uint8_t handle;
1443 } __attribute__ ((packed)) write_remote_amp_assoc_rp;
1444 #define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2
1445 
1446 /* Testing commands */
1447 #define OGF_TESTING_CMD 0x3e
1448 
1449 #define OCF_READ_LOOPBACK_MODE 0x0001
1450 
1451 #define OCF_WRITE_LOOPBACK_MODE 0x0002
1452 
1453 #define OCF_ENABLE_DEVICE_UNDER_TEST_MODE 0x0003
1454 
1455 #define OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004
1456 typedef struct {
1457  uint8_t mode;
1458 } __attribute__ ((packed)) write_simple_pairing_debug_mode_cp;
1459 #define WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE 1
1460 typedef struct {
1461  uint8_t status;
1462 } __attribute__ ((packed)) write_simple_pairing_debug_mode_rp;
1463 #define WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE 1
1464 
1465 /* LE commands */
1466 #define OGF_LE_CTL 0x08
1467 
1468 #define OCF_LE_SET_EVENT_MASK 0x0001
1469 typedef struct {
1470  uint8_t mask[8];
1471 } __attribute__ ((packed)) le_set_event_mask_cp;
1472 #define LE_SET_EVENT_MASK_CP_SIZE 8
1473 
1474 #define OCF_LE_READ_BUFFER_SIZE 0x0002
1475 typedef struct {
1476  uint8_t status;
1477  uint16_t pkt_len;
1478  uint8_t max_pkt;
1479 } __attribute__ ((packed)) le_read_buffer_size_rp;
1480 #define LE_READ_BUFFER_SIZE_RP_SIZE 4
1481 
1482 #define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003
1483 typedef struct {
1484  uint8_t status;
1485  uint8_t features[8];
1486 } __attribute__ ((packed)) le_read_local_supported_features_rp;
1487 #define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9
1488 
1489 #define OCF_LE_SET_RANDOM_ADDRESS 0x0005
1490 typedef struct {
1491  bdaddr_t bdaddr;
1492 } __attribute__ ((packed)) le_set_random_address_cp;
1493 #define LE_SET_RANDOM_ADDRESS_CP_SIZE 6
1494 
1495 #define OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006
1496 typedef struct {
1497  uint16_t min_interval;
1498  uint16_t max_interval;
1499  uint8_t advtype;
1502  bdaddr_t direct_bdaddr;
1503  uint8_t chan_map;
1504  uint8_t filter;
1505 } __attribute__ ((packed)) le_set_advertising_parameters_cp;
1506 #define LE_SET_ADVERTISING_PARAMETERS_CP_SIZE 15
1507 
1508 #define OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007
1509 typedef struct {
1510  uint8_t status;
1511  int8_t level;
1512 } __attribute__ ((packed)) le_read_advertising_channel_tx_power_rp;
1513 #define LE_READ_ADVERTISING_CHANNEL_TX_POWER_RP_SIZE 2
1514 
1515 #define OCF_LE_SET_ADVERTISING_DATA 0x0008
1516 typedef struct {
1517  uint8_t length;
1518  uint8_t data[31];
1519 } __attribute__ ((packed)) le_set_advertising_data_cp;
1520 #define LE_SET_ADVERTISING_DATA_CP_SIZE 32
1521 
1522 #define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009
1523 typedef struct {
1524  uint8_t length;
1525  uint8_t data[31];
1526 } __attribute__ ((packed)) le_set_scan_response_data_cp;
1527 #define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32
1528 
1529 #define OCF_LE_SET_ADVERTISE_ENABLE 0x000A
1530 typedef struct {
1531  uint8_t enable;
1532 } __attribute__ ((packed)) le_set_advertise_enable_cp;
1533 #define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1
1534 
1535 #define OCF_LE_SET_SCAN_PARAMETERS 0x000B
1536 typedef struct {
1537  uint8_t type;
1538  uint16_t interval;
1539  uint16_t window;
1540  uint8_t own_bdaddr_type;
1541  uint8_t filter;
1542 } __attribute__ ((packed)) le_set_scan_parameters_cp;
1543 #define LE_SET_SCAN_PARAMETERS_CP_SIZE 7
1544 
1545 #define OCF_LE_SET_SCAN_ENABLE 0x000C
1546 typedef struct {
1547  uint8_t enable;
1548  uint8_t filter_dup;
1549 } __attribute__ ((packed)) le_set_scan_enable_cp;
1550 #define LE_SET_SCAN_ENABLE_CP_SIZE 2
1551 
1552 #define OCF_LE_CREATE_CONN 0x000D
1553 typedef struct {
1554  uint16_t interval;
1555  uint16_t window;
1558  bdaddr_t peer_bdaddr;
1559  uint8_t own_bdaddr_type;
1560  uint16_t min_interval;
1561  uint16_t max_interval;
1562  uint16_t latency;
1564  uint16_t min_ce_length;
1565  uint16_t max_ce_length;
1566 } __attribute__ ((packed)) le_create_connection_cp;
1567 #define LE_CREATE_CONN_CP_SIZE 25
1568 
1569 #define OCF_LE_CREATE_CONN_CANCEL 0x000E
1570 
1571 #define OCF_LE_READ_WHITE_LIST_SIZE 0x000F
1572 typedef struct {
1573  uint8_t status;
1574  uint8_t size;
1575 } __attribute__ ((packed)) le_read_white_list_size_rp;
1576 #define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2
1577 
1578 #define OCF_LE_CLEAR_WHITE_LIST 0x0010
1579 
1580 #define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
1581 typedef struct {
1582  uint8_t bdaddr_type;
1583  bdaddr_t bdaddr;
1584 } __attribute__ ((packed)) le_add_device_to_white_list_cp;
1585 #define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7
1586 
1587 #define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012
1588 typedef struct {
1589  uint8_t bdaddr_type;
1590  bdaddr_t bdaddr;
1591 } __attribute__ ((packed)) le_remove_device_from_white_list_cp;
1592 #define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7
1593 
1594 #define OCF_LE_CONN_UPDATE 0x0013
1595 typedef struct {
1596  uint16_t handle;
1597  uint16_t min_interval;
1598  uint16_t max_interval;
1599  uint16_t latency;
1600  uint16_t supervision_timeout;
1601  uint16_t min_ce_length;
1602  uint16_t max_ce_length;
1603 } __attribute__ ((packed)) le_connection_update_cp;
1604 #define LE_CONN_UPDATE_CP_SIZE 14
1605 
1606 #define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014
1607 typedef struct {
1608  uint8_t map[5];
1609 } __attribute__ ((packed)) le_set_host_channel_classification_cp;
1610 #define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5
1611 
1612 #define OCF_LE_READ_CHANNEL_MAP 0x0015
1613 typedef struct {
1614  uint16_t handle;
1615 } __attribute__ ((packed)) le_read_channel_map_cp;
1616 #define LE_READ_CHANNEL_MAP_CP_SIZE 2
1617 typedef struct {
1618  uint8_t status;
1619  uint16_t handle;
1620  uint8_t map[5];
1621 } __attribute__ ((packed)) le_read_channel_map_rp;
1622 #define LE_READ_CHANNEL_MAP_RP_SIZE 8
1623 
1624 #define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016
1625 typedef struct {
1626  uint16_t handle;
1627 } __attribute__ ((packed)) le_read_remote_used_features_cp;
1628 #define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2
1629 
1630 #define OCF_LE_ENCRYPT 0x0017
1631 typedef struct {
1632  uint8_t key[16];
1633  uint8_t plaintext[16];
1634 } __attribute__ ((packed)) le_encrypt_cp;
1635 #define LE_ENCRYPT_CP_SIZE 32
1636 typedef struct {
1637  uint8_t status;
1638  uint8_t data[16];
1639 } __attribute__ ((packed)) le_encrypt_rp;
1640 #define LE_ENCRYPT_RP_SIZE 17
1641 
1642 #define OCF_LE_RAND 0x0018
1643 typedef struct {
1644  uint8_t status;
1645  uint64_t random;
1646 } __attribute__ ((packed)) le_rand_rp;
1647 #define LE_RAND_RP_SIZE 9
1648 
1649 #define OCF_LE_START_ENCRYPTION 0x0019
1650 typedef struct {
1651  uint16_t handle;
1652  uint64_t random;
1653  uint16_t diversifier;
1654  uint8_t key[16];
1655 } __attribute__ ((packed)) le_start_encryption_cp;
1656 #define LE_START_ENCRYPTION_CP_SIZE 28
1657 
1658 #define OCF_LE_LTK_REPLY 0x001A
1659 typedef struct {
1660  uint16_t handle;
1661  uint8_t key[16];
1662 } __attribute__ ((packed)) le_ltk_reply_cp;
1663 #define LE_LTK_REPLY_CP_SIZE 18
1664 typedef struct {
1665  uint8_t status;
1666  uint16_t handle;
1667 } __attribute__ ((packed)) le_ltk_reply_rp;
1668 #define LE_LTK_REPLY_RP_SIZE 3
1669 
1670 #define OCF_LE_LTK_NEG_REPLY 0x001B
1671 typedef struct {
1672  uint16_t handle;
1673 } __attribute__ ((packed)) le_ltk_neg_reply_cp;
1674 #define LE_LTK_NEG_REPLY_CP_SIZE 2
1675 typedef struct {
1676  uint8_t status;
1677  uint16_t handle;
1678 } __attribute__ ((packed)) le_ltk_neg_reply_rp;
1679 #define LE_LTK_NEG_REPLY_RP_SIZE 3
1680 
1681 #define OCF_LE_READ_SUPPORTED_STATES 0x001C
1682 typedef struct {
1683  uint8_t status;
1684  uint64_t states;
1685 } __attribute__ ((packed)) le_read_supported_states_rp;
1686 #define LE_READ_SUPPORTED_STATES_RP_SIZE 9
1687 
1688 #define OCF_LE_RECEIVER_TEST 0x001D
1689 typedef struct {
1690  uint8_t frequency;
1691 } __attribute__ ((packed)) le_receiver_test_cp;
1692 #define LE_RECEIVER_TEST_CP_SIZE 1
1693 
1694 #define OCF_LE_TRANSMITTER_TEST 0x001E
1695 typedef struct {
1696  uint8_t frequency;
1697  uint8_t length;
1698  uint8_t payload;
1699 } __attribute__ ((packed)) le_transmitter_test_cp;
1700 #define LE_TRANSMITTER_TEST_CP_SIZE 3
1701 
1702 #define OCF_LE_TEST_END 0x001F
1703 typedef struct {
1704  uint8_t status;
1705  uint16_t num_pkts;
1706 } __attribute__ ((packed)) le_test_end_rp;
1707 #define LE_TEST_END_RP_SIZE 3
1708 
1709 #define OCF_LE_ADD_DEVICE_TO_RESOLV_LIST 0x0027
1710 typedef struct {
1711  uint8_t bdaddr_type;
1712  bdaddr_t bdaddr;
1713  uint8_t peer_irk[16];
1714  uint8_t local_irk[16];
1715 } __attribute__ ((packed)) le_add_device_to_resolv_list_cp;
1716 #define LE_ADD_DEVICE_TO_RESOLV_LIST_CP_SIZE 39
1717 
1718 #define OCF_LE_REMOVE_DEVICE_FROM_RESOLV_LIST 0x0028
1719 typedef struct {
1720  uint8_t bdaddr_type;
1721  bdaddr_t bdaddr;
1722 } __attribute__ ((packed)) le_remove_device_from_resolv_list_cp;
1723 #define LE_REMOVE_DEVICE_FROM_RESOLV_LIST_CP_SIZE 7
1724 
1725 #define OCF_LE_CLEAR_RESOLV_LIST 0x0029
1726 
1727 #define OCF_LE_READ_RESOLV_LIST_SIZE 0x002A
1728 typedef struct {
1729  uint8_t status;
1730  uint8_t size;
1731 } __attribute__ ((packed)) le_read_resolv_list_size_rp;
1732 #define LE_READ_RESOLV_LIST_SIZE_RP_SIZE 2
1733 
1734 #define OCF_LE_SET_ADDRESS_RESOLUTION_ENABLE 0x002D
1735 typedef struct {
1736  uint8_t enable;
1737 } __attribute__ ((packed)) le_set_address_resolution_enable_cp;
1738 #define LE_SET_ADDRESS_RESOLUTION_ENABLE_CP_SIZE 1
1739 
1740 /* Vendor specific commands */
1741 #define OGF_VENDOR_CMD 0x3f
1742 
1743 /* ---- HCI Events ---- */
1744 
1745 #define EVT_INQUIRY_COMPLETE 0x01
1746 
1747 #define EVT_INQUIRY_RESULT 0x02
1748 typedef struct {
1749  bdaddr_t bdaddr;
1750  uint8_t pscan_rep_mode;
1752  uint8_t pscan_mode;
1753  uint8_t dev_class[3];
1754  uint16_t clock_offset;
1755 } __attribute__ ((packed)) inquiry_info;
1756 #define INQUIRY_INFO_SIZE 14
1757 
1758 #define EVT_CONN_COMPLETE 0x03
1759 typedef struct {
1760  uint8_t status;
1761  uint16_t handle;
1762  bdaddr_t bdaddr;
1763  uint8_t link_type;
1764  uint8_t encr_mode;
1765 } __attribute__ ((packed)) evt_conn_complete;
1766 #define EVT_CONN_COMPLETE_SIZE 11
1767 
1768 #define EVT_CONN_REQUEST 0x04
1769 typedef struct {
1770  bdaddr_t bdaddr;
1771  uint8_t dev_class[3];
1772  uint8_t link_type;
1773 } __attribute__ ((packed)) evt_conn_request;
1774 #define EVT_CONN_REQUEST_SIZE 10
1775 
1776 #define EVT_DISCONN_COMPLETE 0x05
1777 typedef struct {
1778  uint8_t status;
1779  uint16_t handle;
1780  uint8_t reason;
1781 } __attribute__ ((packed)) evt_disconn_complete;
1782 #define EVT_DISCONN_COMPLETE_SIZE 4
1783 
1784 #define EVT_AUTH_COMPLETE 0x06
1785 typedef struct {
1786  uint8_t status;
1787  uint16_t handle;
1788 } __attribute__ ((packed)) evt_auth_complete;
1789 #define EVT_AUTH_COMPLETE_SIZE 3
1790 
1791 #define EVT_REMOTE_NAME_REQ_COMPLETE 0x07
1792 typedef struct {
1793  uint8_t status;
1794  bdaddr_t bdaddr;
1795  uint8_t name[HCI_MAX_NAME_LENGTH];
1796 } __attribute__ ((packed)) evt_remote_name_req_complete;
1797 #define EVT_REMOTE_NAME_REQ_COMPLETE_SIZE 255
1798 
1799 #define EVT_ENCRYPT_CHANGE 0x08
1800 typedef struct {
1801  uint8_t status;
1802  uint16_t handle;
1803  uint8_t encrypt;
1804 } __attribute__ ((packed)) evt_encrypt_change;
1805 #define EVT_ENCRYPT_CHANGE_SIZE 4
1806 
1807 #define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
1808 typedef struct {
1809  uint8_t status;
1810  uint16_t handle;
1811 } __attribute__ ((packed)) evt_change_conn_link_key_complete;
1812 #define EVT_CHANGE_CONN_LINK_KEY_COMPLETE_SIZE 3
1813 
1814 #define EVT_MASTER_LINK_KEY_COMPLETE 0x0A
1815 typedef struct {
1816  uint8_t status;
1817  uint16_t handle;
1818  uint8_t key_flag;
1819 } __attribute__ ((packed)) evt_master_link_key_complete;
1820 #define EVT_MASTER_LINK_KEY_COMPLETE_SIZE 4
1821 
1822 #define EVT_READ_REMOTE_FEATURES_COMPLETE 0x0B
1823 typedef struct {
1824  uint8_t status;
1825  uint16_t handle;
1826  uint8_t features[8];
1827 } __attribute__ ((packed)) evt_read_remote_features_complete;
1828 #define EVT_READ_REMOTE_FEATURES_COMPLETE_SIZE 11
1829 
1830 #define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C
1831 typedef struct {
1832  uint8_t status;
1833  uint16_t handle;
1834  uint8_t lmp_ver;
1835  uint16_t manufacturer;
1836  uint16_t lmp_subver;
1837 } __attribute__ ((packed)) evt_read_remote_version_complete;
1838 #define EVT_READ_REMOTE_VERSION_COMPLETE_SIZE 8
1839 
1840 #define EVT_QOS_SETUP_COMPLETE 0x0D
1841 typedef struct {
1842  uint8_t status;
1843  uint16_t handle;
1844  uint8_t flags; /* Reserved */
1845  hci_qos qos;
1846 } __attribute__ ((packed)) evt_qos_setup_complete;
1847 #define EVT_QOS_SETUP_COMPLETE_SIZE (4 + HCI_QOS_CP_SIZE)
1848 
1849 #define EVT_CMD_COMPLETE 0x0E
1850 typedef struct {
1851  uint8_t ncmd;
1852  uint16_t opcode;
1853 } __attribute__ ((packed)) evt_cmd_complete;
1854 #define EVT_CMD_COMPLETE_SIZE 3
1855 
1856 #define EVT_CMD_STATUS 0x0F
1857 typedef struct {
1858  uint8_t status;
1859  uint8_t ncmd;
1860  uint16_t opcode;
1861 } __attribute__ ((packed)) evt_cmd_status;
1862 #define EVT_CMD_STATUS_SIZE 4
1863 
1864 #define EVT_HARDWARE_ERROR 0x10
1865 typedef struct {
1866  uint8_t code;
1867 } __attribute__ ((packed)) evt_hardware_error;
1868 #define EVT_HARDWARE_ERROR_SIZE 1
1869 
1870 #define EVT_FLUSH_OCCURRED 0x11
1871 typedef struct {
1872  uint16_t handle;
1873 } __attribute__ ((packed)) evt_flush_occured;
1874 #define EVT_FLUSH_OCCURRED_SIZE 2
1875 
1876 #define EVT_ROLE_CHANGE 0x12
1877 typedef struct {
1878  uint8_t status;
1879  bdaddr_t bdaddr;
1880  uint8_t role;
1881 } __attribute__ ((packed)) evt_role_change;
1882 #define EVT_ROLE_CHANGE_SIZE 8
1883 
1884 #define EVT_NUM_COMP_PKTS 0x13
1885 typedef struct {
1886  uint8_t num_hndl;
1887  /* variable length part */
1888 } __attribute__ ((packed)) evt_num_comp_pkts;
1889 #define EVT_NUM_COMP_PKTS_SIZE 1
1890 
1891 #define EVT_MODE_CHANGE 0x14
1892 typedef struct {
1893  uint8_t status;
1894  uint16_t handle;
1895  uint8_t mode;
1896  uint16_t interval;
1897 } __attribute__ ((packed)) evt_mode_change;
1898 #define EVT_MODE_CHANGE_SIZE 6
1899 
1900 #define EVT_RETURN_LINK_KEYS 0x15
1901 typedef struct {
1902  uint8_t num_keys;
1903  /* variable length part */
1904 } __attribute__ ((packed)) evt_return_link_keys;
1905 #define EVT_RETURN_LINK_KEYS_SIZE 1
1906 
1907 #define EVT_PIN_CODE_REQ 0x16
1908 typedef struct {
1909  bdaddr_t bdaddr;
1910 } __attribute__ ((packed)) evt_pin_code_req;
1911 #define EVT_PIN_CODE_REQ_SIZE 6
1912 
1913 #define EVT_LINK_KEY_REQ 0x17
1914 typedef struct {
1915  bdaddr_t bdaddr;
1916 } __attribute__ ((packed)) evt_link_key_req;
1917 #define EVT_LINK_KEY_REQ_SIZE 6
1918 
1919 #define EVT_LINK_KEY_NOTIFY 0x18
1920 typedef struct {
1921  bdaddr_t bdaddr;
1922  uint8_t link_key[16];
1923  uint8_t key_type;
1924 } __attribute__ ((packed)) evt_link_key_notify;
1925 #define EVT_LINK_KEY_NOTIFY_SIZE 23
1926 
1927 #define EVT_LOOPBACK_COMMAND 0x19
1928 
1929 #define EVT_DATA_BUFFER_OVERFLOW 0x1A
1930 typedef struct {
1931  uint8_t link_type;
1932 } __attribute__ ((packed)) evt_data_buffer_overflow;
1933 #define EVT_DATA_BUFFER_OVERFLOW_SIZE 1
1934 
1935 #define EVT_MAX_SLOTS_CHANGE 0x1B
1936 typedef struct {
1937  uint16_t handle;
1938  uint8_t max_slots;
1939 } __attribute__ ((packed)) evt_max_slots_change;
1940 #define EVT_MAX_SLOTS_CHANGE_SIZE 3
1941 
1942 #define EVT_READ_CLOCK_OFFSET_COMPLETE 0x1C
1943 typedef struct {
1944  uint8_t status;
1945  uint16_t handle;
1946  uint16_t clock_offset;
1947 } __attribute__ ((packed)) evt_read_clock_offset_complete;
1948 #define EVT_READ_CLOCK_OFFSET_COMPLETE_SIZE 5
1949 
1950 #define EVT_CONN_PTYPE_CHANGED 0x1D
1951 typedef struct {
1952  uint8_t status;
1953  uint16_t handle;
1954  uint16_t ptype;
1955 } __attribute__ ((packed)) evt_conn_ptype_changed;
1956 #define EVT_CONN_PTYPE_CHANGED_SIZE 5
1957 
1958 #define EVT_QOS_VIOLATION 0x1E
1959 typedef struct {
1960  uint16_t handle;
1961 } __attribute__ ((packed)) evt_qos_violation;
1962 #define EVT_QOS_VIOLATION_SIZE 2
1963 
1964 #define EVT_PSCAN_REP_MODE_CHANGE 0x20
1965 typedef struct {
1966  bdaddr_t bdaddr;
1967  uint8_t pscan_rep_mode;
1968 } __attribute__ ((packed)) evt_pscan_rep_mode_change;
1969 #define EVT_PSCAN_REP_MODE_CHANGE_SIZE 7
1970 
1971 #define EVT_FLOW_SPEC_COMPLETE 0x21
1972 typedef struct {
1973  uint8_t status;
1974  uint16_t handle;
1975  uint8_t flags;
1976  uint8_t direction;
1977  hci_qos qos;
1978 } __attribute__ ((packed)) evt_flow_spec_complete;
1979 #define EVT_FLOW_SPEC_COMPLETE_SIZE (5 + HCI_QOS_CP_SIZE)
1980 
1981 #define EVT_INQUIRY_RESULT_WITH_RSSI 0x22
1982 typedef struct {
1983  bdaddr_t bdaddr;
1984  uint8_t pscan_rep_mode;
1985  uint8_t pscan_period_mode;
1986  uint8_t dev_class[3];
1987  uint16_t clock_offset;
1988  int8_t rssi;
1989 } __attribute__ ((packed)) inquiry_info_with_rssi;
1990 #define INQUIRY_INFO_WITH_RSSI_SIZE 14
1991 typedef struct {
1992  bdaddr_t bdaddr;
1993  uint8_t pscan_rep_mode;
1994  uint8_t pscan_period_mode;
1995  uint8_t pscan_mode;
1996  uint8_t dev_class[3];
1997  uint16_t clock_offset;
1998  int8_t rssi;
1999 } __attribute__ ((packed)) inquiry_info_with_rssi_and_pscan_mode;
2000 #define INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE 15
2001 
2002 #define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE 0x23
2003 typedef struct {
2004  uint8_t status;
2005  uint16_t handle;
2006  uint8_t page_num;
2007  uint8_t max_page_num;
2008  uint8_t features[8];
2009 } __attribute__ ((packed)) evt_read_remote_ext_features_complete;
2010 #define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE_SIZE 13
2011 
2012 #define EVT_SYNC_CONN_COMPLETE 0x2C
2013 typedef struct {
2014  uint8_t status;
2015  uint16_t handle;
2016  bdaddr_t bdaddr;
2017  uint8_t link_type;
2020  uint16_t rx_pkt_len;
2021  uint16_t tx_pkt_len;
2022  uint8_t air_mode;
2023 } __attribute__ ((packed)) evt_sync_conn_complete;
2024 #define EVT_SYNC_CONN_COMPLETE_SIZE 17
2025 
2026 #define EVT_SYNC_CONN_CHANGED 0x2D
2027 typedef struct {
2028  uint8_t status;
2029  uint16_t handle;
2030  uint8_t trans_interval;
2031  uint8_t retrans_window;
2032  uint16_t rx_pkt_len;
2033  uint16_t tx_pkt_len;
2034 } __attribute__ ((packed)) evt_sync_conn_changed;
2035 #define EVT_SYNC_CONN_CHANGED_SIZE 9
2036 
2037 #define EVT_SNIFF_SUBRATING 0x2E
2038 typedef struct {
2039  uint8_t status;
2040  uint16_t handle;
2041  uint16_t max_tx_latency;
2042  uint16_t max_rx_latency;
2043  uint16_t min_remote_timeout;
2044  uint16_t min_local_timeout;
2045 } __attribute__ ((packed)) evt_sniff_subrating;
2046 #define EVT_SNIFF_SUBRATING_SIZE 11
2047 
2048 #define EVT_EXTENDED_INQUIRY_RESULT 0x2F
2049 typedef struct {
2050  bdaddr_t bdaddr;
2051  uint8_t pscan_rep_mode;
2052  uint8_t pscan_period_mode;
2053  uint8_t dev_class[3];
2054  uint16_t clock_offset;
2055  int8_t rssi;
2056  uint8_t data[HCI_MAX_EIR_LENGTH];
2057 } __attribute__ ((packed)) extended_inquiry_info;
2058 #define EXTENDED_INQUIRY_INFO_SIZE 254
2059 
2060 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
2061 typedef struct {
2062  uint8_t status;
2063  uint16_t handle;
2064 } __attribute__ ((packed)) evt_encryption_key_refresh_complete;
2065 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3
2066 
2067 #define EVT_IO_CAPABILITY_REQUEST 0x31
2068 typedef struct {
2069  bdaddr_t bdaddr;
2070 } __attribute__ ((packed)) evt_io_capability_request;
2071 #define EVT_IO_CAPABILITY_REQUEST_SIZE 6
2072 
2073 #define EVT_IO_CAPABILITY_RESPONSE 0x32
2074 typedef struct {
2075  bdaddr_t bdaddr;
2076  uint8_t capability;
2077  uint8_t oob_data;
2078  uint8_t authentication;
2079 } __attribute__ ((packed)) evt_io_capability_response;
2080 #define EVT_IO_CAPABILITY_RESPONSE_SIZE 9
2081 
2082 #define EVT_USER_CONFIRM_REQUEST 0x33
2083 typedef struct {
2084  bdaddr_t bdaddr;
2085  uint32_t passkey;
2086 } __attribute__ ((packed)) evt_user_confirm_request;
2087 #define EVT_USER_CONFIRM_REQUEST_SIZE 10
2088 
2089 #define EVT_USER_PASSKEY_REQUEST 0x34
2090 typedef struct {
2091  bdaddr_t bdaddr;
2092 } __attribute__ ((packed)) evt_user_passkey_request;
2093 #define EVT_USER_PASSKEY_REQUEST_SIZE 6
2094 
2095 #define EVT_REMOTE_OOB_DATA_REQUEST 0x35
2096 typedef struct {
2097  bdaddr_t bdaddr;
2098 } __attribute__ ((packed)) evt_remote_oob_data_request;
2099 #define EVT_REMOTE_OOB_DATA_REQUEST_SIZE 6
2100 
2101 #define EVT_SIMPLE_PAIRING_COMPLETE 0x36
2102 typedef struct {
2103  uint8_t status;
2104  bdaddr_t bdaddr;
2105 } __attribute__ ((packed)) evt_simple_pairing_complete;
2106 #define EVT_SIMPLE_PAIRING_COMPLETE_SIZE 7
2107 
2108 #define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
2109 typedef struct {
2110  uint16_t handle;
2111  uint16_t timeout;
2112 } __attribute__ ((packed)) evt_link_supervision_timeout_changed;
2113 #define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED_SIZE 4
2114 
2115 #define EVT_ENHANCED_FLUSH_COMPLETE 0x39
2116 typedef struct {
2117  uint16_t handle;
2118 } __attribute__ ((packed)) evt_enhanced_flush_complete;
2119 #define EVT_ENHANCED_FLUSH_COMPLETE_SIZE 2
2120 
2121 #define EVT_USER_PASSKEY_NOTIFY 0x3B
2122 typedef struct {
2123  bdaddr_t bdaddr;
2124  uint32_t passkey;
2125 } __attribute__ ((packed)) evt_user_passkey_notify;
2126 #define EVT_USER_PASSKEY_NOTIFY_SIZE 10
2127 
2128 #define EVT_KEYPRESS_NOTIFY 0x3C
2129 typedef struct {
2130  bdaddr_t bdaddr;
2131  uint8_t type;
2132 } __attribute__ ((packed)) evt_keypress_notify;
2133 #define EVT_KEYPRESS_NOTIFY_SIZE 7
2134 
2135 #define EVT_REMOTE_HOST_FEATURES_NOTIFY 0x3D
2136 typedef struct {
2137  bdaddr_t bdaddr;
2138  uint8_t features[8];
2139 } __attribute__ ((packed)) evt_remote_host_features_notify;
2140 #define EVT_REMOTE_HOST_FEATURES_NOTIFY_SIZE 14
2141 
2142 #define EVT_LE_META_EVENT 0x3E
2143 typedef struct {
2144  uint8_t subevent;
2145  uint8_t data[0];
2146 } __attribute__ ((packed)) evt_le_meta_event;
2147 #define EVT_LE_META_EVENT_SIZE 1
2148 
2149 #define EVT_LE_CONN_COMPLETE 0x01
2150 typedef struct {
2151  uint8_t status;
2152  uint16_t handle;
2153  uint8_t role;
2154  uint8_t peer_bdaddr_type;
2155  bdaddr_t peer_bdaddr;
2156  uint16_t interval;
2157  uint16_t latency;
2158  uint16_t supervision_timeout;
2160 } __attribute__ ((packed)) evt_le_connection_complete;
2161 #define EVT_LE_CONN_COMPLETE_SIZE 18
2162 
2163 #define EVT_LE_ADVERTISING_REPORT 0x02
2164 typedef struct {
2165  uint8_t evt_type;
2166  uint8_t bdaddr_type;
2167  bdaddr_t bdaddr;
2168  uint8_t length;
2169  uint8_t data[0];
2170 } __attribute__ ((packed)) le_advertising_info;
2171 #define LE_ADVERTISING_INFO_SIZE 9
2172 
2173 #define EVT_LE_CONN_UPDATE_COMPLETE 0x03
2174 typedef struct {
2175  uint8_t status;
2176  uint16_t handle;
2177  uint16_t interval;
2178  uint16_t latency;
2179  uint16_t supervision_timeout;
2180 } __attribute__ ((packed)) evt_le_connection_update_complete;
2181 #define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9
2182 
2183 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
2184 typedef struct {
2185  uint8_t status;
2186  uint16_t handle;
2187  uint8_t features[8];
2188 } __attribute__ ((packed)) evt_le_read_remote_used_features_complete;
2189 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11
2190 
2191 #define EVT_LE_LTK_REQUEST 0x05
2192 typedef struct {
2193  uint16_t handle;
2194  uint64_t random;
2195  uint16_t diversifier;
2196 } __attribute__ ((packed)) evt_le_long_term_key_request;
2197 #define EVT_LE_LTK_REQUEST_SIZE 12
2198 
2199 #define EVT_PHYSICAL_LINK_COMPLETE 0x40
2200 typedef struct {
2201  uint8_t status;
2202  uint8_t handle;
2203 } __attribute__ ((packed)) evt_physical_link_complete;
2204 #define EVT_PHYSICAL_LINK_COMPLETE_SIZE 2
2205 
2206 #define EVT_CHANNEL_SELECTED 0x41
2207 
2208 #define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE 0x42
2209 typedef struct {
2210  uint8_t status;
2211  uint8_t handle;
2212  uint8_t reason;
2213 } __attribute__ ((packed)) evt_disconn_physical_link_complete;
2214 #define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE_SIZE 3
2215 
2216 #define EVT_PHYSICAL_LINK_LOSS_EARLY_WARNING 0x43
2217 typedef struct {
2218  uint8_t handle;
2219  uint8_t reason;
2220 } __attribute__ ((packed)) evt_physical_link_loss_warning;
2221 #define EVT_PHYSICAL_LINK_LOSS_WARNING_SIZE 2
2222 
2223 #define EVT_PHYSICAL_LINK_RECOVERY 0x44
2224 typedef struct {
2225  uint8_t handle;
2226 } __attribute__ ((packed)) evt_physical_link_recovery;
2227 #define EVT_PHYSICAL_LINK_RECOVERY_SIZE 1
2228 
2229 #define EVT_LOGICAL_LINK_COMPLETE 0x45
2230 typedef struct {
2231  uint8_t status;
2232  uint16_t log_handle;
2233  uint8_t handle;
2234  uint8_t tx_flow_id;
2235 } __attribute__ ((packed)) evt_logical_link_complete;
2236 #define EVT_LOGICAL_LINK_COMPLETE_SIZE 5
2237 
2238 #define EVT_DISCONNECT_LOGICAL_LINK_COMPLETE 0x46
2239 
2240 #define EVT_FLOW_SPEC_MODIFY_COMPLETE 0x47
2241 typedef struct {
2242  uint8_t status;
2243  uint16_t handle;
2244 } __attribute__ ((packed)) evt_flow_spec_modify_complete;
2245 #define EVT_FLOW_SPEC_MODIFY_COMPLETE_SIZE 3
2246 
2247 #define EVT_NUMBER_COMPLETED_BLOCKS 0x48
2248 typedef struct {
2249  uint16_t handle;
2250  uint16_t num_cmplt_pkts;
2251  uint16_t num_cmplt_blks;
2252 } __attribute__ ((packed)) cmplt_handle;
2253 typedef struct {
2255  uint8_t num_handles;
2256  cmplt_handle handles[0];
2257 } __attribute__ ((packed)) evt_num_completed_blocks;
2258 
2259 #define EVT_AMP_STATUS_CHANGE 0x4D
2260 typedef struct {
2261  uint8_t status;
2262  uint8_t amp_status;
2263 } __attribute__ ((packed)) evt_amp_status_change;
2264 #define EVT_AMP_STATUS_CHANGE_SIZE 2
2265 
2266 #define EVT_TESTING 0xFE
2267 
2268 #define EVT_VENDOR 0xFF
2269 
2270 /* Internal events generated by BlueZ stack */
2271 #define EVT_STACK_INTERNAL 0xFD
2272 typedef struct {
2273  uint16_t type;
2274  uint8_t data[0];
2275 } __attribute__ ((packed)) evt_stack_internal;
2276 #define EVT_STACK_INTERNAL_SIZE 2
2277 
2278 #define EVT_SI_DEVICE 0x01
2279 typedef struct {
2280  uint16_t event;
2281  uint16_t dev_id;
2282 } __attribute__ ((packed)) evt_si_device;
2283 #define EVT_SI_DEVICE_SIZE 4
2284 
2285 /* -------- HCI Packet structures -------- */
2286 #define HCI_TYPE_LEN 1
2287 
2288 typedef struct {
2289  uint16_t opcode; /* OCF & OGF */
2290  uint8_t plen;
2291 } __attribute__ ((packed)) hci_command_hdr;
2292 #define HCI_COMMAND_HDR_SIZE 3
2293 
2294 typedef struct {
2295  uint8_t evt;
2296  uint8_t plen;
2297 } __attribute__ ((packed)) hci_event_hdr;
2298 #define HCI_EVENT_HDR_SIZE 2
2299 
2300 typedef struct {
2301  uint16_t handle; /* Handle & Flags(PB, BC) */
2302  uint16_t dlen;
2303 } __attribute__ ((packed)) hci_acl_hdr;
2304 #define HCI_ACL_HDR_SIZE 4
2305 
2306 typedef struct {
2307  uint16_t handle;
2308  uint8_t dlen;
2309 } __attribute__ ((packed)) hci_sco_hdr;
2310 #define HCI_SCO_HDR_SIZE 3
2311 
2312 typedef struct {
2313  uint16_t device;
2314  uint16_t type;
2315  uint16_t plen;
2316 } __attribute__ ((packed)) hci_msg_hdr;
2317 #define HCI_MSG_HDR_SIZE 6
2318 
2319 /* Command opcode pack/unpack */
2320 #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10))
2321 #define cmd_opcode_ogf(op) (op >> 10)
2322 #define cmd_opcode_ocf(op) (op & 0x03ff)
2323 
2324 /* ACL handle and flags pack/unpack */
2325 #define acl_handle_pack(h, f) (uint16_t)((h & 0x0fff)|(f << 12))
2326 #define acl_handle(h) (h & 0x0fff)
2327 #define acl_flags(h) (h >> 12)
2328 
2329 #endif /* _NO_HCI_DEFS */
2330 
2331 /* HCI Socket options */
2332 #define HCI_DATA_DIR 1
2333 #define HCI_FILTER 2
2334 #define HCI_TIME_STAMP 3
2335 
2336 /* HCI CMSG flags */
2337 #define HCI_CMSG_DIR 0x0001
2338 #define HCI_CMSG_TSTAMP 0x0002
2339 
2341  sa_family_t hci_family;
2342  unsigned short hci_dev;
2343  unsigned short hci_channel;
2344 };
2345 #define HCI_DEV_NONE 0xffff
2346 
2347 #define HCI_CHANNEL_RAW 0
2348 #define HCI_CHANNEL_USER 1
2349 #define HCI_CHANNEL_MONITOR 2
2350 #define HCI_CHANNEL_CONTROL 3
2351 
2352 struct hci_filter {
2353  uint32_t type_mask;
2354  uint32_t event_mask[2];
2355  uint16_t opcode;
2356 };
2357 
2358 #define HCI_FLT_TYPE_BITS 31
2359 #define HCI_FLT_EVENT_BITS 63
2360 #define HCI_FLT_OGF_BITS 63
2361 #define HCI_FLT_OCF_BITS 127
2362 
2363 /* Ioctl requests structures */
2365  uint32_t err_rx;
2366  uint32_t err_tx;
2367  uint32_t cmd_tx;
2368  uint32_t evt_rx;
2369  uint32_t acl_tx;
2370  uint32_t acl_rx;
2371  uint32_t sco_tx;
2372  uint32_t sco_rx;
2373  uint32_t byte_rx;
2374  uint32_t byte_tx;
2375 };
2376 
2378  uint16_t dev_id;
2379  char name[8];
2380 
2381  bdaddr_t bdaddr;
2382 
2383  uint32_t flags;
2384  uint8_t type;
2385 
2386  uint8_t features[8];
2387 
2388  uint32_t pkt_type;
2389  uint32_t link_policy;
2390  uint32_t link_mode;
2391 
2392  uint16_t acl_mtu;
2393  uint16_t acl_pkts;
2394  uint16_t sco_mtu;
2395  uint16_t sco_pkts;
2396 
2398 };
2399 
2401  uint16_t handle;
2402  bdaddr_t bdaddr;
2403  uint8_t type;
2404  uint8_t out;
2405  uint16_t state;
2406  uint32_t link_mode;
2407 };
2408 
2409 struct hci_dev_req {
2410  uint16_t dev_id;
2411  uint32_t dev_opt;
2412 };
2413 
2415  uint16_t dev_num;
2416  struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
2417 };
2418 
2420  uint16_t dev_id;
2421  uint16_t conn_num;
2423 };
2424 
2426  bdaddr_t bdaddr;
2427  uint8_t type;
2429 };
2430 
2432  bdaddr_t bdaddr;
2433  uint8_t type;
2434 };
2435 
2437  uint16_t dev_id;
2438  uint16_t flags;
2439  uint8_t lap[3];
2440  uint8_t length;
2441  uint8_t num_rsp;
2442 };
2443 #define IREQ_CACHE_FLUSH 0x0001
2444 
2445 #ifdef __cplusplus
2446 }
2447 #endif
2448 
2449 #endif /* __HCI_H */
Definition: hci.h:65
Definition: hci.h:66
int8_t level_dqpsk
Definition: hci.h:1238
uint8_t num_current_iac
Definition: hci.h:1008
uint8_t role_switch
Definition: hci.h:348
#define HCI_MAX_EIR_LENGTH
Definition: hci.h:1095
uint32_t byte_tx
Definition: hci.h:2374
uint8_t read_all
Definition: hci.h:779
#define MAX_IAC_LAP
Definition: hci.h:1004
uint32_t tx_bandwith
Definition: hci.h:482
uint8_t lmp_ver
Definition: hci.h:1284
enum att_op_type type
Definition: att.c:141
uint8_t bdaddr_type
Definition: hci.h:1582
uint16_t opcode
Definition: hci.h:1852
uint8_t payload
Definition: hci.h:1698
uint16_t log_handle
Definition: hci.h:2232
uint16_t plen
Definition: hci.h:2315
uint8_t capability
Definition: hci.h:513
uint8_t le
Definition: hci.h:1264
uint16_t handle
Definition: hci.h:354
uint8_t num_rsp
Definition: hci.h:2441
uint32_t rx_bandwith
Definition: hci.h:483
uint16_t flags
Definition: hci.h:2438
uint32_t timeout
Definition: hci.h:1246
uint8_t size
Definition: hci.h:1574
uint32_t min_latency
Definition: hci.h:1407
uint16_t max_period
Definition: hci.h:331
uint16_t hci_rev
Definition: hci.h:1283
uint16_t num_pkts
Definition: hci.h:1705
uint8_t filter_dup
Definition: hci.h:1548
uint8_t out
Definition: hci.h:2404
uint32_t peak_bandwidth
Definition: hci.h:654
uint16_t dlen
Definition: hci.h:2302
Definition: hci.h:71
int8_t level_gfsk
Definition: hci.h:1237
uint16_t pkt_type
Definition: hci.h:344
uint8_t filter
Definition: hci.h:1504
uint16_t device
Definition: hci.h:2313
uint32_t byte_rx
Definition: hci.h:2373
uint8_t num_hndl
Definition: hci.h:977
uint16_t acl_max_pkt
Definition: hci.h:970
uint16_t max_interval
Definition: hci.h:615
uint8_t encrypt
Definition: hci.h:421
uint16_t supervision_timeout
Definition: hci.h:1563
uint16_t length
Definition: hci.h:1427
uint8_t fec
Definition: hci.h:1100
uint32_t max_flush_timeout
Definition: hci.h:1412
uint8_t page_num
Definition: hci.h:461
uint8_t retrans_window
Definition: hci.h:2019
uint16_t dev_id
Definition: hci.h:2420
uint32_t acl_rx
Definition: hci.h:2370
uint8_t cond_type
Definition: hci.h:738
uint32_t acl_tx
Definition: hci.h:2369
uint16_t dev_id
Definition: hci.h:2437
uint8_t flt_type
Definition: hci.h:737
struct hci_dev_req dev_req[0]
Definition: hci.h:2416
uint8_t advtype
Definition: hci.h:1499
uint8_t handle
Definition: hci.h:555
uint8_t link_type
Definition: hci.h:1763
uint16_t acl_mtu
Definition: hci.h:968
uint8_t oob_data
Definition: hci.h:514
bdaddr_t peer_bdaddr
Definition: hci.h:1558
uint32_t sco_tx
Definition: hci.h:2371
uint8_t max_pkt
Definition: hci.h:1478
int8_t rssi
Definition: hci.h:1374
sa_family_t hci_family
Definition: hci.h:2341
uint16_t pkt_len
Definition: hci.h:1477
uint8_t frequency
Definition: hci.h:1690
uint16_t opcode
Definition: hci.h:2355
uint32_t link_mode
Definition: hci.h:2390
uint8_t delete_all
Definition: hci.h:804
uint16_t dev_id
Definition: hci.h:2378
uint8_t status
Definition: hci.h:322
uint8_t air_mode
Definition: hci.h:2022
uint8_t features[8]
Definition: hci.h:2386
uint8_t controller_type
Definition: hci.h:1409
int8_t level
Definition: hci.h:956
uint16_t policy
Definition: hci.h:693
uint8_t type
Definition: hci.h:2427
Definition: hci.h:70
uint8_t type
Definition: hci.h:2403
uint8_t mode
Definition: hci.h:1058
uint32_t token_rate
Definition: hci.h:653
uint8_t max_slots
Definition: hci.h:1938
char name[8]
Definition: hci.h:2379
uint16_t dev_id
Definition: hci.h:2410
uint16_t dev_num
Definition: hci.h:2415
uint32_t cmd_tx
Definition: hci.h:2367
struct hci_dev_stats stat
Definition: hci.h:2397
uint16_t event
Definition: hci.h:2280
uint16_t max_acl_len
Definition: hci.h:1339
uint8_t pscan_rep_mode
Definition: hci.h:345
struct hci_conn_info conn_info[0]
Definition: hci.h:2428
uint16_t min_remote_timeout
Definition: hci.h:719
uint8_t length
Definition: hci.h:2440
uint32_t latency
Definition: hci.h:655
uint16_t max_rx_latency
Definition: hci.h:2042
uint8_t flags
Definition: hci.h:661
uint8_t pscan_mode
Definition: hci.h:346
uint32_t err_rx
Definition: hci.h:2365
uint16_t handle
Definition: hci.h:2401
uint8_t link_quality
Definition: hci.h:1366
uint8_t direction
Definition: hci.h:1976
uint16_t diversifier
Definition: hci.h:1653
int8_t level_8dpsk
Definition: hci.h:1239
uint16_t sco_mtu
Definition: hci.h:2394
uint8_t max_page_num
Definition: hci.h:1312
uint16_t num_cmplt_pkts
Definition: hci.h:2250
uint8_t retrans_effort
Definition: hci.h:486
uint16_t acl_mtu
Definition: hci.h:2392
uint8_t lap[3]
Definition: hci.h:2439
uint16_t ptype
Definition: hci.h:1954
uint8_t ncmd
Definition: hci.h:1851
uint16_t data_block_len
Definition: hci.h:1340
Definition: hci.h:75
uint32_t max_pdu_size
Definition: hci.h:1408
uint16_t rx_pkt_len
Definition: hci.h:2020
uint8_t length
Definition: hci.h:316
uint16_t sco_max_pkt
Definition: hci.h:971
bdaddr_t bdaddr
Definition: hci.h:2432
uint16_t attempt
Definition: hci.h:625
uint8_t master_clock_accuracy
Definition: hci.h:2159
uint16_t total_num_blocks
Definition: hci.h:2254
uint8_t key_length
Definition: hci.h:556
uint8_t pscan_period_mode
Definition: hci.h:1751
uint32_t total_bandwidth
Definition: hci.h:1405
uint8_t amp_status
Definition: hci.h:1404
uint16_t state
Definition: hci.h:2405
uint8_t counter
Definition: hci.h:1351
uint8_t simul
Definition: hci.h:1265
uint8_t sco_mtu
Definition: hci.h:969
Definition: hci.h:69
uint8_t trans_interval
Definition: hci.h:2018
uint16_t pal_caps
Definition: hci.h:1410
uint32_t clock
Definition: hci.h:1396
uint64_t random
Definition: hci.h:1645
uint8_t authentication
Definition: hci.h:515
uint32_t sco_rx
Definition: hci.h:2372
uint32_t max_guaranteed_bandwidth
Definition: hci.h:1406
uint16_t conn_num
Definition: hci.h:2421
uint8_t type
Definition: hci.h:2433
uint32_t link_policy
Definition: hci.h:2389
uint16_t num_cmplt_blks
Definition: hci.h:2251
uint8_t enable
Definition: hci.h:857
uint16_t max_tx_latency
Definition: hci.h:2041
#define HCI_MAX_NAME_LENGTH
Definition: hci.h:813
bdaddr_t bdaddr
Definition: hci.h:2426
uint16_t min_ce_length
Definition: hci.h:1564
uint8_t pin_type
Definition: hci.h:764
uint8_t service_type
Definition: hci.h:652
uint32_t best_effort_flush_timeout
Definition: hci.h:1413
uint32_t link_mode
Definition: hci.h:2406
uint8_t reporting
Definition: hci.h:1178
uint8_t direct_bdaddr_type
Definition: hci.h:1501
uint16_t assoc_length
Definition: hci.h:1421
uint8_t own_bdaddr_type
Definition: hci.h:1500
uint8_t evt_type
Definition: hci.h:2165
uint8_t encr_mode
Definition: hci.h:1764
uint16_t acl_pkts
Definition: hci.h:2393
uint8_t initiator_filter
Definition: hci.h:1556
uint16_t window
Definition: hci.h:870
uint8_t which_clock
Definition: hci.h:1390
uint8_t code
Definition: hci.h:1866
hci_qos qos
Definition: hci.h:662
uint16_t min_interval
Definition: hci.h:616
uint16_t num_blocks
Definition: hci.h:1341
unsigned short hci_dev
Definition: hci.h:2342
uint8_t hci_ver
Definition: hci.h:1282
unsigned short hci_channel
Definition: hci.h:2343
struct hci_conn_info conn_info[0]
Definition: hci.h:2422
bdaddr_t direct_bdaddr
Definition: hci.h:1502
uint8_t type
Definition: hci.h:2384
uint8_t key_flag
Definition: hci.h:433
bdaddr_t bdaddr
Definition: hci.h:2402
uint8_t pin_len
Definition: hci.h:398
uint16_t clock_offset
Definition: hci.h:347
uint32_t flags
Definition: hci.h:2383
uint16_t voice_setting
Definition: hci.h:485
uint16_t max_latency
Definition: hci.h:484
uint16_t max_keys
Definition: hci.h:784
uint8_t subevent
Definition: hci.h:2144
uint16_t min_local_timeout
Definition: hci.h:720
uint32_t pkt_type
Definition: hci.h:2388
uint16_t remaining_length
Definition: hci.h:1436
uint16_t min_period
Definition: hci.h:332
uint8_t key_type
Definition: hci.h:557
uint8_t reason
Definition: hci.h:355
uint16_t max_ce_length
Definition: hci.h:1565
uint32_t evt_rx
Definition: hci.h:2368
uint16_t timeout
Definition: hci.h:626
uint64_t states
Definition: hci.h:1684
uint16_t interval
Definition: hci.h:869
uint8_t num_handles
Definition: hci.h:2255
uint16_t manufacturer
Definition: hci.h:1285
uint8_t num_rsp
Definition: hci.h:317
uint16_t accuracy
Definition: hci.h:1397
uint8_t role
Definition: hci.h:375
bdaddr_t bdaddr
Definition: hci.h:323
uint32_t passkey
Definition: hci.h:530
uint16_t dev_id
Definition: hci.h:2281
uint8_t peer_bdaddr_type
Definition: hci.h:1557
uint16_t max_amp_assoc_length
Definition: hci.h:1411
uint16_t sco_pkts
Definition: hci.h:2395
uint32_t delay_variation
Definition: hci.h:656
uint32_t event_mask[2]
Definition: hci.h:2354
uint8_t type
Definition: hci.h:950
uint16_t num_keys
Definition: hci.h:785
uint8_t chan_map
Definition: hci.h:1503
uint8_t opcode
Definition: att.c:140
uint16_t lmp_subver
Definition: hci.h:1286
uint16_t length_so_far
Definition: hci.h:1420
uint8_t dlen
Definition: hci.h:2308
uint8_t evt
Definition: hci.h:2295
uint16_t tx_pkt_len
Definition: hci.h:2021
bdaddr_t bdaddr
Definition: hci.h:2381
uint8_t tx_flow_id
Definition: hci.h:597
uint32_t dev_opt
Definition: hci.h:2411
uint32_t err_tx
Definition: hci.h:2366
uint8_t plen
Definition: hci.h:2290
uint32_t type_mask
Definition: hci.h:2353