2009-10-29 20:25:42 +00:00
|
|
|
|
/*
|
2015-02-06 16:19:27 +00:00
|
|
|
|
* Copyright (C) 2014 BlueKitchen GmbH
|
2009-10-29 20:25:42 +00:00
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
*
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. Neither the name of the copyright holders nor the names of
|
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
|
* from this software without specific prior written permission.
|
2012-05-07 21:54:09 +00:00
|
|
|
|
* 4. Any redistribution, use, or modification is done solely for
|
|
|
|
|
* personal benefit and not for any commercial purpose or for
|
|
|
|
|
* monetary gain.
|
2009-10-29 20:25:42 +00:00
|
|
|
|
*
|
2015-02-06 16:19:27 +00:00
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
2009-10-29 20:25:42 +00:00
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
|
|
|
|
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
|
|
|
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*
|
2015-02-06 16:19:27 +00:00
|
|
|
|
* Please inquire about commercial licensing options at
|
|
|
|
|
* contact@bluekitchen-gmbh.com
|
2012-05-07 21:54:09 +00:00
|
|
|
|
*
|
2009-10-29 20:25:42 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2009-07-23 21:25:39 +00:00
|
|
|
|
/*
|
2016-01-21 11:33:17 +01:00
|
|
|
|
* hci_cmd.c
|
2009-07-23 21:25:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Created by Matthias Ringwald on 7/23/09.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-01-21 15:41:16 +01:00
|
|
|
|
#include "btstack_config.h"
|
2010-07-06 16:37:46 +00:00
|
|
|
|
|
2015-11-13 15:04:41 +01:00
|
|
|
|
#include "classic/sdp_util.h"
|
2009-09-29 19:40:55 +00:00
|
|
|
|
#include "hci.h"
|
2016-01-21 11:33:17 +01:00
|
|
|
|
#include "hci_cmd.h"
|
2016-01-21 11:30:24 +01:00
|
|
|
|
|
|
|
|
|
#include <string.h>
|
2009-09-29 20:10:24 +00:00
|
|
|
|
|
|
|
|
|
// calculate combined ogf/ocf value
|
|
|
|
|
#define OPCODE(ogf, ocf) (ocf | ogf << 10)
|
2009-07-23 21:25:39 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* construct HCI Command based on template
|
|
|
|
|
*
|
|
|
|
|
* Format:
|
|
|
|
|
* 1,2,3,4: one to four byte value
|
|
|
|
|
* H: HCI connection handle
|
|
|
|
|
* B: Bluetooth Baseband Address (BD_ADDR)
|
2015-04-17 11:53:41 +02:00
|
|
|
|
* D: 8 byte data block
|
2009-07-23 21:25:39 +00:00
|
|
|
|
* E: Extended Inquiry Result
|
2010-07-06 18:10:25 +00:00
|
|
|
|
* N: Name up to 248 chars, \0 terminated
|
2010-06-12 19:03:58 +00:00
|
|
|
|
* P: 16 byte Pairing code
|
2015-04-17 11:53:41 +02:00
|
|
|
|
* A: 31 bytes advertising data
|
2010-06-12 19:03:58 +00:00
|
|
|
|
* S: Service Record (Data Element Sequence)
|
2016-11-07 15:15:48 +01:00
|
|
|
|
* Q: 32 byte data block, e.g. for X and Y coordinates of P-256 public key
|
2009-07-23 21:25:39 +00:00
|
|
|
|
*/
|
2016-01-21 11:30:24 +01:00
|
|
|
|
uint16_t hci_cmd_create_from_template(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr){
|
2009-07-23 21:25:39 +00:00
|
|
|
|
|
|
|
|
|
hci_cmd_buffer[0] = cmd->opcode & 0xff;
|
|
|
|
|
hci_cmd_buffer[1] = cmd->opcode >> 8;
|
|
|
|
|
int pos = 3;
|
|
|
|
|
|
|
|
|
|
const char *format = cmd->format;
|
|
|
|
|
uint16_t word;
|
|
|
|
|
uint32_t longword;
|
|
|
|
|
uint8_t * ptr;
|
|
|
|
|
while (*format) {
|
|
|
|
|
switch(*format) {
|
|
|
|
|
case '1': // 8 bit value
|
|
|
|
|
case '2': // 16 bit value
|
|
|
|
|
case 'H': // hci_handle
|
|
|
|
|
word = va_arg(argptr, int); // minimal va_arg is int: 2 bytes on 8+16 bit CPUs
|
|
|
|
|
hci_cmd_buffer[pos++] = word & 0xff;
|
|
|
|
|
if (*format == '2') {
|
|
|
|
|
hci_cmd_buffer[pos++] = word >> 8;
|
|
|
|
|
} else if (*format == 'H') {
|
2009-08-09 11:14:35 +00:00
|
|
|
|
// TODO implement opaque client connection handles
|
|
|
|
|
// pass module handle for now
|
|
|
|
|
hci_cmd_buffer[pos++] = word >> 8;
|
2009-07-23 21:25:39 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
case '4':
|
|
|
|
|
longword = va_arg(argptr, uint32_t);
|
|
|
|
|
// longword = va_arg(argptr, int);
|
|
|
|
|
hci_cmd_buffer[pos++] = longword;
|
|
|
|
|
hci_cmd_buffer[pos++] = longword >> 8;
|
|
|
|
|
hci_cmd_buffer[pos++] = longword >> 16;
|
|
|
|
|
if (*format == '4'){
|
|
|
|
|
hci_cmd_buffer[pos++] = longword >> 24;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'B': // bt-addr
|
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[5];
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[4];
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[3];
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[2];
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[1];
|
|
|
|
|
hci_cmd_buffer[pos++] = ptr[0];
|
|
|
|
|
break;
|
2012-11-06 10:30:43 +00:00
|
|
|
|
case 'D': // 8 byte data block
|
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, 8);
|
|
|
|
|
pos += 8;
|
|
|
|
|
break;
|
2010-06-12 19:03:58 +00:00
|
|
|
|
case 'E': // Extended Inquiry Information 240 octets
|
2009-07-23 21:25:39 +00:00
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
2010-06-12 19:03:58 +00:00
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, 240);
|
|
|
|
|
pos += 240;
|
2009-07-23 21:25:39 +00:00
|
|
|
|
break;
|
2010-07-06 18:10:25 +00:00
|
|
|
|
case 'N': { // UTF-8 string, null terminated
|
2009-07-23 21:25:39 +00:00
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
2010-07-06 18:13:54 +00:00
|
|
|
|
uint16_t len = strlen((const char*) ptr);
|
2010-07-06 18:10:25 +00:00
|
|
|
|
if (len > 248) {
|
|
|
|
|
len = 248;
|
|
|
|
|
}
|
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, len);
|
|
|
|
|
if (len < 248) {
|
|
|
|
|
// fill remaining space with zeroes
|
2011-08-18 16:43:15 +00:00
|
|
|
|
memset(&hci_cmd_buffer[pos+len], 0, 248-len);
|
2010-07-06 18:10:25 +00:00
|
|
|
|
}
|
2009-07-23 21:25:39 +00:00
|
|
|
|
pos += 248;
|
|
|
|
|
break;
|
2010-07-06 18:10:25 +00:00
|
|
|
|
}
|
2010-06-12 19:03:58 +00:00
|
|
|
|
case 'P': // 16 byte PIN code or link key
|
2009-07-23 21:25:39 +00:00
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
2010-06-12 19:03:58 +00:00
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, 16);
|
|
|
|
|
pos += 16;
|
2009-07-23 21:25:39 +00:00
|
|
|
|
break;
|
2016-01-21 15:33:36 +01:00
|
|
|
|
#ifdef ENABLE_BLE
|
2011-09-24 18:17:02 +00:00
|
|
|
|
case 'A': // 31 bytes advertising data
|
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, 31);
|
|
|
|
|
pos += 31;
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
2016-01-21 15:33:36 +01:00
|
|
|
|
#ifdef ENABLE_SDP
|
2010-06-12 19:03:58 +00:00
|
|
|
|
case 'S': { // Service Record (Data Element Sequence)
|
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
|
|
|
|
uint16_t len = de_get_len(ptr);
|
|
|
|
|
memcpy(&hci_cmd_buffer[pos], ptr, len);
|
2010-06-12 21:00:03 +00:00
|
|
|
|
pos += len;
|
2010-06-12 19:03:58 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2016-11-07 15:15:48 +01:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef ENABLE_LE_SECURE_CONNECTIONS
|
|
|
|
|
case 'Q':
|
|
|
|
|
ptr = va_arg(argptr, uint8_t *);
|
|
|
|
|
reverse_bytes(ptr, &hci_cmd_buffer[pos], 32);
|
|
|
|
|
pos += 32;
|
|
|
|
|
break;
|
2010-07-04 16:30:50 +00:00
|
|
|
|
#endif
|
2009-07-23 21:25:39 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
format++;
|
|
|
|
|
};
|
|
|
|
|
hci_cmd_buffer[2] = pos - 3;
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Link Control Commands
|
|
|
|
|
*/
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param lap
|
|
|
|
|
* @param inquiry_length
|
|
|
|
|
* @param num_responses
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_inquiry = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x01), "311"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_inquiry_cancel = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x02), ""
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param packet_type
|
|
|
|
|
* @param page_scan_repetition_mode
|
|
|
|
|
* @param reserved
|
|
|
|
|
* @param clock_offset
|
|
|
|
|
* @param allow_role_switch
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_create_connection = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x05), "B21121"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param reason (0x05, 0x13-0x15, 0x1a, 0x29, see Errors Codes in BT Spec Part D)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_disconnect = {
|
2009-08-09 11:14:35 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x06), "H1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_create_connection_cancel = {
|
2009-12-14 22:42:14 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x08), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param role (become master, stay slave)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_accept_connection_request = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x09), "B1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param reason (e.g. CONNECTION REJECTED DUE TO LIMITED RESOURCES (0x0d))
|
|
|
|
|
*/
|
2011-07-25 18:48:34 +00:00
|
|
|
|
const hci_cmd_t hci_reject_connection_request = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0a), "B1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param link_key
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_link_key_request_reply = {
|
2009-12-12 20:21:18 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0b), "BP"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_link_key_request_negative_reply = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0c), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param pin_length
|
|
|
|
|
* @param pin (c-string)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_pin_code_request_reply = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0d), "B1P"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_pin_code_request_negative_reply = {
|
2010-04-28 20:33:30 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0e), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param packet_type
|
|
|
|
|
*/
|
2013-03-07 17:26:46 +00:00
|
|
|
|
const hci_cmd_t hci_change_connection_packet_type = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0f), "H2"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_authentication_requested = {
|
2009-11-28 21:45:21 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x11), "H"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param encryption_enable
|
|
|
|
|
*/
|
2011-03-19 15:34:55 +00:00
|
|
|
|
const hci_cmd_t hci_set_connection_encryption = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x13), "H1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2011-03-19 15:34:55 +00:00
|
|
|
|
const hci_cmd_t hci_change_connection_link_key = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x15), "H"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param page_scan_repetition_mode
|
|
|
|
|
* @param reserved
|
|
|
|
|
* @param clock_offset
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_remote_name_request = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x19), "B112"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_remote_name_request_cancel = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x1A), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2014-01-16 14:47:36 +00:00
|
|
|
|
const hci_cmd_t hci_read_remote_supported_features_command = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x1B), "H"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2015-02-12 13:45:59 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
2015-02-27 16:16:39 +00:00
|
|
|
|
* @param transmit_bandwidth 8000(64kbps)
|
|
|
|
|
* @param receive_bandwidth 8000(64kbps)
|
|
|
|
|
* @param max_latency >= 7ms for eSCO, 0xFFFF do not care
|
|
|
|
|
* @param voice_settings e.g. CVSD, Input Coding: Linear, Input Data Format: 2’s complement, data 16bit: 00011000000 == 0x60
|
|
|
|
|
* @param retransmission_effort e.g. 0xFF do not care
|
|
|
|
|
* @param packet_type at least EV3 for eSCO
|
2015-02-12 13:45:59 +00:00
|
|
|
|
*/
|
2015-07-02 10:45:15 +02:00
|
|
|
|
const hci_cmd_t hci_setup_synchronous_connection = {
|
2015-02-12 13:45:59 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0028), "H442212"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param transmit_bandwidth
|
|
|
|
|
* @param receive_bandwidth
|
|
|
|
|
* @param max_latency
|
|
|
|
|
* @param voice_settings
|
|
|
|
|
* @param retransmission_effort
|
|
|
|
|
* @param packet_type
|
|
|
|
|
*/
|
2015-07-02 10:45:15 +02:00
|
|
|
|
const hci_cmd_t hci_accept_synchronous_connection = {
|
2015-02-19 23:12:56 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x0029), "B442212"
|
2015-02-12 13:45:59 +00:00
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param IO_capability
|
|
|
|
|
* @param OOB_data_present
|
|
|
|
|
* @param authentication_requirements
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_io_capability_request_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x2b), "B111"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_user_confirmation_request_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x2c), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_user_confirmation_request_negative_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x2d), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param numeric_value
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_user_passkey_request_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x2e), "B4"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_user_passkey_request_negative_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x2f), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_remote_oob_data_request_negative_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x33), "B"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param reason (Part D, Error codes)
|
|
|
|
|
*/
|
2013-08-30 12:42:13 +00:00
|
|
|
|
const hci_cmd_t hci_io_capability_request_negative_reply = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x34), "B1"
|
|
|
|
|
};
|
|
|
|
|
|
2015-02-12 13:45:59 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param transmit_bandwidth
|
|
|
|
|
* @param receive_bandwidth
|
|
|
|
|
* @param transmit_coding_format_type
|
|
|
|
|
* @param transmit_coding_format_company
|
|
|
|
|
* @param transmit_coding_format_codec
|
|
|
|
|
* @param receive_coding_format_type
|
|
|
|
|
* @param receive_coding_format_company
|
|
|
|
|
* @param receive_coding_format_codec
|
|
|
|
|
* @param transmit_coding_frame_size
|
|
|
|
|
* @param receive_coding_frame_size
|
|
|
|
|
* @param input_bandwidth
|
|
|
|
|
* @param output_bandwidth
|
|
|
|
|
* @param input_coding_format_type
|
|
|
|
|
* @param input_coding_format_company
|
|
|
|
|
* @param input_coding_format_codec
|
|
|
|
|
* @param output_coding_format_type
|
|
|
|
|
* @param output_coding_format_company
|
|
|
|
|
* @param output_coding_format_codec
|
|
|
|
|
* @param input_coded_data_size
|
|
|
|
|
* @param outupt_coded_data_size
|
|
|
|
|
* @param input_pcm_data_format
|
|
|
|
|
* @param output_pcm_data_format
|
|
|
|
|
* @param input_pcm_sample_payload_msb_position
|
|
|
|
|
* @param output_pcm_sample_payload_msb_position
|
|
|
|
|
* @param input_data_path
|
|
|
|
|
* @param output_data_path
|
|
|
|
|
* @param input_transport_unit_size
|
|
|
|
|
* @param output_transport_unit_size
|
|
|
|
|
* @param max_latency
|
|
|
|
|
* @param packet_type
|
|
|
|
|
* @param retransmission_effort
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_enhanced_setup_synchronous_connection = {
|
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x3d), "H4412212222441221222211111111221"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param transmit_bandwidth
|
|
|
|
|
* @param receive_bandwidth
|
|
|
|
|
* @param transmit_coding_format_type
|
|
|
|
|
* @param transmit_coding_format_company
|
|
|
|
|
* @param transmit_coding_format_codec
|
|
|
|
|
* @param receive_coding_format_type
|
|
|
|
|
* @param receive_coding_format_company
|
|
|
|
|
* @param receive_coding_format_codec
|
|
|
|
|
* @param transmit_coding_frame_size
|
|
|
|
|
* @param receive_coding_frame_size
|
|
|
|
|
* @param input_bandwidth
|
|
|
|
|
* @param output_bandwidth
|
|
|
|
|
* @param input_coding_format_type
|
|
|
|
|
* @param input_coding_format_company
|
|
|
|
|
* @param input_coding_format_codec
|
|
|
|
|
* @param output_coding_format_type
|
|
|
|
|
* @param output_coding_format_company
|
|
|
|
|
* @param output_coding_format_codec
|
|
|
|
|
* @param input_coded_data_size
|
|
|
|
|
* @param outupt_coded_data_size
|
|
|
|
|
* @param input_pcm_data_format
|
|
|
|
|
* @param output_pcm_data_format
|
|
|
|
|
* @param input_pcm_sample_payload_msb_position
|
|
|
|
|
* @param output_pcm_sample_payload_msb_position
|
|
|
|
|
* @param input_data_path
|
|
|
|
|
* @param output_data_path
|
|
|
|
|
* @param input_transport_unit_size
|
|
|
|
|
* @param output_transport_unit_size
|
|
|
|
|
* @param max_latency
|
|
|
|
|
* @param packet_type
|
|
|
|
|
* @param retransmission_effort
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_enhanced_accept_synchronous_connection = {
|
2015-02-20 10:42:00 +00:00
|
|
|
|
OPCODE(OGF_LINK_CONTROL, 0x3e), "B4412212222441221222211111111221"
|
2015-02-12 13:45:59 +00:00
|
|
|
|
};
|
2009-07-23 21:25:39 +00:00
|
|
|
|
|
2010-01-23 18:26:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* Link Policy Commands
|
|
|
|
|
*/
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param sniff_max_interval
|
|
|
|
|
* @param sniff_min_interval
|
|
|
|
|
* @param sniff_attempt
|
|
|
|
|
* @param sniff_timeout
|
|
|
|
|
*/
|
2011-06-20 18:15:49 +00:00
|
|
|
|
const hci_cmd_t hci_sniff_mode = {
|
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x03), "H2222"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param flags
|
|
|
|
|
* @param service_type
|
|
|
|
|
* @param token_rate (bytes/s)
|
|
|
|
|
* @param peak_bandwith (bytes/s)
|
|
|
|
|
* @param latency (us)
|
|
|
|
|
* @param delay_variation (us)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_qos_setup = {
|
2010-03-14 11:09:10 +00:00
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x07), "H114444"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_role_discovery = {
|
2010-03-14 11:09:10 +00:00
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x09), "H"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param role (0=master,1=slave)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_switch_role_command= {
|
2010-03-14 11:09:10 +00:00
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x0b), "B1"
|
2010-01-23 18:26:56 +00:00
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_read_link_policy_settings = {
|
2010-03-14 11:09:10 +00:00
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x0c), "H"
|
2010-01-23 18:26:56 +00:00
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param settings
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_link_policy_settings = {
|
2010-03-14 11:09:10 +00:00
|
|
|
|
OPCODE(OGF_LINK_POLICY, 0x0d), "H2"
|
2010-01-23 18:26:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2009-07-23 21:25:39 +00:00
|
|
|
|
/**
|
|
|
|
|
* Controller & Baseband Commands
|
|
|
|
|
*/
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param event_mask_lover_octets
|
|
|
|
|
* @param event_mask_higher_octets
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_set_event_mask = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x01), "44"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_reset = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x03), ""
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2016-11-07 22:10:03 +01:00
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_flush = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x09), "H"
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
* @param delete_all_flags
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_delete_stored_link_key = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x12), "B1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param local_name (UTF-8, Null Terminated, max 248 octets)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_local_name = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x13), "N"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param page_timeout (* 0.625 ms)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_page_timeout = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x18), "2"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param scan_enable (no, inq, page, inq+page)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_scan_enable = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x1A), "1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param authentication_enable
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_authentication_enable = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x20), "1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param class_of_device
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_class_of_device = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x24), "3"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2012-01-15 21:28:42 +00:00
|
|
|
|
const hci_cmd_t hci_read_num_broadcast_retransmissions = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x29), ""
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param num_broadcast_retransmissions (e.g. 0 for a single broadcast)
|
|
|
|
|
*/
|
2012-01-15 21:28:42 +00:00
|
|
|
|
const hci_cmd_t hci_write_num_broadcast_retransmissions = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x2a), "1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2015-02-18 22:12:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param synchronous_flow_control_enable - if yes, num completed packet everts are sent for SCO packets
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_write_synchronous_flow_control_enable = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x2f), "1"
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* @param host_acl_data_packet_length
|
|
|
|
|
* @param host_synchronous_data_packet_length
|
|
|
|
|
* @param host_total_num_acl_data_packets
|
|
|
|
|
* @param host_total_num_synchronous_data_packets
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_host_buffer_size = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x33), "2122"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_read_link_supervision_timeout = {
|
2010-01-24 21:57:30 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x36), "H"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
* @param timeout (0x0001 - 0xFFFF Time -> Range: 0.625ms - 40.9 sec)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_link_supervision_timeout = {
|
2010-01-24 22:31:09 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x37), "H2"
|
2010-01-24 21:57:30 +00:00
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param inquiry_mode (0x00 = standard, 0x01 = with RSSI, 0x02 = extended)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_inquiry_mode = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x45), "1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param fec_required
|
|
|
|
|
* @param exstended_inquiry_response
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_extended_inquiry_response = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x52), "1E"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mode (0 = off, 1 = on)
|
|
|
|
|
*/
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_write_simple_pairing_mode = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x56), "1"
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2016-05-20 14:26:48 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mode (0 = off, 1 = on)
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_write_default_erroneous_data_reporting = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x5B), "1"
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
/**
|
|
|
|
|
*/
|
2011-09-25 19:38:06 +00:00
|
|
|
|
const hci_cmd_t hci_read_le_host_supported = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x6c), ""
|
|
|
|
|
// return: status, le supported host, simultaneous le host
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param le_supported_host
|
|
|
|
|
* @param simultaneous_le_host
|
|
|
|
|
*/
|
2011-09-25 19:38:06 +00:00
|
|
|
|
const hci_cmd_t hci_write_le_host_supported = {
|
|
|
|
|
OPCODE(OGF_CONTROLLER_BASEBAND, 0x6d), "11"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2009-07-23 21:25:39 +00:00
|
|
|
|
|
2015-11-12 11:52:05 +01:00
|
|
|
|
/**
|
|
|
|
|
* Testing Commands
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_read_loopback_mode = {
|
|
|
|
|
OPCODE(OGF_TESTING, 0x01), ""
|
|
|
|
|
// return: status, loopback mode (0 = off, 1 = local loopback, 2 = remote loopback)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param loopback_mode
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_write_loopback_mode = {
|
2015-11-12 12:01:54 +01:00
|
|
|
|
OPCODE(OGF_TESTING, 0x02), "1"
|
2015-11-12 11:52:05 +01:00
|
|
|
|
// return: status
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2010-07-25 15:11:33 +00:00
|
|
|
|
/**
|
|
|
|
|
* Informational Parameters
|
|
|
|
|
*/
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2015-04-16 15:38:30 +02:00
|
|
|
|
const hci_cmd_t hci_read_local_version_information = {
|
|
|
|
|
OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x01), ""
|
|
|
|
|
};
|
2015-06-10 22:30:32 +02:00
|
|
|
|
const hci_cmd_t hci_read_local_supported_commands = {
|
|
|
|
|
OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x02), ""
|
|
|
|
|
};
|
2011-09-25 18:35:20 +00:00
|
|
|
|
const hci_cmd_t hci_read_local_supported_features = {
|
|
|
|
|
OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x03), ""
|
|
|
|
|
};
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_read_buffer_size = {
|
2010-07-25 15:11:33 +00:00
|
|
|
|
OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x05), ""
|
|
|
|
|
};
|
2010-08-08 18:10:45 +00:00
|
|
|
|
const hci_cmd_t hci_read_bd_addr = {
|
2009-07-23 21:25:39 +00:00
|
|
|
|
OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x09), ""
|
|
|
|
|
};
|
|
|
|
|
|
2014-08-26 17:59:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* Status Paramters
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param handle
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_read_rssi = {
|
|
|
|
|
OPCODE(OGF_STATUS_PARAMETERS, 0x05), "H"
|
|
|
|
|
// no params
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-21 15:33:36 +01:00
|
|
|
|
#ifdef ENABLE_BLE
|
2011-09-24 18:17:02 +00:00
|
|
|
|
/**
|
|
|
|
|
* Low Energy Commands
|
|
|
|
|
*/
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param event_mask_lower_octets
|
|
|
|
|
* @param event_mask_higher_octets
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_event_mask = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x01), "44"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_buffer_size = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x02), ""
|
|
|
|
|
// return: status, le acl data packet len (16), total num le acl data packets(8)
|
|
|
|
|
};
|
|
|
|
|
const hci_cmd_t hci_le_read_supported_features = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x03), ""
|
|
|
|
|
// return: LE_Features See [Vol 6] Part B, Section 4.6
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param random_bd_addr
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_random_address = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x05), "B"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2014-05-09 13:12:14 +00:00
|
|
|
|
/**
|
2014-11-28 11:10:16 +00:00
|
|
|
|
* @param advertising_interval_min ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
|
|
|
|
|
* @param advertising_interval_max ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
|
|
|
|
|
* @param advertising_type (enum from 0: ADV_IND, ADC_DIRECT_IND, ADV_SCAN_IND, ADV_NONCONN_IND)
|
|
|
|
|
* @param own_address_type (enum from 0: public device address, random device address)
|
|
|
|
|
* @param direct_address_type ()
|
|
|
|
|
* @param direct_address (public or random address of device to be connecteed)
|
|
|
|
|
* @param advertising_channel_map (flags: chan_37(1), chan_38(2), chan_39(4))
|
|
|
|
|
* @param advertising_filter_policy (enum from 0: scan any conn any, scan whitelist, con any, scan any conn whitelist, scan whitelist, con whitelist)
|
2014-05-09 13:12:14 +00:00
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_advertising_parameters = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x06), "22111B11"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_advertising_channel_tx_power = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x07), ""
|
|
|
|
|
// return: status, level [-20,10] signed int (8), units dBm
|
|
|
|
|
};
|
2014-05-09 13:12:14 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param advertising_data_length
|
2014-11-28 11:10:16 +00:00
|
|
|
|
* @param advertising_data (31 bytes)
|
2014-05-09 13:12:14 +00:00
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_advertising_data= {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x08), "1A"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param scan_response_data_length
|
|
|
|
|
* @param scan_response_data (31 bytes)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_scan_response_data= {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x09), "1A"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2014-05-09 13:12:14 +00:00
|
|
|
|
/**
|
2014-11-28 11:10:16 +00:00
|
|
|
|
* @param advertise_enable (off: 0, on: 1)
|
2014-05-09 13:12:14 +00:00
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_advertise_enable = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0a), "1"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param le_scan_type (passive (0), active (1))
|
|
|
|
|
* @param le_scan_interval ([0x0004,0x4000], unit: 0.625 msec)
|
|
|
|
|
* @param le_scan_window ([0x0004,0x4000], unit: 0.625 msec)
|
|
|
|
|
* @param own_address_type (public (0), random (1))
|
|
|
|
|
* @param scanning_filter_policy (any (0), only whitelist (1))
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_scan_parameters = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0b), "12211"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param le_scan_enable (disabled (0), enabled (1))
|
|
|
|
|
* @param filter_duplices (disabled (0), enabled (1))
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_scan_enable = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0c), "11"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param le_scan_interval ([0x0004, 0x4000], unit: 0.625 msec)
|
|
|
|
|
* @param le_scan_window ([0x0004, 0x4000], unit: 0.625 msec)
|
|
|
|
|
* @param initiator_filter_policy (peer address type + peer address (0), whitelist (1))
|
|
|
|
|
* @param peer_address_type (public (0), random (1))
|
|
|
|
|
* @param peer_address
|
|
|
|
|
* @param own_address_type (public (0), random (1))
|
|
|
|
|
* @param conn_interval_min ([0x0006, 0x0c80], unit: 1.25 msec)
|
|
|
|
|
* @param conn_interval_max ([0x0006, 0x0c80], unit: 1.25 msec)
|
|
|
|
|
* @param conn_latency (number of connection events [0x0000, 0x01f4])
|
|
|
|
|
* @param supervision_timeout ([0x000a, 0x0c80], unit: 10 msec)
|
|
|
|
|
* @param minimum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
|
|
|
|
|
* @param maximum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_create_connection= {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0d), "2211B1222222"
|
|
|
|
|
// return: none -> le create connection complete event
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_create_connection_cancel = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0e), ""
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_white_list_size = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x0f), ""
|
|
|
|
|
// return: status, number of entries in controller whitelist
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:27:59 +00:00
|
|
|
|
const hci_cmd_t hci_le_clear_white_list = {
|
2011-09-24 18:17:02 +00:00
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x10), ""
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param address_type (public (0), random (1))
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2015-07-28 14:56:48 +02:00
|
|
|
|
const hci_cmd_t hci_le_add_device_to_white_list = {
|
2011-09-24 18:17:02 +00:00
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x11), "1B"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param address_type (public (0), random (1))
|
|
|
|
|
* @param bd_addr
|
|
|
|
|
*/
|
2015-07-28 14:56:48 +02:00
|
|
|
|
const hci_cmd_t hci_le_remove_device_from_white_list = {
|
2011-09-24 18:17:02 +00:00
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x12), "1B"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
* @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec)
|
|
|
|
|
* @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec)
|
|
|
|
|
* @param conn_latency ([0x0000,0x03e8], number of connection events)
|
|
|
|
|
* @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec)
|
|
|
|
|
* @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
|
|
|
|
|
* @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_connection_update = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x13), "H222222"
|
|
|
|
|
// return: none -> le connection update complete event
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param channel_map_lower_32bits
|
|
|
|
|
* @param channel_map_higher_5bits
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_set_host_channel_classification = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x14), "41"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_channel_map = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x15), "H"
|
|
|
|
|
// return: status, connection handle, channel map (5 bytes, 37 used)
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_remote_used_features = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x16), "H"
|
|
|
|
|
// return: none -> le read remote used features complete event
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param key ((128) for AES-128)
|
|
|
|
|
* @param plain_text (128)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_encrypt = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x17), "PP"
|
|
|
|
|
// return: status, encrypted data (128)
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_rand = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x18), ""
|
|
|
|
|
// return: status, random number (64)
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
* @param random_number_lower_32bits
|
|
|
|
|
* @param random_number_higher_32bits
|
|
|
|
|
* @param encryption_diversifier (16)
|
|
|
|
|
* @param long_term_key (128)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_start_encryption = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x19), "H442P"
|
|
|
|
|
// return: none -> encryption changed or encryption key refresh complete event
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param connection_handle
|
|
|
|
|
* @param long_term_key (128)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_long_term_key_request_reply = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1a), "HP"
|
|
|
|
|
// return: status, connection handle
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_long_term_key_negative_reply = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1b), "H"
|
|
|
|
|
// return: status, connection handle
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param conn_handle
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_read_supported_states = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1c), "H"
|
|
|
|
|
// return: status, LE states (64)
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param rx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_receiver_test = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1d), "1"
|
|
|
|
|
// return: status
|
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param tx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
|
|
|
|
|
* @param test_payload_lengh ([0x00,0x25])
|
|
|
|
|
* @param packet_payload ([0,7] different patterns)
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_transmitter_test = {
|
2014-05-04 18:07:41 +00:00
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1e), "111"
|
2014-11-28 11:10:16 +00:00
|
|
|
|
// return: status
|
2011-09-24 18:17:02 +00:00
|
|
|
|
};
|
2014-11-28 11:10:16 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param end_test_cmd
|
|
|
|
|
*/
|
2011-09-24 18:17:02 +00:00
|
|
|
|
const hci_cmd_t hci_le_test_end = {
|
2014-05-04 18:07:41 +00:00
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x1f), "1"
|
2014-11-28 11:10:16 +00:00
|
|
|
|
// return: status, number of packets (8)
|
2011-09-24 18:17:02 +00:00
|
|
|
|
};
|
2016-11-07 15:15:48 +01:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_le_read_local_p256_public_key = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x25), ""
|
|
|
|
|
// LE Read Local P-256 Public Key Complete is generated on completion
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param end_test_cmd
|
|
|
|
|
*/
|
|
|
|
|
const hci_cmd_t hci_le_generate_dhkey = {
|
|
|
|
|
OPCODE(OGF_LE_CONTROLLER, 0x26), "QQ"
|
|
|
|
|
// LE Generate DHKey Complete is generated on completion
|
|
|
|
|
};
|
|
|
|
|
|
2011-09-24 18:17:02 +00:00
|
|
|
|
#endif
|