3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2011-2012 Intel Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #define BT_H4_CMD_PKT 0x01
28 #define BT_H4_ACL_PKT 0x02
29 #define BT_H4_SCO_PKT 0x03
30 #define BT_H4_EVT_PKT 0x04
32 struct bt_hci_cmd_hdr {
35 } __attribute__ ((packed));
37 struct bt_hci_evt_hdr {
40 } __attribute__ ((packed));
42 #define BT_HCI_CMD_NOP 0x0000
44 #define BT_HCI_CMD_INQUIRY 0x0401
45 struct bt_hci_cmd_inquiry {
49 } __attribute__ ((packed));
51 #define BT_HCI_CMD_INQUIRY_CANCEL 0x0402
53 #define BT_HCI_CMD_CREATE_CONN 0x0405
54 struct bt_hci_cmd_create_conn {
57 uint8_t pscan_rep_mode;
59 uint16_t clock_offset;
61 } __attribute__ ((packed));
63 #define BT_HCI_CMD_DISCONNECT 0x0406
64 struct bt_hci_cmd_disconnect {
67 } __attribute__ ((packed));
69 #define BT_HCI_CMD_ADD_SCO_CONN 0x0407
70 struct bt_hci_cmd_add_sco_conn {
73 } __attribute__ ((packed));
75 #define BT_HCI_CMD_CREATE_CONN_CANCEL 0x0408
76 struct bt_hci_cmd_create_conn_cancel {
78 } __attribute__ ((packed));
80 #define BT_HCI_CMD_ACCEPT_CONN_REQUEST 0x0409
81 struct bt_hci_cmd_accept_conn_request {
84 } __attribute__ ((packed));
86 #define BT_HCI_CMD_REJECT_CONN_REQUEST 0x040a
87 struct bt_hci_cmd_reject_conn_request {
90 } __attribute__ ((packed));
92 #define BT_HCI_CMD_CHANGE_CONN_PKT_TYPE 0x040f
93 struct bt_hci_cmd_change_conn_pkt_type {
96 } __attribute__ ((packed));
98 #define BT_HCI_CMD_REMOTE_NAME_REQUEST 0x0419
99 struct bt_hci_cmd_remote_name_request {
101 uint8_t pscan_rep_mode;
103 uint16_t clock_offset;
104 } __attribute__ ((packed));
106 #define BT_HCI_CMD_REMOTE_NAME_REQUEST_CANCEL 0x041a
107 struct bt_hci_cmd_remote_name_request_cancel {
109 } __attribute__ ((packed));
111 #define BT_HCI_CMD_READ_REMOTE_FEATURES 0x041b
112 struct bt_hci_cmd_read_remote_features {
114 } __attribute__ ((packed));
116 #define BT_HCI_CMD_READ_REMOTE_EXT_FEATURES 0x041c
117 struct bt_hci_cmd_read_remote_ext_features {
120 } __attribute__ ((packed));
122 #define BT_HCI_CMD_READ_REMOTE_VERSION 0x041d
123 struct bt_hci_cmd_read_remote_version {
125 } __attribute__ ((packed));
127 #define BT_HCI_CMD_READ_DEFAULT_LINK_POLICY 0x080e
128 struct bt_hci_rsp_read_default_link_policy {
131 } __attribute__ ((packed));
133 #define BT_HCI_CMD_WRITE_DEFAULT_LINK_POLICY 0x080f
134 struct bt_hci_cmd_write_default_link_policy {
136 } __attribute__ ((packed));
138 #define BT_HCI_CMD_SET_EVENT_MASK 0x0c01
139 struct bt_hci_cmd_set_event_mask {
141 } __attribute__ ((packed));
143 #define BT_HCI_CMD_RESET 0x0c03
145 #define BT_HCI_CMD_SET_EVENT_FILTER 0x0c05
146 struct bt_hci_cmd_set_event_filter {
150 } __attribute__ ((packed));
152 #define BT_HCI_CMD_READ_STORED_LINK_KEY 0x0c0d
153 struct bt_hci_cmd_read_stored_link_key {
156 } __attribute__ ((packed));
157 struct bt_hci_rsp_read_stored_link_key {
159 uint16_t max_num_keys;
161 } __attribute__ ((packed));
163 #define BT_HCI_CMD_WRITE_STORED_LINK_KEY 0x0c11
164 struct bt_hci_cmd_write_stored_link_key {
166 } __attribute__ ((packed));
167 struct bt_hci_rsp_write_stored_link_key {
170 } __attribute__ ((packed));
172 #define BT_HCI_CMD_DELETE_STORED_LINK_KEY 0x0c12
173 struct bt_hci_cmd_delete_stored_link_key {
176 } __attribute__ ((packed));
177 struct bt_hci_rsp_delete_stored_link_key {
180 } __attribute__ ((packed));
182 #define BT_HCI_CMD_WRITE_LOCAL_NAME 0x0c13
183 struct bt_hci_cmd_write_local_name {
185 } __attribute__ ((packed));
187 #define BT_HCI_CMD_READ_LOCAL_NAME 0x0c14
188 struct bt_hci_rsp_read_local_name {
191 } __attribute__ ((packed));
193 #define BT_HCI_CMD_READ_CONN_ACCEPT_TIMEOUT 0x0c15
194 struct bt_hci_rsp_read_conn_accept_timeout {
197 } __attribute__ ((packed));
199 #define BT_HCI_CMD_WRITE_CONN_ACCEPT_TIMEOUT 0x0c16
200 struct bt_hci_cmd_write_conn_accept_timeout {
202 } __attribute__ ((packed));
204 #define BT_HCI_CMD_READ_PAGE_TIMEOUT 0x0c17
205 struct bt_hci_rsp_read_page_timeout {
208 } __attribute__ ((packed));
210 #define BT_HCI_CMD_WRITE_PAGE_TIMEOUT 0x0c18
211 struct bt_hci_cmd_write_page_timeout {
213 } __attribute__ ((packed));
215 #define BT_HCI_CMD_READ_SCAN_ENABLE 0x0c19
216 struct bt_hci_rsp_read_scan_enable {
219 } __attribute__ ((packed));
221 #define BT_HCI_CMD_WRITE_SCAN_ENABLE 0x0c1a
222 struct bt_hci_cmd_write_scan_enable {
224 } __attribute__ ((packed));
226 #define BT_HCI_CMD_READ_AUTH_ENABLE 0x0c1f
227 struct bt_hci_rsp_read_auth_enable {
230 } __attribute__ ((packed));
232 #define BT_HCI_CMD_WRITE_AUTH_ENABLE 0x0c20
233 struct bt_hci_cmd_write_auth_enable {
235 } __attribute__ ((packed));
237 #define BT_HCI_CMD_READ_CLASS_OF_DEV 0x0c23
238 struct bt_hci_rsp_read_class_of_dev {
240 uint8_t dev_class[3];
241 } __attribute__ ((packed));
243 #define BT_HCI_CMD_WRITE_CLASS_OF_DEV 0x0c24
244 struct bt_hci_cmd_write_class_of_dev {
245 uint8_t dev_class[3];
246 } __attribute__ ((packed));
248 #define BT_HCI_CMD_READ_VOICE_SETTING 0x0c25
249 struct bt_hci_rsp_read_voice_setting {
252 } __attribute__ ((packed));
254 #define BT_HCI_CMD_WRITE_VOICE_SETTING 0x0c26
255 struct bt_hci_cmd_write_voice_setting {
257 } __attribute__ ((packed));
259 #define BT_HCI_CMD_READ_INQUIRY_MODE 0x0c44
260 struct bt_hci_rsp_read_inquiry_mode {
263 } __attribute__ ((packed));
265 #define BT_HCI_CMD_WRITE_INQUIRY_MODE 0x0c45
266 struct bt_hci_cmd_write_inquiry_mode {
268 } __attribute__ ((packed));
270 #define BT_HCI_CMD_READ_AFH_ASSESS_MODE 0x0c48
271 struct bt_hci_rsp_read_afh_assess_mode {
274 } __attribute__ ((packed));
276 #define BT_HCI_CMD_WRITE_AFH_ASSESS_MODE 0x0c49
277 struct bt_hci_cmd_write_afh_assess_mode {
279 } __attribute__ ((packed));
281 #define BT_HCI_CMD_READ_EXT_INQUIRY_RSP 0x0c51
282 struct bt_hci_rsp_read_ext_inquiry_rsp {
286 } __attribute__ ((packed));
288 #define BT_HCI_CMD_WRITE_EXT_INQUIRY_RSP 0x0c52
289 struct bt_hci_cmd_write_ext_inquiry_rsp {
292 } __attribute__ ((packed));
294 #define BT_HCI_CMD_READ_SIMPLE_PAIRING_MODE 0x0c55
295 struct bt_hci_rsp_read_simple_pairing_mode {
298 } __attribute__ ((packed));
300 #define BT_HCI_CMD_WRITE_SIMPLE_PAIRING_MODE 0x0c56
301 struct bt_hci_cmd_write_simple_pairing_mode {
303 } __attribute__ ((packed));
305 #define BT_HCI_CMD_READ_INQUIRY_RSP_TX_POWER 0x0c58
306 struct bt_hci_rsp_read_inquiry_rsp_tx_power {
309 } __attribute__ ((packed));
311 #define BT_HCI_CMD_READ_LE_HOST_SUPPORTED 0x0c6c
312 struct bt_hci_rsp_read_le_host_supported {
315 uint8_t simultaneous;
316 } __attribute__ ((packed));
318 #define BT_HCI_CMD_WRITE_LE_HOST_SUPPORTED 0x0c6d
319 struct bt_hci_cmd_write_le_host_supported {
321 uint8_t simultaneous;
322 } __attribute__ ((packed));
324 #define BT_HCI_CMD_READ_LOCAL_VERSION 0x1001
325 struct bt_hci_rsp_read_local_version {
330 uint16_t manufacturer;
332 } __attribute__ ((packed));
334 #define BT_HCI_CMD_READ_LOCAL_COMMANDS 0x1002
335 struct bt_hci_rsp_read_local_commands {
337 uint8_t commands[64];
338 } __attribute__ ((packed));
340 #define BT_HCI_CMD_READ_LOCAL_FEATURES 0x1003
341 struct bt_hci_rsp_read_local_features {
344 } __attribute__ ((packed));
346 #define BT_HCI_CMD_READ_LOCAL_EXT_FEATURES 0x1004
347 struct bt_hci_cmd_read_local_ext_features {
349 } __attribute__ ((packed));
350 struct bt_hci_rsp_read_local_ext_features {
355 } __attribute__ ((packed));
357 #define BT_HCI_CMD_READ_BUFFER_SIZE 0x1005
358 struct bt_hci_rsp_read_buffer_size {
362 uint16_t acl_max_pkt;
363 uint16_t sco_max_pkt;
364 } __attribute__ ((packed));
366 #define BT_HCI_CMD_READ_COUNTRY_CODE 0x1007
367 struct bt_hci_rsp_read_country_code {
370 } __attribute__ ((packed));
372 #define BT_HCI_CMD_READ_BD_ADDR 0x1009
373 struct bt_hci_rsp_read_bd_addr {
376 } __attribute__ ((packed));
378 #define BT_HCI_CMD_READ_DATA_BLOCK_SIZE 0x100a
379 struct bt_hci_rsp_read_data_block_size {
381 uint16_t max_acl_len;
384 } __attribute__ ((packed));
386 #define BT_HCI_CMD_LE_SET_EVENT_MASK 0x2001
387 struct bt_hci_cmd_le_set_event_mask {
389 } __attribute__ ((packed));
391 #define BT_HCI_CMD_LE_READ_BUFFER_SIZE 0x2002
392 struct bt_hci_rsp_le_read_buffer_size {
396 } __attribute__ ((packed));
398 #define BT_HCI_CMD_LE_READ_LOCAL_FEATURES 0x2003
399 struct bt_hci_rsp_le_read_local_features {
402 } __attribute__ ((packed));
404 #define BT_HCI_CMD_LE_SET_SCAN_PARAMETERS 0x200b
405 struct bt_hci_cmd_le_set_scan_parameters {
409 uint8_t own_addr_type;
410 uint8_t filter_policy;
411 } __attribute__ ((packed));
413 #define BT_HCI_CMD_LE_SET_SCAN_ENABLE 0x200c
414 struct bt_hci_cmd_le_set_scan_enable {
417 } __attribute__ ((packed));
419 #define BT_HCI_CMD_LE_READ_SUPPORTED_STATES 0x201c
420 struct bt_hci_rsp_le_read_supported_states {
423 } __attribute__ ((packed));
425 #define BT_HCI_EVT_INQUIRY_COMPLETE 0x01
426 struct bt_hci_evt_inquiry_complete {
428 } __attribute__ ((packed));
430 #define BT_HCI_EVT_INQUIRY_RESULT 0x02
431 struct bt_hci_evt_inquiry_result {
434 uint8_t pscan_rep_mode;
435 uint8_t pscan_period_mode;
437 uint8_t dev_class[3];
438 uint8_t clock_offset;
439 } __attribute__ ((packed));
441 #define BT_HCI_EVT_CONN_COMPLETE 0x03
442 struct bt_hci_evt_conn_complete {
448 } __attribute__ ((packed));
450 #define BT_HCI_EVT_CONN_REQUEST 0x04
451 struct bt_hci_evt_conn_request {
453 uint8_t dev_class[3];
455 } __attribute__ ((packed));
457 #define BT_HCI_EVT_DISCONNECT_COMPLETE 0x05
458 struct bt_hci_evt_disconnect_complete {
462 } __attribute__ ((packed));
464 #define BT_HCI_EVT_REMOTE_NAME_REQUEST_COMPLETE 0x07
465 struct bt_hci_evt_remote_name_req_complete {
469 } __attribute__ ((packed));
471 #define BT_HCI_EVT_REMOTE_FEATURES_COMPLETE 0x0b
472 struct bt_hci_evt_remote_features_complete {
476 } __attribute__ ((packed));
478 #define BT_HCI_EVT_REMOTE_VERSION_COMPLETE 0x0c
479 struct bt_hci_evt_remote_version_complete {
483 uint16_t manufacturer;
485 } __attribute__ ((packed));
487 #define BT_HCI_EVT_CMD_COMPLETE 0x0e
488 struct bt_hci_evt_cmd_complete {
491 } __attribute__ ((packed));
493 #define BT_HCI_EVT_CMD_STATUS 0x0f
494 struct bt_hci_evt_cmd_status {
498 } __attribute__ ((packed));
500 #define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13
501 struct bt_hci_evt_num_completed_packets {
505 } __attribute__ ((packed));
507 #define BT_HCI_EVT_CONN_PKT_TYPE_CHANGED 0x1d
508 struct bt_hci_evt_conn_pkt_type_changed {
512 } __attribute__ ((packed));
514 #define BT_HCI_EVT_INQUIRY_RESULT_WITH_RSSI 0x22
515 struct bt_hci_evt_inquiry_result_with_rssi {
518 uint8_t pscan_rep_mode;
519 uint8_t pscan_period_mode;
520 uint8_t dev_class[3];
521 uint16_t clock_offset;
523 } __attribute__ ((packed));
525 #define BT_HCI_EVT_REMOTE_EXT_FEATURES_COMPLETE 0x23
526 struct bt_hci_evt_remote_ext_features_complete {
532 } __attribute__ ((packed));
534 #define BT_HCI_EVT_EXT_INQUIRY_RESULT 0x2f
535 struct bt_hci_evt_ext_inquiry_result {
538 uint8_t pscan_rep_mode;
539 uint8_t pscan_period_mode;
540 uint8_t dev_class[3];
541 uint16_t clock_offset;
544 } __attribute__ ((packed));
546 #define BT_HCI_ERR_SUCCESS 0x00
547 #define BT_HCI_ERR_UNKNOWN_COMMAND 0x01
548 #define BT_HCI_ERR_UNKNOWN_CONN_ID 0x02
549 #define BT_HCI_ERR_HARDWARE_FAILURE 0x03
550 #define BT_HCI_ERR_PAGE_TIMEOUT 0x04
551 #define BT_HCI_ERR_INVALID_PARAMETERS 0x12