~ubuntu-branches/ubuntu/wily/bluez/wily

« back to all changes in this revision

Viewing changes to lib/hci.h

ImportĀ upstreamĀ versionĀ 4.81

Show diffs side-by-side

added added

removed removed

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