MT2523 API Reference  LinkIt SDK v4
bt_hci.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_HCI_H__
36 #define __BT_HCI_H__
37 
106 #include "bt_type.h"
107 
116 #define BT_HCI_STATUS_SUCCESS 0x00
117 #define BT_HCI_STATUS_UNKNOWN_HCI_COMMAND 0x01
118 #define BT_HCI_STATUS_UNKNOWN_CONNECTION_IDENTIFIER 0x02
119 #define BT_HCI_STATUS_HARDWARE_FAILURE 0x03
120 #define BT_HCI_STATUS_PAGE_TIMEOUT 0x04
121 #define BT_HCI_STATUS_AUTHENTICATION_FAILURE 0x05
122 #define BT_HCI_STATUS_PIN_OR_KEY_MISSING 0x06
123 #define BT_HCI_STATUS_MEMORY_CAPACITY_EXCEEDED 0x07
124 #define BT_HCI_STATUS_CONNECTION_TIMEOUT 0x08
125 #define BT_HCI_STATUS_CONNECTION_LIMIT_EXCEEDED 0x09
126 #define BT_HCI_STATUS_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A
127 #define BT_HCI_STATUS_ACL_CONNECTION_ALREADY_EXISTS 0x0B
128 #define BT_HCI_STATUS_COMMAND_DISALLOWED 0x0C
129 #define BT_HCI_STATUS_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D
130 #define BT_HCI_STATUS_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E
131 #define BT_HCI_STATUS_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BDADDR 0x0F
132 #define BT_HCI_STATUS_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10
133 #define BT_HCI_STATUS_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11
134 #define BT_HCI_STATUS_INVALID_HCI_COMMAND_PARAMETERS 0x12
135 #define BT_HCI_STATUS_REMOTE_USER_TERMINATED_CONNECTION 0x13
136 #define BT_HCI_STATUS_REMOTE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14
137 #define BT_HCI_STATUS_REMOTE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15
138 #define BT_HCI_STATUS_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16
139 #define BT_HCI_STATUS_REPEATED_ATTEMPTS 0x17
141 #define BT_HCI_STATUS_PAIRING_NOT_ALLOWED 0x18
142 #define BT_HCI_STATUS_UNKNOWN_LMP_PDU 0x19
143 #define BT_HCI_STATUS_UNSUPPORTED_REMOTE_FEATURE_OR_LMP_FEATURE 0x1A
144 #define BT_HCI_STATUS_SCO_OFFSET_REJECTED 0x1B
145 #define BT_HCI_STATUS_SCO_INTERVAL_REJECTED 0x1C
146 #define BT_HCI_STATUS_SCO_AIR_MODE_REJECTED 0x1D
147 #define BT_HCI_STATUS_INVALID_LMP_PARAMETERS_OR_LL_PARAMETERS 0x1E
148 #define BT_HCI_STATUS_UNSPECIFIED_ERROR 0x1F
149 #define BT_HCI_STATUS_UPSUPPORTED_LMP_OR_LL_PARAMETER_VALUE 0x20
150 #define BT_HCI_STATUS_ROLE_CHANGE_NOT_ALLOWED 0x21
151 #define BT_HCI_STATUS_LMP_RESPONSE_TIMEOUT_OR_LL_RESPONSE_TIMEOUT 0x22
152 #define BT_HCI_STATUS_LMP_ERROR_TRANSACTION_COLLISION 0x23
153 #define BT_HCI_STATUS_LMP_PDU_NOT_ALLOWED 0x24
154 #define BT_HCI_STATUS_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25
155 #define BT_HCI_STATUS_LINK_KEY_CANNOT_BE_CHANGED 0x26
156 #define BT_HCI_STATUS_REQUESTED_QOS_NOT_SUPPORTED 0x27
157 #define BT_HCI_STATUS_INSTANT_PASSED 0x28
158 #define BT_HCI_STATUS_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
159 #define BT_HCI_STATUS_DIFFERENT_TRANSACTION_COLLISION 0x2A
160 #define BT_HCI_STATUS_QOS_UNACCEPTABLE_PARAMETER 0x2C
161 #define BT_HCI_STATUS_QOS_REJECTED 0x2D
162 #define BT_HCI_STATUS_CHANNEL_ASSESSMENT_NOT_SUPPORTED 0x2E
163 #define BT_HCI_STATUS_INSUFFICIENT_SECURITY 0x2F
164 #define BT_HCI_STATUS_PARAMETER_OUT_OF_MANADATORY_RANGE 0x30
165 #define BT_HCI_STATUS_ROLE_SWITCH_PENDING 0x32
166 #define BT_HCI_STATUS_RESERVED_SLOT_VIOLATION 0x34
167 #define BT_HCI_STATUS_ROLE_SWITCH_FAILED 0x35
168 #define BT_HCI_STATUS_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36
169 #define BT_HCI_STATUS_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37
170 #define BT_HCI_STATUS_HOST_BUSY_PAIRING 0x38
171 #define BT_HCI_STATUS_CONNECTION_REJECTED_DUE_TO_NOT_SUITABLE_CHANNEL_FOUND 0x39
172 #define BT_HCI_STATUS_CONTROLLER_BUSY 0x3A
173 #define BT_HCI_STATUS_UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B
174 #define BT_HCI_STATUS_DIRECTED_ADVERTISING_TIMEOUT 0x3C
175 #define BT_HCI_STATUS_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D
176 #define BT_HCI_STATUS_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E
177 #define BT_HCI_STATUS_MAC_CONNECTION_FAILED 0x3F
178 #define BT_HCI_STATUS_COARSE_CLOCK_ADJUSTMENT_REJECTED 0x40
180 /* Proprietary. */
181 #define BT_HCI_STATUS_CHIP_LIMITATION 0xF1
182 #define BT_HCI_STATUS_FORCED_TERMINATE 0xF4
183 typedef uint8_t bt_hci_status_t;
184 typedef bt_hci_status_t bt_hci_disconnect_reason_t;
186 /* Common definitions. */
187 #define BT_HCI_DISABLE 0x00
188 #define BT_HCI_ENABLE 0x01
189 typedef uint8_t bt_hci_enable_t;
191 #define BT_HCI_REJECT 0x00
192 #define BT_HCI_ACCEPT 0x01
193 typedef uint16_t bt_hci_accept_t;
195 #define BT_HCI_SCAN_TYPE_PASSIVE 0x00
196 #define BT_HCI_SCAN_TYPE_ACTIVE 0x01
197 typedef uint8_t bt_hci_scan_type_t;
199 #define BT_HCI_SCAN_ADDR_PUBLIC 0x00
200 #define BT_HCI_SCAN_ADDR_RANDOM 0x01
201 #define BT_HCI_SCAN_ADDR_RESOLVE_PRIVATE_WITH_PUBLIC 0x02
202 #define BT_HCI_SCAN_ADDR_RESOLVE_PRIVATE_WITH_RANDOM 0x03
203 typedef uint8_t bt_hci_scan_addr_type_t;
205 #define BT_HCI_SCAN_FILTER_ACCEPT_ALL_ADVERTISING_PACKETS 0x00
206 #define BT_HCI_SCAN_FILTER_ACCEPT_ONLY_ADVERTISING_PACKETS_IN_WHITE_LIST 0x01
207 typedef uint8_t bt_hci_scan_filter_type_t;
209 #define BT_HCI_CONN_FILTER_ASSIGNED_ADDRESS 0x00
210 #define BT_HCI_CONN_FILTER_WHITE_LIST_ONLY 0x01
211 typedef uint8_t bt_hci_conn_filter_type_t;
213 #define BT_HCI_ADV_TYPE_CONNECTABLE_UNDIRECTED 0x00
214 #define BT_HCI_ADV_TYPE_CONNECTABLE_DIRECTED_HIGH 0x01
215 #define BT_HCI_ADV_TYPE_SCANNABLE_UNDIRECTED 0x02
216 #define BT_HCI_ADV_TYPE_NON_CONNECTABLE_UNDIRECTED 0x03
217 #define BT_HCI_ADV_TYPE_CONNECTABLE_DIRECTED_LOW 0x04
218 typedef uint8_t bt_hci_advertising_type_t;
220 #define BT_GAP_LE_ADD_TO_RESOLVING_LIST 0x2027
221 #define BT_GAP_LE_REMOVE_FROM_RESOLVING_LIST 0x2028
222 #define BT_GAP_LE_CLEAR_RESOLVING_LIST 0x2029
223 typedef uint32_t bt_gap_le_set_resolving_list_op_t;
238 BT_PACKED (
239 typedef struct {
240  bt_handle_t connection_handle;
247 BT_PACKED (
248 typedef struct {
249  bt_hci_status_t status;
250  bt_handle_t connection_handle;
264 BT_PACKED (
265 typedef struct {
266  bt_handle_t handle;
272 BT_PACKED (
273 typedef struct {
274  uint16_t advertising_interval_min;
275  uint16_t advertising_interval_max;
276  bt_hci_advertising_type_t advertising_type;
277  bt_addr_type_t own_address_type;
278  bt_addr_t peer_address;
279  uint8_t advertising_channel_map;
280  uint8_t advertising_filter_policy;
286 BT_PACKED (
287 typedef struct {
288  uint8_t advertising_data_length;
289  uint8_t advertising_data[31];
295 BT_PACKED (
296 typedef struct {
297  uint8_t scan_response_data_length;
298  uint8_t scan_response_data[31];
304 BT_PACKED (
305 typedef struct {
306  bt_hci_enable_t advertising_enable;
312 BT_PACKED (
313 typedef struct {
314  bt_hci_scan_type_t le_scan_type;
315  uint16_t le_scan_interval;
316  uint16_t le_scan_window;
317  bt_hci_scan_addr_type_t own_address_type;
318  bt_hci_scan_filter_type_t scanning_filter_policy;
324 BT_PACKED (
325 typedef struct {
326  bt_hci_enable_t le_scan_enable;
327  bt_hci_enable_t filter_duplicates;
333 BT_PACKED (
334 typedef struct {
335  uint16_t le_scan_interval;
336  uint16_t le_scan_window;
337  bt_hci_conn_filter_type_t initiator_filter_policy;
338  bt_addr_t peer_address;
339  bt_addr_type_t own_address_type;
340  uint16_t conn_interval_min;
341  uint16_t conn_interval_max;
342  uint16_t conn_latency;
343  uint16_t supervision_timeout;
344  uint16_t minimum_ce_length;
345  uint16_t maximum_ce_length;
351 BT_PACKED (
352 typedef struct {
353  bt_addr_t address;
364 BT_PACKED (
365 typedef struct {
366  bt_handle_t connection_handle;
367  uint16_t conn_interval_min;
368  uint16_t conn_interval_max;
369  uint16_t conn_latency;
370  uint16_t supervision_timeout;
371  uint16_t minimum_ce_length;
372  uint16_t maximum_ce_length;
383 BT_PACKED (
384 typedef struct {
385  bt_handle_t connection_handle;
386  uint16_t tx_octets;
387  uint16_t tx_time;
393 BT_PACKED (
394 typedef struct {
395  bt_handle_t connection_handle;
396  uint16_t tx_power_level;
402 BT_PACKED (
403 typedef struct {
404  bt_addr_t peer_identity_address;
405  bt_key_t peer_irk;
406  bt_key_t local_irk;
412 BT_PACKED (
413 typedef struct {
414  bt_addr_t peer_identity_address;
429 BT_PACKED (
430 typedef struct {
431  uint8_t address_resolution_enable;
437 BT_PACKED (
438 typedef struct {
439  uint16_t rpa_timeout;
445 BT_PACKED (
446 typedef struct {
447  bt_hci_status_t status;
448  bt_handle_t handle;
449  int8_t rssi;
455 BT_PACKED (
456 typedef struct {
457  bt_hci_status_t status;
458  bt_handle_t connection_handle;
472 #endif /* __BT_HCI_H__ */
LE add device to the white list command.
Definition: bt_hci.h:355
uint8_t bt_hci_advertising_type_t
Advertising type.
Definition: bt_hci.h:219
bt_hci_cmd_le_add_device_to_white_list_t bt_hci_cmd_le_remove_device_from_white_list_t
LE remove device from the white list command.
Definition: bt_hci.h:360
LE set transmit power command.
Definition: bt_hci.h:398
LE long term key request reply command complete event.
Definition: bt_hci.h:252
LE set address resolution enable command.
Definition: bt_hci.h:433
LE set scan enable command.
Definition: bt_hci.h:329
LE set scan response data command.
Definition: bt_hci.h:300
LE set advertising parameters command.
Definition: bt_hci.h:282
LE remove device from the resolving list command.
Definition: bt_hci.h:416
Disconnect command.
Definition: bt_hci.h:243
uint16_t bt_handle_t
Define the connection handle type.
Definition: bt_type.h:85
Disconnect complete event information.
Definition: bt_hci.h:461
uint8_t bt_hci_conn_filter_type_t
Connection filter type.
Definition: bt_hci.h:212
bt_hci_cmd_le_connection_update_t bt_hci_cmd_le_remote_connection_parameter_request_reply_t
LE remote connection parameter request reply command.
Definition: bt_hci.h:379
uint8_t bt_hci_scan_addr_type_t
Scan address type.
Definition: bt_hci.h:204
uint8_t bt_hci_enable_t
HCI boolean type.
Definition: bt_hci.h:190
uint8_t bt_addr_type_t
Define the address type.
Definition: bt_type.h:190
LE set advertising enable command.
Definition: bt_hci.h:308
uint8_t bt_hci_scan_type_t
Scan type.
Definition: bt_hci.h:198
bt_hci_status_t bt_hci_disconnect_reason_t
The reason to disconnect.
Definition: bt_hci.h:185
bt_hci_cmd_le_remove_device_from_resolving_list_t bt_hci_evt_cmd_le_read_peer_resolvable_address_t
LE read peer resolvable address command.
Definition: bt_hci.h:421
LE set scan parameters command.
Definition: bt_hci.h:320
uint8_t bt_hci_status_t
Defines the status of the controller events.
Definition: bt_hci.h:184
LE create connection command.
Definition: bt_hci.h:347
LE add device to the resolving list command.
Definition: bt_hci.h:408
This structure defines the Bluetooth address.
Definition: bt_type.h:215
bt_hci_evt_cc_le_long_term_key_request_reply_t bt_hci_evt_cc_le_set_data_length_t
LE set data length command complete event.
Definition: bt_hci.h:257
LE set resolvable private address timeout command.
Definition: bt_hci.h:441
Read the RSSI command complete event.
Definition: bt_hci.h:451
uint8_t bt_key_t[16]
Define the SM key type.
Definition: bt_type.h:91
uint8_t bt_hci_scan_filter_type_t
Scan filter type.
Definition: bt_hci.h:208
LE set data length command.
Definition: bt_hci.h:389
For more information on the status parameters, please refer to Bluetooth core specification version 4...
Definition: bt_hci.h:268
LE connection update command.
Definition: bt_hci.h:374
bt_hci_cmd_le_remove_device_from_resolving_list_t bt_hci_evt_cmd_le_read_local_resolvable_address_t
LE read local resolvable address command.
Definition: bt_hci.h:425
LE set advertising data command.
Definition: bt_hci.h:291