1 | /*
|
---|
2 | * Copyright (C) 2009-2012 by Matthias Ringwald
|
---|
3 | *
|
---|
4 | * Redistribution and use in source and binary forms, with or without
|
---|
5 | * modification, are permitted provided that the following conditions
|
---|
6 | * are met:
|
---|
7 | *
|
---|
8 | * 1. Redistributions of source code must retain the above copyright
|
---|
9 | * notice, this list of conditions and the following disclaimer.
|
---|
10 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
11 | * notice, this list of conditions and the following disclaimer in the
|
---|
12 | * documentation and/or other materials provided with the distribution.
|
---|
13 | * 3. Neither the name of the copyright holders nor the names of
|
---|
14 | * contributors may be used to endorse or promote products derived
|
---|
15 | * from this software without specific prior written permission.
|
---|
16 | * 4. Any redistribution, use, or modification is done solely for
|
---|
17 | * personal benefit and not for any commercial purpose or for
|
---|
18 | * monetary gain.
|
---|
19 | *
|
---|
20 | * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
|
---|
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
---|
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
---|
23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
---|
24 | * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
---|
26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
---|
27 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
---|
28 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
---|
30 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
31 | * SUCH DAMAGE.
|
---|
32 | *
|
---|
33 | * Please inquire about commercial licensing options at btstack@ringwald.ch
|
---|
34 | *
|
---|
35 | */
|
---|
36 |
|
---|
37 | /*
|
---|
38 | * hci_cmds.c
|
---|
39 | *
|
---|
40 | * Created by Matthias Ringwald on 7/23/09.
|
---|
41 | */
|
---|
42 |
|
---|
43 | #include <btstack/hci_cmds.h>
|
---|
44 |
|
---|
45 | #include <string.h>
|
---|
46 |
|
---|
47 | #include <btstack/sdp_util.h>
|
---|
48 | #include "btstack-config.h"
|
---|
49 | #include "hci.h"
|
---|
50 |
|
---|
51 | // calculate combined ogf/ocf value
|
---|
52 | #define OPCODE(ogf, ocf) (ocf | ogf << 10)
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * construct HCI Command based on template
|
---|
56 | *
|
---|
57 | * Format:
|
---|
58 | * 1,2,3,4: one to four byte value
|
---|
59 | * H: HCI connection handle
|
---|
60 | * B: Bluetooth Baseband Address (BD_ADDR)
|
---|
61 | * E: Extended Inquiry Result
|
---|
62 | * N: Name up to 248 chars, \0 terminated
|
---|
63 | * P: 16 byte Pairing code
|
---|
64 | * S: Service Record (Data Element Sequence)
|
---|
65 | */
|
---|
66 | uint16_t hci_create_cmd_internal(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr){
|
---|
67 | int pos;
|
---|
68 | const char *format;
|
---|
69 | uint16_t word;
|
---|
70 | uint32_t longword;
|
---|
71 | uint8_t * ptr;
|
---|
72 | uint16_t len;
|
---|
73 |
|
---|
74 | hci_cmd_buffer[0] = cmd->opcode & 0xff;
|
---|
75 | hci_cmd_buffer[1] = cmd->opcode >> 8;
|
---|
76 | pos = 3;
|
---|
77 |
|
---|
78 | format = cmd->format;
|
---|
79 | while (*format) {
|
---|
80 | switch(*format) {
|
---|
81 | case '1': // 8 bit value
|
---|
82 | case '2': // 16 bit value
|
---|
83 | case 'H': // hci_handle
|
---|
84 | word = va_arg(argptr, int); // minimal va_arg is int: 2 bytes on 8+16 bit CPUs
|
---|
85 | hci_cmd_buffer[pos++] = word & 0xff;
|
---|
86 | if (*format == '2') {
|
---|
87 | hci_cmd_buffer[pos++] = word >> 8;
|
---|
88 | } else if (*format == 'H') {
|
---|
89 | // TODO implement opaque client connection handles
|
---|
90 | // pass module handle for now
|
---|
91 | hci_cmd_buffer[pos++] = word >> 8;
|
---|
92 | }
|
---|
93 | break;
|
---|
94 | case '3':
|
---|
95 | case '4':
|
---|
96 | longword = va_arg(argptr, uint32_t);
|
---|
97 | // longword = va_arg(argptr, int);
|
---|
98 | hci_cmd_buffer[pos++] = longword;
|
---|
99 | hci_cmd_buffer[pos++] = longword >> 8;
|
---|
100 | hci_cmd_buffer[pos++] = longword >> 16;
|
---|
101 | if (*format == '4'){
|
---|
102 | hci_cmd_buffer[pos++] = longword >> 24;
|
---|
103 | }
|
---|
104 | break;
|
---|
105 | case 'B': // bt-addr
|
---|
106 | ptr = va_arg(argptr, uint8_t *);
|
---|
107 | hci_cmd_buffer[pos++] = ptr[5];
|
---|
108 | hci_cmd_buffer[pos++] = ptr[4];
|
---|
109 | hci_cmd_buffer[pos++] = ptr[3];
|
---|
110 | hci_cmd_buffer[pos++] = ptr[2];
|
---|
111 | hci_cmd_buffer[pos++] = ptr[1];
|
---|
112 | hci_cmd_buffer[pos++] = ptr[0];
|
---|
113 | break;
|
---|
114 | case 'D': // 8 byte data block
|
---|
115 | ptr = va_arg(argptr, uint8_t *);
|
---|
116 | memcpy(&hci_cmd_buffer[pos], ptr, 8);
|
---|
117 | pos += 8;
|
---|
118 | break;
|
---|
119 | case 'E': // Extended Inquiry Information 240 octets
|
---|
120 | ptr = va_arg(argptr, uint8_t *);
|
---|
121 | memcpy(&hci_cmd_buffer[pos], ptr, 240);
|
---|
122 | pos += 240;
|
---|
123 | break;
|
---|
124 | case 'N': { // UTF-8 string, null terminated
|
---|
125 | ptr = va_arg(argptr, uint8_t *);
|
---|
126 | len = strlen((const char*) ptr) + 1;
|
---|
127 | if (len > 248) {
|
---|
128 | len = 248;
|
---|
129 | }
|
---|
130 | memcpy(&hci_cmd_buffer[pos], ptr, len);
|
---|
131 | if (len < 248) {
|
---|
132 | // fill remaining space with zeroes
|
---|
133 | memset(&hci_cmd_buffer[pos+len], 0, 248-len);
|
---|
134 | }
|
---|
135 | pos += len;
|
---|
136 | break;
|
---|
137 | }
|
---|
138 | case 'P': // 16 byte PIN code or link key
|
---|
139 | ptr = va_arg(argptr, uint8_t *);
|
---|
140 | memcpy(&hci_cmd_buffer[pos], ptr, 16);
|
---|
141 | pos += 16;
|
---|
142 | break;
|
---|
143 | #ifdef HAVE_BLE
|
---|
144 | case 'A': // 31 bytes advertising data
|
---|
145 | ptr = va_arg(argptr, uint8_t *);
|
---|
146 | memcpy(&hci_cmd_buffer[pos], ptr, 31);
|
---|
147 | pos += 31;
|
---|
148 | break;
|
---|
149 | #endif
|
---|
150 | #ifdef HAVE_SDP
|
---|
151 | case 'S': { // Service Record (Data Element Sequence)
|
---|
152 | ptr = va_arg(argptr, uint8_t *);
|
---|
153 | uint16_t len = de_get_len(ptr);
|
---|
154 | memcpy(&hci_cmd_buffer[pos], ptr, len);
|
---|
155 | pos += len;
|
---|
156 | break;
|
---|
157 | }
|
---|
158 | #endif
|
---|
159 | default:
|
---|
160 | break;
|
---|
161 | }
|
---|
162 | format++;
|
---|
163 | };
|
---|
164 | hci_cmd_buffer[2] = pos - 3;
|
---|
165 | return pos;
|
---|
166 | }
|
---|
167 |
|
---|
168 | /**
|
---|
169 | * construct HCI Command based on template
|
---|
170 | *
|
---|
171 | * mainly calls hci_create_cmd_internal
|
---|
172 | */
|
---|
173 | uint16_t hci_create_cmd(uint8_t *hci_cmd_buffer, hci_cmd_t *cmd, ...){
|
---|
174 | va_list argptr;
|
---|
175 | uint16_t len;
|
---|
176 | va_start(argptr, cmd);
|
---|
177 | len = hci_create_cmd_internal(hci_cmd_buffer, cmd, argptr);
|
---|
178 | va_end(argptr);
|
---|
179 | return len;
|
---|
180 | }
|
---|
181 |
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * Link Control Commands
|
---|
185 | */
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * @param lap
|
---|
189 | * @param inquiry_length
|
---|
190 | * @param num_responses
|
---|
191 | */
|
---|
192 | const hci_cmd_t hci_inquiry = {
|
---|
193 | OPCODE(OGF_LINK_CONTROL, 0x01), "311"
|
---|
194 | };
|
---|
195 |
|
---|
196 | /**
|
---|
197 | */
|
---|
198 | const hci_cmd_t hci_inquiry_cancel = {
|
---|
199 | OPCODE(OGF_LINK_CONTROL, 0x02), ""
|
---|
200 | };
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * @param bd_addr
|
---|
204 | * @param packet_type
|
---|
205 | * @param page_scan_repetition_mode
|
---|
206 | * @param reserved
|
---|
207 | * @param clock_offset
|
---|
208 | * @param allow_role_switch
|
---|
209 | */
|
---|
210 | const hci_cmd_t hci_create_connection = {
|
---|
211 | OPCODE(OGF_LINK_CONTROL, 0x05), "B21121"
|
---|
212 | };
|
---|
213 |
|
---|
214 | /**
|
---|
215 | * @param handle
|
---|
216 | * @param reason (0x05, 0x13-0x15, 0x1a, 0x29, see Errors Codes in BT Spec Part D)
|
---|
217 | */
|
---|
218 | const hci_cmd_t hci_disconnect = {
|
---|
219 | OPCODE(OGF_LINK_CONTROL, 0x06), "H1"
|
---|
220 | };
|
---|
221 |
|
---|
222 | /**
|
---|
223 | * @param bd_addr
|
---|
224 | */
|
---|
225 | const hci_cmd_t hci_create_connection_cancel = {
|
---|
226 | OPCODE(OGF_LINK_CONTROL, 0x08), "B"
|
---|
227 | };
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * @param bd_addr
|
---|
231 | * @param role (become master, stay slave)
|
---|
232 | */
|
---|
233 | const hci_cmd_t hci_accept_connection_request = {
|
---|
234 | OPCODE(OGF_LINK_CONTROL, 0x09), "B1"
|
---|
235 | };
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * @param bd_addr
|
---|
239 | * @param reason (e.g. CONNECTION REJECTED DUE TO LIMITED RESOURCES (0x0d))
|
---|
240 | */
|
---|
241 | const hci_cmd_t hci_reject_connection_request = {
|
---|
242 | OPCODE(OGF_LINK_CONTROL, 0x0a), "B1"
|
---|
243 | };
|
---|
244 |
|
---|
245 | /**
|
---|
246 | * @param bd_addr
|
---|
247 | * @param link_key
|
---|
248 | */
|
---|
249 | const hci_cmd_t hci_link_key_request_reply = {
|
---|
250 | OPCODE(OGF_LINK_CONTROL, 0x0b), "BP"
|
---|
251 | };
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * @param bd_addr
|
---|
255 | */
|
---|
256 | const hci_cmd_t hci_link_key_request_negative_reply = {
|
---|
257 | OPCODE(OGF_LINK_CONTROL, 0x0c), "B"
|
---|
258 | };
|
---|
259 |
|
---|
260 | /**
|
---|
261 | * @param bd_addr
|
---|
262 | * @param pin_length
|
---|
263 | * @param pin (c-string)
|
---|
264 | */
|
---|
265 | const hci_cmd_t hci_pin_code_request_reply = {
|
---|
266 | OPCODE(OGF_LINK_CONTROL, 0x0d), "B1P"
|
---|
267 | };
|
---|
268 |
|
---|
269 | /**
|
---|
270 | * @param bd_addr
|
---|
271 | */
|
---|
272 | const hci_cmd_t hci_pin_code_request_negative_reply = {
|
---|
273 | OPCODE(OGF_LINK_CONTROL, 0x0e), "B"
|
---|
274 | };
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * @param handle
|
---|
278 | * @param packet_type
|
---|
279 | */
|
---|
280 | const hci_cmd_t hci_change_connection_packet_type = {
|
---|
281 | OPCODE(OGF_LINK_CONTROL, 0x0f), "H2"
|
---|
282 | };
|
---|
283 |
|
---|
284 | /**
|
---|
285 | * @param handle
|
---|
286 | */
|
---|
287 | const hci_cmd_t hci_authentication_requested = {
|
---|
288 | OPCODE(OGF_LINK_CONTROL, 0x11), "H"
|
---|
289 | };
|
---|
290 |
|
---|
291 | /**
|
---|
292 | * @param handle
|
---|
293 | * @param encryption_enable
|
---|
294 | */
|
---|
295 | const hci_cmd_t hci_set_connection_encryption = {
|
---|
296 | OPCODE(OGF_LINK_CONTROL, 0x13), "H1"
|
---|
297 | };
|
---|
298 |
|
---|
299 | /**
|
---|
300 | * @param handle
|
---|
301 | */
|
---|
302 | const hci_cmd_t hci_change_connection_link_key = {
|
---|
303 | OPCODE(OGF_LINK_CONTROL, 0x15), "H"
|
---|
304 | };
|
---|
305 |
|
---|
306 | /**
|
---|
307 | * @param bd_addr
|
---|
308 | * @param page_scan_repetition_mode
|
---|
309 | * @param reserved
|
---|
310 | * @param clock_offset
|
---|
311 | */
|
---|
312 | const hci_cmd_t hci_remote_name_request = {
|
---|
313 | OPCODE(OGF_LINK_CONTROL, 0x19), "B112"
|
---|
314 | };
|
---|
315 |
|
---|
316 |
|
---|
317 | /**
|
---|
318 | * @param bd_addr
|
---|
319 | */
|
---|
320 | const hci_cmd_t hci_remote_name_request_cancel = {
|
---|
321 | OPCODE(OGF_LINK_CONTROL, 0x1A), "B"
|
---|
322 | };
|
---|
323 |
|
---|
324 | /**
|
---|
325 | * @param handle
|
---|
326 | */
|
---|
327 | const hci_cmd_t hci_read_remote_supported_features_command = {
|
---|
328 | OPCODE(OGF_LINK_CONTROL, 0x1B), "H"
|
---|
329 | };
|
---|
330 |
|
---|
331 | /**
|
---|
332 | * @param bd_addr
|
---|
333 | * @param IO_capability
|
---|
334 | * @param OOB_data_present
|
---|
335 | * @param authentication_requirements
|
---|
336 | */
|
---|
337 | const hci_cmd_t hci_io_capability_request_reply = {
|
---|
338 | OPCODE(OGF_LINK_CONTROL, 0x2b), "B111"
|
---|
339 | };
|
---|
340 |
|
---|
341 | /**
|
---|
342 | * @param bd_addr
|
---|
343 | */
|
---|
344 | const hci_cmd_t hci_user_confirmation_request_reply = {
|
---|
345 | OPCODE(OGF_LINK_CONTROL, 0x2c), "B"
|
---|
346 | };
|
---|
347 |
|
---|
348 | /**
|
---|
349 | * @param bd_addr
|
---|
350 | */
|
---|
351 | const hci_cmd_t hci_user_confirmation_request_negative_reply = {
|
---|
352 | OPCODE(OGF_LINK_CONTROL, 0x2d), "B"
|
---|
353 | };
|
---|
354 |
|
---|
355 | /**
|
---|
356 | * @param bd_addr
|
---|
357 | * @param numeric_value
|
---|
358 | */
|
---|
359 | const hci_cmd_t hci_user_passkey_request_reply = {
|
---|
360 | OPCODE(OGF_LINK_CONTROL, 0x2e), "B4"
|
---|
361 | };
|
---|
362 |
|
---|
363 | /**
|
---|
364 | * @param bd_addr
|
---|
365 | */
|
---|
366 | const hci_cmd_t hci_user_passkey_request_negative_reply = {
|
---|
367 | OPCODE(OGF_LINK_CONTROL, 0x2f), "B"
|
---|
368 | };
|
---|
369 |
|
---|
370 | /**
|
---|
371 | * @param bd_addr
|
---|
372 | */
|
---|
373 | const hci_cmd_t hci_remote_oob_data_request_negative_reply = {
|
---|
374 | OPCODE(OGF_LINK_CONTROL, 0x33), "B"
|
---|
375 | };
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * @param bd_addr
|
---|
379 | * @param reason (Part D, Error codes)
|
---|
380 | */
|
---|
381 | const hci_cmd_t hci_io_capability_request_negative_reply = {
|
---|
382 | OPCODE(OGF_LINK_CONTROL, 0x34), "B1"
|
---|
383 | };
|
---|
384 |
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * Link Policy Commands
|
---|
388 | */
|
---|
389 |
|
---|
390 | /**
|
---|
391 | * @param handle
|
---|
392 | * @param sniff_max_interval
|
---|
393 | * @param sniff_min_interval
|
---|
394 | * @param sniff_attempt
|
---|
395 | * @param sniff_timeout
|
---|
396 | */
|
---|
397 | const hci_cmd_t hci_sniff_mode = {
|
---|
398 | OPCODE(OGF_LINK_POLICY, 0x03), "H2222"
|
---|
399 | };
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * @param handle
|
---|
403 | * @param flags
|
---|
404 | * @param service_type
|
---|
405 | * @param token_rate (bytes/s)
|
---|
406 | * @param peak_bandwith (bytes/s)
|
---|
407 | * @param latency (us)
|
---|
408 | * @param delay_variation (us)
|
---|
409 | */
|
---|
410 | const hci_cmd_t hci_qos_setup = {
|
---|
411 | OPCODE(OGF_LINK_POLICY, 0x07), "H114444"
|
---|
412 | };
|
---|
413 |
|
---|
414 | /**
|
---|
415 | * @param handle
|
---|
416 | */
|
---|
417 | const hci_cmd_t hci_role_discovery = {
|
---|
418 | OPCODE(OGF_LINK_POLICY, 0x09), "H"
|
---|
419 | };
|
---|
420 |
|
---|
421 | /**
|
---|
422 | * @param bd_addr
|
---|
423 | * @param role (0=master,1=slave)
|
---|
424 | */
|
---|
425 | const hci_cmd_t hci_switch_role_command= {
|
---|
426 | OPCODE(OGF_LINK_POLICY, 0x0b), "B1"
|
---|
427 | };
|
---|
428 |
|
---|
429 | /**
|
---|
430 | * @param handle
|
---|
431 | */
|
---|
432 | const hci_cmd_t hci_read_link_policy_settings = {
|
---|
433 | OPCODE(OGF_LINK_POLICY, 0x0c), "H"
|
---|
434 | };
|
---|
435 |
|
---|
436 | /**
|
---|
437 | * @param handle
|
---|
438 | * @param settings
|
---|
439 | */
|
---|
440 | const hci_cmd_t hci_write_link_policy_settings = {
|
---|
441 | OPCODE(OGF_LINK_POLICY, 0x0d), "H2"
|
---|
442 | };
|
---|
443 |
|
---|
444 |
|
---|
445 | /**
|
---|
446 | * Controller & Baseband Commands
|
---|
447 | */
|
---|
448 |
|
---|
449 | /**
|
---|
450 | * @param event_mask_lover_octets
|
---|
451 | * @param event_mask_higher_octets
|
---|
452 | */
|
---|
453 | const hci_cmd_t hci_set_event_mask = {
|
---|
454 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x01), "44"
|
---|
455 | };
|
---|
456 |
|
---|
457 | /**
|
---|
458 | */
|
---|
459 | const hci_cmd_t hci_reset = {
|
---|
460 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x03), ""
|
---|
461 | };
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * @param bd_addr
|
---|
465 | * @param delete_all_flags
|
---|
466 | */
|
---|
467 | const hci_cmd_t hci_delete_stored_link_key = {
|
---|
468 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x12), "B1"
|
---|
469 | };
|
---|
470 |
|
---|
471 | /**
|
---|
472 | * @param local_name (UTF-8, Null Terminated, max 248 octets)
|
---|
473 | */
|
---|
474 | const hci_cmd_t hci_write_local_name = {
|
---|
475 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x13), "N"
|
---|
476 | };
|
---|
477 |
|
---|
478 | /**
|
---|
479 | * @param page_timeout (* 0.625 ms)
|
---|
480 | */
|
---|
481 | const hci_cmd_t hci_write_page_timeout = {
|
---|
482 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x18), "2"
|
---|
483 | };
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * @param scan_enable (no, inq, page, inq+page)
|
---|
487 | */
|
---|
488 | const hci_cmd_t hci_write_scan_enable = {
|
---|
489 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x1A), "1"
|
---|
490 | };
|
---|
491 |
|
---|
492 | /**
|
---|
493 | * @param authentication_enable
|
---|
494 | */
|
---|
495 | const hci_cmd_t hci_write_authentication_enable = {
|
---|
496 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x20), "1"
|
---|
497 | };
|
---|
498 |
|
---|
499 | /**
|
---|
500 | * @param class_of_device
|
---|
501 | */
|
---|
502 | const hci_cmd_t hci_write_class_of_device = {
|
---|
503 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x24), "3"
|
---|
504 | };
|
---|
505 |
|
---|
506 | /**
|
---|
507 | */
|
---|
508 | const hci_cmd_t hci_read_num_broadcast_retransmissions = {
|
---|
509 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x29), ""
|
---|
510 | };
|
---|
511 |
|
---|
512 | /**
|
---|
513 | * @param num_broadcast_retransmissions (e.g. 0 for a single broadcast)
|
---|
514 | */
|
---|
515 | const hci_cmd_t hci_write_num_broadcast_retransmissions = {
|
---|
516 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x2a), "1"
|
---|
517 | };
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * @param host_acl_data_packet_length
|
---|
521 | * @param host_synchronous_data_packet_length
|
---|
522 | * @param host_total_num_acl_data_packets
|
---|
523 | * @param host_total_num_synchronous_data_packets
|
---|
524 | */
|
---|
525 | const hci_cmd_t hci_host_buffer_size = {
|
---|
526 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x33), "2122"
|
---|
527 | };
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * @param handle
|
---|
531 | */
|
---|
532 | const hci_cmd_t hci_read_link_supervision_timeout = {
|
---|
533 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x36), "H"
|
---|
534 | };
|
---|
535 |
|
---|
536 | /**
|
---|
537 | * @param handle
|
---|
538 | * @param timeout (0x0001 - 0xFFFF Time -> Range: 0.625ms - 40.9 sec)
|
---|
539 | */
|
---|
540 | const hci_cmd_t hci_write_link_supervision_timeout = {
|
---|
541 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x37), "H2"
|
---|
542 | };
|
---|
543 |
|
---|
544 | /**
|
---|
545 | * @param inquiry_mode (0x00 = standard, 0x01 = with RSSI, 0x02 = extended)
|
---|
546 | */
|
---|
547 | const hci_cmd_t hci_write_inquiry_mode = {
|
---|
548 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x45), "1"
|
---|
549 | };
|
---|
550 |
|
---|
551 | /**
|
---|
552 | * @param fec_required
|
---|
553 | * @param exstended_inquiry_response
|
---|
554 | */
|
---|
555 | const hci_cmd_t hci_write_extended_inquiry_response = {
|
---|
556 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x52), "1E"
|
---|
557 | };
|
---|
558 |
|
---|
559 | /**
|
---|
560 | * @param mode (0 = off, 1 = on)
|
---|
561 | */
|
---|
562 | const hci_cmd_t hci_write_simple_pairing_mode = {
|
---|
563 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x56), "1"
|
---|
564 | };
|
---|
565 |
|
---|
566 | /**
|
---|
567 | */
|
---|
568 | const hci_cmd_t hci_read_le_host_supported = {
|
---|
569 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x6c), ""
|
---|
570 | // return: status, le supported host, simultaneous le host
|
---|
571 | };
|
---|
572 |
|
---|
573 | /**
|
---|
574 | * @param le_supported_host
|
---|
575 | * @param simultaneous_le_host
|
---|
576 | */
|
---|
577 | const hci_cmd_t hci_write_le_host_supported = {
|
---|
578 | OPCODE(OGF_CONTROLLER_BASEBAND, 0x6d), "11"
|
---|
579 | // return: status
|
---|
580 | };
|
---|
581 |
|
---|
582 |
|
---|
583 | /**
|
---|
584 | * Informational Parameters
|
---|
585 | */
|
---|
586 |
|
---|
587 | const hci_cmd_t hci_read_local_supported_features = {
|
---|
588 | OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x03), ""
|
---|
589 | };
|
---|
590 | const hci_cmd_t hci_read_buffer_size = {
|
---|
591 | OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x05), ""
|
---|
592 | };
|
---|
593 | const hci_cmd_t hci_read_bd_addr = {
|
---|
594 | OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x09), ""
|
---|
595 | };
|
---|
596 |
|
---|
597 | /**
|
---|
598 | * Status Paramters
|
---|
599 | */
|
---|
600 |
|
---|
601 | /**
|
---|
602 | * @param handle
|
---|
603 | */
|
---|
604 | const hci_cmd_t hci_read_rssi = {
|
---|
605 | OPCODE(OGF_STATUS_PARAMETERS, 0x05), "H"
|
---|
606 | // no params
|
---|
607 | };
|
---|
608 |
|
---|
609 |
|
---|
610 |
|
---|
611 | #ifdef HAVE_BLE
|
---|
612 | /**
|
---|
613 | * Low Energy Commands
|
---|
614 | */
|
---|
615 |
|
---|
616 | /**
|
---|
617 | * @param event_mask_lower_octets
|
---|
618 | * @param event_mask_higher_octets
|
---|
619 | */
|
---|
620 | const hci_cmd_t hci_le_set_event_mask = {
|
---|
621 | OPCODE(OGF_LE_CONTROLLER, 0x01), "44"
|
---|
622 | // return: status
|
---|
623 | };
|
---|
624 |
|
---|
625 | const hci_cmd_t hci_le_read_buffer_size = {
|
---|
626 | OPCODE(OGF_LE_CONTROLLER, 0x02), ""
|
---|
627 | // return: status, le acl data packet len (16), total num le acl data packets(8)
|
---|
628 | };
|
---|
629 | const hci_cmd_t hci_le_read_supported_features = {
|
---|
630 | OPCODE(OGF_LE_CONTROLLER, 0x03), ""
|
---|
631 | // return: LE_Features See [Vol 6] Part B, Section 4.6
|
---|
632 | };
|
---|
633 |
|
---|
634 | /**
|
---|
635 | * @param random_bd_addr
|
---|
636 | */
|
---|
637 | const hci_cmd_t hci_le_set_random_address = {
|
---|
638 | OPCODE(OGF_LE_CONTROLLER, 0x05), "B"
|
---|
639 | // return: status
|
---|
640 | };
|
---|
641 |
|
---|
642 | /**
|
---|
643 | * @param advertising_interval_min ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
|
---|
644 | * @param advertising_interval_max ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
|
---|
645 | * @param advertising_type (enum from 0: ADV_IND, ADC_DIRECT_IND, ADV_SCAN_IND, ADV_NONCONN_IND)
|
---|
646 | * @param own_address_type (enum from 0: public device address, random device address)
|
---|
647 | * @param direct_address_type ()
|
---|
648 | * @param direct_address (public or random address of device to be connecteed)
|
---|
649 | * @param advertising_channel_map (flags: chan_37(1), chan_38(2), chan_39(4))
|
---|
650 | * @param advertising_filter_policy (enum from 0: scan any conn any, scan whitelist, con any, scan any conn whitelist, scan whitelist, con whitelist)
|
---|
651 | */
|
---|
652 | const hci_cmd_t hci_le_set_advertising_parameters = {
|
---|
653 | OPCODE(OGF_LE_CONTROLLER, 0x06), "22111B11"
|
---|
654 | // return: status
|
---|
655 | };
|
---|
656 |
|
---|
657 | const hci_cmd_t hci_le_read_advertising_channel_tx_power = {
|
---|
658 | OPCODE(OGF_LE_CONTROLLER, 0x07), ""
|
---|
659 | // return: status, level [-20,10] signed int (8), units dBm
|
---|
660 | };
|
---|
661 |
|
---|
662 | /**
|
---|
663 | * @param advertising_data_length
|
---|
664 | * @param advertising_data (31 bytes)
|
---|
665 | */
|
---|
666 | const hci_cmd_t hci_le_set_advertising_data= {
|
---|
667 | OPCODE(OGF_LE_CONTROLLER, 0x08), "1A"
|
---|
668 | // return: status
|
---|
669 | };
|
---|
670 |
|
---|
671 | /**
|
---|
672 | * @param scan_response_data_length
|
---|
673 | * @param scan_response_data (31 bytes)
|
---|
674 | */
|
---|
675 | const hci_cmd_t hci_le_set_scan_response_data= {
|
---|
676 | OPCODE(OGF_LE_CONTROLLER, 0x09), "1A"
|
---|
677 | // return: status
|
---|
678 | };
|
---|
679 |
|
---|
680 | /**
|
---|
681 | * @param advertise_enable (off: 0, on: 1)
|
---|
682 | */
|
---|
683 | const hci_cmd_t hci_le_set_advertise_enable = {
|
---|
684 | OPCODE(OGF_LE_CONTROLLER, 0x0a), "1"
|
---|
685 | // return: status
|
---|
686 | };
|
---|
687 |
|
---|
688 | /**
|
---|
689 | * @param le_scan_type (passive (0), active (1))
|
---|
690 | * @param le_scan_interval ([0x0004,0x4000], unit: 0.625 msec)
|
---|
691 | * @param le_scan_window ([0x0004,0x4000], unit: 0.625 msec)
|
---|
692 | * @param own_address_type (public (0), random (1))
|
---|
693 | * @param scanning_filter_policy (any (0), only whitelist (1))
|
---|
694 | */
|
---|
695 | const hci_cmd_t hci_le_set_scan_parameters = {
|
---|
696 | OPCODE(OGF_LE_CONTROLLER, 0x0b), "12211"
|
---|
697 | // return: status
|
---|
698 | };
|
---|
699 |
|
---|
700 | /**
|
---|
701 | * @param le_scan_enable (disabled (0), enabled (1))
|
---|
702 | * @param filter_duplices (disabled (0), enabled (1))
|
---|
703 | */
|
---|
704 | const hci_cmd_t hci_le_set_scan_enable = {
|
---|
705 | OPCODE(OGF_LE_CONTROLLER, 0x0c), "11"
|
---|
706 | // return: status
|
---|
707 | };
|
---|
708 |
|
---|
709 | /**
|
---|
710 | * @param le_scan_interval ([0x0004, 0x4000], unit: 0.625 msec)
|
---|
711 | * @param le_scan_window ([0x0004, 0x4000], unit: 0.625 msec)
|
---|
712 | * @param initiator_filter_policy (peer address type + peer address (0), whitelist (1))
|
---|
713 | * @param peer_address_type (public (0), random (1))
|
---|
714 | * @param peer_address
|
---|
715 | * @param own_address_type (public (0), random (1))
|
---|
716 | * @param conn_interval_min ([0x0006, 0x0c80], unit: 1.25 msec)
|
---|
717 | * @param conn_interval_max ([0x0006, 0x0c80], unit: 1.25 msec)
|
---|
718 | * @param conn_latency (number of connection events [0x0000, 0x01f4])
|
---|
719 | * @param supervision_timeout ([0x000a, 0x0c80], unit: 10 msec)
|
---|
720 | * @param minimum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
|
---|
721 | * @param maximum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
|
---|
722 | */
|
---|
723 | const hci_cmd_t hci_le_create_connection= {
|
---|
724 | OPCODE(OGF_LE_CONTROLLER, 0x0d), "2211B1222222"
|
---|
725 | // return: none -> le create connection complete event
|
---|
726 | };
|
---|
727 |
|
---|
728 | const hci_cmd_t hci_le_create_connection_cancel = {
|
---|
729 | OPCODE(OGF_LE_CONTROLLER, 0x0e), ""
|
---|
730 | // return: status
|
---|
731 | };
|
---|
732 |
|
---|
733 | const hci_cmd_t hci_le_read_white_list_size = {
|
---|
734 | OPCODE(OGF_LE_CONTROLLER, 0x0f), ""
|
---|
735 | // return: status, number of entries in controller whitelist
|
---|
736 | };
|
---|
737 |
|
---|
738 | const hci_cmd_t hci_le_clear_white_list = {
|
---|
739 | OPCODE(OGF_LE_CONTROLLER, 0x10), ""
|
---|
740 | // return: status
|
---|
741 | };
|
---|
742 |
|
---|
743 | /**
|
---|
744 | * @param address_type (public (0), random (1))
|
---|
745 | * @param bd_addr
|
---|
746 | */
|
---|
747 | const hci_cmd_t hci_le_add_device_to_whitelist = {
|
---|
748 | OPCODE(OGF_LE_CONTROLLER, 0x11), "1B"
|
---|
749 | // return: status
|
---|
750 | };
|
---|
751 |
|
---|
752 | /**
|
---|
753 | * @param address_type (public (0), random (1))
|
---|
754 | * @param bd_addr
|
---|
755 | */
|
---|
756 | const hci_cmd_t hci_le_remove_device_from_whitelist = {
|
---|
757 | OPCODE(OGF_LE_CONTROLLER, 0x12), "1B"
|
---|
758 | // return: status
|
---|
759 | };
|
---|
760 |
|
---|
761 | /**
|
---|
762 | * @param conn_handle
|
---|
763 | * @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec)
|
---|
764 | * @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec)
|
---|
765 | * @param conn_latency ([0x0000,0x03e8], number of connection events)
|
---|
766 | * @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec)
|
---|
767 | * @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
|
---|
768 | * @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
|
---|
769 | */
|
---|
770 | const hci_cmd_t hci_le_connection_update = {
|
---|
771 | OPCODE(OGF_LE_CONTROLLER, 0x13), "H222222"
|
---|
772 | // return: none -> le connection update complete event
|
---|
773 | };
|
---|
774 |
|
---|
775 | /**
|
---|
776 | * @param channel_map_lower_32bits
|
---|
777 | * @param channel_map_higher_5bits
|
---|
778 | */
|
---|
779 | const hci_cmd_t hci_le_set_host_channel_classification = {
|
---|
780 | OPCODE(OGF_LE_CONTROLLER, 0x14), "41"
|
---|
781 | // return: status
|
---|
782 | };
|
---|
783 |
|
---|
784 | /**
|
---|
785 | * @param conn_handle
|
---|
786 | */
|
---|
787 | const hci_cmd_t hci_le_read_channel_map = {
|
---|
788 | OPCODE(OGF_LE_CONTROLLER, 0x15), "H"
|
---|
789 | // return: status, connection handle, channel map (5 bytes, 37 used)
|
---|
790 | };
|
---|
791 |
|
---|
792 | /**
|
---|
793 | * @param conn_handle
|
---|
794 | */
|
---|
795 | const hci_cmd_t hci_le_read_remote_used_features = {
|
---|
796 | OPCODE(OGF_LE_CONTROLLER, 0x16), "H"
|
---|
797 | // return: none -> le read remote used features complete event
|
---|
798 | };
|
---|
799 |
|
---|
800 | /**
|
---|
801 | * @param key ((128) for AES-128)
|
---|
802 | * @param plain_text (128)
|
---|
803 | */
|
---|
804 | const hci_cmd_t hci_le_encrypt = {
|
---|
805 | OPCODE(OGF_LE_CONTROLLER, 0x17), "PP"
|
---|
806 | // return: status, encrypted data (128)
|
---|
807 | };
|
---|
808 |
|
---|
809 | const hci_cmd_t hci_le_rand = {
|
---|
810 | OPCODE(OGF_LE_CONTROLLER, 0x18), ""
|
---|
811 | // return: status, random number (64)
|
---|
812 | };
|
---|
813 |
|
---|
814 | /**
|
---|
815 | * @param conn_handle
|
---|
816 | * @param random_number_lower_32bits
|
---|
817 | * @param random_number_higher_32bits
|
---|
818 | * @param encryption_diversifier (16)
|
---|
819 | * @param long_term_key (128)
|
---|
820 | */
|
---|
821 | const hci_cmd_t hci_le_start_encryption = {
|
---|
822 | OPCODE(OGF_LE_CONTROLLER, 0x19), "H442P"
|
---|
823 | // return: none -> encryption changed or encryption key refresh complete event
|
---|
824 | };
|
---|
825 |
|
---|
826 | /**
|
---|
827 | * @param connection_handle
|
---|
828 | * @param long_term_key (128)
|
---|
829 | */
|
---|
830 | const hci_cmd_t hci_le_long_term_key_request_reply = {
|
---|
831 | OPCODE(OGF_LE_CONTROLLER, 0x1a), "HP"
|
---|
832 | // return: status, connection handle
|
---|
833 | };
|
---|
834 |
|
---|
835 | /**
|
---|
836 | * @param conn_handle
|
---|
837 | */
|
---|
838 | const hci_cmd_t hci_le_long_term_key_negative_reply = {
|
---|
839 | OPCODE(OGF_LE_CONTROLLER, 0x1b), "H"
|
---|
840 | // return: status, connection handle
|
---|
841 | };
|
---|
842 |
|
---|
843 | /**
|
---|
844 | * @param conn_handle
|
---|
845 | */
|
---|
846 | const hci_cmd_t hci_le_read_supported_states = {
|
---|
847 | OPCODE(OGF_LE_CONTROLLER, 0x1c), "H"
|
---|
848 | // return: status, LE states (64)
|
---|
849 | };
|
---|
850 |
|
---|
851 | /**
|
---|
852 | * @param rx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
|
---|
853 | */
|
---|
854 | const hci_cmd_t hci_le_receiver_test = {
|
---|
855 | OPCODE(OGF_LE_CONTROLLER, 0x1d), "1"
|
---|
856 | // return: status
|
---|
857 | };
|
---|
858 |
|
---|
859 | /**
|
---|
860 | * @param tx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
|
---|
861 | * @param test_payload_lengh ([0x00,0x25])
|
---|
862 | * @param packet_payload ([0,7] different patterns)
|
---|
863 | */
|
---|
864 | const hci_cmd_t hci_le_transmitter_test = {
|
---|
865 | OPCODE(OGF_LE_CONTROLLER, 0x1e), "111"
|
---|
866 | // return: status
|
---|
867 | };
|
---|
868 |
|
---|
869 | /**
|
---|
870 | * @param end_test_cmd
|
---|
871 | */
|
---|
872 | const hci_cmd_t hci_le_test_end = {
|
---|
873 | OPCODE(OGF_LE_CONTROLLER, 0x1f), "1"
|
---|
874 | // return: status, number of packets (8)
|
---|
875 | };
|
---|
876 | #endif
|
---|
877 |
|
---|
878 |
|
---|
879 | // BTstack commands
|
---|
880 | const hci_cmd_t btstack_get_state = {
|
---|
881 | OPCODE(OGF_BTSTACK, BTSTACK_GET_STATE), ""
|
---|
882 | };
|
---|
883 |
|
---|
884 | /**
|
---|
885 | * @param power_mode (0 = off, 1 = on)
|
---|
886 | */
|
---|
887 | const hci_cmd_t btstack_set_power_mode = {
|
---|
888 | OPCODE(OGF_BTSTACK, BTSTACK_SET_POWER_MODE), "1"
|
---|
889 | };
|
---|
890 |
|
---|
891 |
|
---|
892 | /**
|
---|
893 | * @param acl_capture_mode (0 = off, 1 = on)
|
---|
894 | */
|
---|
895 | const hci_cmd_t btstack_set_acl_capture_mode = {
|
---|
896 | OPCODE(OGF_BTSTACK, BTSTACK_SET_ACL_CAPTURE_MODE), "1"
|
---|
897 | };
|
---|
898 |
|
---|
899 | const hci_cmd_t btstack_get_version = {
|
---|
900 | OPCODE(OGF_BTSTACK, BTSTACK_GET_VERSION), ""
|
---|
901 | };
|
---|
902 |
|
---|
903 | const hci_cmd_t btstack_get_system_bluetooth_enabled = {
|
---|
904 | OPCODE(OGF_BTSTACK, BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED), ""
|
---|
905 | };
|
---|
906 |
|
---|
907 | /**
|
---|
908 | * @param bluetooth_enabled_flag (0 = off, 1 = on, only used by btstack config)
|
---|
909 | */
|
---|
910 | const hci_cmd_t btstack_set_system_bluetooth_enabled = {
|
---|
911 | OPCODE(OGF_BTSTACK, BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED), "1"
|
---|
912 | };
|
---|
913 |
|
---|
914 | /**
|
---|
915 | * @param discoverable_flag (0 = off, 1 = on)
|
---|
916 | */
|
---|
917 | const hci_cmd_t btstack_set_discoverable = {
|
---|
918 | OPCODE(OGF_BTSTACK, BTSTACK_SET_DISCOVERABLE), "1"
|
---|
919 | };
|
---|
920 |
|
---|
921 | /**
|
---|
922 | * @param bluetooth_enabled_flag (0 = off, 1 = on, only used by btstack config)
|
---|
923 | */
|
---|
924 | const hci_cmd_t btstack_set_bluetooth_enabled = {
|
---|
925 | OPCODE(OGF_BTSTACK, BTSTACK_SET_BLUETOOTH_ENABLED), "1"
|
---|
926 | };
|
---|
927 |
|
---|
928 | /**
|
---|
929 | * @param bd_addr (48)
|
---|
930 | * @param psm (16)
|
---|
931 | */
|
---|
932 | const hci_cmd_t l2cap_create_channel = {
|
---|
933 | OPCODE(OGF_BTSTACK, L2CAP_CREATE_CHANNEL), "B2"
|
---|
934 | };
|
---|
935 |
|
---|
936 | /**
|
---|
937 | * @param bd_addr (48)
|
---|
938 | * @param psm (16)
|
---|
939 | * @param mtu (16)
|
---|
940 | */
|
---|
941 | const hci_cmd_t l2cap_create_channel_mtu = {
|
---|
942 | OPCODE(OGF_BTSTACK, L2CAP_CREATE_CHANNEL_MTU), "B22"
|
---|
943 | // @param bd_addr(48), psm (16), mtu (16)
|
---|
944 | };
|
---|
945 |
|
---|
946 | /**
|
---|
947 | * @param channel (16)
|
---|
948 | * @param reason (16)
|
---|
949 | */
|
---|
950 | const hci_cmd_t l2cap_disconnect = {
|
---|
951 | OPCODE(OGF_BTSTACK, L2CAP_DISCONNECT), "21"
|
---|
952 | };
|
---|
953 |
|
---|
954 | /**
|
---|
955 | * @param psm (16)
|
---|
956 | * @param mtu (16)
|
---|
957 | */
|
---|
958 | const hci_cmd_t l2cap_register_service = {
|
---|
959 | OPCODE(OGF_BTSTACK, L2CAP_REGISTER_SERVICE), "22"
|
---|
960 | };
|
---|
961 |
|
---|
962 | /**
|
---|
963 | * @param psm (16)
|
---|
964 | */
|
---|
965 | const hci_cmd_t l2cap_unregister_service = {
|
---|
966 | OPCODE(OGF_BTSTACK, L2CAP_UNREGISTER_SERVICE), "2"
|
---|
967 | };
|
---|
968 |
|
---|
969 | /**
|
---|
970 | * @param source_cid (16)
|
---|
971 | */
|
---|
972 | const hci_cmd_t l2cap_accept_connection = {
|
---|
973 | OPCODE(OGF_BTSTACK, L2CAP_ACCEPT_CONNECTION), "2"
|
---|
974 | };
|
---|
975 |
|
---|
976 | /**
|
---|
977 | * @param source_cid (16)
|
---|
978 | * @param reason
|
---|
979 | */
|
---|
980 | const hci_cmd_t l2cap_decline_connection = {
|
---|
981 | OPCODE(OGF_BTSTACK, L2CAP_DECLINE_CONNECTION), "21"
|
---|
982 | };
|
---|
983 |
|
---|
984 |
|
---|
985 | /**
|
---|
986 | * @param service_record
|
---|
987 | */
|
---|
988 | const hci_cmd_t sdp_register_service_record = {
|
---|
989 | OPCODE(OGF_BTSTACK, SDP_REGISTER_SERVICE_RECORD), "S"
|
---|
990 | };
|
---|
991 |
|
---|
992 | /**
|
---|
993 | * @param service_record_handle
|
---|
994 | */
|
---|
995 | const hci_cmd_t sdp_unregister_service_record = {
|
---|
996 | OPCODE(OGF_BTSTACK, SDP_UNREGISTER_SERVICE_RECORD), "4"
|
---|
997 | };
|
---|
998 |
|
---|
999 | /**
|
---|
1000 | * @param bd_addr
|
---|
1001 | * @param service_search_pattern
|
---|
1002 | */
|
---|
1003 | const hci_cmd_t sdp_client_query_rfcomm_services = {
|
---|
1004 | OPCODE(OGF_BTSTACK, SDP_CLIENT_QUERY_RFCOMM_SERVICES), "BS"
|
---|
1005 | };
|
---|
1006 |
|
---|
1007 | /**
|
---|
1008 | * @param bd_addr
|
---|
1009 | * @param service_search_pattern
|
---|
1010 | * @param attribute_ID_list
|
---|
1011 | */
|
---|
1012 | const hci_cmd_t sdp_client_query_services = {
|
---|
1013 | OPCODE(OGF_BTSTACK, SDP_CLIENT_QUERY_SERVICES), "BSS"
|
---|
1014 | };
|
---|
1015 |
|
---|
1016 | /**
|
---|
1017 | * @param bd_addr
|
---|
1018 | * @param server_channel
|
---|
1019 | */
|
---|
1020 | const hci_cmd_t rfcomm_create_channel = {
|
---|
1021 | OPCODE(OGF_BTSTACK, RFCOMM_CREATE_CHANNEL), "B1"
|
---|
1022 | };
|
---|
1023 |
|
---|
1024 | /**
|
---|
1025 | * @param bd_addr
|
---|
1026 | * @param server_channel
|
---|
1027 | * @param mtu
|
---|
1028 | * @param credits
|
---|
1029 | */
|
---|
1030 | const hci_cmd_t rfcomm_create_channel_with_initial_credits = {
|
---|
1031 | OPCODE(OGF_BTSTACK, RFCOMM_CREATE_CHANNEL_WITH_CREDITS), "B121"
|
---|
1032 | };
|
---|
1033 |
|
---|
1034 | /**
|
---|
1035 | * @param rfcomm_cid
|
---|
1036 | * @param credits
|
---|
1037 | */
|
---|
1038 | const hci_cmd_t rfcomm_grants_credits= {
|
---|
1039 | OPCODE(OGF_BTSTACK, RFCOMM_GRANT_CREDITS), "21"
|
---|
1040 | };
|
---|
1041 |
|
---|
1042 | /**
|
---|
1043 | * @param rfcomm_cid
|
---|
1044 | * @param reason
|
---|
1045 | */
|
---|
1046 | const hci_cmd_t rfcomm_disconnect = {
|
---|
1047 | OPCODE(OGF_BTSTACK, RFCOMM_DISCONNECT), "21"
|
---|
1048 | };
|
---|
1049 |
|
---|
1050 | /**
|
---|
1051 | * @param server_channel
|
---|
1052 | * @param mtu
|
---|
1053 | */
|
---|
1054 | const hci_cmd_t rfcomm_register_service = {
|
---|
1055 | OPCODE(OGF_BTSTACK, RFCOMM_REGISTER_SERVICE), "12"
|
---|
1056 | };
|
---|
1057 |
|
---|
1058 | /**
|
---|
1059 | * @param server_channel
|
---|
1060 | * @param mtu
|
---|
1061 | * @param initial_credits
|
---|
1062 | */
|
---|
1063 | const hci_cmd_t rfcomm_register_service_with_initial_credits = {
|
---|
1064 | OPCODE(OGF_BTSTACK, RFCOMM_REGISTER_SERVICE_WITH_CREDITS), "121"
|
---|
1065 | };
|
---|
1066 |
|
---|
1067 | /**
|
---|
1068 | * @param service_channel
|
---|
1069 | */
|
---|
1070 | const hci_cmd_t rfcomm_unregister_service = {
|
---|
1071 | OPCODE(OGF_BTSTACK, RFCOMM_UNREGISTER_SERVICE), "2"
|
---|
1072 | };
|
---|
1073 |
|
---|
1074 | /**
|
---|
1075 | * @param source_cid
|
---|
1076 | */
|
---|
1077 | const hci_cmd_t rfcomm_accept_connection = {
|
---|
1078 | OPCODE(OGF_BTSTACK, RFCOMM_ACCEPT_CONNECTION), "2"
|
---|
1079 | };
|
---|
1080 |
|
---|
1081 |
|
---|
1082 | /**
|
---|
1083 | * @param source_cid
|
---|
1084 | * @param reason
|
---|
1085 | */
|
---|
1086 | const hci_cmd_t rfcomm_decline_connection = {
|
---|
1087 | OPCODE(OGF_BTSTACK, RFCOMM_DECLINE_CONNECTION), "21"
|
---|
1088 | };
|
---|
1089 |
|
---|
1090 | // request persistent rfcomm channel number for named service
|
---|
1091 | /**
|
---|
1092 | * @param named_service
|
---|
1093 | */
|
---|
1094 | const hci_cmd_t rfcomm_persistent_channel_for_service = {
|
---|
1095 | OPCODE(OGF_BTSTACK, RFCOMM_PERSISTENT_CHANNEL), "N"
|
---|
1096 | };
|
---|
1097 |
|
---|
1098 | /**
|
---|
1099 | * @param handle
|
---|
1100 | */
|
---|
1101 | const hci_cmd_t gap_disconnect_cmd = {
|
---|
1102 | OPCODE(OGF_BTSTACK, GAP_DISCONNECT), "H"
|
---|
1103 | };
|
---|
1104 |
|
---|
1105 | /**
|
---|
1106 | */
|
---|
1107 | const hci_cmd_t gap_le_scan_start = {
|
---|
1108 | OPCODE(OGF_BTSTACK, GAP_LE_SCAN_START), ""
|
---|
1109 | };
|
---|
1110 |
|
---|
1111 | /**
|
---|
1112 | */
|
---|
1113 | const hci_cmd_t gap_le_scan_stop = {
|
---|
1114 | OPCODE(OGF_BTSTACK, GAP_LE_SCAN_STOP), ""
|
---|
1115 | };
|
---|
1116 |
|
---|
1117 | /**
|
---|
1118 | * @param scan_type
|
---|
1119 | * @param scan_interval
|
---|
1120 | * @param scan_window
|
---|
1121 | */
|
---|
1122 | const hci_cmd_t gap_le_set_scan_parameters = {
|
---|
1123 | OPCODE(OGF_BTSTACK, GAP_LE_SET_SCAN_PARAMETERS), "122"
|
---|
1124 | };
|
---|
1125 |
|
---|
1126 | /**
|
---|
1127 | * @param peer_address_type
|
---|
1128 | * @param peer_address
|
---|
1129 | */
|
---|
1130 | const hci_cmd_t gap_le_connect_cmd = {
|
---|
1131 | OPCODE(OGF_BTSTACK, GAP_LE_CONNECT), "1B"
|
---|
1132 | };
|
---|
1133 |
|
---|
1134 | /**
|
---|
1135 | * @param peer_address_type
|
---|
1136 | * @param peer_address
|
---|
1137 | */
|
---|
1138 | const hci_cmd_t gap_le_connect_cancel_cmd = {
|
---|
1139 | OPCODE(OGF_BTSTACK, GAP_LE_CONNECT_CANCEL), ""
|
---|
1140 | };
|
---|
1141 |
|
---|
1142 | /**
|
---|
1143 | * @param handle
|
---|
1144 | */
|
---|
1145 | const hci_cmd_t gatt_discover_primary_services_cmd = {
|
---|
1146 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_ALL_PRIMARY_SERVICES), "H"
|
---|
1147 | };
|
---|
1148 |
|
---|
1149 | /**
|
---|
1150 | * @param handle
|
---|
1151 | * @param uuid16
|
---|
1152 | */
|
---|
1153 | const hci_cmd_t gatt_discover_primary_services_by_uuid16_cmd = {
|
---|
1154 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16), "H2"
|
---|
1155 | };
|
---|
1156 |
|
---|
1157 | /**
|
---|
1158 | * @param handle
|
---|
1159 | * @param uuid128
|
---|
1160 | */
|
---|
1161 | const hci_cmd_t gatt_discover_primary_services_by_uuid128_cmd = {
|
---|
1162 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128), "HU"
|
---|
1163 | };
|
---|
1164 |
|
---|
1165 | /**
|
---|
1166 | * @param handle
|
---|
1167 | * @param service
|
---|
1168 | */
|
---|
1169 | const hci_cmd_t gatt_find_included_services_for_service_cmd = {
|
---|
1170 | OPCODE(OGF_BTSTACK, GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE), "HX"
|
---|
1171 | };
|
---|
1172 |
|
---|
1173 | /**
|
---|
1174 | * @param handle
|
---|
1175 | * @param service
|
---|
1176 | */
|
---|
1177 | const hci_cmd_t gatt_discover_characteristics_for_service_cmd = {
|
---|
1178 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE), "HX"
|
---|
1179 | };
|
---|
1180 |
|
---|
1181 | /**
|
---|
1182 | * @param handle
|
---|
1183 | * @param service
|
---|
1184 | * @param uuid128
|
---|
1185 | */
|
---|
1186 | const hci_cmd_t gatt_discover_characteristics_for_service_by_uuid128_cmd = {
|
---|
1187 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128), "HXU"
|
---|
1188 | };
|
---|
1189 |
|
---|
1190 | /**
|
---|
1191 | * @param handle
|
---|
1192 | * @param characteristic
|
---|
1193 | */
|
---|
1194 | const hci_cmd_t gatt_discover_characteristic_descriptors_cmd = {
|
---|
1195 | OPCODE(OGF_BTSTACK, GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS), "HY"
|
---|
1196 | };
|
---|
1197 |
|
---|
1198 | /**
|
---|
1199 | * @param handle
|
---|
1200 | * @param characteristic
|
---|
1201 | */
|
---|
1202 | const hci_cmd_t gatt_read_value_of_characteristic_cmd = {
|
---|
1203 | OPCODE(OGF_BTSTACK, GATT_READ_VALUE_OF_CHARACTERISTIC), "HY"
|
---|
1204 | };
|
---|
1205 |
|
---|
1206 | /**
|
---|
1207 | * @param handle
|
---|
1208 | * @param characteristic
|
---|
1209 | */
|
---|
1210 | const hci_cmd_t gatt_read_long_value_of_characteristic_cmd = {
|
---|
1211 | OPCODE(OGF_BTSTACK, GATT_READ_LONG_VALUE_OF_CHARACTERISTIC), "HY"
|
---|
1212 | };
|
---|
1213 |
|
---|
1214 | /**
|
---|
1215 | * @param handle
|
---|
1216 | * @param characteristic
|
---|
1217 | * @param data_length
|
---|
1218 | * @param data
|
---|
1219 | */
|
---|
1220 | const hci_cmd_t gatt_write_value_of_characteristic_without_response_cmd = {
|
---|
1221 | OPCODE(OGF_BTSTACK, GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE), "HYLV"
|
---|
1222 | };
|
---|
1223 |
|
---|
1224 | /**
|
---|
1225 | * @param handle
|
---|
1226 | * @param characteristic
|
---|
1227 | * @param data_length
|
---|
1228 | * @param data
|
---|
1229 | */
|
---|
1230 | const hci_cmd_t gatt_write_value_of_characteristic_cmd = {
|
---|
1231 | OPCODE(OGF_BTSTACK, GATT_WRITE_VALUE_OF_CHARACTERISTIC), "HYLV"
|
---|
1232 | };
|
---|
1233 |
|
---|
1234 | /**
|
---|
1235 | * @param handle
|
---|
1236 | * @param characteristic
|
---|
1237 | * @param data_length
|
---|
1238 | * @param data
|
---|
1239 | */
|
---|
1240 | const hci_cmd_t gatt_write_long_value_of_characteristic_cmd = {
|
---|
1241 | OPCODE(OGF_BTSTACK, GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC), "HYLV"
|
---|
1242 | };
|
---|
1243 |
|
---|
1244 | /**
|
---|
1245 | * @param handle
|
---|
1246 | * @param characteristic
|
---|
1247 | * @param data_length
|
---|
1248 | * @param data
|
---|
1249 | */
|
---|
1250 | const hci_cmd_t gatt_reliable_write_long_value_of_characteristic_cmd = {
|
---|
1251 | OPCODE(OGF_BTSTACK, GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC), "HYLV"
|
---|
1252 | };
|
---|
1253 |
|
---|
1254 | /**
|
---|
1255 | * @param handle
|
---|
1256 | * @param descriptor
|
---|
1257 | */
|
---|
1258 | const hci_cmd_t gatt_read_characteristic_descriptor_cmd = {
|
---|
1259 | OPCODE(OGF_BTSTACK, GATT_READ_CHARACTERISTIC_DESCRIPTOR), "HZ"
|
---|
1260 | };
|
---|
1261 |
|
---|
1262 | /**
|
---|
1263 | * @param handle
|
---|
1264 | * @param descriptor
|
---|
1265 | */
|
---|
1266 | const hci_cmd_t gatt_read_long_characteristic_descriptor_cmd = {
|
---|
1267 | OPCODE(OGF_BTSTACK, GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR), "HZ"
|
---|
1268 | };
|
---|
1269 |
|
---|
1270 | /**
|
---|
1271 | * @param handle
|
---|
1272 | * @param descriptor
|
---|
1273 | * @param data_length
|
---|
1274 | * @param data
|
---|
1275 | */
|
---|
1276 | const hci_cmd_t gatt_write_characteristic_descriptor_cmd = {
|
---|
1277 | OPCODE(OGF_BTSTACK, GATT_WRITE_CHARACTERISTIC_DESCRIPTOR), "HZLV"
|
---|
1278 | };
|
---|
1279 |
|
---|
1280 | /**
|
---|
1281 | * @param handle
|
---|
1282 | * @param descriptor
|
---|
1283 | * @param data_length
|
---|
1284 | * @param data
|
---|
1285 | */
|
---|
1286 | const hci_cmd_t gatt_write_long_characteristic_descriptor_cmd = {
|
---|
1287 | OPCODE(OGF_BTSTACK, GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR), "HZLV"
|
---|
1288 | };
|
---|
1289 |
|
---|
1290 | /**
|
---|
1291 | * @param handle
|
---|
1292 | * @param characteristic
|
---|
1293 | * @param configuration
|
---|
1294 | */
|
---|
1295 | const hci_cmd_t gatt_write_client_characteristic_configuration_cmd = {
|
---|
1296 | OPCODE(OGF_BTSTACK, GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION), "HY2"
|
---|
1297 | };
|
---|