The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
Jakub Pawlowski | 5b790fe | 2017-09-18 09:00:20 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright 1999-2012 Broadcom Corporation |
| 4 | * |
| 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 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 18 | |
| 19 | /****************************************************************************** |
| 20 | * |
| 21 | * This file contains function of the HCIC unit to format and send HCI |
| 22 | * commands. |
| 23 | * |
| 24 | ******************************************************************************/ |
| 25 | |
Pavlin Radoslavov | 258c253 | 2015-09-27 20:59:05 -0700 | [diff] [blame] | 26 | #include "bt_common.h" |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 27 | #include "bt_target.h" |
| 28 | #include "btu.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 29 | #include "hcidefs.h" |
| 30 | #include "hcimsgs.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 31 | |
| 32 | #include <stddef.h> |
| 33 | #include <string.h> |
| 34 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 35 | #include "btm_int.h" /* Included for UIPC_* macro definitions */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 36 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 37 | void btsnd_hcic_inquiry(const LAP inq_lap, uint8_t duration, |
| 38 | uint8_t response_cnt) { |
| 39 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 40 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 41 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 42 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQUIRY; |
| 43 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 44 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 45 | UINT16_TO_STREAM(pp, HCI_INQUIRY); |
| 46 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_INQUIRY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 47 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 48 | LAP_TO_STREAM(pp, inq_lap); |
| 49 | UINT8_TO_STREAM(pp, duration); |
| 50 | UINT8_TO_STREAM(pp, response_cnt); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 51 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 52 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 53 | } |
| 54 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 55 | void btsnd_hcic_inq_cancel(void) { |
| 56 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 57 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 58 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 59 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL; |
| 60 | p->offset = 0; |
| 61 | UINT16_TO_STREAM(pp, HCI_INQUIRY_CANCEL); |
| 62 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_INQ_CANCEL); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 63 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 64 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 65 | } |
| 66 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 67 | void btsnd_hcic_per_inq_mode(uint16_t max_period, uint16_t min_period, |
| 68 | const LAP inq_lap, uint8_t duration, |
| 69 | uint8_t response_cnt) { |
| 70 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 71 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 72 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 73 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PER_INQ_MODE; |
| 74 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 75 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 76 | UINT16_TO_STREAM(pp, HCI_PERIODIC_INQUIRY_MODE); |
| 77 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_PER_INQ_MODE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 78 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 79 | UINT16_TO_STREAM(pp, max_period); |
| 80 | UINT16_TO_STREAM(pp, min_period); |
| 81 | LAP_TO_STREAM(pp, inq_lap); |
| 82 | UINT8_TO_STREAM(pp, duration); |
| 83 | UINT8_TO_STREAM(pp, response_cnt); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 84 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 85 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 86 | } |
| 87 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 88 | void btsnd_hcic_exit_per_inq(void) { |
| 89 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 90 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 91 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 92 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXIT_PER_INQ; |
| 93 | p->offset = 0; |
| 94 | UINT16_TO_STREAM(pp, HCI_EXIT_PERIODIC_INQUIRY_MODE); |
| 95 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_EXIT_PER_INQ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 96 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 97 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 98 | } |
| 99 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 100 | void btsnd_hcic_create_conn(const RawAddress& dest, uint16_t packet_types, |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 101 | uint8_t page_scan_rep_mode, uint8_t page_scan_mode, |
| 102 | uint16_t clock_offset, uint8_t allow_switch) { |
| 103 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 104 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 105 | |
| 106 | #ifndef BT_10A |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 107 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 108 | #else |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 109 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN - 1; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 110 | #endif |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 111 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 112 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 113 | UINT16_TO_STREAM(pp, HCI_CREATE_CONNECTION); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 114 | #ifndef BT_10A |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 115 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CREATE_CONN); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 116 | #else |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 117 | UINT8_TO_STREAM(pp, (HCIC_PARAM_SIZE_CREATE_CONN - 1)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 118 | #endif |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 119 | BDADDR_TO_STREAM(pp, dest); |
| 120 | UINT16_TO_STREAM(pp, packet_types); |
| 121 | UINT8_TO_STREAM(pp, page_scan_rep_mode); |
| 122 | UINT8_TO_STREAM(pp, page_scan_mode); |
| 123 | UINT16_TO_STREAM(pp, clock_offset); |
| 124 | #if !defined(BT_10A) |
| 125 | UINT8_TO_STREAM(pp, allow_switch); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 126 | #endif |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 127 | btm_acl_paging(p, dest); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 128 | } |
| 129 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 130 | void btsnd_hcic_disconnect(uint16_t handle, uint8_t reason) { |
| 131 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 132 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 133 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 134 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DISCONNECT; |
| 135 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 136 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 137 | UINT16_TO_STREAM(pp, HCI_DISCONNECT); |
| 138 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_DISCONNECT); |
| 139 | UINT16_TO_STREAM(pp, handle); |
| 140 | UINT8_TO_STREAM(pp, reason); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 141 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 142 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 143 | } |
| 144 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 145 | void btsnd_hcic_add_SCO_conn(uint16_t handle, uint16_t packet_types) { |
| 146 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 147 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 148 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 149 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ADD_SCO_CONN; |
| 150 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 151 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 152 | UINT16_TO_STREAM(pp, HCI_ADD_SCO_CONNECTION); |
| 153 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ADD_SCO_CONN); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 154 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 155 | UINT16_TO_STREAM(pp, handle); |
| 156 | UINT16_TO_STREAM(pp, packet_types); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 157 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 158 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 159 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 160 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 161 | void btsnd_hcic_create_conn_cancel(const RawAddress& dest) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 162 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 163 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 164 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 165 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN_CANCEL; |
| 166 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 167 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 168 | UINT16_TO_STREAM(pp, HCI_CREATE_CONNECTION_CANCEL); |
| 169 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CREATE_CONN_CANCEL); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 170 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 171 | BDADDR_TO_STREAM(pp, dest); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 172 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 173 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 174 | } |
| 175 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 176 | void btsnd_hcic_accept_conn(const RawAddress& dest, uint8_t role) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 177 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 178 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 179 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 180 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_CONN; |
| 181 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 182 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 183 | UINT16_TO_STREAM(pp, HCI_ACCEPT_CONNECTION_REQUEST); |
| 184 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ACCEPT_CONN); |
| 185 | BDADDR_TO_STREAM(pp, dest); |
| 186 | UINT8_TO_STREAM(pp, role); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 187 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 188 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 189 | } |
| 190 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 191 | void btsnd_hcic_reject_conn(const RawAddress& dest, uint8_t reason) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 192 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 193 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 194 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 195 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_CONN; |
| 196 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 197 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 198 | UINT16_TO_STREAM(pp, HCI_REJECT_CONNECTION_REQUEST); |
| 199 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_REJECT_CONN); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 200 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 201 | BDADDR_TO_STREAM(pp, dest); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 202 | UINT8_TO_STREAM(pp, reason); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 203 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 204 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 205 | } |
| 206 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 207 | void btsnd_hcic_link_key_req_reply(const RawAddress& bd_addr, |
Jakub Pawlowski | ae57211 | 2018-06-14 17:40:34 -0700 | [diff] [blame] | 208 | const LinkKey& link_key) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 209 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 210 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 211 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 212 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY; |
| 213 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 214 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 215 | UINT16_TO_STREAM(pp, HCI_LINK_KEY_REQUEST_REPLY); |
| 216 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 217 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 218 | BDADDR_TO_STREAM(pp, bd_addr); |
Jakub Pawlowski | ae57211 | 2018-06-14 17:40:34 -0700 | [diff] [blame] | 219 | ARRAY16_TO_STREAM(pp, link_key.data()); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 220 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 221 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 222 | } |
| 223 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 224 | void btsnd_hcic_link_key_neg_reply(const RawAddress& bd_addr) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 225 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 226 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 227 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 228 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY; |
| 229 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 230 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 231 | UINT16_TO_STREAM(pp, HCI_LINK_KEY_REQUEST_NEG_REPLY); |
| 232 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 233 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 234 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 235 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 236 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 237 | } |
| 238 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 239 | void btsnd_hcic_pin_code_req_reply(const RawAddress& bd_addr, |
Jakub Pawlowski | c2276b0 | 2017-06-09 16:00:25 -0700 | [diff] [blame] | 240 | uint8_t pin_code_len, PIN_CODE pin_code) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 241 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 242 | uint8_t* pp = (uint8_t*)(p + 1); |
| 243 | int i; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 244 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 245 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY; |
| 246 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 247 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 248 | UINT16_TO_STREAM(pp, HCI_PIN_CODE_REQUEST_REPLY); |
| 249 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 250 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 251 | BDADDR_TO_STREAM(pp, bd_addr); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 252 | UINT8_TO_STREAM(pp, pin_code_len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 253 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 254 | for (i = 0; i < pin_code_len; i++) *pp++ = *pin_code++; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 255 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 256 | for (; i < PIN_CODE_LEN; i++) *pp++ = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 257 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 258 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 259 | } |
| 260 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 261 | void btsnd_hcic_pin_code_neg_reply(const RawAddress& bd_addr) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 262 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 263 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 264 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 265 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY; |
| 266 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 267 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 268 | UINT16_TO_STREAM(pp, HCI_PIN_CODE_REQUEST_NEG_REPLY); |
| 269 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 270 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 271 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 272 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 273 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 274 | } |
| 275 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 276 | void btsnd_hcic_change_conn_type(uint16_t handle, uint16_t packet_types) { |
| 277 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 278 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 279 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 280 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_CONN_TYPE; |
| 281 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 282 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 283 | UINT16_TO_STREAM(pp, HCI_CHANGE_CONN_PACKET_TYPE); |
| 284 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CHANGE_CONN_TYPE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 285 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 286 | UINT16_TO_STREAM(pp, handle); |
| 287 | UINT16_TO_STREAM(pp, packet_types); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 288 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 289 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 290 | } |
| 291 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 292 | void btsnd_hcic_auth_request(uint16_t handle) { |
| 293 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 294 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 295 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 296 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 297 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 298 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 299 | UINT16_TO_STREAM(pp, HCI_AUTHENTICATION_REQUESTED); |
| 300 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 301 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 302 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 303 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 304 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 305 | } |
| 306 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 307 | void btsnd_hcic_set_conn_encrypt(uint16_t handle, bool enable) { |
| 308 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 309 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 310 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 311 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_CONN_ENCRYPT; |
| 312 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 313 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 314 | UINT16_TO_STREAM(pp, HCI_SET_CONN_ENCRYPTION); |
| 315 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONN_ENCRYPT); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 316 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 317 | UINT16_TO_STREAM(pp, handle); |
| 318 | UINT8_TO_STREAM(pp, enable); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 319 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 320 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 321 | } |
| 322 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 323 | void btsnd_hcic_rmt_name_req(const RawAddress& bd_addr, |
Jakub Pawlowski | c2276b0 | 2017-06-09 16:00:25 -0700 | [diff] [blame] | 324 | uint8_t page_scan_rep_mode, uint8_t page_scan_mode, |
| 325 | uint16_t clock_offset) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 326 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 327 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 328 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 329 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ; |
| 330 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 331 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 332 | UINT16_TO_STREAM(pp, HCI_RMT_NAME_REQUEST); |
| 333 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_RMT_NAME_REQ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 334 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 335 | BDADDR_TO_STREAM(pp, bd_addr); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 336 | UINT8_TO_STREAM(pp, page_scan_rep_mode); |
| 337 | UINT8_TO_STREAM(pp, page_scan_mode); |
| 338 | UINT16_TO_STREAM(pp, clock_offset); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 339 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 340 | btm_acl_paging(p, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 341 | } |
| 342 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 343 | void btsnd_hcic_rmt_name_req_cancel(const RawAddress& bd_addr) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 344 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 345 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 346 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 347 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL; |
| 348 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 349 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 350 | UINT16_TO_STREAM(pp, HCI_RMT_NAME_REQUEST_CANCEL); |
| 351 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 352 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 353 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 354 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 355 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 356 | } |
| 357 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 358 | void btsnd_hcic_rmt_features_req(uint16_t handle) { |
| 359 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 360 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 361 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 362 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 363 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 364 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 365 | UINT16_TO_STREAM(pp, HCI_READ_RMT_FEATURES); |
| 366 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 367 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 368 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 369 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 370 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 371 | } |
| 372 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 373 | void btsnd_hcic_rmt_ext_features(uint16_t handle, uint8_t page_num) { |
| 374 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 375 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 376 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 377 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_EXT_FEATURES; |
| 378 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 379 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 380 | UINT16_TO_STREAM(pp, HCI_READ_RMT_EXT_FEATURES); |
| 381 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_RMT_EXT_FEATURES); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 382 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 383 | UINT16_TO_STREAM(pp, handle); |
| 384 | UINT8_TO_STREAM(pp, page_num); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 385 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 386 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 387 | } |
| 388 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 389 | void btsnd_hcic_rmt_ver_req(uint16_t handle) { |
| 390 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 391 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 392 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 393 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 394 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 395 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 396 | UINT16_TO_STREAM(pp, HCI_READ_RMT_VERSION_INFO); |
| 397 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 398 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 399 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 400 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 401 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 402 | } |
| 403 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 404 | void btsnd_hcic_read_rmt_clk_offset(uint16_t handle) { |
| 405 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 406 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 407 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 408 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 409 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 410 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 411 | UINT16_TO_STREAM(pp, HCI_READ_RMT_CLOCK_OFFSET); |
| 412 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 413 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 414 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 415 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 416 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 417 | } |
| 418 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 419 | void btsnd_hcic_read_lmp_handle(uint16_t handle) { |
| 420 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 421 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 422 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 423 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 424 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 425 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 426 | UINT16_TO_STREAM(pp, HCI_READ_LMP_HANDLE); |
| 427 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 428 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 429 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 430 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 431 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 432 | } |
| 433 | |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 434 | void btsnd_hcic_setup_esco_conn(uint16_t handle, uint32_t transmit_bandwidth, |
| 435 | uint32_t receive_bandwidth, |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 436 | uint16_t max_latency, uint16_t voice, |
| 437 | uint8_t retrans_effort, uint16_t packet_types) { |
| 438 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 439 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 440 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 441 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SETUP_ESCO; |
| 442 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 443 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 444 | UINT16_TO_STREAM(pp, HCI_SETUP_ESCO_CONNECTION); |
| 445 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SETUP_ESCO); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 446 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 447 | UINT16_TO_STREAM(pp, handle); |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 448 | UINT32_TO_STREAM(pp, transmit_bandwidth); |
| 449 | UINT32_TO_STREAM(pp, receive_bandwidth); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 450 | UINT16_TO_STREAM(pp, max_latency); |
| 451 | UINT16_TO_STREAM(pp, voice); |
| 452 | UINT8_TO_STREAM(pp, retrans_effort); |
| 453 | UINT16_TO_STREAM(pp, packet_types); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 454 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 455 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 456 | } |
| 457 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 458 | void btsnd_hcic_accept_esco_conn(const RawAddress& bd_addr, |
Jakub Pawlowski | c2276b0 | 2017-06-09 16:00:25 -0700 | [diff] [blame] | 459 | uint32_t transmit_bandwidth, |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 460 | uint32_t receive_bandwidth, |
| 461 | uint16_t max_latency, uint16_t content_fmt, |
| 462 | uint8_t retrans_effort, |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 463 | uint16_t packet_types) { |
| 464 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 465 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 466 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 467 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ACCEPT_ESCO; |
| 468 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 469 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 470 | UINT16_TO_STREAM(pp, HCI_ACCEPT_ESCO_CONNECTION); |
| 471 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ACCEPT_ESCO); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 472 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 473 | BDADDR_TO_STREAM(pp, bd_addr); |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 474 | UINT32_TO_STREAM(pp, transmit_bandwidth); |
| 475 | UINT32_TO_STREAM(pp, receive_bandwidth); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 476 | UINT16_TO_STREAM(pp, max_latency); |
| 477 | UINT16_TO_STREAM(pp, content_fmt); |
| 478 | UINT8_TO_STREAM(pp, retrans_effort); |
| 479 | UINT16_TO_STREAM(pp, packet_types); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 480 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 481 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 482 | } |
| 483 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 484 | void btsnd_hcic_reject_esco_conn(const RawAddress& bd_addr, uint8_t reason) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 485 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 486 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 487 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 488 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_ESCO; |
| 489 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 490 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 491 | UINT16_TO_STREAM(pp, HCI_REJECT_ESCO_CONNECTION); |
| 492 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_REJECT_ESCO); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 493 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 494 | BDADDR_TO_STREAM(pp, bd_addr); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 495 | UINT8_TO_STREAM(pp, reason); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 496 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 497 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 498 | } |
| 499 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 500 | void btsnd_hcic_hold_mode(uint16_t handle, uint16_t max_hold_period, |
| 501 | uint16_t min_hold_period) { |
| 502 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 503 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 504 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 505 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_HOLD_MODE; |
| 506 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 507 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 508 | UINT16_TO_STREAM(pp, HCI_HOLD_MODE); |
| 509 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_HOLD_MODE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 510 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 511 | UINT16_TO_STREAM(pp, handle); |
| 512 | UINT16_TO_STREAM(pp, max_hold_period); |
| 513 | UINT16_TO_STREAM(pp, min_hold_period); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 514 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 515 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 516 | } |
| 517 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 518 | void btsnd_hcic_sniff_mode(uint16_t handle, uint16_t max_sniff_period, |
| 519 | uint16_t min_sniff_period, uint16_t sniff_attempt, |
| 520 | uint16_t sniff_timeout) { |
| 521 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 522 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 523 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 524 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_MODE; |
| 525 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 526 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 527 | UINT16_TO_STREAM(pp, HCI_SNIFF_MODE); |
| 528 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SNIFF_MODE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 529 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 530 | UINT16_TO_STREAM(pp, handle); |
| 531 | UINT16_TO_STREAM(pp, max_sniff_period); |
| 532 | UINT16_TO_STREAM(pp, min_sniff_period); |
| 533 | UINT16_TO_STREAM(pp, sniff_attempt); |
| 534 | UINT16_TO_STREAM(pp, sniff_timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 535 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 536 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 537 | } |
| 538 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 539 | void btsnd_hcic_exit_sniff_mode(uint16_t handle) { |
| 540 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 541 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 542 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 543 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 544 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 545 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 546 | UINT16_TO_STREAM(pp, HCI_EXIT_SNIFF_MODE); |
| 547 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 548 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 549 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 550 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 551 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 552 | } |
| 553 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 554 | void btsnd_hcic_park_mode(uint16_t handle, uint16_t beacon_max_interval, |
| 555 | uint16_t beacon_min_interval) { |
| 556 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 557 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 558 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 559 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_PARK_MODE; |
| 560 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 561 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 562 | UINT16_TO_STREAM(pp, HCI_PARK_MODE); |
| 563 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_PARK_MODE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 564 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 565 | UINT16_TO_STREAM(pp, handle); |
| 566 | UINT16_TO_STREAM(pp, beacon_max_interval); |
| 567 | UINT16_TO_STREAM(pp, beacon_min_interval); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 568 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 569 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 570 | } |
| 571 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 572 | void btsnd_hcic_exit_park_mode(uint16_t handle) { |
| 573 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 574 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 575 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 576 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 577 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 578 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 579 | UINT16_TO_STREAM(pp, HCI_EXIT_PARK_MODE); |
| 580 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 581 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 582 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 583 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 584 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 585 | } |
| 586 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 587 | void btsnd_hcic_qos_setup(uint16_t handle, uint8_t flags, uint8_t service_type, |
| 588 | uint32_t token_rate, uint32_t peak, uint32_t latency, |
| 589 | uint32_t delay_var) { |
| 590 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 591 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 592 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 593 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_QOS_SETUP; |
| 594 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 595 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 596 | UINT16_TO_STREAM(pp, HCI_QOS_SETUP); |
| 597 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_QOS_SETUP); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 598 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 599 | UINT16_TO_STREAM(pp, handle); |
| 600 | UINT8_TO_STREAM(pp, flags); |
| 601 | UINT8_TO_STREAM(pp, service_type); |
| 602 | UINT32_TO_STREAM(pp, token_rate); |
| 603 | UINT32_TO_STREAM(pp, peak); |
| 604 | UINT32_TO_STREAM(pp, latency); |
| 605 | UINT32_TO_STREAM(pp, delay_var); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 606 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 607 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 608 | } |
| 609 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 610 | void btsnd_hcic_switch_role(const RawAddress& bd_addr, uint8_t role) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 611 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 612 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 613 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 614 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SWITCH_ROLE; |
| 615 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 616 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 617 | UINT16_TO_STREAM(pp, HCI_SWITCH_ROLE); |
| 618 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SWITCH_ROLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 619 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 620 | BDADDR_TO_STREAM(pp, bd_addr); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 621 | UINT8_TO_STREAM(pp, role); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 622 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 623 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 624 | } |
| 625 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 626 | void btsnd_hcic_write_policy_set(uint16_t handle, uint16_t settings) { |
| 627 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 628 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 629 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 630 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_POLICY_SET; |
| 631 | p->offset = 0; |
| 632 | UINT16_TO_STREAM(pp, HCI_WRITE_POLICY_SETTINGS); |
| 633 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_POLICY_SET); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 634 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 635 | UINT16_TO_STREAM(pp, handle); |
| 636 | UINT16_TO_STREAM(pp, settings); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 637 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 638 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 639 | } |
| 640 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 641 | void btsnd_hcic_write_def_policy_set(uint16_t settings) { |
| 642 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 643 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 644 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 645 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET; |
| 646 | p->offset = 0; |
| 647 | UINT16_TO_STREAM(pp, HCI_WRITE_DEF_POLICY_SETTINGS); |
| 648 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 649 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 650 | UINT16_TO_STREAM(pp, settings); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 651 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 652 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 653 | } |
| 654 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 655 | void btsnd_hcic_set_event_filter(uint8_t filt_type, uint8_t filt_cond_type, |
| 656 | uint8_t* filt_cond, uint8_t filt_cond_len) { |
| 657 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 658 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 659 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 660 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 661 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 662 | UINT16_TO_STREAM(pp, HCI_SET_EVENT_FILTER); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 663 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 664 | if (filt_type) { |
| 665 | p->len = (uint16_t)(HCIC_PREAMBLE_SIZE + 2 + filt_cond_len); |
| 666 | UINT8_TO_STREAM(pp, (uint8_t)(2 + filt_cond_len)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 667 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 668 | UINT8_TO_STREAM(pp, filt_type); |
| 669 | UINT8_TO_STREAM(pp, filt_cond_type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 670 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 671 | if (filt_cond_type == HCI_FILTER_COND_DEVICE_CLASS) { |
| 672 | DEVCLASS_TO_STREAM(pp, filt_cond); |
| 673 | filt_cond += DEV_CLASS_LEN; |
| 674 | DEVCLASS_TO_STREAM(pp, filt_cond); |
| 675 | filt_cond += DEV_CLASS_LEN; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 676 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 677 | filt_cond_len -= (2 * DEV_CLASS_LEN); |
| 678 | } else if (filt_cond_type == HCI_FILTER_COND_BD_ADDR) { |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 679 | BDADDR_TO_STREAM(pp, *((RawAddress*)filt_cond)); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 680 | filt_cond += BD_ADDR_LEN; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 681 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 682 | filt_cond_len -= BD_ADDR_LEN; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 683 | } |
| 684 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 685 | if (filt_cond_len) ARRAY_TO_STREAM(pp, filt_cond, filt_cond_len); |
| 686 | } else { |
| 687 | p->len = (uint16_t)(HCIC_PREAMBLE_SIZE + 1); |
| 688 | UINT8_TO_STREAM(pp, 1); |
| 689 | |
| 690 | UINT8_TO_STREAM(pp, filt_type); |
| 691 | } |
| 692 | |
| 693 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 694 | } |
| 695 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 696 | void btsnd_hcic_write_pin_type(uint8_t type) { |
| 697 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 698 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 699 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 700 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 701 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 702 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 703 | UINT16_TO_STREAM(pp, HCI_WRITE_PIN_TYPE); |
| 704 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 705 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 706 | UINT8_TO_STREAM(pp, type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 707 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 708 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 709 | } |
| 710 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 711 | void btsnd_hcic_delete_stored_key(const RawAddress& bd_addr, |
Jakub Pawlowski | c2276b0 | 2017-06-09 16:00:25 -0700 | [diff] [blame] | 712 | bool delete_all_flag) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 713 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 714 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 715 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 716 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DELETE_STORED_KEY; |
| 717 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 718 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 719 | UINT16_TO_STREAM(pp, HCI_DELETE_STORED_LINK_KEY); |
| 720 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_DELETE_STORED_KEY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 721 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 722 | BDADDR_TO_STREAM(pp, bd_addr); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 723 | UINT8_TO_STREAM(pp, delete_all_flag); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 724 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 725 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 726 | } |
| 727 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 728 | void btsnd_hcic_change_name(BD_NAME name) { |
| 729 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 730 | uint8_t* pp = (uint8_t*)(p + 1); |
| 731 | uint16_t len = strlen((char*)name) + 1; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 732 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 733 | memset(pp, 0, HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 734 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 735 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CHANGE_NAME; |
| 736 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 737 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 738 | UINT16_TO_STREAM(pp, HCI_CHANGE_LOCAL_NAME); |
| 739 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CHANGE_NAME); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 740 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 741 | if (len > HCIC_PARAM_SIZE_CHANGE_NAME) len = HCIC_PARAM_SIZE_CHANGE_NAME; |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 742 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 743 | ARRAY_TO_STREAM(pp, name, len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 744 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 745 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 746 | } |
| 747 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 748 | void btsnd_hcic_read_name(void) { |
| 749 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 750 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 751 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 752 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; |
| 753 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 754 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 755 | UINT16_TO_STREAM(pp, HCI_READ_LOCAL_NAME); |
| 756 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_CMD); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 757 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 758 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 759 | } |
| 760 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 761 | void btsnd_hcic_write_page_tout(uint16_t timeout) { |
| 762 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 763 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 764 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 765 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; |
| 766 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 767 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 768 | UINT16_TO_STREAM(pp, HCI_WRITE_PAGE_TOUT); |
| 769 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM2); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 770 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 771 | UINT16_TO_STREAM(pp, timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 772 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 773 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 774 | } |
| 775 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 776 | void btsnd_hcic_write_scan_enable(uint8_t flag) { |
| 777 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 778 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 779 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 780 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 781 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 782 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 783 | UINT16_TO_STREAM(pp, HCI_WRITE_SCAN_ENABLE); |
| 784 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 785 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 786 | UINT8_TO_STREAM(pp, flag); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 787 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 788 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 789 | } |
| 790 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 791 | void btsnd_hcic_write_pagescan_cfg(uint16_t interval, uint16_t window) { |
| 792 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 793 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 794 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 795 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG; |
| 796 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 797 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 798 | UINT16_TO_STREAM(pp, HCI_WRITE_PAGESCAN_CFG); |
| 799 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 800 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 801 | UINT16_TO_STREAM(pp, interval); |
| 802 | UINT16_TO_STREAM(pp, window); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 803 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 804 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 805 | } |
| 806 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 807 | void btsnd_hcic_write_inqscan_cfg(uint16_t interval, uint16_t window) { |
| 808 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 809 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 810 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 811 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG; |
| 812 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 813 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 814 | UINT16_TO_STREAM(pp, HCI_WRITE_INQUIRYSCAN_CFG); |
| 815 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 816 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 817 | UINT16_TO_STREAM(pp, interval); |
| 818 | UINT16_TO_STREAM(pp, window); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 819 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 820 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 821 | } |
| 822 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 823 | void btsnd_hcic_write_auth_enable(uint8_t flag) { |
| 824 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 825 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 826 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 827 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 828 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 829 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 830 | UINT16_TO_STREAM(pp, HCI_WRITE_AUTHENTICATION_ENABLE); |
| 831 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 832 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 833 | UINT8_TO_STREAM(pp, flag); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 834 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 835 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 836 | } |
| 837 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 838 | void btsnd_hcic_write_dev_class(DEV_CLASS dev_class) { |
| 839 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 840 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 841 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 842 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3; |
| 843 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 844 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 845 | UINT16_TO_STREAM(pp, HCI_WRITE_CLASS_OF_DEVICE); |
| 846 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM3); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 847 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 848 | DEVCLASS_TO_STREAM(pp, dev_class); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 849 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 850 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 851 | } |
| 852 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 853 | void btsnd_hcic_write_voice_settings(uint16_t flags) { |
| 854 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 855 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 856 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 857 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM2; |
| 858 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 859 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 860 | UINT16_TO_STREAM(pp, HCI_WRITE_VOICE_SETTINGS); |
| 861 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM2); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 862 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 863 | UINT16_TO_STREAM(pp, flags); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 864 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 865 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 866 | } |
| 867 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 868 | void btsnd_hcic_write_auto_flush_tout(uint16_t handle, uint16_t tout) { |
| 869 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 870 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 871 | |
Pavlin Radoslavov | b8568ae | 2017-09-01 16:09:27 -0700 | [diff] [blame] | 872 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_AUTOMATIC_FLUSH_TIMEOUT; |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 873 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 874 | |
Pavlin Radoslavov | b8568ae | 2017-09-01 16:09:27 -0700 | [diff] [blame] | 875 | UINT16_TO_STREAM(pp, HCI_WRITE_AUTOMATIC_FLUSH_TIMEOUT); |
| 876 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_AUTOMATIC_FLUSH_TIMEOUT); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 877 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 878 | UINT16_TO_STREAM(pp, handle); |
| 879 | UINT16_TO_STREAM(pp, tout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 880 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 881 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 882 | } |
| 883 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 884 | void btsnd_hcic_read_tx_power(uint16_t handle, uint8_t type) { |
| 885 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 886 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 887 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 888 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER; |
| 889 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 890 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 891 | UINT16_TO_STREAM(pp, HCI_READ_TRANSMIT_POWER_LEVEL); |
| 892 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_TX_POWER); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 893 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 894 | UINT16_TO_STREAM(pp, handle); |
| 895 | UINT8_TO_STREAM(pp, type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 896 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 897 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 898 | } |
| 899 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 900 | void btsnd_hcic_host_num_xmitted_pkts(uint8_t num_handles, uint16_t* handle, |
| 901 | uint16_t* num_pkts) { |
| 902 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 903 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 904 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 905 | p->len = HCIC_PREAMBLE_SIZE + 1 + (num_handles * 4); |
| 906 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 907 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 908 | UINT16_TO_STREAM(pp, HCI_HOST_NUM_PACKETS_DONE); |
| 909 | UINT8_TO_STREAM(pp, p->len - HCIC_PREAMBLE_SIZE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 910 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 911 | UINT8_TO_STREAM(pp, num_handles); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 912 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 913 | for (int i = 0; i < num_handles; i++) { |
| 914 | UINT16_TO_STREAM(pp, handle[i]); |
| 915 | UINT16_TO_STREAM(pp, num_pkts[i]); |
| 916 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 917 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 918 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 919 | } |
| 920 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 921 | void btsnd_hcic_write_link_super_tout(uint8_t local_controller_id, |
| 922 | uint16_t handle, uint16_t timeout) { |
| 923 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 924 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 925 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 926 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT; |
| 927 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 928 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 929 | UINT16_TO_STREAM(pp, HCI_WRITE_LINK_SUPER_TOUT); |
| 930 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 931 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 932 | UINT16_TO_STREAM(pp, handle); |
| 933 | UINT16_TO_STREAM(pp, timeout); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 934 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 935 | btu_hcif_send_cmd(local_controller_id, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 936 | } |
| 937 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 938 | void btsnd_hcic_write_cur_iac_lap(uint8_t num_cur_iac, LAP* const iac_lap) { |
| 939 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 940 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 941 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 942 | p->len = HCIC_PREAMBLE_SIZE + 1 + (LAP_LEN * num_cur_iac); |
| 943 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 944 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 945 | UINT16_TO_STREAM(pp, HCI_WRITE_CURRENT_IAC_LAP); |
| 946 | UINT8_TO_STREAM(pp, p->len - HCIC_PREAMBLE_SIZE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 947 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 948 | UINT8_TO_STREAM(pp, num_cur_iac); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 949 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 950 | for (int i = 0; i < num_cur_iac; i++) LAP_TO_STREAM(pp, iac_lap[i]); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 951 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 952 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 953 | } |
| 954 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 955 | /****************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 956 | * Lisbon Features |
| 957 | ******************************************/ |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 958 | #if (BTM_SSR_INCLUDED == TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 959 | |
Jakub Pawlowski | 763abdf | 2016-10-10 11:39:39 -0700 | [diff] [blame] | 960 | void btsnd_hcic_sniff_sub_rate(uint16_t handle, uint16_t max_lat, |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 961 | uint16_t min_remote_lat, |
| 962 | uint16_t min_local_lat) { |
| 963 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 964 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 965 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 966 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SNIFF_SUB_RATE; |
| 967 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 968 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 969 | UINT16_TO_STREAM(pp, HCI_SNIFF_SUB_RATE); |
| 970 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SNIFF_SUB_RATE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 971 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 972 | UINT16_TO_STREAM(pp, handle); |
| 973 | UINT16_TO_STREAM(pp, max_lat); |
| 974 | UINT16_TO_STREAM(pp, min_remote_lat); |
| 975 | UINT16_TO_STREAM(pp, min_local_lat); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 976 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 977 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 978 | } |
| 979 | #endif /* BTM_SSR_INCLUDED */ |
| 980 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 981 | /**** Extended Inquiry Response Commands ****/ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 982 | void btsnd_hcic_write_ext_inquiry_response(void* buffer, uint8_t fec_req) { |
| 983 | BT_HDR* p = (BT_HDR*)buffer; |
| 984 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 985 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 986 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXT_INQ_RESP; |
| 987 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 988 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 989 | UINT16_TO_STREAM(pp, HCI_WRITE_EXT_INQ_RESPONSE); |
| 990 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_EXT_INQ_RESP); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 991 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 992 | UINT8_TO_STREAM(pp, fec_req); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 993 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 994 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 995 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 996 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 997 | void btsnd_hcic_io_cap_req_reply(const RawAddress& bd_addr, uint8_t capability, |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 998 | uint8_t oob_present, uint8_t auth_req) { |
| 999 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1000 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1001 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1002 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_RESP; |
| 1003 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1004 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1005 | UINT16_TO_STREAM(pp, HCI_IO_CAPABILITY_REQUEST_REPLY); |
| 1006 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_IO_CAP_RESP); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1007 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1008 | BDADDR_TO_STREAM(pp, bd_addr); |
| 1009 | UINT8_TO_STREAM(pp, capability); |
| 1010 | UINT8_TO_STREAM(pp, oob_present); |
| 1011 | UINT8_TO_STREAM(pp, auth_req); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1012 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1013 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1014 | } |
| 1015 | |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 1016 | void btsnd_hcic_enhanced_set_up_synchronous_connection( |
| 1017 | uint16_t conn_handle, enh_esco_params_t* p_params) { |
| 1018 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1019 | uint8_t* pp = (uint8_t*)(p + 1); |
| 1020 | |
| 1021 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENH_SET_ESCO_CONN; |
| 1022 | p->offset = 0; |
| 1023 | |
| 1024 | UINT16_TO_STREAM(pp, HCI_ENH_SETUP_ESCO_CONNECTION); |
| 1025 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ENH_SET_ESCO_CONN); |
| 1026 | |
| 1027 | UINT16_TO_STREAM(pp, conn_handle); |
| 1028 | UINT32_TO_STREAM(pp, p_params->transmit_bandwidth); |
| 1029 | UINT32_TO_STREAM(pp, p_params->receive_bandwidth); |
| 1030 | UINT8_TO_STREAM(pp, p_params->transmit_coding_format.coding_format); |
| 1031 | UINT16_TO_STREAM(pp, p_params->transmit_coding_format.company_id); |
| 1032 | UINT16_TO_STREAM(pp, |
| 1033 | p_params->transmit_coding_format.vendor_specific_codec_id); |
| 1034 | UINT8_TO_STREAM(pp, p_params->receive_coding_format.coding_format); |
| 1035 | UINT16_TO_STREAM(pp, p_params->receive_coding_format.company_id); |
| 1036 | UINT16_TO_STREAM(pp, |
| 1037 | p_params->receive_coding_format.vendor_specific_codec_id); |
| 1038 | UINT16_TO_STREAM(pp, p_params->transmit_codec_frame_size); |
| 1039 | UINT16_TO_STREAM(pp, p_params->receive_codec_frame_size); |
| 1040 | UINT32_TO_STREAM(pp, p_params->input_bandwidth); |
| 1041 | UINT32_TO_STREAM(pp, p_params->output_bandwidth); |
| 1042 | UINT8_TO_STREAM(pp, p_params->input_coding_format.coding_format); |
| 1043 | UINT16_TO_STREAM(pp, p_params->input_coding_format.company_id); |
| 1044 | UINT16_TO_STREAM(pp, p_params->input_coding_format.vendor_specific_codec_id); |
| 1045 | UINT8_TO_STREAM(pp, p_params->output_coding_format.coding_format); |
| 1046 | UINT16_TO_STREAM(pp, p_params->output_coding_format.company_id); |
| 1047 | UINT16_TO_STREAM(pp, p_params->output_coding_format.vendor_specific_codec_id); |
| 1048 | UINT16_TO_STREAM(pp, p_params->input_coded_data_size); |
| 1049 | UINT16_TO_STREAM(pp, p_params->output_coded_data_size); |
| 1050 | UINT8_TO_STREAM(pp, p_params->input_pcm_data_format); |
| 1051 | UINT8_TO_STREAM(pp, p_params->output_pcm_data_format); |
| 1052 | UINT8_TO_STREAM(pp, p_params->input_pcm_payload_msb_position); |
| 1053 | UINT8_TO_STREAM(pp, p_params->output_pcm_payload_msb_position); |
| 1054 | UINT8_TO_STREAM(pp, p_params->input_data_path); |
| 1055 | UINT8_TO_STREAM(pp, p_params->output_data_path); |
| 1056 | UINT8_TO_STREAM(pp, p_params->input_transport_unit_size); |
| 1057 | UINT8_TO_STREAM(pp, p_params->output_transport_unit_size); |
| 1058 | UINT16_TO_STREAM(pp, p_params->max_latency_ms); |
| 1059 | UINT16_TO_STREAM(pp, p_params->packet_types); |
| 1060 | UINT8_TO_STREAM(pp, p_params->retransmission_effort); |
| 1061 | |
| 1062 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1063 | } |
| 1064 | |
| 1065 | void btsnd_hcic_enhanced_accept_synchronous_connection( |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1066 | const RawAddress& bd_addr, enh_esco_params_t* p_params) { |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 1067 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 1068 | uint8_t* pp = (uint8_t*)(p + 1); |
| 1069 | |
| 1070 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN; |
| 1071 | p->offset = 0; |
| 1072 | |
| 1073 | UINT16_TO_STREAM(pp, HCI_ENH_ACCEPT_ESCO_CONNECTION); |
| 1074 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ENH_ACC_ESCO_CONN); |
| 1075 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 1076 | BDADDR_TO_STREAM(pp, bd_addr); |
Mudumba Ananth | 57f6508 | 2017-02-09 09:05:48 -0800 | [diff] [blame] | 1077 | UINT32_TO_STREAM(pp, p_params->transmit_bandwidth); |
| 1078 | UINT32_TO_STREAM(pp, p_params->receive_bandwidth); |
| 1079 | UINT8_TO_STREAM(pp, p_params->transmit_coding_format.coding_format); |
| 1080 | UINT16_TO_STREAM(pp, p_params->transmit_coding_format.company_id); |
| 1081 | UINT16_TO_STREAM(pp, |
| 1082 | p_params->transmit_coding_format.vendor_specific_codec_id); |
| 1083 | UINT8_TO_STREAM(pp, p_params->receive_coding_format.coding_format); |
| 1084 | UINT16_TO_STREAM(pp, p_params->receive_coding_format.company_id); |
| 1085 | UINT16_TO_STREAM(pp, |
| 1086 | p_params->receive_coding_format.vendor_specific_codec_id); |
| 1087 | UINT16_TO_STREAM(pp, p_params->transmit_codec_frame_size); |
| 1088 | UINT16_TO_STREAM(pp, p_params->receive_codec_frame_size); |
| 1089 | UINT32_TO_STREAM(pp, p_params->input_bandwidth); |
| 1090 | UINT32_TO_STREAM(pp, p_params->output_bandwidth); |
| 1091 | UINT8_TO_STREAM(pp, p_params->input_coding_format.coding_format); |
| 1092 | UINT16_TO_STREAM(pp, p_params->input_coding_format.company_id); |
| 1093 | UINT16_TO_STREAM(pp, p_params->input_coding_format.vendor_specific_codec_id); |
| 1094 | UINT8_TO_STREAM(pp, p_params->output_coding_format.coding_format); |
| 1095 | UINT16_TO_STREAM(pp, p_params->output_coding_format.company_id); |
| 1096 | UINT16_TO_STREAM(pp, p_params->output_coding_format.vendor_specific_codec_id); |
| 1097 | UINT16_TO_STREAM(pp, p_params->input_coded_data_size); |
| 1098 | UINT16_TO_STREAM(pp, p_params->output_coded_data_size); |
| 1099 | UINT8_TO_STREAM(pp, p_params->input_pcm_data_format); |
| 1100 | UINT8_TO_STREAM(pp, p_params->output_pcm_data_format); |
| 1101 | UINT8_TO_STREAM(pp, p_params->input_pcm_payload_msb_position); |
| 1102 | UINT8_TO_STREAM(pp, p_params->output_pcm_payload_msb_position); |
| 1103 | UINT8_TO_STREAM(pp, p_params->input_data_path); |
| 1104 | UINT8_TO_STREAM(pp, p_params->output_data_path); |
| 1105 | UINT8_TO_STREAM(pp, p_params->input_transport_unit_size); |
| 1106 | UINT8_TO_STREAM(pp, p_params->output_transport_unit_size); |
| 1107 | UINT16_TO_STREAM(pp, p_params->max_latency_ms); |
| 1108 | UINT16_TO_STREAM(pp, p_params->packet_types); |
| 1109 | UINT8_TO_STREAM(pp, p_params->retransmission_effort); |
| 1110 | |
| 1111 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1112 | } |
| 1113 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1114 | void btsnd_hcic_io_cap_req_neg_reply(const RawAddress& bd_addr, |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 1115 | uint8_t err_code) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1116 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1117 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1118 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1119 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY; |
| 1120 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1121 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1122 | UINT16_TO_STREAM(pp, HCI_IO_CAP_REQ_NEG_REPLY); |
| 1123 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1124 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1125 | BDADDR_TO_STREAM(pp, bd_addr); |
| 1126 | UINT8_TO_STREAM(pp, err_code); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1127 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1128 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1129 | } |
| 1130 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1131 | void btsnd_hcic_read_local_oob_data(void) { |
| 1132 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1133 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1134 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1135 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_LOCAL_OOB; |
| 1136 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1137 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1138 | UINT16_TO_STREAM(pp, HCI_READ_LOCAL_OOB_DATA); |
| 1139 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_R_LOCAL_OOB); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1140 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1141 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1142 | } |
| 1143 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1144 | void btsnd_hcic_user_conf_reply(const RawAddress& bd_addr, bool is_yes) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1145 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1146 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1147 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1148 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_UCONF_REPLY; |
| 1149 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1150 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1151 | if (!is_yes) { |
| 1152 | /* Negative reply */ |
| 1153 | UINT16_TO_STREAM(pp, HCI_USER_CONF_VALUE_NEG_REPLY); |
| 1154 | } else { |
| 1155 | /* Confirmation */ |
| 1156 | UINT16_TO_STREAM(pp, HCI_USER_CONF_REQUEST_REPLY); |
| 1157 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1158 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1159 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_UCONF_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1160 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1161 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1162 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1163 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1164 | } |
| 1165 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1166 | void btsnd_hcic_user_passkey_reply(const RawAddress& bd_addr, uint32_t value) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1167 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1168 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1169 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1170 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_REPLY; |
| 1171 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1172 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1173 | UINT16_TO_STREAM(pp, HCI_USER_PASSKEY_REQ_REPLY); |
| 1174 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_U_PKEY_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1175 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1176 | BDADDR_TO_STREAM(pp, bd_addr); |
| 1177 | UINT32_TO_STREAM(pp, value); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1178 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1179 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1180 | } |
| 1181 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1182 | void btsnd_hcic_user_passkey_neg_reply(const RawAddress& bd_addr) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1183 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1184 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1185 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1186 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY; |
| 1187 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1188 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1189 | UINT16_TO_STREAM(pp, HCI_USER_PASSKEY_REQ_NEG_REPLY); |
| 1190 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1191 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1192 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1193 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1194 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1195 | } |
| 1196 | |
Jakub Pawlowski | ae57211 | 2018-06-14 17:40:34 -0700 | [diff] [blame] | 1197 | void btsnd_hcic_rem_oob_reply(const RawAddress& bd_addr, const Octet16& c, |
| 1198 | const Octet16& r) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1199 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1200 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1201 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1202 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_REPLY; |
| 1203 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1204 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1205 | UINT16_TO_STREAM(pp, HCI_REM_OOB_DATA_REQ_REPLY); |
| 1206 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_REM_OOB_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1207 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 1208 | BDADDR_TO_STREAM(pp, bd_addr); |
Jakub Pawlowski | ae57211 | 2018-06-14 17:40:34 -0700 | [diff] [blame] | 1209 | ARRAY16_TO_STREAM(pp, c.data()); |
| 1210 | ARRAY16_TO_STREAM(pp, r.data()); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1211 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1212 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1213 | } |
| 1214 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1215 | void btsnd_hcic_rem_oob_neg_reply(const RawAddress& bd_addr) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1216 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1217 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1218 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1219 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY; |
| 1220 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1221 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1222 | UINT16_TO_STREAM(pp, HCI_REM_OOB_DATA_REQ_NEG_REPLY); |
| 1223 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1224 | |
Jakub Pawlowski | b8a477e | 2017-06-16 15:16:15 -0700 | [diff] [blame] | 1225 | BDADDR_TO_STREAM(pp, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1226 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1227 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1228 | } |
| 1229 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1230 | void btsnd_hcic_read_inq_tx_power(void) { |
| 1231 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1232 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1233 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1234 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_R_TX_POWER; |
| 1235 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1236 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1237 | UINT16_TO_STREAM(pp, HCI_READ_INQ_TX_POWER_LEVEL); |
| 1238 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_R_TX_POWER); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1239 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1240 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1241 | } |
| 1242 | |
Jakub Pawlowski | a484a88 | 2017-06-24 17:30:18 -0700 | [diff] [blame] | 1243 | void btsnd_hcic_send_keypress_notif(const RawAddress& bd_addr, uint8_t notif) { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1244 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1245 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1246 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1247 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF; |
| 1248 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1249 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1250 | UINT16_TO_STREAM(pp, HCI_SEND_KEYPRESS_NOTIF); |
| 1251 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1252 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1253 | BDADDR_TO_STREAM(pp, bd_addr); |
| 1254 | UINT8_TO_STREAM(pp, notif); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1255 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1256 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1257 | } |
| 1258 | |
| 1259 | /**** end of Simple Pairing Commands ****/ |
| 1260 | |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 1261 | #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE) |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1262 | void btsnd_hcic_enhanced_flush(uint16_t handle, uint8_t packet_type) { |
| 1263 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1264 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1265 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1266 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_ENHANCED_FLUSH; |
| 1267 | p->offset = 0; |
| 1268 | UINT16_TO_STREAM(pp, HCI_ENHANCED_FLUSH); |
| 1269 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ENHANCED_FLUSH); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1270 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1271 | UINT16_TO_STREAM(pp, handle); |
| 1272 | UINT8_TO_STREAM(pp, packet_type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1273 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1274 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1275 | } |
| 1276 | #endif |
| 1277 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1278 | /************************* |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 1279 | * End of Lisbon Commands |
| 1280 | *************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1281 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1282 | void btsnd_hcic_get_link_quality(uint16_t handle) { |
| 1283 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1284 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1285 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1286 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1287 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1288 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1289 | UINT16_TO_STREAM(pp, HCI_GET_LINK_QUALITY); |
| 1290 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1291 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1292 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1293 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1294 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1295 | } |
| 1296 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1297 | void btsnd_hcic_read_rssi(uint16_t handle) { |
| 1298 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1299 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1300 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1301 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1302 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1303 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1304 | UINT16_TO_STREAM(pp, HCI_READ_RSSI); |
| 1305 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1306 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1307 | UINT16_TO_STREAM(pp, handle); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1308 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1309 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1310 | } |
| 1311 | |
Jakub Pawlowski | 3c03d4f | 2019-02-14 12:44:06 +0100 | [diff] [blame] | 1312 | static void read_encryption_key_size_complete(ReadEncKeySizeCb cb, uint8_t* return_parameters, |
| 1313 | uint16_t return_parameters_length) { |
| 1314 | uint8_t status; |
| 1315 | uint16_t handle; |
| 1316 | uint8_t key_size; |
| 1317 | STREAM_TO_UINT8(status, return_parameters); |
| 1318 | STREAM_TO_UINT16(handle, return_parameters); |
| 1319 | STREAM_TO_UINT8(key_size, return_parameters); |
| 1320 | |
| 1321 | std::move(cb).Run(status, handle, key_size); |
| 1322 | } |
| 1323 | |
| 1324 | void btsnd_hcic_read_encryption_key_size(uint16_t handle, ReadEncKeySizeCb cb) { |
| 1325 | constexpr uint8_t len = 2; |
| 1326 | uint8_t param[len]; |
| 1327 | memset(param, 0, len); |
| 1328 | |
| 1329 | uint8_t* p = param; |
| 1330 | UINT16_TO_STREAM(p, handle); |
| 1331 | |
| 1332 | btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_READ_ENCR_KEY_SIZE, param, len, |
| 1333 | base::Bind(&read_encryption_key_size_complete, base::Passed(&cb))); |
| 1334 | } |
| 1335 | |
Pavlin Radoslavov | 6ab749f | 2017-08-31 22:06:11 -0700 | [diff] [blame] | 1336 | void btsnd_hcic_read_failed_contact_counter(uint16_t handle) { |
| 1337 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1338 | uint8_t* pp = (uint8_t*)(p + 1); |
| 1339 | |
| 1340 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1341 | p->offset = 0; |
| 1342 | |
| 1343 | UINT16_TO_STREAM(pp, HCI_READ_FAILED_CONTACT_COUNTER); |
| 1344 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 1345 | |
| 1346 | UINT16_TO_STREAM(pp, handle); |
| 1347 | |
| 1348 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1349 | } |
| 1350 | |
Pavlin Radoslavov | b8568ae | 2017-09-01 16:09:27 -0700 | [diff] [blame] | 1351 | void btsnd_hcic_read_automatic_flush_timeout(uint16_t handle) { |
| 1352 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1353 | uint8_t* pp = (uint8_t*)(p + 1); |
| 1354 | |
| 1355 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CMD_HANDLE; |
| 1356 | p->offset = 0; |
| 1357 | |
| 1358 | UINT16_TO_STREAM(pp, HCI_READ_AUTOMATIC_FLUSH_TIMEOUT); |
| 1359 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CMD_HANDLE); |
| 1360 | |
| 1361 | UINT16_TO_STREAM(pp, handle); |
| 1362 | |
| 1363 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
| 1364 | } |
| 1365 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1366 | void btsnd_hcic_enable_test_mode(void) { |
| 1367 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1368 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1369 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1370 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_CMD; |
| 1371 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1372 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1373 | UINT16_TO_STREAM(pp, HCI_ENABLE_DEV_UNDER_TEST_MODE); |
| 1374 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_CMD); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1375 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1376 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1377 | } |
| 1378 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1379 | void btsnd_hcic_write_inqscan_type(uint8_t type) { |
| 1380 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1381 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1382 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1383 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1384 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1385 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1386 | UINT16_TO_STREAM(pp, HCI_WRITE_INQSCAN_TYPE); |
| 1387 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1388 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1389 | UINT8_TO_STREAM(pp, type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1390 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1391 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1392 | } |
| 1393 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1394 | void btsnd_hcic_write_inquiry_mode(uint8_t mode) { |
| 1395 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1396 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1397 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1398 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1399 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1400 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1401 | UINT16_TO_STREAM(pp, HCI_WRITE_INQUIRY_MODE); |
| 1402 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1403 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1404 | UINT8_TO_STREAM(pp, mode); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1405 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1406 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1407 | } |
| 1408 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1409 | void btsnd_hcic_write_pagescan_type(uint8_t type) { |
| 1410 | BT_HDR* p = (BT_HDR*)osi_malloc(HCI_CMD_BUF_SIZE); |
| 1411 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1412 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1413 | p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM1; |
| 1414 | p->offset = 0; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1415 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1416 | UINT16_TO_STREAM(pp, HCI_WRITE_PAGESCAN_TYPE); |
| 1417 | UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_WRITE_PARAM1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1418 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1419 | UINT8_TO_STREAM(pp, type); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1420 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1421 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1422 | } |
| 1423 | |
| 1424 | /* Must have room to store BT_HDR + max VSC length + callback pointer */ |
Pavlin Radoslavov | 70ae7de | 2015-09-23 14:49:24 -0700 | [diff] [blame] | 1425 | #if (HCI_CMD_BUF_SIZE < 268) |
| 1426 | #error "HCI_CMD_BUF_SIZE must be larger than 268" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1427 | #endif |
| 1428 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1429 | void btsnd_hcic_vendor_spec_cmd(void* buffer, uint16_t opcode, uint8_t len, |
| 1430 | uint8_t* p_data, void* p_cmd_cplt_cback) { |
| 1431 | BT_HDR* p = (BT_HDR*)buffer; |
| 1432 | uint8_t* pp = (uint8_t*)(p + 1); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1433 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1434 | p->len = HCIC_PREAMBLE_SIZE + len; |
| 1435 | p->offset = sizeof(void*); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1436 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1437 | *((void**)pp) = |
| 1438 | p_cmd_cplt_cback; /* Store command complete callback in buffer */ |
| 1439 | pp += sizeof(void*); /* Skip over callback pointer */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1440 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1441 | UINT16_TO_STREAM(pp, HCI_GRP_VENDOR_SPECIFIC | opcode); |
| 1442 | UINT8_TO_STREAM(pp, len); |
| 1443 | ARRAY_TO_STREAM(pp, p_data, len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1444 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 1445 | btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1446 | } |