blob: 285ae419bf1b557b6f68f13b5afc17b0b86b13b3 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
Jakub Pawlowski5b790fe2017-09-18 09:00:20 -07003 * Copyright 1999-2012 Broadcom Corporation
The Android Open Source Project5738f832012-12-12 16:00:35 -08004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19#ifndef HCIMSGS_H
20#define HCIMSGS_H
21
22#include "bt_target.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080023#include "bt_types.h"
Mudumba Ananth57f65082017-02-09 09:05:48 -080024#include "device/include/esco_parameters.h"
Myles Watson911d1ae2016-11-28 16:44:40 -080025#include "hcidefs.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080026
Jakub Pawlowski0c683232017-02-24 09:49:59 -080027#include <base/callback_forward.h>
28
Myles Watson911d1ae2016-11-28 16:44:40 -080029void bte_main_hci_send(BT_HDR* p_msg, uint16_t event);
Chris Mantonf857d642014-09-26 13:31:41 -070030
The Android Open Source Project5738f832012-12-12 16:00:35 -080031/* Message by message.... */
32
Jakub Pawlowski763abdf2016-10-10 11:39:39 -070033extern void btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration,
Myles Watson911d1ae2016-11-28 16:44:40 -080034 uint8_t response_cnt);
The Android Open Source Project5738f832012-12-12 16:00:35 -080035
36#define HCIC_PARAM_SIZE_INQUIRY 5
37
Myles Watson911d1ae2016-11-28 16:44:40 -080038#define HCIC_INQ_INQ_LAP_OFF 0
39#define HCIC_INQ_DUR_OFF 3
40#define HCIC_INQ_RSP_CNT_OFF 4
41/* Inquiry */
The Android Open Source Project5738f832012-12-12 16:00:35 -080042
Myles Watson911d1ae2016-11-28 16:44:40 -080043/* Inquiry Cancel */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -070044extern void btsnd_hcic_inq_cancel(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -080045
Myles Watson911d1ae2016-11-28 16:44:40 -080046#define HCIC_PARAM_SIZE_INQ_CANCEL 0
The Android Open Source Project5738f832012-12-12 16:00:35 -080047
Myles Watson911d1ae2016-11-28 16:44:40 -080048/* Periodic Inquiry Mode */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -070049extern void btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period,
Myles Watson911d1ae2016-11-28 16:44:40 -080050 const LAP inq_lap, uint8_t duration,
51 uint8_t response_cnt);
The Android Open Source Project5738f832012-12-12 16:00:35 -080052
Myles Watson911d1ae2016-11-28 16:44:40 -080053#define HCIC_PARAM_SIZE_PER_INQ_MODE 9
The Android Open Source Project5738f832012-12-12 16:00:35 -080054
Myles Watson911d1ae2016-11-28 16:44:40 -080055#define HCI_PER_INQ_MAX_INTRVL_OFF 0
56#define HCI_PER_INQ_MIN_INTRVL_OFF 2
57#define HCI_PER_INQ_INQ_LAP_OFF 4
58#define HCI_PER_INQ_DURATION_OFF 7
59#define HCI_PER_INQ_RSP_CNT_OFF 8
60/* Periodic Inquiry Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -080061
Myles Watson911d1ae2016-11-28 16:44:40 -080062/* Exit Periodic Inquiry Mode */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -070063extern void btsnd_hcic_exit_per_inq(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -080064
Myles Watson911d1ae2016-11-28 16:44:40 -080065#define HCIC_PARAM_SIZE_EXIT_PER_INQ 0
66/* Create Connection */
Jakub Pawlowskia484a882017-06-24 17:30:18 -070067extern void btsnd_hcic_create_conn(const RawAddress& dest,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -070068 uint16_t packet_types,
Myles Watson911d1ae2016-11-28 16:44:40 -080069 uint8_t page_scan_rep_mode,
70 uint8_t page_scan_mode,
71 uint16_t clock_offset, uint8_t allow_switch);
The Android Open Source Project5738f832012-12-12 16:00:35 -080072
Myles Watson911d1ae2016-11-28 16:44:40 -080073#define HCIC_PARAM_SIZE_CREATE_CONN 13
The Android Open Source Project5738f832012-12-12 16:00:35 -080074
Myles Watson911d1ae2016-11-28 16:44:40 -080075#define HCIC_CR_CONN_BD_ADDR_OFF 0
76#define HCIC_CR_CONN_PKT_TYPES_OFF 6
77#define HCIC_CR_CONN_REP_MODE_OFF 8
The Android Open Source Project5738f832012-12-12 16:00:35 -080078#define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
Myles Watson911d1ae2016-11-28 16:44:40 -080079#define HCIC_CR_CONN_CLK_OFF_OFF 10
80#define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12
81/* Create Connection */
The Android Open Source Project5738f832012-12-12 16:00:35 -080082
Myles Watson911d1ae2016-11-28 16:44:40 -080083/* Disconnect */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -070084extern void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason);
The Android Open Source Project5738f832012-12-12 16:00:35 -080085
86#define HCIC_PARAM_SIZE_DISCONNECT 3
87
Myles Watson911d1ae2016-11-28 16:44:40 -080088#define HCI_DISC_HANDLE_OFF 0
89#define HCI_DISC_REASON_OFF 2
90/* Disconnect */
The Android Open Source Project5738f832012-12-12 16:00:35 -080091
Myles Watson911d1ae2016-11-28 16:44:40 -080092/* Add SCO Connection */
93extern void btsnd_hcic_add_SCO_conn(uint16_t handle, uint16_t packet_types);
The Android Open Source Project5738f832012-12-12 16:00:35 -080094
Myles Watson911d1ae2016-11-28 16:44:40 -080095#define HCIC_PARAM_SIZE_ADD_SCO_CONN 4
The Android Open Source Project5738f832012-12-12 16:00:35 -080096
Myles Watson911d1ae2016-11-28 16:44:40 -080097#define HCI_ADD_SCO_HANDLE_OFF 0
98#define HCI_ADD_SCO_PACKET_TYPES_OFF 2
99/* Add SCO Connection */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800100
Myles Watson911d1ae2016-11-28 16:44:40 -0800101/* Create Connection Cancel */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700102extern void btsnd_hcic_create_conn_cancel(const RawAddress& dest);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800103
Myles Watson911d1ae2016-11-28 16:44:40 -0800104#define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800105
Myles Watson911d1ae2016-11-28 16:44:40 -0800106#define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0
107/* Create Connection Cancel */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800108
Myles Watson911d1ae2016-11-28 16:44:40 -0800109/* Accept Connection Request */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700110extern void btsnd_hcic_accept_conn(const RawAddress& bd_addr, uint8_t role);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800111
Myles Watson911d1ae2016-11-28 16:44:40 -0800112#define HCIC_PARAM_SIZE_ACCEPT_CONN 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800113
Myles Watson911d1ae2016-11-28 16:44:40 -0800114#define HCI_ACC_CONN_BD_ADDR_OFF 0
115#define HCI_ACC_CONN_ROLE_OFF 6
116/* Accept Connection Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800117
Myles Watson911d1ae2016-11-28 16:44:40 -0800118/* Reject Connection Request */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700119extern void btsnd_hcic_reject_conn(const RawAddress& bd_addr, uint8_t reason);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800120
Myles Watson911d1ae2016-11-28 16:44:40 -0800121#define HCIC_PARAM_SIZE_REJECT_CONN 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800122
Myles Watson911d1ae2016-11-28 16:44:40 -0800123#define HCI_REJ_CONN_BD_ADDR_OFF 0
124#define HCI_REJ_CONN_REASON_OFF 6
125/* Reject Connection Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800126
Myles Watson911d1ae2016-11-28 16:44:40 -0800127/* Link Key Request Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700128extern void btsnd_hcic_link_key_req_reply(const RawAddress& bd_addr,
Jakub Pawlowskiae572112018-06-14 17:40:34 -0700129 const LinkKey& link_key);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800130
Myles Watson911d1ae2016-11-28 16:44:40 -0800131#define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22
The Android Open Source Project5738f832012-12-12 16:00:35 -0800132
Myles Watson911d1ae2016-11-28 16:44:40 -0800133#define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800134#define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
Myles Watson911d1ae2016-11-28 16:44:40 -0800135/* Link Key Request Reply */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800136
Myles Watson911d1ae2016-11-28 16:44:40 -0800137/* Link Key Request Neg Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700138extern void btsnd_hcic_link_key_neg_reply(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800139
Myles Watson911d1ae2016-11-28 16:44:40 -0800140#define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800141
142#define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
Myles Watson911d1ae2016-11-28 16:44:40 -0800143/* Link Key Request Neg Reply */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800144
Myles Watson911d1ae2016-11-28 16:44:40 -0800145/* PIN Code Request Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700146extern void btsnd_hcic_pin_code_req_reply(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700147 uint8_t pin_code_len,
Myles Watson911d1ae2016-11-28 16:44:40 -0800148 PIN_CODE pin_code);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800149
Myles Watson911d1ae2016-11-28 16:44:40 -0800150#define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23
The Android Open Source Project5738f832012-12-12 16:00:35 -0800151
Myles Watson911d1ae2016-11-28 16:44:40 -0800152#define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0
153#define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800154#define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
Myles Watson911d1ae2016-11-28 16:44:40 -0800155/* PIN Code Request Reply */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800156
Myles Watson911d1ae2016-11-28 16:44:40 -0800157/* Link Key Request Neg Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700158extern void btsnd_hcic_pin_code_neg_reply(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800159
Myles Watson911d1ae2016-11-28 16:44:40 -0800160#define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800161
162#define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
Myles Watson911d1ae2016-11-28 16:44:40 -0800163/* Link Key Request Neg Reply */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800164
Myles Watson911d1ae2016-11-28 16:44:40 -0800165/* Change Connection Type */
166extern void btsnd_hcic_change_conn_type(uint16_t handle, uint16_t packet_types);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800167
Myles Watson911d1ae2016-11-28 16:44:40 -0800168#define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800169
Myles Watson911d1ae2016-11-28 16:44:40 -0800170#define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0
171#define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2
172/* Change Connection Type */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800173
Myles Watson911d1ae2016-11-28 16:44:40 -0800174#define HCIC_PARAM_SIZE_CMD_HANDLE 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800175
Myles Watson911d1ae2016-11-28 16:44:40 -0800176#define HCI_CMD_HANDLE_HANDLE_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800177
Myles Watson911d1ae2016-11-28 16:44:40 -0800178extern void btsnd_hcic_auth_request(
179 uint16_t handle); /* Authentication Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800180
Myles Watson911d1ae2016-11-28 16:44:40 -0800181/* Set Connection Encryption */
182extern void btsnd_hcic_set_conn_encrypt(uint16_t handle, bool enable);
183#define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800184
Myles Watson911d1ae2016-11-28 16:44:40 -0800185#define HCI_SET_ENCRYPT_HANDLE_OFF 0
186#define HCI_SET_ENCRYPT_ENABLE_OFF 2
187/* Set Connection Encryption */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800188
Myles Watson911d1ae2016-11-28 16:44:40 -0800189/* Remote Name Request */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700190extern void btsnd_hcic_rmt_name_req(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700191 uint8_t page_scan_rep_mode,
Myles Watson911d1ae2016-11-28 16:44:40 -0800192 uint8_t page_scan_mode,
193 uint16_t clock_offset);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800194
Myles Watson911d1ae2016-11-28 16:44:40 -0800195#define HCIC_PARAM_SIZE_RMT_NAME_REQ 10
The Android Open Source Project5738f832012-12-12 16:00:35 -0800196
Myles Watson911d1ae2016-11-28 16:44:40 -0800197#define HCI_RMT_NAME_BD_ADDR_OFF 0
198#define HCI_RMT_NAME_REP_MODE_OFF 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800199#define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
Myles Watson911d1ae2016-11-28 16:44:40 -0800200#define HCI_RMT_NAME_CLK_OFF_OFF 8
201/* Remote Name Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800202
Myles Watson911d1ae2016-11-28 16:44:40 -0800203/* Remote Name Request Cancel */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700204extern void btsnd_hcic_rmt_name_req_cancel(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800205
Myles Watson911d1ae2016-11-28 16:44:40 -0800206#define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800207
Myles Watson911d1ae2016-11-28 16:44:40 -0800208#define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0
209/* Remote Name Request Cancel */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800210
Myles Watson911d1ae2016-11-28 16:44:40 -0800211extern void btsnd_hcic_rmt_features_req(
212 uint16_t handle); /* Remote Features Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800213
Myles Watson911d1ae2016-11-28 16:44:40 -0800214/* Remote Extended Features */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700215extern void btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800216
Myles Watson911d1ae2016-11-28 16:44:40 -0800217#define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800218
Myles Watson911d1ae2016-11-28 16:44:40 -0800219#define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0
220#define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2
221/* Remote Extended Features */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800222
Myles Watson911d1ae2016-11-28 16:44:40 -0800223extern void btsnd_hcic_rmt_ver_req(
224 uint16_t handle); /* Remote Version Info Request */
225extern void btsnd_hcic_read_rmt_clk_offset(
226 uint16_t handle); /* Remote Clock Offset */
227extern void btsnd_hcic_read_lmp_handle(uint16_t handle); /* Remote LMP Handle */
Mudumba Ananth57f65082017-02-09 09:05:48 -0800228extern void btsnd_hcic_setup_esco_conn(uint16_t handle,
229 uint32_t transmit_bandwidth,
230 uint32_t receive_bandwidth,
231 uint16_t max_latency, uint16_t voice,
232 uint8_t retrans_effort,
Myles Watson911d1ae2016-11-28 16:44:40 -0800233 uint16_t packet_types);
234#define HCIC_PARAM_SIZE_SETUP_ESCO 17
The Android Open Source Project5738f832012-12-12 16:00:35 -0800235
Myles Watson911d1ae2016-11-28 16:44:40 -0800236#define HCI_SETUP_ESCO_HANDLE_OFF 0
237#define HCI_SETUP_ESCO_TX_BW_OFF 2
238#define HCI_SETUP_ESCO_RX_BW_OFF 6
239#define HCI_SETUP_ESCO_MAX_LAT_OFF 10
240#define HCI_SETUP_ESCO_VOICE_OFF 12
241#define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14
242#define HCI_SETUP_ESCO_PKT_TYPES_OFF 15
The Android Open Source Project5738f832012-12-12 16:00:35 -0800243
Mudumba Ananth57f65082017-02-09 09:05:48 -0800244extern void btsnd_hcic_accept_esco_conn(
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700245 const RawAddress& bd_addr, uint32_t transmit_bandwidth,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700246 uint32_t receive_bandwidth, uint16_t max_latency, uint16_t content_fmt,
247 uint8_t retrans_effort, uint16_t packet_types);
Myles Watson911d1ae2016-11-28 16:44:40 -0800248#define HCIC_PARAM_SIZE_ACCEPT_ESCO 21
The Android Open Source Project5738f832012-12-12 16:00:35 -0800249
Myles Watson911d1ae2016-11-28 16:44:40 -0800250#define HCI_ACCEPT_ESCO_BDADDR_OFF 0
251#define HCI_ACCEPT_ESCO_TX_BW_OFF 6
252#define HCI_ACCEPT_ESCO_RX_BW_OFF 10
253#define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14
254#define HCI_ACCEPT_ESCO_VOICE_OFF 16
255#define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18
256#define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19
The Android Open Source Project5738f832012-12-12 16:00:35 -0800257
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700258extern void btsnd_hcic_reject_esco_conn(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700259 uint8_t reason);
Myles Watson911d1ae2016-11-28 16:44:40 -0800260#define HCIC_PARAM_SIZE_REJECT_ESCO 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800261
Myles Watson911d1ae2016-11-28 16:44:40 -0800262#define HCI_REJECT_ESCO_BDADDR_OFF 0
263#define HCI_REJECT_ESCO_REASON_OFF 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800264
265/* Hold Mode */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700266extern void btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period,
Myles Watson911d1ae2016-11-28 16:44:40 -0800267 uint16_t min_hold_period);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800268
Myles Watson911d1ae2016-11-28 16:44:40 -0800269#define HCIC_PARAM_SIZE_HOLD_MODE 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800270
Myles Watson911d1ae2016-11-28 16:44:40 -0800271#define HCI_HOLD_MODE_HANDLE_OFF 0
272#define HCI_HOLD_MODE_MAX_PER_OFF 2
273#define HCI_HOLD_MODE_MIN_PER_OFF 4
274/* Hold Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800275
Myles Watson911d1ae2016-11-28 16:44:40 -0800276/* Sniff Mode */
277extern void btsnd_hcic_sniff_mode(uint16_t handle, uint16_t max_sniff_period,
278 uint16_t min_sniff_period,
279 uint16_t sniff_attempt,
280 uint16_t sniff_timeout);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800281
Myles Watson911d1ae2016-11-28 16:44:40 -0800282#define HCIC_PARAM_SIZE_SNIFF_MODE 10
The Android Open Source Project5738f832012-12-12 16:00:35 -0800283
Myles Watson911d1ae2016-11-28 16:44:40 -0800284#define HCI_SNIFF_MODE_HANDLE_OFF 0
285#define HCI_SNIFF_MODE_MAX_PER_OFF 2
286#define HCI_SNIFF_MODE_MIN_PER_OFF 4
287#define HCI_SNIFF_MODE_ATTEMPT_OFF 6
288#define HCI_SNIFF_MODE_TIMEOUT_OFF 8
289/* Sniff Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800290
Myles Watson911d1ae2016-11-28 16:44:40 -0800291extern void btsnd_hcic_exit_sniff_mode(uint16_t handle); /* Exit Sniff Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800292
Myles Watson911d1ae2016-11-28 16:44:40 -0800293/* Park Mode */
294extern void btsnd_hcic_park_mode(uint16_t handle, uint16_t beacon_max_interval,
295 uint16_t beacon_min_interval);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800296
Myles Watson911d1ae2016-11-28 16:44:40 -0800297#define HCIC_PARAM_SIZE_PARK_MODE 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800298
Myles Watson911d1ae2016-11-28 16:44:40 -0800299#define HCI_PARK_MODE_HANDLE_OFF 0
300#define HCI_PARK_MODE_MAX_PER_OFF 2
301#define HCI_PARK_MODE_MIN_PER_OFF 4
302/* Park Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800303
Myles Watson911d1ae2016-11-28 16:44:40 -0800304extern void btsnd_hcic_exit_park_mode(uint16_t handle); /* Exit Park Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800305
Myles Watson911d1ae2016-11-28 16:44:40 -0800306/* QoS Setup */
307extern void btsnd_hcic_qos_setup(uint16_t handle, uint8_t flags,
308 uint8_t service_type, uint32_t token_rate,
309 uint32_t peak, uint32_t latency,
310 uint32_t delay_var);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800311
Myles Watson911d1ae2016-11-28 16:44:40 -0800312#define HCIC_PARAM_SIZE_QOS_SETUP 20
The Android Open Source Project5738f832012-12-12 16:00:35 -0800313
Myles Watson911d1ae2016-11-28 16:44:40 -0800314#define HCI_QOS_HANDLE_OFF 0
315#define HCI_QOS_FLAGS_OFF 2
316#define HCI_QOS_SERVICE_TYPE_OFF 3
317#define HCI_QOS_TOKEN_RATE_OFF 4
318#define HCI_QOS_PEAK_BANDWIDTH_OFF 8
319#define HCI_QOS_LATENCY_OFF 12
320#define HCI_QOS_DELAY_VAR_OFF 16
321/* QoS Setup */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800322
Myles Watson911d1ae2016-11-28 16:44:40 -0800323/* Switch Role Request */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700324extern void btsnd_hcic_switch_role(const RawAddress& bd_addr, uint8_t role);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800325
Myles Watson911d1ae2016-11-28 16:44:40 -0800326#define HCIC_PARAM_SIZE_SWITCH_ROLE 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800327
Myles Watson911d1ae2016-11-28 16:44:40 -0800328#define HCI_SWITCH_BD_ADDR_OFF 0
329#define HCI_SWITCH_ROLE_OFF 6
330/* Switch Role Request */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800331
Myles Watson911d1ae2016-11-28 16:44:40 -0800332/* Write Policy Settings */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700333extern void btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800334
Myles Watson911d1ae2016-11-28 16:44:40 -0800335#define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800336
Myles Watson911d1ae2016-11-28 16:44:40 -0800337#define HCI_WRITE_POLICY_HANDLE_OFF 0
338#define HCI_WRITE_POLICY_SETTINGS_OFF 2
339/* Write Policy Settings */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800340
Myles Watson911d1ae2016-11-28 16:44:40 -0800341/* Write Default Policy Settings */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700342extern void btsnd_hcic_write_def_policy_set(uint16_t settings);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800343
Myles Watson911d1ae2016-11-28 16:44:40 -0800344#define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800345
Myles Watson911d1ae2016-11-28 16:44:40 -0800346#define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0
347/* Write Default Policy Settings */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800348
The Android Open Source Project5738f832012-12-12 16:00:35 -0800349/******************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -0800350 * Lisbon Features
351 ******************************************/
Marie Janssend19e0782016-07-15 12:48:27 -0700352#if (BTM_SSR_INCLUDED == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -0800353/* Sniff Subrating */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700354extern void btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat,
Myles Watson911d1ae2016-11-28 16:44:40 -0800355 uint16_t min_remote_lat,
356 uint16_t min_local_lat);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800357
Myles Watson911d1ae2016-11-28 16:44:40 -0800358#define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8
The Android Open Source Project5738f832012-12-12 16:00:35 -0800359
Myles Watson911d1ae2016-11-28 16:44:40 -0800360#define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0
361#define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2
362#define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4
363#define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6
364/* Sniff Subrating */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800365
Myles Watson911d1ae2016-11-28 16:44:40 -0800366#else /* BTM_SSR_INCLUDED == FALSE */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800367
Myles Watson911d1ae2016-11-28 16:44:40 -0800368#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, \
369 min_local_lat) \
370 false
The Android Open Source Project5738f832012-12-12 16:00:35 -0800371
Myles Watson911d1ae2016-11-28 16:44:40 -0800372#endif /* BTM_SSR_INCLUDED */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800373
Myles Watson911d1ae2016-11-28 16:44:40 -0800374/* Extended Inquiry Response */
375extern void btsnd_hcic_write_ext_inquiry_response(void* buffer,
376 uint8_t fec_req);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800377
Myles Watson911d1ae2016-11-28 16:44:40 -0800378#define HCIC_PARAM_SIZE_EXT_INQ_RESP 241
The Android Open Source Project5738f832012-12-12 16:00:35 -0800379
Myles Watson911d1ae2016-11-28 16:44:40 -0800380#define HCIC_EXT_INQ_RESP_FEC_OFF 0
381#define HCIC_EXT_INQ_RESP_RESPONSE 1
382/* IO Capabilities Response */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700383extern void btsnd_hcic_io_cap_req_reply(const RawAddress& bd_addr,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700384 uint8_t capability, uint8_t oob_present,
385 uint8_t auth_req);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800386
Myles Watson911d1ae2016-11-28 16:44:40 -0800387#define HCIC_PARAM_SIZE_IO_CAP_RESP 9
The Android Open Source Project5738f832012-12-12 16:00:35 -0800388
Myles Watson911d1ae2016-11-28 16:44:40 -0800389#define HCI_IO_CAP_BD_ADDR_OFF 0
390#define HCI_IO_CAPABILITY_OFF 6
391#define HCI_IO_CAP_OOB_DATA_OFF 7
392#define HCI_IO_CAP_AUTH_REQ_OFF 8
The Android Open Source Project5738f832012-12-12 16:00:35 -0800393
Myles Watson911d1ae2016-11-28 16:44:40 -0800394/* IO Capabilities Req Neg Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700395extern void btsnd_hcic_io_cap_req_neg_reply(const RawAddress& bd_addr,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700396 uint8_t err_code);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800397
398#define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
399
Myles Watson911d1ae2016-11-28 16:44:40 -0800400#define HCI_IO_CAP_NR_BD_ADDR_OFF 0
401#define HCI_IO_CAP_NR_ERR_CODE 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800402
Myles Watson911d1ae2016-11-28 16:44:40 -0800403/* Read Local OOB Data */
404extern void btsnd_hcic_read_local_oob_data(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800405
Myles Watson911d1ae2016-11-28 16:44:40 -0800406#define HCIC_PARAM_SIZE_R_LOCAL_OOB 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800407
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700408extern void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800409
Myles Watson911d1ae2016-11-28 16:44:40 -0800410#define HCIC_PARAM_SIZE_UCONF_REPLY 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800411
Myles Watson911d1ae2016-11-28 16:44:40 -0800412#define HCI_USER_CONF_BD_ADDR_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800413
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700414extern void btsnd_hcic_user_passkey_reply(const RawAddress& bd_addr,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700415 uint32_t value);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800416
Myles Watson911d1ae2016-11-28 16:44:40 -0800417#define HCIC_PARAM_SIZE_U_PKEY_REPLY 10
The Android Open Source Project5738f832012-12-12 16:00:35 -0800418
Myles Watson911d1ae2016-11-28 16:44:40 -0800419#define HCI_USER_PASSKEY_BD_ADDR_OFF 0
420#define HCI_USER_PASSKEY_VALUE_OFF 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800421
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700422extern void btsnd_hcic_user_passkey_neg_reply(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800423
424#define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
425
426#define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
427
Myles Watson911d1ae2016-11-28 16:44:40 -0800428/* Remote OOB Data Request Reply */
Jakub Pawlowskiae572112018-06-14 17:40:34 -0700429extern void btsnd_hcic_rem_oob_reply(const RawAddress& bd_addr,
430 const Octet16& c, const Octet16& r);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800431
Myles Watson911d1ae2016-11-28 16:44:40 -0800432#define HCIC_PARAM_SIZE_REM_OOB_REPLY 38
The Android Open Source Project5738f832012-12-12 16:00:35 -0800433
Myles Watson911d1ae2016-11-28 16:44:40 -0800434#define HCI_REM_OOB_DATA_BD_ADDR_OFF 0
435#define HCI_REM_OOB_DATA_C_OFF 6
436#define HCI_REM_OOB_DATA_R_OFF 22
The Android Open Source Project5738f832012-12-12 16:00:35 -0800437
Myles Watson911d1ae2016-11-28 16:44:40 -0800438/* Remote OOB Data Request Negative Reply */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700439extern void btsnd_hcic_rem_oob_neg_reply(const RawAddress& bd_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800440
Myles Watson911d1ae2016-11-28 16:44:40 -0800441#define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800442
Myles Watson911d1ae2016-11-28 16:44:40 -0800443#define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800444
Myles Watson911d1ae2016-11-28 16:44:40 -0800445/* Read Tx Power Level */
446extern void btsnd_hcic_read_inq_tx_power(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800447
Myles Watson911d1ae2016-11-28 16:44:40 -0800448#define HCIC_PARAM_SIZE_R_TX_POWER 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800449
Myles Watson911d1ae2016-11-28 16:44:40 -0800450/* Read Default Erroneous Data Reporting */
451extern void btsnd_hcic_read_default_erroneous_data_rpt(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800452
Myles Watson911d1ae2016-11-28 16:44:40 -0800453#define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800454
Marie Janssend19e0782016-07-15 12:48:27 -0700455#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
Myles Watson911d1ae2016-11-28 16:44:40 -0800456extern void btsnd_hcic_enhanced_flush(uint16_t handle, uint8_t packet_type);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800457
Myles Watson911d1ae2016-11-28 16:44:40 -0800458#define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800459#endif
460
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700461extern void btsnd_hcic_send_keypress_notif(const RawAddress& bd_addr,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700462 uint8_t notif);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800463
Myles Watson911d1ae2016-11-28 16:44:40 -0800464#define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800465
Myles Watson911d1ae2016-11-28 16:44:40 -0800466#define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0
467#define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6
The Android Open Source Project5738f832012-12-12 16:00:35 -0800468
The Android Open Source Project5738f832012-12-12 16:00:35 -0800469/**** end of Simple Pairing Commands ****/
470
Myles Watson911d1ae2016-11-28 16:44:40 -0800471/* Store Current Settings */
472#define MAX_FILT_COND (sizeof(BD_ADDR) + 1)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800473
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700474extern void btsnd_hcic_set_event_filter(uint8_t filt_type,
Myles Watson911d1ae2016-11-28 16:44:40 -0800475 uint8_t filt_cond_type,
476 uint8_t* filt_cond,
477 uint8_t filt_cond_len);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800478
Myles Watson911d1ae2016-11-28 16:44:40 -0800479#define HCIC_PARAM_SIZE_SET_EVT_FILTER 9
The Android Open Source Project5738f832012-12-12 16:00:35 -0800480
Myles Watson911d1ae2016-11-28 16:44:40 -0800481#define HCI_FILT_COND_FILT_TYPE_OFF 0
482#define HCI_FILT_COND_COND_TYPE_OFF 1
483#define HCI_FILT_COND_FILT_OFF 2
484/* Set Event Filter */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800485
Myles Watson911d1ae2016-11-28 16:44:40 -0800486/* Delete Stored Key */
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700487extern void btsnd_hcic_delete_stored_key(const RawAddress& bd_addr,
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700488 bool delete_all_flag);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800489
Myles Watson911d1ae2016-11-28 16:44:40 -0800490#define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7
The Android Open Source Project5738f832012-12-12 16:00:35 -0800491
Myles Watson911d1ae2016-11-28 16:44:40 -0800492#define HCI_DELETE_KEY_BD_ADDR_OFF 0
493#define HCI_DELETE_KEY_ALL_FLAG_OFF 6
494/* Delete Stored Key */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800495
Myles Watson911d1ae2016-11-28 16:44:40 -0800496/* Change Local Name */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700497extern void btsnd_hcic_change_name(BD_NAME name);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800498
Myles Watson911d1ae2016-11-28 16:44:40 -0800499#define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN
The Android Open Source Project5738f832012-12-12 16:00:35 -0800500
Myles Watson911d1ae2016-11-28 16:44:40 -0800501#define HCI_CHANGE_NAME_NAME_OFF 0
502/* Change Local Name */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800503
Myles Watson911d1ae2016-11-28 16:44:40 -0800504#define HCIC_PARAM_SIZE_READ_CMD 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800505
Myles Watson911d1ae2016-11-28 16:44:40 -0800506#define HCIC_PARAM_SIZE_WRITE_PARAM1 1
The Android Open Source Project5738f832012-12-12 16:00:35 -0800507
Myles Watson911d1ae2016-11-28 16:44:40 -0800508#define HCIC_WRITE_PARAM1_PARAM_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800509
Myles Watson911d1ae2016-11-28 16:44:40 -0800510#define HCIC_PARAM_SIZE_WRITE_PARAM2 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800511
Myles Watson911d1ae2016-11-28 16:44:40 -0800512#define HCIC_WRITE_PARAM2_PARAM_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800513
Myles Watson911d1ae2016-11-28 16:44:40 -0800514#define HCIC_PARAM_SIZE_WRITE_PARAM3 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800515
Myles Watson911d1ae2016-11-28 16:44:40 -0800516#define HCIC_WRITE_PARAM3_PARAM_OFF 0
The Android Open Source Project5738f832012-12-12 16:00:35 -0800517
Myles Watson911d1ae2016-11-28 16:44:40 -0800518#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
The Android Open Source Project5738f832012-12-12 16:00:35 -0800519
Myles Watson911d1ae2016-11-28 16:44:40 -0800520extern void btsnd_hcic_write_pin_type(uint8_t type); /* Write PIN Type */
521extern void btsnd_hcic_write_auto_accept(uint8_t flag); /* Write Auto Accept */
522extern void btsnd_hcic_read_name(void); /* Read Local Name */
523extern void btsnd_hcic_write_page_tout(
524 uint16_t timeout); /* Write Page Timout */
525extern void btsnd_hcic_write_scan_enable(uint8_t flag); /* Write Scan Enable */
526extern void btsnd_hcic_write_pagescan_cfg(
527 uint16_t interval, uint16_t window); /* Write Page Scan Activity */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800528
Mudumba Ananth57f65082017-02-09 09:05:48 -0800529#define HCIC_PARAM_SIZE_ENH_SET_ESCO_CONN 59
530#define HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN 63
531
Myles Watson911d1ae2016-11-28 16:44:40 -0800532#define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800533
Myles Watson911d1ae2016-11-28 16:44:40 -0800534#define HCI_SCAN_CFG_INTERVAL_OFF 0
535#define HCI_SCAN_CFG_WINDOW_OFF 2
536/* Write Page Scan Activity */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800537
Myles Watson911d1ae2016-11-28 16:44:40 -0800538/* Write Inquiry Scan Activity */
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700539extern void btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800540
Myles Watson911d1ae2016-11-28 16:44:40 -0800541#define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800542
Myles Watson911d1ae2016-11-28 16:44:40 -0800543#define HCI_SCAN_CFG_INTERVAL_OFF 0
544#define HCI_SCAN_CFG_WINDOW_OFF 2
545/* Write Inquiry Scan Activity */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800546
Myles Watson911d1ae2016-11-28 16:44:40 -0800547extern void btsnd_hcic_write_auth_enable(
548 uint8_t flag); /* Write Authentication Enable */
549extern void btsnd_hcic_write_dev_class(
550 DEV_CLASS dev); /* Write Class of Device */
551extern void btsnd_hcic_write_voice_settings(
552 uint16_t flags); /* Write Voice Settings */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800553
554/* Host Controller to Host flow control */
Myles Watson911d1ae2016-11-28 16:44:40 -0800555#define HCI_HOST_FLOW_CTRL_OFF 0
556#define HCI_HOST_FLOW_CTRL_ACL_ON 1
557#define HCI_HOST_FLOW_CTRL_SCO_ON 2
558#define HCI_HOST_FLOW_CTRL_BOTH_ON 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800559
Myles Watson911d1ae2016-11-28 16:44:40 -0800560extern void btsnd_hcic_write_auto_flush_tout(
561 uint16_t handle, uint16_t timeout); /* Write Retransmit Timout */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800562
Pavlin Radoslavovb8568ae2017-09-01 16:09:27 -0700563#define HCIC_PARAM_SIZE_WRITE_AUTOMATIC_FLUSH_TIMEOUT 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800564
Myles Watson911d1ae2016-11-28 16:44:40 -0800565#define HCI_FLUSH_TOUT_HANDLE_OFF 0
566#define HCI_FLUSH_TOUT_TOUT_OFF 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800567
Myles Watson911d1ae2016-11-28 16:44:40 -0800568extern void btsnd_hcic_read_tx_power(uint16_t handle,
569 uint8_t type); /* Read Tx Power */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800570
Myles Watson911d1ae2016-11-28 16:44:40 -0800571#define HCIC_PARAM_SIZE_READ_TX_POWER 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800572
Myles Watson911d1ae2016-11-28 16:44:40 -0800573#define HCI_READ_TX_POWER_HANDLE_OFF 0
574#define HCI_READ_TX_POWER_TYPE_OFF 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800575
576/* Read transmit power level parameter */
Myles Watson911d1ae2016-11-28 16:44:40 -0800577#define HCI_READ_CURRENT 0x00
578#define HCI_READ_MAXIMUM 0x01
The Android Open Source Project5738f832012-12-12 16:00:35 -0800579
Myles Watson911d1ae2016-11-28 16:44:40 -0800580extern void btsnd_hcic_host_num_xmitted_pkts(
581 uint8_t num_handles, uint16_t* handle,
582 uint16_t* num_pkts); /* Set Host Buffer Size */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800583
Myles Watson911d1ae2016-11-28 16:44:40 -0800584#define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800585
Myles Watson911d1ae2016-11-28 16:44:40 -0800586#define MAX_DATA_HANDLES 10
The Android Open Source Project5738f832012-12-12 16:00:35 -0800587
Myles Watson911d1ae2016-11-28 16:44:40 -0800588#define HCI_PKTS_DONE_NUM_HANDLES_OFF 0
589#define HCI_PKTS_DONE_HANDLE_OFF 1
590#define HCI_PKTS_DONE_NUM_PKTS_OFF 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800591
Myles Watson911d1ae2016-11-28 16:44:40 -0800592/* Write Link Supervision Timeout */
593extern void btsnd_hcic_write_link_super_tout(uint8_t local_controller_id,
594 uint16_t handle, uint16_t timeout);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800595
Myles Watson911d1ae2016-11-28 16:44:40 -0800596#define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800597
Myles Watson911d1ae2016-11-28 16:44:40 -0800598#define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0
599#define HCI_LINK_SUPER_TOUT_TOUT_OFF 2
600/* Write Link Supervision Timeout */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800601
Myles Watson911d1ae2016-11-28 16:44:40 -0800602extern void btsnd_hcic_write_cur_iac_lap(
603 uint8_t num_cur_iac, LAP* const iac_lap); /* Write Current IAC LAP */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800604
Myles Watson911d1ae2016-11-28 16:44:40 -0800605#define MAX_IAC_LAPS 0x40
The Android Open Source Project5738f832012-12-12 16:00:35 -0800606
Myles Watson911d1ae2016-11-28 16:44:40 -0800607#define HCI_WRITE_IAC_LAP_NUM_OFF 0
608#define HCI_WRITE_IAC_LAP_LAP_OFF 1
609/* Write Current IAC LAP */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800610
Myles Watson911d1ae2016-11-28 16:44:40 -0800611extern void btsnd_hcic_get_link_quality(uint16_t handle); /* Get Link Quality */
612extern void btsnd_hcic_read_rssi(uint16_t handle); /* Read RSSI */
Jakub Pawlowski3c03d4f2019-02-14 12:44:06 +0100613using ReadEncKeySizeCb = base::OnceCallback<void(uint8_t, uint16_t, uint8_t)>;
614extern void btsnd_hcic_read_encryption_key_size(uint16_t handle, ReadEncKeySizeCb cb);
Pavlin Radoslavov6ab749f2017-08-31 22:06:11 -0700615extern void btsnd_hcic_read_failed_contact_counter(uint16_t handle);
Pavlin Radoslavovb8568ae2017-09-01 16:09:27 -0700616extern void btsnd_hcic_read_automatic_flush_timeout(uint16_t handle);
Myles Watson911d1ae2016-11-28 16:44:40 -0800617extern void btsnd_hcic_enable_test_mode(
618 void); /* Enable Device Under Test Mode */
619extern void btsnd_hcic_write_pagescan_type(
620 uint8_t type); /* Write Page Scan Type */
621extern void btsnd_hcic_write_inqscan_type(
622 uint8_t type); /* Write Inquiry Scan Type */
623extern void btsnd_hcic_write_inquiry_mode(
624 uint8_t type); /* Write Inquiry Mode */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800625
Mudumba Ananth57f65082017-02-09 09:05:48 -0800626/* Enhanced setup SCO connection (CSA2) */
627extern void btsnd_hcic_enhanced_set_up_synchronous_connection(
628 uint16_t conn_handle, enh_esco_params_t* p_parms);
629
630/* Enhanced accept SCO connection request (CSA2) */
631extern void btsnd_hcic_enhanced_accept_synchronous_connection(
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700632 const RawAddress& bd_addr, enh_esco_params_t* p_parms);
Mudumba Ananth57f65082017-02-09 09:05:48 -0800633
The Android Open Source Project5738f832012-12-12 16:00:35 -0800634#define HCI_DATA_HANDLE_MASK 0x0FFF
635
Myles Watson911d1ae2016-11-28 16:44:40 -0800636#define HCID_GET_HANDLE_EVENT(p) \
637 (uint16_t)((*((uint8_t*)((p) + 1) + (p)->offset) + \
638 (*((uint8_t*)((p) + 1) + (p)->offset + 1) << 8)))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800639
Myles Watson911d1ae2016-11-28 16:44:40 -0800640#define HCID_GET_HANDLE(u16) (uint16_t)((u16)&HCI_DATA_HANDLE_MASK)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800641
Myles Watson911d1ae2016-11-28 16:44:40 -0800642#define HCI_DATA_EVENT_MASK 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800643#define HCI_DATA_EVENT_OFFSET 12
Myles Watson911d1ae2016-11-28 16:44:40 -0800644#define HCID_GET_EVENT(u16) \
645 (uint8_t)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800646
Myles Watson911d1ae2016-11-28 16:44:40 -0800647#define HCI_DATA_BCAST_MASK 3
The Android Open Source Project5738f832012-12-12 16:00:35 -0800648#define HCI_DATA_BCAST_OFFSET 10
Myles Watson911d1ae2016-11-28 16:44:40 -0800649#define HCID_GET_BCAST(u16) \
650 (uint8_t)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800651
Myles Watson911d1ae2016-11-28 16:44:40 -0800652#define HCID_GET_ACL_LEN(p) \
653 (uint16_t)((*((uint8_t*)((p) + 1) + (p)->offset + 2) + \
654 (*((uint8_t*)((p) + 1) + (p)->offset + 3) << 8)))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800655
Myles Watson911d1ae2016-11-28 16:44:40 -0800656#define HCID_HEADER_SIZE 4
The Android Open Source Project5738f832012-12-12 16:00:35 -0800657
Myles Watson911d1ae2016-11-28 16:44:40 -0800658#define HCID_GET_SCO_LEN(p) (*((uint8_t*)((p) + 1) + (p)->offset + 2))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800659
Myles Watson911d1ae2016-11-28 16:44:40 -0800660extern void btsnd_hcic_vendor_spec_cmd(void* buffer, uint16_t opcode,
661 uint8_t len, uint8_t* p_data,
662 void* p_cmd_cplt_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800663
Myles Watsonee96a3c2016-11-23 14:49:54 -0800664/*******************************************************************************
665 * BLE Commands
Myles Watson9ca07092016-11-28 16:41:53 -0800666 * Note: "local_controller_id" is for transport, not counted in HCI
667 * message size
Myles Watsonee96a3c2016-11-23 14:49:54 -0800668 ******************************************************************************/
Myles Watson911d1ae2016-11-28 16:44:40 -0800669#define HCIC_BLE_RAND_DI_SIZE 8
Myles Watson911d1ae2016-11-28 16:44:40 -0800670#define HCIC_BLE_IRK_SIZE 16
Satya Calloji444a8da2015-03-06 10:38:22 -0800671
Myles Watson911d1ae2016-11-28 16:44:40 -0800672#define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8
673#define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6
674#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15
675#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31
676#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1
677#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7
678#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2
679#define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25
680#define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0
681#define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0
682#define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7
683#define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7
684#define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14
685#define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5
686#define HCIC_PARAM_SIZE_READ_CHNL_MAP 2
687#define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2
688#define HCIC_PARAM_SIZE_BLE_ENCRYPT 32
Priti Aghera636d6712014-12-18 13:55:48 -0800689#define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2
The Android Open Source Project5738f832012-12-12 16:00:35 -0800690
Myles Watson911d1ae2016-11-28 16:44:40 -0800691#define HCIC_BLE_RAND_DI_SIZE 8
692#define HCIC_BLE_ENCRYT_KEY_SIZE 16
693#define HCIC_PARAM_SIZE_BLE_START_ENC \
694 (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
695#define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
696#define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2
697#define HCIC_BLE_CHNL_MAP_SIZE 5
698#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31
The Android Open Source Project5738f832012-12-12 16:00:35 -0800699
Myles Watson911d1ae2016-11-28 16:44:40 -0800700#define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
701#define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
Jakub Pawlowskif6db7cb2017-04-07 06:19:50 -0700702#define HCIC_PARAM_SIZE_BLE_SET_PRIVACY_MODE 8
Myles Watson911d1ae2016-11-28 16:44:40 -0800703#define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
704#define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
705#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
706#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL 7
707#define HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE 1
708#define HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT 2
Avish Shah5a475e72017-04-13 17:15:20 +0530709
710#define HCIC_PARAM_SIZE_BLE_READ_PHY 2
711#define HCIC_PARAM_SIZE_BLE_SET_DEFAULT_PHY 3
712#define HCIC_PARAM_SIZE_BLE_SET_PHY 7
713#define HCIC_PARAM_SIZE_BLE_ENH_RX_TEST 3
714#define HCIC_PARAM_SIZE_BLE_ENH_TX_TEST 4
715
Myles Watson911d1ae2016-11-28 16:44:40 -0800716#define HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH 6
717#define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM 11
Satya Calloji444a8da2015-03-06 10:38:22 -0800718
The Android Open Source Project5738f832012-12-12 16:00:35 -0800719/* ULP HCI command */
Myles Watson911d1ae2016-11-28 16:44:40 -0800720extern void btsnd_hcic_ble_set_evt_mask(BT_EVENT_MASK event_mask);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800721
Myles Watson911d1ae2016-11-28 16:44:40 -0800722extern void btsnd_hcic_ble_read_buffer_size(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800723
Myles Watson911d1ae2016-11-28 16:44:40 -0800724extern void btsnd_hcic_ble_read_local_spt_feat(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800725
Myles Watson911d1ae2016-11-28 16:44:40 -0800726extern void btsnd_hcic_ble_set_local_used_feat(uint8_t feat_set[8]);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800727
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700728extern void btsnd_hcic_ble_set_random_addr(const RawAddress& random_addr);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800729
Myles Watson911d1ae2016-11-28 16:44:40 -0800730extern void btsnd_hcic_ble_write_adv_params(
731 uint16_t adv_int_min, uint16_t adv_int_max, uint8_t adv_type,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700732 uint8_t addr_type_own, uint8_t addr_type_dir, const RawAddress& direct_bda,
Myles Watson911d1ae2016-11-28 16:44:40 -0800733 uint8_t channel_map, uint8_t adv_filter_policy);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800734
Myles Watson911d1ae2016-11-28 16:44:40 -0800735extern void btsnd_hcic_ble_read_adv_chnl_tx_power(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800736
Myles Watson911d1ae2016-11-28 16:44:40 -0800737extern void btsnd_hcic_ble_set_adv_data(uint8_t data_len, uint8_t* p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800738
Myles Watson911d1ae2016-11-28 16:44:40 -0800739extern void btsnd_hcic_ble_set_scan_rsp_data(uint8_t data_len,
740 uint8_t* p_scan_rsp);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800741
Myles Watson911d1ae2016-11-28 16:44:40 -0800742extern void btsnd_hcic_ble_set_adv_enable(uint8_t adv_enable);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800743
Myles Watson911d1ae2016-11-28 16:44:40 -0800744extern void btsnd_hcic_ble_set_scan_params(uint8_t scan_type, uint16_t scan_int,
745 uint16_t scan_win, uint8_t addr_type,
746 uint8_t scan_filter_policy);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800747
Myles Watson911d1ae2016-11-28 16:44:40 -0800748extern void btsnd_hcic_ble_set_scan_enable(uint8_t scan_enable,
749 uint8_t duplicate);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800750
Myles Watson911d1ae2016-11-28 16:44:40 -0800751extern void btsnd_hcic_ble_create_ll_conn(
752 uint16_t scan_int, uint16_t scan_win, uint8_t init_filter_policy,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700753 uint8_t addr_type_peer, const RawAddress& bda_peer, uint8_t addr_type_own,
Myles Watson911d1ae2016-11-28 16:44:40 -0800754 uint16_t conn_int_min, uint16_t conn_int_max, uint16_t conn_latency,
755 uint16_t conn_timeout, uint16_t min_ce_len, uint16_t max_ce_len);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800756
Myles Watson911d1ae2016-11-28 16:44:40 -0800757extern void btsnd_hcic_ble_create_conn_cancel(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800758
Myles Watson911d1ae2016-11-28 16:44:40 -0800759extern void btsnd_hcic_ble_read_white_list_size(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800760
Jakub Pawlowski553e88b2018-10-30 22:49:30 +0100761extern void btsnd_hcic_ble_clear_white_list(
762 base::OnceCallback<void(uint8_t*, uint16_t)> cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800763
Jakub Pawlowski553e88b2018-10-30 22:49:30 +0100764extern void btsnd_hcic_ble_add_white_list(
765 uint8_t addr_type, const RawAddress& bda,
766 base::OnceCallback<void(uint8_t*, uint16_t)> cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800767
Jakub Pawlowski553e88b2018-10-30 22:49:30 +0100768extern void btsnd_hcic_ble_remove_from_white_list(
769 uint8_t addr_type, const RawAddress& bda,
770 base::OnceCallback<void(uint8_t*, uint16_t)> cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800771
Myles Watson911d1ae2016-11-28 16:44:40 -0800772extern void btsnd_hcic_ble_upd_ll_conn_params(
773 uint16_t handle, uint16_t conn_int_min, uint16_t conn_int_max,
774 uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_len,
775 uint16_t max_len);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800776
Myles Watson911d1ae2016-11-28 16:44:40 -0800777extern void btsnd_hcic_ble_set_host_chnl_class(
778 uint8_t chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800779
Myles Watson911d1ae2016-11-28 16:44:40 -0800780extern void btsnd_hcic_ble_read_chnl_map(uint16_t handle);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800781
Myles Watson911d1ae2016-11-28 16:44:40 -0800782extern void btsnd_hcic_ble_read_remote_feat(uint16_t handle);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800783
Myles Watson911d1ae2016-11-28 16:44:40 -0800784extern void btsnd_hcic_ble_encrypt(uint8_t* key, uint8_t key_len,
785 uint8_t* plain_text, uint8_t pt_len,
786 void* p_cmd_cplt_cback);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800787
Jakub Pawlowski0c683232017-02-24 09:49:59 -0800788extern void btsnd_hcic_ble_rand(base::Callback<void(BT_OCTET8)> cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800789
Myles Watson911d1ae2016-11-28 16:44:40 -0800790extern void btsnd_hcic_ble_start_enc(uint16_t handle,
791 uint8_t rand[HCIC_BLE_RAND_DI_SIZE],
Jakub Pawlowskiae572112018-06-14 17:40:34 -0700792 uint16_t ediv, const Octet16& ltk);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800793
Jakub Pawlowskiae572112018-06-14 17:40:34 -0700794extern void btsnd_hcic_ble_ltk_req_reply(uint16_t handle, const Octet16& ltk);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800795
Myles Watson911d1ae2016-11-28 16:44:40 -0800796extern void btsnd_hcic_ble_ltk_req_neg_reply(uint16_t handle);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800797
Myles Watson911d1ae2016-11-28 16:44:40 -0800798extern void btsnd_hcic_ble_read_supported_states(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800799
Myles Watson911d1ae2016-11-28 16:44:40 -0800800extern void btsnd_hcic_ble_write_host_supported(uint8_t le_host_spt,
801 uint8_t simul_le_host_spt);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800802
Myles Watson911d1ae2016-11-28 16:44:40 -0800803extern void btsnd_hcic_ble_read_host_supported(void);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800804
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700805extern void btsnd_hcic_ble_receiver_test(uint8_t rx_freq);
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800806
Myles Watson911d1ae2016-11-28 16:44:40 -0800807extern void btsnd_hcic_ble_transmitter_test(uint8_t tx_freq,
808 uint8_t test_data_len,
809 uint8_t payload);
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700810extern void btsnd_hcic_ble_test_end(void);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800811
Marie Janssend19e0782016-07-15 12:48:27 -0700812#if (BLE_LLT_INCLUDED == TRUE)
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700813
Myles Watson911d1ae2016-11-28 16:44:40 -0800814#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14
815extern void btsnd_hcic_ble_rc_param_req_reply(
816 uint16_t handle, uint16_t conn_int_min, uint16_t conn_int_max,
817 uint16_t conn_latency, uint16_t conn_timeout, uint16_t min_ce_len,
818 uint16_t max_ce_len);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700819
Myles Watson911d1ae2016-11-28 16:44:40 -0800820#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3
821extern void btsnd_hcic_ble_rc_param_req_neg_reply(uint16_t handle,
822 uint8_t reason);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700823
824#endif /* BLE_LLT_INCLUDED */
825
Myles Watson911d1ae2016-11-28 16:44:40 -0800826extern void btsnd_hcic_ble_set_data_length(uint16_t conn_handle,
827 uint16_t tx_octets,
828 uint16_t tx_time);
Ganesh Ganapathi Batta7fa4fba2014-04-16 16:50:09 -0700829
Jakub Pawlowskiae572112018-06-14 17:40:34 -0700830extern void btsnd_hcic_ble_add_device_resolving_list(uint8_t addr_type_peer,
831 const RawAddress& bda_peer,
832 const Octet16& irk_peer,
833 const Octet16& irk_local);
Satya Calloji444a8da2015-03-06 10:38:22 -0800834
Jakub Pawlowski9df2a552016-12-02 11:34:06 -0800835struct scanning_phy_cfg {
836 uint8_t scan_type;
837 uint16_t scan_int;
838 uint16_t scan_win;
839};
840
841extern void btsnd_hcic_ble_set_extended_scan_params(
842 uint8_t own_address_type, uint8_t scanning_filter_policy,
843 uint8_t scanning_phys, scanning_phy_cfg* phy_cfg);
844
845extern void btsnd_hcic_ble_set_extended_scan_enable(uint8_t enable,
846 uint8_t filter_duplicates,
847 uint16_t duration,
848 uint16_t period);
849
Jakub Pawlowski93df8602017-02-15 08:35:30 -0800850struct EXT_CONN_PHY_CFG {
851 uint16_t scan_int;
852 uint16_t scan_win;
853 uint16_t conn_int_min;
854 uint16_t conn_int_max;
855 uint16_t conn_latency;
856 uint16_t sup_timeout;
857 uint16_t min_ce_len;
858 uint16_t max_ce_len;
859};
860
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700861extern void btsnd_hcic_ble_ext_create_conn(uint8_t init_filter_policy,
862 uint8_t addr_type_own,
863 uint8_t addr_type_peer,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700864 const RawAddress& bda_peer,
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700865 uint8_t initiating_phys,
866 EXT_CONN_PHY_CFG* phy_cfg);
Jakub Pawlowski93df8602017-02-15 08:35:30 -0800867
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700868extern void btsnd_hcic_ble_rm_device_resolving_list(uint8_t addr_type_peer,
869 const RawAddress& bda_peer);
Satya Calloji444a8da2015-03-06 10:38:22 -0800870
Jakub Pawlowskif6db7cb2017-04-07 06:19:50 -0700871extern void btsnd_hcic_ble_set_privacy_mode(uint8_t addr_type_peer,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700872 const RawAddress& bda_peer,
Jakub Pawlowskif6db7cb2017-04-07 06:19:50 -0700873 uint8_t privacy_type);
874
Myles Watson911d1ae2016-11-28 16:44:40 -0800875extern void btsnd_hcic_ble_clear_resolving_list(void);
Satya Calloji444a8da2015-03-06 10:38:22 -0800876
Jakub Pawlowskic2276b02017-06-09 16:00:25 -0700877extern void btsnd_hcic_ble_read_resolvable_addr_peer(
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700878 uint8_t addr_type_peer, const RawAddress& bda_peer);
Satya Calloji444a8da2015-03-06 10:38:22 -0800879
Jakub Pawlowskib8a477e2017-06-16 15:16:15 -0700880extern void btsnd_hcic_ble_read_resolvable_addr_local(
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700881 uint8_t addr_type_peer, const RawAddress& bda_peer);
Satya Calloji444a8da2015-03-06 10:38:22 -0800882
Myles Watson911d1ae2016-11-28 16:44:40 -0800883extern void btsnd_hcic_ble_set_addr_resolution_enable(
884 uint8_t addr_resolution_enable);
Satya Calloji444a8da2015-03-06 10:38:22 -0800885
Myles Watson911d1ae2016-11-28 16:44:40 -0800886extern void btsnd_hcic_ble_set_rand_priv_addr_timeout(uint16_t rpa_timout);
Satya Calloji444a8da2015-03-06 10:38:22 -0800887
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700888extern void btsnd_hcic_read_authenticated_payload_tout(uint16_t handle);
Satya Calloji444a8da2015-03-06 10:38:22 -0800889
Jakub Pawlowski763abdf2016-10-10 11:39:39 -0700890extern void btsnd_hcic_write_authenticated_payload_tout(uint16_t handle,
Myles Watson911d1ae2016-11-28 16:44:40 -0800891 uint16_t timeout);
Satya Calloji444a8da2015-03-06 10:38:22 -0800892
Myles Watson911d1ae2016-11-28 16:44:40 -0800893#define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT 4
Satya Calloji444a8da2015-03-06 10:38:22 -0800894
Myles Watson911d1ae2016-11-28 16:44:40 -0800895#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF 0
896#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_TOUT_OFF 2
Satya Calloji444a8da2015-03-06 10:38:22 -0800897
The Android Open Source Project5738f832012-12-12 16:00:35 -0800898#endif