BTstack for Nucleo F401RE/FRDM-KL46Z example program

Dependencies:   F401RE-USBHost mbed

The usage is the same as KL46Z-BTstack_example.
使い方はKL46Z-BTstack_exampleと同じです。
/media/uploads/va009039/f401re-btstack.jpg

Committer:
va009039
Date:
Mon Jun 09 09:03:25 2014 +0000
Revision:
0:a05a07cd6fdf
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:a05a07cd6fdf 1 /*
va009039 0:a05a07cd6fdf 2 * Copyright (C) 2009-2012 by Matthias Ringwald
va009039 0:a05a07cd6fdf 3 *
va009039 0:a05a07cd6fdf 4 * Redistribution and use in source and binary forms, with or without
va009039 0:a05a07cd6fdf 5 * modification, are permitted provided that the following conditions
va009039 0:a05a07cd6fdf 6 * are met:
va009039 0:a05a07cd6fdf 7 *
va009039 0:a05a07cd6fdf 8 * 1. Redistributions of source code must retain the above copyright
va009039 0:a05a07cd6fdf 9 * notice, this list of conditions and the following disclaimer.
va009039 0:a05a07cd6fdf 10 * 2. Redistributions in binary form must reproduce the above copyright
va009039 0:a05a07cd6fdf 11 * notice, this list of conditions and the following disclaimer in the
va009039 0:a05a07cd6fdf 12 * documentation and/or other materials provided with the distribution.
va009039 0:a05a07cd6fdf 13 * 3. Neither the name of the copyright holders nor the names of
va009039 0:a05a07cd6fdf 14 * contributors may be used to endorse or promote products derived
va009039 0:a05a07cd6fdf 15 * from this software without specific prior written permission.
va009039 0:a05a07cd6fdf 16 * 4. Any redistribution, use, or modification is done solely for
va009039 0:a05a07cd6fdf 17 * personal benefit and not for any commercial purpose or for
va009039 0:a05a07cd6fdf 18 * monetary gain.
va009039 0:a05a07cd6fdf 19 *
va009039 0:a05a07cd6fdf 20 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
va009039 0:a05a07cd6fdf 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
va009039 0:a05a07cd6fdf 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
va009039 0:a05a07cd6fdf 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
va009039 0:a05a07cd6fdf 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
va009039 0:a05a07cd6fdf 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
va009039 0:a05a07cd6fdf 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
va009039 0:a05a07cd6fdf 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
va009039 0:a05a07cd6fdf 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
va009039 0:a05a07cd6fdf 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
va009039 0:a05a07cd6fdf 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
va009039 0:a05a07cd6fdf 31 * SUCH DAMAGE.
va009039 0:a05a07cd6fdf 32 *
va009039 0:a05a07cd6fdf 33 * Please inquire about commercial licensing options at btstack@ringwald.ch
va009039 0:a05a07cd6fdf 34 *
va009039 0:a05a07cd6fdf 35 */
va009039 0:a05a07cd6fdf 36
va009039 0:a05a07cd6fdf 37 /*
va009039 0:a05a07cd6fdf 38 * hci_cmds.c
va009039 0:a05a07cd6fdf 39 *
va009039 0:a05a07cd6fdf 40 * Created by Matthias Ringwald on 7/23/09.
va009039 0:a05a07cd6fdf 41 */
va009039 0:a05a07cd6fdf 42
va009039 0:a05a07cd6fdf 43 #include <btstack/hci_cmds.h>
va009039 0:a05a07cd6fdf 44
va009039 0:a05a07cd6fdf 45 #include <string.h>
va009039 0:a05a07cd6fdf 46
va009039 0:a05a07cd6fdf 47 #include <btstack/sdp_util.h>
va009039 0:a05a07cd6fdf 48 #include "config.h"
va009039 0:a05a07cd6fdf 49 #include "hci.h"
va009039 0:a05a07cd6fdf 50
va009039 0:a05a07cd6fdf 51 // calculate combined ogf/ocf value
va009039 0:a05a07cd6fdf 52 #define OPCODE(ogf, ocf) (ocf | ogf << 10)
va009039 0:a05a07cd6fdf 53
va009039 0:a05a07cd6fdf 54 /**
va009039 0:a05a07cd6fdf 55 * construct HCI Command based on template
va009039 0:a05a07cd6fdf 56 *
va009039 0:a05a07cd6fdf 57 * Format:
va009039 0:a05a07cd6fdf 58 * 1,2,3,4: one to four byte value
va009039 0:a05a07cd6fdf 59 * H: HCI connection handle
va009039 0:a05a07cd6fdf 60 * B: Bluetooth Baseband Address (BD_ADDR)
va009039 0:a05a07cd6fdf 61 * E: Extended Inquiry Result
va009039 0:a05a07cd6fdf 62 * N: Name up to 248 chars, \0 terminated
va009039 0:a05a07cd6fdf 63 * P: 16 byte Pairing code
va009039 0:a05a07cd6fdf 64 * S: Service Record (Data Element Sequence)
va009039 0:a05a07cd6fdf 65 */
va009039 0:a05a07cd6fdf 66 uint16_t hci_create_cmd_internal(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr){
va009039 0:a05a07cd6fdf 67
va009039 0:a05a07cd6fdf 68 hci_cmd_buffer[0] = cmd->opcode & 0xff;
va009039 0:a05a07cd6fdf 69 hci_cmd_buffer[1] = cmd->opcode >> 8;
va009039 0:a05a07cd6fdf 70 int pos = 3;
va009039 0:a05a07cd6fdf 71
va009039 0:a05a07cd6fdf 72 const char *format = cmd->format;
va009039 0:a05a07cd6fdf 73 uint16_t word;
va009039 0:a05a07cd6fdf 74 uint32_t longword;
va009039 0:a05a07cd6fdf 75 uint8_t * ptr;
va009039 0:a05a07cd6fdf 76 while (*format) {
va009039 0:a05a07cd6fdf 77 switch(*format) {
va009039 0:a05a07cd6fdf 78 case '1': // 8 bit value
va009039 0:a05a07cd6fdf 79 case '2': // 16 bit value
va009039 0:a05a07cd6fdf 80 case 'H': // hci_handle
va009039 0:a05a07cd6fdf 81 word = va_arg(argptr, int); // minimal va_arg is int: 2 bytes on 8+16 bit CPUs
va009039 0:a05a07cd6fdf 82 hci_cmd_buffer[pos++] = word & 0xff;
va009039 0:a05a07cd6fdf 83 if (*format == '2') {
va009039 0:a05a07cd6fdf 84 hci_cmd_buffer[pos++] = word >> 8;
va009039 0:a05a07cd6fdf 85 } else if (*format == 'H') {
va009039 0:a05a07cd6fdf 86 // TODO implement opaque client connection handles
va009039 0:a05a07cd6fdf 87 // pass module handle for now
va009039 0:a05a07cd6fdf 88 hci_cmd_buffer[pos++] = word >> 8;
va009039 0:a05a07cd6fdf 89 }
va009039 0:a05a07cd6fdf 90 break;
va009039 0:a05a07cd6fdf 91 case '3':
va009039 0:a05a07cd6fdf 92 case '4':
va009039 0:a05a07cd6fdf 93 longword = va_arg(argptr, uint32_t);
va009039 0:a05a07cd6fdf 94 // longword = va_arg(argptr, int);
va009039 0:a05a07cd6fdf 95 hci_cmd_buffer[pos++] = longword;
va009039 0:a05a07cd6fdf 96 hci_cmd_buffer[pos++] = longword >> 8;
va009039 0:a05a07cd6fdf 97 hci_cmd_buffer[pos++] = longword >> 16;
va009039 0:a05a07cd6fdf 98 if (*format == '4'){
va009039 0:a05a07cd6fdf 99 hci_cmd_buffer[pos++] = longword >> 24;
va009039 0:a05a07cd6fdf 100 }
va009039 0:a05a07cd6fdf 101 break;
va009039 0:a05a07cd6fdf 102 case 'B': // bt-addr
va009039 0:a05a07cd6fdf 103 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 104 hci_cmd_buffer[pos++] = ptr[5];
va009039 0:a05a07cd6fdf 105 hci_cmd_buffer[pos++] = ptr[4];
va009039 0:a05a07cd6fdf 106 hci_cmd_buffer[pos++] = ptr[3];
va009039 0:a05a07cd6fdf 107 hci_cmd_buffer[pos++] = ptr[2];
va009039 0:a05a07cd6fdf 108 hci_cmd_buffer[pos++] = ptr[1];
va009039 0:a05a07cd6fdf 109 hci_cmd_buffer[pos++] = ptr[0];
va009039 0:a05a07cd6fdf 110 break;
va009039 0:a05a07cd6fdf 111 case 'E': // Extended Inquiry Information 240 octets
va009039 0:a05a07cd6fdf 112 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 113 memcpy(&hci_cmd_buffer[pos], ptr, 240);
va009039 0:a05a07cd6fdf 114 pos += 240;
va009039 0:a05a07cd6fdf 115 break;
va009039 0:a05a07cd6fdf 116 case 'N': { // UTF-8 string, null terminated
va009039 0:a05a07cd6fdf 117 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 118 uint16_t len = strlen((const char*) ptr);
va009039 0:a05a07cd6fdf 119 if (len > 248) {
va009039 0:a05a07cd6fdf 120 len = 248;
va009039 0:a05a07cd6fdf 121 }
va009039 0:a05a07cd6fdf 122 memcpy(&hci_cmd_buffer[pos], ptr, len);
va009039 0:a05a07cd6fdf 123 if (len < 248) {
va009039 0:a05a07cd6fdf 124 // fill remaining space with zeroes
va009039 0:a05a07cd6fdf 125 memset(&hci_cmd_buffer[pos+len], 0, 248-len);
va009039 0:a05a07cd6fdf 126 }
va009039 0:a05a07cd6fdf 127 pos += 248;
va009039 0:a05a07cd6fdf 128 break;
va009039 0:a05a07cd6fdf 129 }
va009039 0:a05a07cd6fdf 130 case 'P': // 16 byte PIN code or link key
va009039 0:a05a07cd6fdf 131 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 132 memcpy(&hci_cmd_buffer[pos], ptr, 16);
va009039 0:a05a07cd6fdf 133 pos += 16;
va009039 0:a05a07cd6fdf 134 break;
va009039 0:a05a07cd6fdf 135 #ifdef HAVE_BLE
va009039 0:a05a07cd6fdf 136 case 'A': // 31 bytes advertising data
va009039 0:a05a07cd6fdf 137 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 138 memcpy(&hci_cmd_buffer[pos], ptr, 31);
va009039 0:a05a07cd6fdf 139 pos += 31;
va009039 0:a05a07cd6fdf 140 break;
va009039 0:a05a07cd6fdf 141 #endif
va009039 0:a05a07cd6fdf 142 #ifdef HAVE_SDP
va009039 0:a05a07cd6fdf 143 case 'S': { // Service Record (Data Element Sequence)
va009039 0:a05a07cd6fdf 144 ptr = va_arg(argptr, uint8_t *);
va009039 0:a05a07cd6fdf 145 uint16_t len = de_get_len(ptr);
va009039 0:a05a07cd6fdf 146 memcpy(&hci_cmd_buffer[pos], ptr, len);
va009039 0:a05a07cd6fdf 147 pos += len;
va009039 0:a05a07cd6fdf 148 break;
va009039 0:a05a07cd6fdf 149 }
va009039 0:a05a07cd6fdf 150 #endif
va009039 0:a05a07cd6fdf 151 default:
va009039 0:a05a07cd6fdf 152 break;
va009039 0:a05a07cd6fdf 153 }
va009039 0:a05a07cd6fdf 154 format++;
va009039 0:a05a07cd6fdf 155 };
va009039 0:a05a07cd6fdf 156 hci_cmd_buffer[2] = pos - 3;
va009039 0:a05a07cd6fdf 157 return pos;
va009039 0:a05a07cd6fdf 158 }
va009039 0:a05a07cd6fdf 159
va009039 0:a05a07cd6fdf 160 /**
va009039 0:a05a07cd6fdf 161 * construct HCI Command based on template
va009039 0:a05a07cd6fdf 162 *
va009039 0:a05a07cd6fdf 163 * mainly calls hci_create_cmd_internal
va009039 0:a05a07cd6fdf 164 */
va009039 0:a05a07cd6fdf 165 uint16_t hci_create_cmd(uint8_t *hci_cmd_buffer, hci_cmd_t *cmd, ...){
va009039 0:a05a07cd6fdf 166 va_list argptr;
va009039 0:a05a07cd6fdf 167 va_start(argptr, cmd);
va009039 0:a05a07cd6fdf 168 uint16_t len = hci_create_cmd_internal(hci_cmd_buffer, cmd, argptr);
va009039 0:a05a07cd6fdf 169 va_end(argptr);
va009039 0:a05a07cd6fdf 170 return len;
va009039 0:a05a07cd6fdf 171 }
va009039 0:a05a07cd6fdf 172
va009039 0:a05a07cd6fdf 173
va009039 0:a05a07cd6fdf 174 /**
va009039 0:a05a07cd6fdf 175 * Link Control Commands
va009039 0:a05a07cd6fdf 176 */
va009039 0:a05a07cd6fdf 177 const hci_cmd_t hci_inquiry = {
va009039 0:a05a07cd6fdf 178 OPCODE(OGF_LINK_CONTROL, 0x01), "311"
va009039 0:a05a07cd6fdf 179 // LAP, Inquiry length, Num_responses
va009039 0:a05a07cd6fdf 180 };
va009039 0:a05a07cd6fdf 181 const hci_cmd_t hci_inquiry_cancel = {
va009039 0:a05a07cd6fdf 182 OPCODE(OGF_LINK_CONTROL, 0x02), ""
va009039 0:a05a07cd6fdf 183 // no params
va009039 0:a05a07cd6fdf 184 };
va009039 0:a05a07cd6fdf 185 const hci_cmd_t hci_create_connection = {
va009039 0:a05a07cd6fdf 186 OPCODE(OGF_LINK_CONTROL, 0x05), "B21121"
va009039 0:a05a07cd6fdf 187 // BD_ADDR, Packet_Type, Page_Scan_Repetition_Mode, Reserved, Clock_Offset, Allow_Role_Switch
va009039 0:a05a07cd6fdf 188 };
va009039 0:a05a07cd6fdf 189 const hci_cmd_t hci_disconnect = {
va009039 0:a05a07cd6fdf 190 OPCODE(OGF_LINK_CONTROL, 0x06), "H1"
va009039 0:a05a07cd6fdf 191 // Handle, Reason: 0x05, 0x13-0x15, 0x1a, 0x29
va009039 0:a05a07cd6fdf 192 // see Errors Codes in BT Spec Part D
va009039 0:a05a07cd6fdf 193 };
va009039 0:a05a07cd6fdf 194 const hci_cmd_t hci_create_connection_cancel = {
va009039 0:a05a07cd6fdf 195 OPCODE(OGF_LINK_CONTROL, 0x08), "B"
va009039 0:a05a07cd6fdf 196 // BD_ADDR
va009039 0:a05a07cd6fdf 197 };
va009039 0:a05a07cd6fdf 198 const hci_cmd_t hci_accept_connection_request = {
va009039 0:a05a07cd6fdf 199 OPCODE(OGF_LINK_CONTROL, 0x09), "B1"
va009039 0:a05a07cd6fdf 200 // BD_ADDR, Role: become master, stay slave
va009039 0:a05a07cd6fdf 201 };
va009039 0:a05a07cd6fdf 202 const hci_cmd_t hci_reject_connection_request = {
va009039 0:a05a07cd6fdf 203 OPCODE(OGF_LINK_CONTROL, 0x0a), "B1"
va009039 0:a05a07cd6fdf 204 // BD_ADDR, reason e.g. CONNECTION REJECTED DUE TO LIMITED RESOURCES (0x0d)
va009039 0:a05a07cd6fdf 205 };
va009039 0:a05a07cd6fdf 206 const hci_cmd_t hci_link_key_request_reply = {
va009039 0:a05a07cd6fdf 207 OPCODE(OGF_LINK_CONTROL, 0x0b), "BP"
va009039 0:a05a07cd6fdf 208 // BD_ADDR, LINK_KEY
va009039 0:a05a07cd6fdf 209 };
va009039 0:a05a07cd6fdf 210 const hci_cmd_t hci_link_key_request_negative_reply = {
va009039 0:a05a07cd6fdf 211 OPCODE(OGF_LINK_CONTROL, 0x0c), "B"
va009039 0:a05a07cd6fdf 212 // BD_ADDR
va009039 0:a05a07cd6fdf 213 };
va009039 0:a05a07cd6fdf 214 const hci_cmd_t hci_pin_code_request_reply = {
va009039 0:a05a07cd6fdf 215 OPCODE(OGF_LINK_CONTROL, 0x0d), "B1P"
va009039 0:a05a07cd6fdf 216 // BD_ADDR, pin length, PIN: c-string
va009039 0:a05a07cd6fdf 217 };
va009039 0:a05a07cd6fdf 218 const hci_cmd_t hci_pin_code_request_negative_reply = {
va009039 0:a05a07cd6fdf 219 OPCODE(OGF_LINK_CONTROL, 0x0e), "B"
va009039 0:a05a07cd6fdf 220 // BD_ADDR
va009039 0:a05a07cd6fdf 221 };
va009039 0:a05a07cd6fdf 222 const hci_cmd_t hci_authentication_requested = {
va009039 0:a05a07cd6fdf 223 OPCODE(OGF_LINK_CONTROL, 0x11), "H"
va009039 0:a05a07cd6fdf 224 // Handle
va009039 0:a05a07cd6fdf 225 };
va009039 0:a05a07cd6fdf 226 const hci_cmd_t hci_set_connection_encryption = {
va009039 0:a05a07cd6fdf 227 OPCODE(OGF_LINK_CONTROL, 0x13), "H1"
va009039 0:a05a07cd6fdf 228 // Handle, Encryption_Enable
va009039 0:a05a07cd6fdf 229 };
va009039 0:a05a07cd6fdf 230 const hci_cmd_t hci_change_connection_link_key = {
va009039 0:a05a07cd6fdf 231 OPCODE(OGF_LINK_CONTROL, 0x15), "H"
va009039 0:a05a07cd6fdf 232 // Handle
va009039 0:a05a07cd6fdf 233 };
va009039 0:a05a07cd6fdf 234 const hci_cmd_t hci_remote_name_request = {
va009039 0:a05a07cd6fdf 235 OPCODE(OGF_LINK_CONTROL, 0x19), "B112"
va009039 0:a05a07cd6fdf 236 // BD_ADDR, Page_Scan_Repetition_Mode, Reserved, Clock_Offset
va009039 0:a05a07cd6fdf 237 };
va009039 0:a05a07cd6fdf 238 const hci_cmd_t hci_remote_name_request_cancel = {
va009039 0:a05a07cd6fdf 239 OPCODE(OGF_LINK_CONTROL, 0x1A), "B"
va009039 0:a05a07cd6fdf 240 // BD_ADDR
va009039 0:a05a07cd6fdf 241 };
va009039 0:a05a07cd6fdf 242
va009039 0:a05a07cd6fdf 243 /**
va009039 0:a05a07cd6fdf 244 * Link Policy Commands
va009039 0:a05a07cd6fdf 245 */
va009039 0:a05a07cd6fdf 246 const hci_cmd_t hci_sniff_mode = {
va009039 0:a05a07cd6fdf 247 OPCODE(OGF_LINK_POLICY, 0x03), "H2222"
va009039 0:a05a07cd6fdf 248 // handle, Sniff_Max_Interval, Sniff_Min_Interval, Sniff_Attempt, Sniff_Timeout:
va009039 0:a05a07cd6fdf 249 };
va009039 0:a05a07cd6fdf 250 const hci_cmd_t hci_qos_setup = {
va009039 0:a05a07cd6fdf 251 OPCODE(OGF_LINK_POLICY, 0x07), "H114444"
va009039 0:a05a07cd6fdf 252 // handle, flags, service_type, token rate (bytes/s), peak bandwith (bytes/s),
va009039 0:a05a07cd6fdf 253 // latency (us), delay_variation (us)
va009039 0:a05a07cd6fdf 254 };
va009039 0:a05a07cd6fdf 255 const hci_cmd_t hci_role_discovery = {
va009039 0:a05a07cd6fdf 256 OPCODE(OGF_LINK_POLICY, 0x09), "H"
va009039 0:a05a07cd6fdf 257 // handle
va009039 0:a05a07cd6fdf 258 };
va009039 0:a05a07cd6fdf 259 const hci_cmd_t hci_switch_role_command= {
va009039 0:a05a07cd6fdf 260 OPCODE(OGF_LINK_POLICY, 0x0b), "B1"
va009039 0:a05a07cd6fdf 261 // BD_ADDR, role: {0=master,1=slave}
va009039 0:a05a07cd6fdf 262 };
va009039 0:a05a07cd6fdf 263 const hci_cmd_t hci_read_link_policy_settings = {
va009039 0:a05a07cd6fdf 264 OPCODE(OGF_LINK_POLICY, 0x0c), "H"
va009039 0:a05a07cd6fdf 265 // handle
va009039 0:a05a07cd6fdf 266 };
va009039 0:a05a07cd6fdf 267 const hci_cmd_t hci_write_link_policy_settings = {
va009039 0:a05a07cd6fdf 268 OPCODE(OGF_LINK_POLICY, 0x0d), "H2"
va009039 0:a05a07cd6fdf 269 // handle, settings
va009039 0:a05a07cd6fdf 270 };
va009039 0:a05a07cd6fdf 271
va009039 0:a05a07cd6fdf 272 /**
va009039 0:a05a07cd6fdf 273 * Controller & Baseband Commands
va009039 0:a05a07cd6fdf 274 */
va009039 0:a05a07cd6fdf 275 const hci_cmd_t hci_set_event_mask = {
va009039 0:a05a07cd6fdf 276 OPCODE(OGF_CONTROLLER_BASEBAND, 0x01), "44"
va009039 0:a05a07cd6fdf 277 // event_mask lower 4 octets, higher 4 bytes
va009039 0:a05a07cd6fdf 278 };
va009039 0:a05a07cd6fdf 279 const hci_cmd_t hci_reset = {
va009039 0:a05a07cd6fdf 280 OPCODE(OGF_CONTROLLER_BASEBAND, 0x03), ""
va009039 0:a05a07cd6fdf 281 // no params
va009039 0:a05a07cd6fdf 282 };
va009039 0:a05a07cd6fdf 283 const hci_cmd_t hci_delete_stored_link_key = {
va009039 0:a05a07cd6fdf 284 OPCODE(OGF_CONTROLLER_BASEBAND, 0x12), "B1"
va009039 0:a05a07cd6fdf 285 // BD_ADDR, Delete_All_Flag
va009039 0:a05a07cd6fdf 286 };
va009039 0:a05a07cd6fdf 287 const hci_cmd_t hci_write_local_name = {
va009039 0:a05a07cd6fdf 288 OPCODE(OGF_CONTROLLER_BASEBAND, 0x13), "N"
va009039 0:a05a07cd6fdf 289 // Local name (UTF-8, Null Terminated, max 248 octets)
va009039 0:a05a07cd6fdf 290 };
va009039 0:a05a07cd6fdf 291 const hci_cmd_t hci_write_page_timeout = {
va009039 0:a05a07cd6fdf 292 OPCODE(OGF_CONTROLLER_BASEBAND, 0x18), "2"
va009039 0:a05a07cd6fdf 293 // Page_Timeout * 0.625 ms
va009039 0:a05a07cd6fdf 294 };
va009039 0:a05a07cd6fdf 295 const hci_cmd_t hci_write_scan_enable = {
va009039 0:a05a07cd6fdf 296 OPCODE(OGF_CONTROLLER_BASEBAND, 0x1A), "1"
va009039 0:a05a07cd6fdf 297 // Scan_enable: no, inq, page, inq+page
va009039 0:a05a07cd6fdf 298 };
va009039 0:a05a07cd6fdf 299 const hci_cmd_t hci_write_authentication_enable = {
va009039 0:a05a07cd6fdf 300 OPCODE(OGF_CONTROLLER_BASEBAND, 0x20), "1"
va009039 0:a05a07cd6fdf 301 // Authentication_Enable
va009039 0:a05a07cd6fdf 302 };
va009039 0:a05a07cd6fdf 303 const hci_cmd_t hci_write_class_of_device = {
va009039 0:a05a07cd6fdf 304 OPCODE(OGF_CONTROLLER_BASEBAND, 0x24), "3"
va009039 0:a05a07cd6fdf 305 // Class of Device
va009039 0:a05a07cd6fdf 306 };
va009039 0:a05a07cd6fdf 307 const hci_cmd_t hci_read_num_broadcast_retransmissions = {
va009039 0:a05a07cd6fdf 308 OPCODE(OGF_CONTROLLER_BASEBAND, 0x29), ""
va009039 0:a05a07cd6fdf 309 };
va009039 0:a05a07cd6fdf 310 const hci_cmd_t hci_write_num_broadcast_retransmissions = {
va009039 0:a05a07cd6fdf 311 OPCODE(OGF_CONTROLLER_BASEBAND, 0x2a), "1"
va009039 0:a05a07cd6fdf 312 // Num broadcast retransmissions (e.g. 0 for a single broadcast)
va009039 0:a05a07cd6fdf 313 };
va009039 0:a05a07cd6fdf 314 const hci_cmd_t hci_host_buffer_size = {
va009039 0:a05a07cd6fdf 315 OPCODE(OGF_CONTROLLER_BASEBAND, 0x33), "2122"
va009039 0:a05a07cd6fdf 316 // Host_ACL_Data_Packet_Length:, Host_Synchronous_Data_Packet_Length:, Host_Total_Num_ACL_Data_Packets:, Host_Total_Num_Synchronous_Data_Packets:
va009039 0:a05a07cd6fdf 317 };
va009039 0:a05a07cd6fdf 318 const hci_cmd_t hci_read_link_supervision_timeout = {
va009039 0:a05a07cd6fdf 319 OPCODE(OGF_CONTROLLER_BASEBAND, 0x36), "H"
va009039 0:a05a07cd6fdf 320 // handle
va009039 0:a05a07cd6fdf 321 };
va009039 0:a05a07cd6fdf 322 const hci_cmd_t hci_write_link_supervision_timeout = {
va009039 0:a05a07cd6fdf 323 OPCODE(OGF_CONTROLLER_BASEBAND, 0x37), "H2"
va009039 0:a05a07cd6fdf 324 // handle, Range for N: 0x0001 Ð 0xFFFF Time (Range: 0.625ms Ð 40.9 sec)
va009039 0:a05a07cd6fdf 325 };
va009039 0:a05a07cd6fdf 326 const hci_cmd_t hci_write_inquiry_mode = {
va009039 0:a05a07cd6fdf 327 OPCODE(OGF_CONTROLLER_BASEBAND, 0x45), "1"
va009039 0:a05a07cd6fdf 328 // Inquiry mode: 0x00 = standard, 0x01 = with RSSI, 0x02 = extended
va009039 0:a05a07cd6fdf 329 };
va009039 0:a05a07cd6fdf 330 const hci_cmd_t hci_write_extended_inquiry_response = {
va009039 0:a05a07cd6fdf 331 OPCODE(OGF_CONTROLLER_BASEBAND, 0x52), "1E"
va009039 0:a05a07cd6fdf 332 // FEC_Required, Exstended Inquiry Response
va009039 0:a05a07cd6fdf 333 };
va009039 0:a05a07cd6fdf 334 const hci_cmd_t hci_write_simple_pairing_mode = {
va009039 0:a05a07cd6fdf 335 OPCODE(OGF_CONTROLLER_BASEBAND, 0x56), "1"
va009039 0:a05a07cd6fdf 336 // mode: 0 = off, 1 = on
va009039 0:a05a07cd6fdf 337 };
va009039 0:a05a07cd6fdf 338 const hci_cmd_t hci_read_le_host_supported = {
va009039 0:a05a07cd6fdf 339 OPCODE(OGF_CONTROLLER_BASEBAND, 0x6c), ""
va009039 0:a05a07cd6fdf 340 // params: none
va009039 0:a05a07cd6fdf 341 // return: status, le supported host, simultaneous le host
va009039 0:a05a07cd6fdf 342 };
va009039 0:a05a07cd6fdf 343 const hci_cmd_t hci_write_le_host_supported = {
va009039 0:a05a07cd6fdf 344 OPCODE(OGF_CONTROLLER_BASEBAND, 0x6d), "11"
va009039 0:a05a07cd6fdf 345 // param: le supported host, simultaneous le host
va009039 0:a05a07cd6fdf 346 // return: status
va009039 0:a05a07cd6fdf 347 };
va009039 0:a05a07cd6fdf 348
va009039 0:a05a07cd6fdf 349 /**
va009039 0:a05a07cd6fdf 350 * Informational Parameters
va009039 0:a05a07cd6fdf 351 */
va009039 0:a05a07cd6fdf 352 const hci_cmd_t hci_read_local_supported_features = {
va009039 0:a05a07cd6fdf 353 OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x03), ""
va009039 0:a05a07cd6fdf 354 // no params
va009039 0:a05a07cd6fdf 355 };
va009039 0:a05a07cd6fdf 356 const hci_cmd_t hci_read_buffer_size = {
va009039 0:a05a07cd6fdf 357 OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x05), ""
va009039 0:a05a07cd6fdf 358 // no params
va009039 0:a05a07cd6fdf 359 };
va009039 0:a05a07cd6fdf 360 const hci_cmd_t hci_read_bd_addr = {
va009039 0:a05a07cd6fdf 361 OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x09), ""
va009039 0:a05a07cd6fdf 362 // no params
va009039 0:a05a07cd6fdf 363 };
va009039 0:a05a07cd6fdf 364
va009039 0:a05a07cd6fdf 365 #ifdef HAVE_BLE
va009039 0:a05a07cd6fdf 366 /**
va009039 0:a05a07cd6fdf 367 * Low Energy Commands
va009039 0:a05a07cd6fdf 368 */
va009039 0:a05a07cd6fdf 369 const hci_cmd_t hci_le_set_event_mask = {
va009039 0:a05a07cd6fdf 370 OPCODE(OGF_LE_CONTROLLER, 0x01), "44"
va009039 0:a05a07cd6fdf 371 // params: event_mask lower 4 octets, higher 4 bytes
va009039 0:a05a07cd6fdf 372 // return: status
va009039 0:a05a07cd6fdf 373 };
va009039 0:a05a07cd6fdf 374 const hci_cmd_t hci_le_read_buffer_size = {
va009039 0:a05a07cd6fdf 375 OPCODE(OGF_LE_CONTROLLER, 0x02), ""
va009039 0:a05a07cd6fdf 376 // params: none
va009039 0:a05a07cd6fdf 377 // return: status, le acl data packet len (16), total num le acl data packets(8)
va009039 0:a05a07cd6fdf 378 };
va009039 0:a05a07cd6fdf 379 const hci_cmd_t hci_le_read_supported_features = {
va009039 0:a05a07cd6fdf 380 OPCODE(OGF_LE_CONTROLLER, 0x03), ""
va009039 0:a05a07cd6fdf 381 // params: none
va009039 0:a05a07cd6fdf 382 // return: LE_Features See [Vol 6] Part B, Section 4.6
va009039 0:a05a07cd6fdf 383 };
va009039 0:a05a07cd6fdf 384 const hci_cmd_t hci_le_set_random_address = {
va009039 0:a05a07cd6fdf 385 OPCODE(OGF_LE_CONTROLLER, 0x05), "B"
va009039 0:a05a07cd6fdf 386 // params: random device address
va009039 0:a05a07cd6fdf 387 // return: status
va009039 0:a05a07cd6fdf 388 };
va009039 0:a05a07cd6fdf 389 const hci_cmd_t hci_le_set_advertising_parameters = {
va009039 0:a05a07cd6fdf 390 OPCODE(OGF_LE_CONTROLLER, 0x06), "22111B11"
va009039 0:a05a07cd6fdf 391 // param: min advertising interval, [0x0020,0x4000], default: 0x0800, unit: 0.625 msec
va009039 0:a05a07cd6fdf 392 // param: max advertising interval, [0x0020,0x4000], default: 0x0800, unit: 0.625 msec
va009039 0:a05a07cd6fdf 393 // param: advertising type (enum from 0): ADV_IND, ADC_DIRECT_IND, ADV_SCAN_IND, ADV_NONCONN_IND
va009039 0:a05a07cd6fdf 394 // param: own address type (enum from 0): public device address, random device address
va009039 0:a05a07cd6fdf 395 // param: direct address type (enum from 0): public device address, random device address
va009039 0:a05a07cd6fdf 396 // param: direct address - public or random address of device to be connecteed
va009039 0:a05a07cd6fdf 397 // param: advertising channel map (flags): chan_37(1), chan_38(2), chan_39(4)
va009039 0:a05a07cd6fdf 398 // param: advertising filter policy (enum from 0): scan any conn any, scan whitelist, con any, scan any conn whitelist, scan whitelist, con whitelist
va009039 0:a05a07cd6fdf 399 // return: status
va009039 0:a05a07cd6fdf 400 };
va009039 0:a05a07cd6fdf 401 const hci_cmd_t hci_le_read_advertising_channel_tx_power = {
va009039 0:a05a07cd6fdf 402 OPCODE(OGF_LE_CONTROLLER, 0x07), ""
va009039 0:a05a07cd6fdf 403 // params: none
va009039 0:a05a07cd6fdf 404 // return: status, level [-20,10] signed int (8), units dBm
va009039 0:a05a07cd6fdf 405 };
va009039 0:a05a07cd6fdf 406 const hci_cmd_t hci_le_set_advertising_data= {
va009039 0:a05a07cd6fdf 407 OPCODE(OGF_LE_CONTROLLER, 0x08), "1A"
va009039 0:a05a07cd6fdf 408 // param: advertising data len
va009039 0:a05a07cd6fdf 409 // param: advertising data (31 bytes)
va009039 0:a05a07cd6fdf 410 // return: status
va009039 0:a05a07cd6fdf 411 };
va009039 0:a05a07cd6fdf 412 const hci_cmd_t hci_le_set_scan_response_data= {
va009039 0:a05a07cd6fdf 413 OPCODE(OGF_LE_CONTROLLER, 0x09), "1A"
va009039 0:a05a07cd6fdf 414 // param: scan response data len
va009039 0:a05a07cd6fdf 415 // param: scan response data (31 bytes)
va009039 0:a05a07cd6fdf 416 // return: status
va009039 0:a05a07cd6fdf 417 };
va009039 0:a05a07cd6fdf 418 const hci_cmd_t hci_le_set_advertise_enable = {
va009039 0:a05a07cd6fdf 419 OPCODE(OGF_LE_CONTROLLER, 0x0a), "1"
va009039 0:a05a07cd6fdf 420 // params: avertise enable: off (0), on (1)
va009039 0:a05a07cd6fdf 421 // return: status
va009039 0:a05a07cd6fdf 422 };
va009039 0:a05a07cd6fdf 423 const hci_cmd_t hci_le_set_scan_parameters = {
va009039 0:a05a07cd6fdf 424 OPCODE(OGF_LE_CONTROLLER, 0x0b), "12211"
va009039 0:a05a07cd6fdf 425 // param: le scan type: passive (0), active (1)
va009039 0:a05a07cd6fdf 426 // param: le scan interval [0x0004,0x4000], unit: 0.625 msec
va009039 0:a05a07cd6fdf 427 // param: le scan window [0x0004,0x4000], unit: 0.625 msec
va009039 0:a05a07cd6fdf 428 // param: own address type: public (0), random (1)
va009039 0:a05a07cd6fdf 429 // param: scanning filter policy: any (0), only whitelist (1)
va009039 0:a05a07cd6fdf 430 // return: status
va009039 0:a05a07cd6fdf 431 };
va009039 0:a05a07cd6fdf 432 const hci_cmd_t hci_le_set_scan_enable = {
va009039 0:a05a07cd6fdf 433 OPCODE(OGF_LE_CONTROLLER, 0x0c), "11"
va009039 0:a05a07cd6fdf 434 // param: le scan enable: disabled (0), enabled (1)
va009039 0:a05a07cd6fdf 435 // param: filter duplices: disabled (0), enabled (1)
va009039 0:a05a07cd6fdf 436 // return: status
va009039 0:a05a07cd6fdf 437 };
va009039 0:a05a07cd6fdf 438 const hci_cmd_t hci_le_create_connection= {
va009039 0:a05a07cd6fdf 439 OPCODE(OGF_LE_CONTROLLER, 0x0d), "2211B1222222"
va009039 0:a05a07cd6fdf 440 // param: le scan interval, [0x0004, 0x4000], unit: 0.625 msec
va009039 0:a05a07cd6fdf 441 // param: le scan window, [0x0004, 0x4000], unit: 0.625 msec
va009039 0:a05a07cd6fdf 442 // param: initiator filter policy: peer address type + peer address (0), whitelist (1)
va009039 0:a05a07cd6fdf 443 // param: peer address type: public (0), random (1)
va009039 0:a05a07cd6fdf 444 // param: peer address
va009039 0:a05a07cd6fdf 445 // param: own address type: public (0), random (1)
va009039 0:a05a07cd6fdf 446 // param: conn interval min, [0x0006, 0x0c80], unit: 1.25 msec
va009039 0:a05a07cd6fdf 447 // param: conn interval max, [0x0006, 0x0c80], unit: 1.25 msec
va009039 0:a05a07cd6fdf 448 // param: conn latency, number of connection events [0x0000, 0x01f4]
va009039 0:a05a07cd6fdf 449 // param: supervision timeout, [0x000a, 0x0c80], unit: 10 msec
va009039 0:a05a07cd6fdf 450 // param: minimum CE length, [0x0000, 0xffff], unit: 0.625 msec
va009039 0:a05a07cd6fdf 451 // return: none -> le create connection complete event
va009039 0:a05a07cd6fdf 452 };
va009039 0:a05a07cd6fdf 453 const hci_cmd_t hci_le_create_connection_cancel = {
va009039 0:a05a07cd6fdf 454 OPCODE(OGF_LE_CONTROLLER, 0x0e), ""
va009039 0:a05a07cd6fdf 455 // params: none
va009039 0:a05a07cd6fdf 456 // return: status
va009039 0:a05a07cd6fdf 457 };
va009039 0:a05a07cd6fdf 458 const hci_cmd_t hci_le_read_white_list_size = {
va009039 0:a05a07cd6fdf 459 OPCODE(OGF_LE_CONTROLLER, 0x0f), ""
va009039 0:a05a07cd6fdf 460 // params: none
va009039 0:a05a07cd6fdf 461 // return: status, number of entries in controller whitelist
va009039 0:a05a07cd6fdf 462 };
va009039 0:a05a07cd6fdf 463 const hci_cmd_t hci_le_clear_white_list = {
va009039 0:a05a07cd6fdf 464 OPCODE(OGF_LE_CONTROLLER, 0x10), ""
va009039 0:a05a07cd6fdf 465 // params: none
va009039 0:a05a07cd6fdf 466 // return: status
va009039 0:a05a07cd6fdf 467 };
va009039 0:a05a07cd6fdf 468 const hci_cmd_t hci_le_add_device_to_whitelist = {
va009039 0:a05a07cd6fdf 469 OPCODE(OGF_LE_CONTROLLER, 0x11), "1B"
va009039 0:a05a07cd6fdf 470 // param: address type: public (0), random (1)
va009039 0:a05a07cd6fdf 471 // param: address
va009039 0:a05a07cd6fdf 472 // return: status
va009039 0:a05a07cd6fdf 473 };
va009039 0:a05a07cd6fdf 474 const hci_cmd_t hci_le_remove_device_from_whitelist = {
va009039 0:a05a07cd6fdf 475 OPCODE(OGF_LE_CONTROLLER, 0x12), "1B"
va009039 0:a05a07cd6fdf 476 // param: address type: public (0), random (1)
va009039 0:a05a07cd6fdf 477 // param: address
va009039 0:a05a07cd6fdf 478 // return: status
va009039 0:a05a07cd6fdf 479 };
va009039 0:a05a07cd6fdf 480 const hci_cmd_t hci_le_connection_update = {
va009039 0:a05a07cd6fdf 481 OPCODE(OGF_LE_CONTROLLER, 0x13), "H222222"
va009039 0:a05a07cd6fdf 482 // param: conn handle
va009039 0:a05a07cd6fdf 483 // param: conn interval min, [0x0006,0x0c80], unit: 1.25 msec
va009039 0:a05a07cd6fdf 484 // param: conn interval max, [0x0006,0x0c80], unit: 1.25 msec
va009039 0:a05a07cd6fdf 485 // param: conn latency, [0x0000,0x03e8], number of connection events
va009039 0:a05a07cd6fdf 486 // param: supervision timeout, [0x000a,0x0c80], unit: 10 msec
va009039 0:a05a07cd6fdf 487 // param: minimum CE length, [0x0000,0xffff], unit: 0.625 msec
va009039 0:a05a07cd6fdf 488 // param: maximum CE length, [0x0000,0xffff], unit: 0.625 msec
va009039 0:a05a07cd6fdf 489 // return: none -> le connection update complete event
va009039 0:a05a07cd6fdf 490 };
va009039 0:a05a07cd6fdf 491 const hci_cmd_t hci_le_set_host_channel_classification = {
va009039 0:a05a07cd6fdf 492 OPCODE(OGF_LE_CONTROLLER, 0x14), "41"
va009039 0:a05a07cd6fdf 493 // param: channel map 37 bit, split into first 32 and higher 5 bits
va009039 0:a05a07cd6fdf 494 // return: status
va009039 0:a05a07cd6fdf 495 };
va009039 0:a05a07cd6fdf 496 const hci_cmd_t hci_le_read_channel_map = {
va009039 0:a05a07cd6fdf 497 OPCODE(OGF_LE_CONTROLLER, 0x15), "H"
va009039 0:a05a07cd6fdf 498 // params: connection handle
va009039 0:a05a07cd6fdf 499 // return: status, connection handle, channel map (5 bytes, 37 used)
va009039 0:a05a07cd6fdf 500 };
va009039 0:a05a07cd6fdf 501 const hci_cmd_t hci_le_read_remote_used_features = {
va009039 0:a05a07cd6fdf 502 OPCODE(OGF_LE_CONTROLLER, 0x16), "H"
va009039 0:a05a07cd6fdf 503 // params: connection handle
va009039 0:a05a07cd6fdf 504 // return: none -> le read remote used features complete event
va009039 0:a05a07cd6fdf 505 };
va009039 0:a05a07cd6fdf 506 const hci_cmd_t hci_le_encrypt = {
va009039 0:a05a07cd6fdf 507 OPCODE(OGF_LE_CONTROLLER, 0x17), "PP"
va009039 0:a05a07cd6fdf 508 // param: key (128) for AES-128
va009039 0:a05a07cd6fdf 509 // param: plain text (128)
va009039 0:a05a07cd6fdf 510 // return: status, encrypted data (128)
va009039 0:a05a07cd6fdf 511 };
va009039 0:a05a07cd6fdf 512 const hci_cmd_t hci_le_rand = {
va009039 0:a05a07cd6fdf 513 OPCODE(OGF_LE_CONTROLLER, 0x18), ""
va009039 0:a05a07cd6fdf 514 // params: none
va009039 0:a05a07cd6fdf 515 // return: status, random number (64)
va009039 0:a05a07cd6fdf 516 };
va009039 0:a05a07cd6fdf 517 const hci_cmd_t hci_le_start_encryption = {
va009039 0:a05a07cd6fdf 518 OPCODE(OGF_LE_CONTROLLER, 0x19), "H442P"
va009039 0:a05a07cd6fdf 519 // param: connection handle
va009039 0:a05a07cd6fdf 520 // param: 64 bit random number lower 32 bit
va009039 0:a05a07cd6fdf 521 // param: 64 bit random number higher 32 bit
va009039 0:a05a07cd6fdf 522 // param: encryption diversifier (16)
va009039 0:a05a07cd6fdf 523 // param: long term key (128)
va009039 0:a05a07cd6fdf 524 // return: none -> encryption changed or encryption key refresh complete event
va009039 0:a05a07cd6fdf 525 };
va009039 0:a05a07cd6fdf 526 const hci_cmd_t hci_le_long_term_key_request_reply = {
va009039 0:a05a07cd6fdf 527 OPCODE(OGF_LE_CONTROLLER, 0x1a), "HP"
va009039 0:a05a07cd6fdf 528 // param: connection handle
va009039 0:a05a07cd6fdf 529 // param: long term key (128)
va009039 0:a05a07cd6fdf 530 // return: status, connection handle
va009039 0:a05a07cd6fdf 531 };
va009039 0:a05a07cd6fdf 532 const hci_cmd_t hci_le_long_term_key_negative_reply = {
va009039 0:a05a07cd6fdf 533 OPCODE(OGF_LE_CONTROLLER, 0x1b), "H"
va009039 0:a05a07cd6fdf 534 // param: connection handle
va009039 0:a05a07cd6fdf 535 // return: status, connection handle
va009039 0:a05a07cd6fdf 536 };
va009039 0:a05a07cd6fdf 537 const hci_cmd_t hci_le_read_supported_states = {
va009039 0:a05a07cd6fdf 538 OPCODE(OGF_LE_CONTROLLER, 0x1c), "H"
va009039 0:a05a07cd6fdf 539 // param: none
va009039 0:a05a07cd6fdf 540 // return: status, LE states (64)
va009039 0:a05a07cd6fdf 541 };
va009039 0:a05a07cd6fdf 542 const hci_cmd_t hci_le_receiver_test = {
va009039 0:a05a07cd6fdf 543 OPCODE(OGF_LE_CONTROLLER, 0x1d), "1"
va009039 0:a05a07cd6fdf 544 // param: rx frequency, [0x00 0x27], frequency (MHz): 2420 + N*2
va009039 0:a05a07cd6fdf 545 // return: status
va009039 0:a05a07cd6fdf 546 };
va009039 0:a05a07cd6fdf 547 const hci_cmd_t hci_le_transmitter_test = {
va009039 0:a05a07cd6fdf 548 OPCODE(OGF_LE_CONTROLLER, 0x1e), "111"
va009039 0:a05a07cd6fdf 549 // param: tx frequency, [0x00 0x27], frequency (MHz): 2420 + N*2
va009039 0:a05a07cd6fdf 550 // param: lengh of test payload [0x00,0x25]
va009039 0:a05a07cd6fdf 551 // param: packet payload [0,7] different patterns
va009039 0:a05a07cd6fdf 552 // return: status
va009039 0:a05a07cd6fdf 553 };
va009039 0:a05a07cd6fdf 554 const hci_cmd_t hci_le_test_end = {
va009039 0:a05a07cd6fdf 555 OPCODE(OGF_LE_CONTROLLER, 0x1f), "1"
va009039 0:a05a07cd6fdf 556 // params: none
va009039 0:a05a07cd6fdf 557 // return: status, number of packets (8)
va009039 0:a05a07cd6fdf 558 };
va009039 0:a05a07cd6fdf 559 #endif
va009039 0:a05a07cd6fdf 560
va009039 0:a05a07cd6fdf 561 // BTstack commands
va009039 0:a05a07cd6fdf 562 const hci_cmd_t btstack_get_state = {
va009039 0:a05a07cd6fdf 563 OPCODE(OGF_BTSTACK, BTSTACK_GET_STATE), ""
va009039 0:a05a07cd6fdf 564 // no params ->
va009039 0:a05a07cd6fdf 565 };
va009039 0:a05a07cd6fdf 566
va009039 0:a05a07cd6fdf 567 const hci_cmd_t btstack_set_power_mode = {
va009039 0:a05a07cd6fdf 568 OPCODE(OGF_BTSTACK, BTSTACK_SET_POWER_MODE), "1"
va009039 0:a05a07cd6fdf 569 // mode: 0 = off, 1 = on
va009039 0:a05a07cd6fdf 570 };
va009039 0:a05a07cd6fdf 571
va009039 0:a05a07cd6fdf 572 const hci_cmd_t btstack_set_acl_capture_mode = {
va009039 0:a05a07cd6fdf 573 OPCODE(OGF_BTSTACK, BTSTACK_SET_ACL_CAPTURE_MODE), "1"
va009039 0:a05a07cd6fdf 574 // mode: 0 = off, 1 = on
va009039 0:a05a07cd6fdf 575 };
va009039 0:a05a07cd6fdf 576
va009039 0:a05a07cd6fdf 577 const hci_cmd_t btstack_get_version = {
va009039 0:a05a07cd6fdf 578 OPCODE(OGF_BTSTACK, BTSTACK_GET_VERSION), ""
va009039 0:a05a07cd6fdf 579 };
va009039 0:a05a07cd6fdf 580
va009039 0:a05a07cd6fdf 581 const hci_cmd_t btstack_get_system_bluetooth_enabled = {
va009039 0:a05a07cd6fdf 582 OPCODE(OGF_BTSTACK, BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED), ""
va009039 0:a05a07cd6fdf 583 };
va009039 0:a05a07cd6fdf 584
va009039 0:a05a07cd6fdf 585 const hci_cmd_t btstack_set_system_bluetooth_enabled = {
va009039 0:a05a07cd6fdf 586 OPCODE(OGF_BTSTACK, BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED), "1"
va009039 0:a05a07cd6fdf 587 };
va009039 0:a05a07cd6fdf 588
va009039 0:a05a07cd6fdf 589 const hci_cmd_t btstack_set_discoverable = {
va009039 0:a05a07cd6fdf 590 OPCODE(OGF_BTSTACK, BTSTACK_SET_DISCOVERABLE), "1"
va009039 0:a05a07cd6fdf 591 };
va009039 0:a05a07cd6fdf 592
va009039 0:a05a07cd6fdf 593 const hci_cmd_t btstack_set_bluetooth_enabled = {
va009039 0:a05a07cd6fdf 594 // only used by btstack config
va009039 0:a05a07cd6fdf 595 OPCODE(OGF_BTSTACK, BTSTACK_SET_BLUETOOTH_ENABLED), "1"
va009039 0:a05a07cd6fdf 596 };
va009039 0:a05a07cd6fdf 597
va009039 0:a05a07cd6fdf 598 const hci_cmd_t l2cap_create_channel = {
va009039 0:a05a07cd6fdf 599 OPCODE(OGF_BTSTACK, L2CAP_CREATE_CHANNEL), "B2"
va009039 0:a05a07cd6fdf 600 // @param bd_addr(48), psm (16)
va009039 0:a05a07cd6fdf 601 };
va009039 0:a05a07cd6fdf 602 const hci_cmd_t l2cap_create_channel_mtu = {
va009039 0:a05a07cd6fdf 603 OPCODE(OGF_BTSTACK, L2CAP_CREATE_CHANNEL_MTU), "B22"
va009039 0:a05a07cd6fdf 604 // @param bd_addr(48), psm (16), mtu (16)
va009039 0:a05a07cd6fdf 605 };
va009039 0:a05a07cd6fdf 606 const hci_cmd_t l2cap_disconnect = {
va009039 0:a05a07cd6fdf 607 OPCODE(OGF_BTSTACK, L2CAP_DISCONNECT), "21"
va009039 0:a05a07cd6fdf 608 // @param channel(16), reason(8)
va009039 0:a05a07cd6fdf 609 };
va009039 0:a05a07cd6fdf 610 const hci_cmd_t l2cap_register_service = {
va009039 0:a05a07cd6fdf 611 OPCODE(OGF_BTSTACK, L2CAP_REGISTER_SERVICE), "22"
va009039 0:a05a07cd6fdf 612 // @param psm (16), mtu (16)
va009039 0:a05a07cd6fdf 613 };
va009039 0:a05a07cd6fdf 614 const hci_cmd_t l2cap_unregister_service = {
va009039 0:a05a07cd6fdf 615 OPCODE(OGF_BTSTACK, L2CAP_UNREGISTER_SERVICE), "2"
va009039 0:a05a07cd6fdf 616 // @param psm (16)
va009039 0:a05a07cd6fdf 617 };
va009039 0:a05a07cd6fdf 618 const hci_cmd_t l2cap_accept_connection = {
va009039 0:a05a07cd6fdf 619 OPCODE(OGF_BTSTACK, L2CAP_ACCEPT_CONNECTION), "2"
va009039 0:a05a07cd6fdf 620 // @param source cid (16)
va009039 0:a05a07cd6fdf 621 };
va009039 0:a05a07cd6fdf 622 const hci_cmd_t l2cap_decline_connection = {
va009039 0:a05a07cd6fdf 623 OPCODE(OGF_BTSTACK, L2CAP_DECLINE_CONNECTION), "21"
va009039 0:a05a07cd6fdf 624 // @param source cid (16), reason(8)
va009039 0:a05a07cd6fdf 625 };
va009039 0:a05a07cd6fdf 626 const hci_cmd_t sdp_register_service_record = {
va009039 0:a05a07cd6fdf 627 OPCODE(OGF_BTSTACK, SDP_REGISTER_SERVICE_RECORD), "S"
va009039 0:a05a07cd6fdf 628 // @param service record handle (DES)
va009039 0:a05a07cd6fdf 629 };
va009039 0:a05a07cd6fdf 630 const hci_cmd_t sdp_unregister_service_record = {
va009039 0:a05a07cd6fdf 631 OPCODE(OGF_BTSTACK, SDP_UNREGISTER_SERVICE_RECORD), "4"
va009039 0:a05a07cd6fdf 632 // @param service record handle (32)
va009039 0:a05a07cd6fdf 633 };
va009039 0:a05a07cd6fdf 634
va009039 0:a05a07cd6fdf 635 // create rfcomm channel: @param bd_addr(48), channel (8)
va009039 0:a05a07cd6fdf 636 const hci_cmd_t rfcomm_create_channel = {
va009039 0:a05a07cd6fdf 637 OPCODE(OGF_BTSTACK, RFCOMM_CREATE_CHANNEL), "B1"
va009039 0:a05a07cd6fdf 638 };
va009039 0:a05a07cd6fdf 639 // create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8)
va009039 0:a05a07cd6fdf 640 const hci_cmd_t rfcomm_create_channel_with_initial_credits = {
va009039 0:a05a07cd6fdf 641 OPCODE(OGF_BTSTACK, RFCOMM_CREATE_CHANNEL_WITH_CREDITS), "B121"
va009039 0:a05a07cd6fdf 642 };
va009039 0:a05a07cd6fdf 643 // grant credits: @param rfcomm_cid(16), credits (8)
va009039 0:a05a07cd6fdf 644 const hci_cmd_t rfcomm_grants_credits= {
va009039 0:a05a07cd6fdf 645 OPCODE(OGF_BTSTACK, RFCOMM_GRANT_CREDITS), "21"
va009039 0:a05a07cd6fdf 646 };
va009039 0:a05a07cd6fdf 647 // disconnect rfcomm disconnect, @param rfcomm_cid(16), reason(8)
va009039 0:a05a07cd6fdf 648 const hci_cmd_t rfcomm_disconnect = {
va009039 0:a05a07cd6fdf 649 OPCODE(OGF_BTSTACK, RFCOMM_DISCONNECT), "21"
va009039 0:a05a07cd6fdf 650 };
va009039 0:a05a07cd6fdf 651
va009039 0:a05a07cd6fdf 652 // register rfcomm service: @param channel(8), mtu (16)
va009039 0:a05a07cd6fdf 653 const hci_cmd_t rfcomm_register_service = {
va009039 0:a05a07cd6fdf 654 OPCODE(OGF_BTSTACK, RFCOMM_REGISTER_SERVICE), "12"
va009039 0:a05a07cd6fdf 655 };
va009039 0:a05a07cd6fdf 656 // register rfcomm service: @param channel(8), mtu (16), initial credits (8)
va009039 0:a05a07cd6fdf 657 const hci_cmd_t rfcomm_register_service_with_initial_credits = {
va009039 0:a05a07cd6fdf 658 OPCODE(OGF_BTSTACK, RFCOMM_REGISTER_SERVICE_WITH_CREDITS), "121"
va009039 0:a05a07cd6fdf 659 };
va009039 0:a05a07cd6fdf 660
va009039 0:a05a07cd6fdf 661 // unregister rfcomm service, @param service_channel(16)
va009039 0:a05a07cd6fdf 662 const hci_cmd_t rfcomm_unregister_service = {
va009039 0:a05a07cd6fdf 663 OPCODE(OGF_BTSTACK, RFCOMM_UNREGISTER_SERVICE), "2"
va009039 0:a05a07cd6fdf 664 };
va009039 0:a05a07cd6fdf 665 // accept connection @param source cid (16)
va009039 0:a05a07cd6fdf 666 const hci_cmd_t rfcomm_accept_connection = {
va009039 0:a05a07cd6fdf 667 OPCODE(OGF_BTSTACK, RFCOMM_ACCEPT_CONNECTION), "2"
va009039 0:a05a07cd6fdf 668 };
va009039 0:a05a07cd6fdf 669 // decline connection @param source cid (16)
va009039 0:a05a07cd6fdf 670 const hci_cmd_t rfcomm_decline_connection = {
va009039 0:a05a07cd6fdf 671 OPCODE(OGF_BTSTACK, RFCOMM_DECLINE_CONNECTION), "21"
va009039 0:a05a07cd6fdf 672 };
va009039 0:a05a07cd6fdf 673 // request persisten rfcomm channel number for named service
va009039 0:a05a07cd6fdf 674 const hci_cmd_t rfcomm_persistent_channel_for_service = {
va009039 0:a05a07cd6fdf 675 OPCODE(OGF_BTSTACK, RFCOMM_PERSISTENT_CHANNEL), "N"
va009039 0:a05a07cd6fdf 676 };
va009039 0:a05a07cd6fdf 677
va009039 0:a05a07cd6fdf 678 // register rfcomm service: @param channel(8), mtu (16), initial credits (8)
va009039 0:a05a07cd6fdf 679 extern const hci_cmd_t rfcomm_register_service_with_initial_credits;