mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-07-28 21:57:55 +00:00
nimble/controller: Remove support for Android specific HCI commands
All functionality provided by those commands is available via standard HCI commands introduced in Bluetooth 5 specification. Also events generated but Android commands were not implemented correctly as vendor events. This resulted in spurious events being sent to host. X-Original-Commit: 4f5ffa33991588da657bd0b1f9651879bb3b9870
This commit is contained in:
@@ -124,14 +124,11 @@ int ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t instance,
|
||||
uint8_t operation);
|
||||
|
||||
/* Set advertising parameters */
|
||||
int ble_ll_adv_set_adv_params(uint8_t *cmd, uint8_t instance, int is_multi);
|
||||
int ble_ll_adv_set_adv_params(uint8_t *cmd);
|
||||
|
||||
/* Read advertising channel power */
|
||||
int ble_ll_adv_read_txpwr(uint8_t *rspbuf, uint8_t *rsplen);
|
||||
|
||||
int ble_ll_adv_multi_adv_cmd(uint8_t *cmd, uint8_t cmdlen, uint8_t *rspbuf,
|
||||
uint8_t *rsplen);
|
||||
|
||||
/*---- API used by BLE LL ----*/
|
||||
/* Send the connection complete event */
|
||||
void ble_ll_adv_send_conn_comp_ev(struct ble_ll_conn_sm *connsm,
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "nimble/ble.h"
|
||||
#include "nimble/nimble_opt.h"
|
||||
#include "nimble/hci_common.h"
|
||||
#include "nimble/hci_vendor.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "controller/ble_phy.h"
|
||||
#include "controller/ble_hw.h"
|
||||
@@ -101,7 +100,7 @@ struct ble_ll_adv_sm
|
||||
uint8_t *conn_comp_ev;
|
||||
struct os_event adv_txdone_ev;
|
||||
struct ble_ll_sched_item adv_sch;
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
uint32_t adv_secondary_start_time;
|
||||
struct ble_ll_sched_item adv_secondary_sch;
|
||||
uint16_t duration; /* TODO */
|
||||
@@ -1049,37 +1048,24 @@ ble_ll_adv_halt(struct ble_ll_adv_sm *advsm)
|
||||
* @return int
|
||||
*/
|
||||
int
|
||||
ble_ll_adv_set_adv_params(uint8_t *cmd, uint8_t instance, int is_multi)
|
||||
ble_ll_adv_set_adv_params(uint8_t *cmd)
|
||||
{
|
||||
uint8_t adv_type;
|
||||
uint8_t adv_filter_policy;
|
||||
uint8_t adv_chanmask;
|
||||
uint8_t own_addr_type;
|
||||
uint8_t peer_addr_type;
|
||||
uint8_t offset;
|
||||
uint16_t adv_itvl_min;
|
||||
uint16_t adv_itvl_max;
|
||||
uint16_t min_itvl;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
uint16_t props;
|
||||
|
||||
/* If already enabled, we return an error */
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
advsm = &g_ble_ll_adv_sm[instance];
|
||||
advsm = &g_ble_ll_adv_sm[0];
|
||||
if (advsm->adv_enabled) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
/* Add offset if this is a multi-advertising command */
|
||||
if (is_multi) {
|
||||
offset = 6;
|
||||
} else {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
/* Make sure intervals are OK (along with advertising type */
|
||||
adv_itvl_min = get_le16(cmd);
|
||||
adv_itvl_max = get_le16(cmd + 2);
|
||||
@@ -1089,7 +1075,7 @@ ble_ll_adv_set_adv_params(uint8_t *cmd, uint8_t instance, int is_multi)
|
||||
* Get the filter policy now since we will ignore it if we are doing
|
||||
* directed advertising
|
||||
*/
|
||||
adv_filter_policy = cmd[14 + offset];
|
||||
adv_filter_policy = cmd[14];
|
||||
|
||||
/* Assume min interval based on low duty cycle/indirect advertising */
|
||||
min_itvl = BLE_LL_ADV_ITVL_MIN;
|
||||
@@ -1136,44 +1122,19 @@ ble_ll_adv_set_adv_params(uint8_t *cmd, uint8_t instance, int is_multi)
|
||||
|
||||
/* Check own and peer address type */
|
||||
own_addr_type = cmd[5];
|
||||
peer_addr_type = cmd[6 + offset];
|
||||
peer_addr_type = cmd[6];
|
||||
|
||||
if ((own_addr_type > BLE_HCI_ADV_OWN_ADDR_MAX) ||
|
||||
(peer_addr_type > BLE_HCI_ADV_PEER_ADDR_MAX)) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
/* Deal with multi-advertising command specific*/
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
if (is_multi) {
|
||||
/* Get and check advertising power */
|
||||
advsm->adv_txpwr = cmd[22];
|
||||
if (advsm->adv_txpwr > 20) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
/* Get own address if it is there. */
|
||||
if (own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
} else {
|
||||
if (own_addr_type == BLE_HCI_ADV_OWN_ADDR_RANDOM) {
|
||||
/* Use this random address if set in own address */
|
||||
if (ble_ll_is_valid_random_addr(cmd + 6)) {
|
||||
memcpy(advsm->adv_random_addr, cmd + 6, BLE_DEV_ADDR_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
advsm->adv_txpwr = MYNEWT_VAL(BLE_LL_TX_PWR_DBM);
|
||||
}
|
||||
#else
|
||||
advsm->adv_txpwr = MYNEWT_VAL(BLE_LL_TX_PWR_DBM);
|
||||
#endif
|
||||
|
||||
#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 1)
|
||||
if (own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
|
||||
/* Copy peer address */
|
||||
memcpy(advsm->peer_addr, cmd + 7 + offset, BLE_DEV_ADDR_LEN);
|
||||
memcpy(advsm->peer_addr, cmd + 7, BLE_DEV_ADDR_LEN);
|
||||
|
||||
/* Reset RPA timer so we generate a new RPA */
|
||||
advsm->adv_rpa_timer = os_time_get();
|
||||
@@ -1186,7 +1147,7 @@ ble_ll_adv_set_adv_params(uint8_t *cmd, uint8_t instance, int is_multi)
|
||||
#endif
|
||||
|
||||
/* There are only three adv channels, so check for any outside the range */
|
||||
adv_chanmask = cmd[13 + offset];
|
||||
adv_chanmask = cmd[13];
|
||||
if (((adv_chanmask & 0xF8) != 0) || (adv_chanmask == 0)) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
@@ -1230,7 +1191,7 @@ ble_ll_adv_sm_stop(struct ble_ll_adv_sm *advsm)
|
||||
|
||||
/* Set to standby if we are no longer advertising */
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (g_ble_ll_cur_adv_sm == advsm) {
|
||||
ble_phy_disable();
|
||||
ble_ll_wfr_disable();
|
||||
@@ -1333,17 +1294,10 @@ ble_ll_adv_sm_start(struct ble_ll_adv_sm *advsm)
|
||||
advsm->flags &= ~BLE_LL_ADV_SM_FLAG_RX_ADD;
|
||||
advsm->flags &= ~BLE_LL_ADV_SM_FLAG_CONN_RSP_TXD;
|
||||
|
||||
/*
|
||||
* This is not in the specification. I will reject the command with a
|
||||
* command disallowed error if no random address has been sent by the
|
||||
* host. All the parameter errors refer to the command
|
||||
* parameter (which in this case is just enable or disable) so that
|
||||
* is why I chose command disallowed.
|
||||
*/
|
||||
if (advsm->own_addr_type == BLE_HCI_ADV_OWN_ADDR_RANDOM) {
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
if (!ble_ll_is_valid_random_addr(advsm->adv_random_addr)) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
#else
|
||||
if (!ble_ll_is_valid_random_addr(g_random_addr)) {
|
||||
@@ -1371,7 +1325,7 @@ ble_ll_adv_sm_start(struct ble_ll_adv_sm *advsm)
|
||||
if ((advsm->own_addr_type & 1) == 0) {
|
||||
addr = g_dev_addr;
|
||||
} else {
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
addr = advsm->adv_random_addr;
|
||||
#else
|
||||
addr = g_random_addr;
|
||||
@@ -1691,7 +1645,7 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t instance, uint8_t operation)
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
int
|
||||
ble_ll_adv_ext_set_param(uint8_t *cmdbuf, uint8_t *rspbuf, uint8_t *rsplen)
|
||||
{
|
||||
@@ -2058,68 +2012,6 @@ ble_ll_adv_clear_all(void)
|
||||
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the multi-advertising command
|
||||
*
|
||||
* NOTE: the command length was already checked to make sure it is non-zero.
|
||||
*
|
||||
* @param cmdbuf Pointer to command buffer
|
||||
* @param cmdlen The length of the command data
|
||||
* @param rspbuf Pointer to response buffer
|
||||
* @param rsplen Pointer to response length
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int
|
||||
ble_ll_adv_multi_adv_cmd(uint8_t *cmdbuf, uint8_t cmdlen, uint8_t *rspbuf,
|
||||
uint8_t *rsplen)
|
||||
{
|
||||
int rc;
|
||||
uint8_t subcmd;
|
||||
|
||||
/* NOTE: the command length includes the sub command byte */
|
||||
rc = BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
subcmd = cmdbuf[0];
|
||||
++cmdbuf;
|
||||
switch (subcmd) {
|
||||
case BLE_HCI_MULTI_ADV_PARAMS:
|
||||
if (cmdlen == BLE_HCI_MULTI_ADV_PARAMS_LEN) {
|
||||
rc = ble_ll_adv_set_adv_params(cmdbuf, cmdbuf[21], 1);
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_MULTI_ADV_DATA:
|
||||
if (cmdlen == BLE_HCI_MULTI_ADV_DATA_LEN) {
|
||||
rc = ble_ll_adv_set_adv_data(cmdbuf, cmdbuf[32],
|
||||
BLE_HCI_LE_SET_EXT_ADV_DATA_OPER_COMPLETE);
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_MULTI_ADV_SCAN_RSP_DATA:
|
||||
if (cmdlen == BLE_HCI_MULTI_ADV_SCAN_RSP_DATA_LEN) {
|
||||
rc = ble_ll_adv_set_scan_rsp_data(cmdbuf, cmdbuf[32],
|
||||
BLE_HCI_LE_SET_EXT_SCAN_RSP_DATA_OPER_COMPLETE);
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_MULTI_ADV_SET_RAND_ADDR:
|
||||
if (cmdlen == BLE_HCI_MULTI_ADV_SET_RAND_ADDR_LEN) {
|
||||
rc = ble_ll_adv_set_random_addr(cmdbuf, cmdbuf[6]);
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_MULTI_ADV_ENABLE:
|
||||
if (cmdlen == BLE_HCI_MULTI_ADV_ENABLE_LEN) {
|
||||
rc = ble_ll_adv_set_enable(cmdbuf[0], cmdbuf[1], 0, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rc = BLE_ERR_UNKNOWN_HCI_CMD;
|
||||
break;
|
||||
}
|
||||
|
||||
rspbuf[0] = subcmd;
|
||||
*rsplen = 1;
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2381,7 +2273,7 @@ int
|
||||
ble_ll_adv_rx_isr_end(uint8_t pdu_type, struct os_mbuf *rxpdu, int crcok)
|
||||
{
|
||||
int rc;
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
struct ble_mbuf_hdr *rxhdr;
|
||||
#endif
|
||||
|
||||
@@ -2389,7 +2281,7 @@ ble_ll_adv_rx_isr_end(uint8_t pdu_type, struct os_mbuf *rxpdu, int crcok)
|
||||
if (rxpdu == NULL) {
|
||||
ble_ll_adv_tx_done(g_ble_ll_cur_adv_sm);
|
||||
} else {
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
rxhdr = BLE_MBUF_HDR_PTR(rxpdu);
|
||||
rxhdr->rxinfo.advsm = g_ble_ll_cur_adv_sm;
|
||||
#endif
|
||||
@@ -2433,7 +2325,7 @@ ble_ll_adv_rx_pkt_in(uint8_t ptype, uint8_t *rxbuf, struct ble_mbuf_hdr *hdr)
|
||||
int adv_event_over;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
advsm = (struct ble_ll_adv_sm *)hdr->rxinfo.advsm;
|
||||
#else
|
||||
advsm = &g_ble_ll_adv_sm[0];
|
||||
@@ -2787,18 +2679,8 @@ ble_ll_adv_send_conn_comp_ev(struct ble_ll_conn_sm *connsm,
|
||||
uint8_t *evbuf;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
advsm = (struct ble_ll_adv_sm *)rxhdr->rxinfo.advsm;
|
||||
evbuf = ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
|
||||
if (evbuf) {
|
||||
evbuf[0] = BLE_HCI_EVCODE_LE_META;
|
||||
evbuf[1] = 5; /* Length of event, including sub-event code */
|
||||
evbuf[2] = BLE_HCI_LE_SUBEV_ADV_STATE_CHG;
|
||||
evbuf[3] = advsm->adv_instance;
|
||||
evbuf[4] = 0x00; /* status code */
|
||||
put_le16(evbuf + 5, connsm->conn_handle);
|
||||
ble_ll_hci_event_send(evbuf);
|
||||
}
|
||||
#else
|
||||
advsm = &g_ble_ll_adv_sm[0];
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "nimble/ble.h"
|
||||
#include "nimble/nimble_opt.h"
|
||||
#include "nimble/hci_common.h"
|
||||
#include "nimble/hci_vendor.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "controller/ble_hw.h"
|
||||
#include "controller/ble_ll_adv.h"
|
||||
@@ -623,87 +622,6 @@ ble_ll_ext_adv_set_remove(uint8_t *cmd)
|
||||
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
/**
|
||||
* Returns the vendor specific capabilities
|
||||
*
|
||||
* @param rspbuf Pointer to response buffer
|
||||
* @param rsplen Length of response buffer
|
||||
*
|
||||
* @return int BLE error code
|
||||
*/
|
||||
static int
|
||||
ble_ll_hci_vendor_caps(uint8_t *rspbuf, uint8_t *rsplen)
|
||||
{
|
||||
/* Clear all bytes */
|
||||
memset(rspbuf, 0, 14);
|
||||
|
||||
/* Fill out the ones we support */
|
||||
rspbuf[0] = BLE_LL_ADV_INSTANCES;
|
||||
rspbuf[9] = 0x60;
|
||||
*rsplen = 14;
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a vendor command sent from the host to the controller. The HCI
|
||||
* command has a 3 byte command header followed by data. The header is:
|
||||
* -> opcode (2 bytes)
|
||||
* -> Length of parameters (1 byte; does include command header bytes).
|
||||
*
|
||||
* @param cmdbuf Pointer to command buffer. Points to start of command header.
|
||||
* @param ocf Opcode command field.
|
||||
* @param *rsplen Pointer to length of response
|
||||
*
|
||||
* @return int This function returns a BLE error code. If a command status
|
||||
* event should be returned as opposed to command complete,
|
||||
* 256 gets added to the return value.
|
||||
*/
|
||||
static int
|
||||
ble_ll_hci_vendor_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
|
||||
{
|
||||
int rc;
|
||||
uint8_t cmdlen;
|
||||
uint8_t *rspbuf;
|
||||
|
||||
/* Assume error; if all pass rc gets set to 0 */
|
||||
rc = BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
|
||||
/* Get length from command */
|
||||
cmdlen = cmdbuf[sizeof(uint16_t)];
|
||||
|
||||
/*
|
||||
* The command response pointer points into the same buffer as the
|
||||
* command data itself. That is fine, as each command reads all the data
|
||||
* before crafting a response.
|
||||
*/
|
||||
rspbuf = cmdbuf + BLE_HCI_EVENT_CMD_COMPLETE_MIN_LEN;
|
||||
|
||||
/* Move past HCI command header */
|
||||
cmdbuf += BLE_HCI_CMD_HDR_LEN;
|
||||
|
||||
switch (ocf) {
|
||||
case BLE_HCI_OCF_VENDOR_CAPS:
|
||||
if (cmdlen == 0) {
|
||||
ble_ll_hci_vendor_caps(rspbuf, rsplen);
|
||||
rc = BLE_ERR_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case BLE_HCI_OCF_MULTI_ADV:
|
||||
if (cmdlen > 0) {
|
||||
rc = ble_ll_adv_multi_adv_cmd(cmdbuf, cmdlen, rspbuf, rsplen);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rc = BLE_ERR_UNKNOWN_HCI_CMD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* XXX: for now, all vendor commands return a command complete */
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Process a LE command sent from the host to the controller. The HCI command
|
||||
* has a 3 byte command header followed by data. The header is:
|
||||
@@ -762,7 +680,7 @@ ble_ll_hci_le_cmd_proc(uint8_t *cmdbuf, uint16_t ocf, uint8_t *rsplen)
|
||||
rc = ble_ll_set_random_addr(cmdbuf);
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_SET_ADV_PARAMS:
|
||||
rc = ble_ll_adv_set_adv_params(cmdbuf, 0, 0);
|
||||
rc = ble_ll_adv_set_adv_params(cmdbuf);
|
||||
break;
|
||||
case BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR:
|
||||
rc = ble_ll_adv_read_txpwr(rspbuf, rsplen);
|
||||
@@ -1194,11 +1112,6 @@ ble_ll_hci_cmd_proc(struct os_event *ev)
|
||||
case BLE_HCI_OGF_LE:
|
||||
rc = ble_ll_hci_le_cmd_proc(cmdbuf, ocf, &rsplen);
|
||||
break;
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
case BLE_HCI_OGF_VENDOR:
|
||||
rc = ble_ll_hci_vendor_cmd_proc(cmdbuf, ocf, &rsplen);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* XXX: Need to support other OGF. For now, return unsupported */
|
||||
rc = BLE_ERR_UNKNOWN_HCI_CMD;
|
||||
|
||||
@@ -67,10 +67,9 @@ struct ble_mbuf_hdr_rxinfo
|
||||
uint8_t handle;
|
||||
int8_t rssi;
|
||||
int8_t phy;
|
||||
#if MYNEWT_VAL(BLE_ANDROID_MULTI_ADV_SUPPORT)
|
||||
void *advsm; /* advertising state machine */
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
|
||||
/* TODO this could be just one user-data pointer */
|
||||
void *advsm; /* advertising state machine */
|
||||
void *aux_data;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#ifndef H_BLE_HCI_VENDOR_
|
||||
#define H_BLE_HCI_VENDOR_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Here is a list of the vendor specific OCFs */
|
||||
#define BLE_HCI_OCF_VENDOR_CAPS (0x153)
|
||||
#define BLE_HCI_OCF_MULTI_ADV (0x154)
|
||||
|
||||
/* Multi-advertiser sub-commands */
|
||||
#define BLE_HCI_MULTI_ADV_PARAMS (0x01)
|
||||
#define BLE_HCI_MULTI_ADV_DATA (0x02)
|
||||
#define BLE_HCI_MULTI_ADV_SCAN_RSP_DATA (0x03)
|
||||
#define BLE_HCI_MULTI_ADV_SET_RAND_ADDR (0x04)
|
||||
#define BLE_HCI_MULTI_ADV_ENABLE (0x05)
|
||||
|
||||
/* Command lengths. Includes sub-command opcode */
|
||||
#define BLE_HCI_MULTI_ADV_PARAMS_LEN (24)
|
||||
#define BLE_HCI_MULTI_ADV_DATA_LEN (34)
|
||||
#define BLE_HCI_MULTI_ADV_SCAN_RSP_DATA_LEN (34)
|
||||
#define BLE_HCI_MULTI_ADV_SET_RAND_ADDR_LEN (8)
|
||||
#define BLE_HCI_MULTI_ADV_ENABLE_LEN (3)
|
||||
|
||||
/* Vendor specific events (LE meta events) */
|
||||
#define BLE_HCI_LE_SUBEV_ADV_STATE_CHG (0x55)
|
||||
|
||||
/* Data structures associated with vendor specific commands */
|
||||
struct hci_vendor_capabilities
|
||||
{
|
||||
uint8_t max_advt_instances;
|
||||
uint8_t offloaded_resolution_of_priv_addr;
|
||||
uint16_t total_scan_results_bytes;
|
||||
uint8_t max_irk_list_sz;
|
||||
uint8_t filtering_support;
|
||||
uint8_t max_filters;
|
||||
uint8_t activity_energy_info_support;
|
||||
uint16_t version_supported;
|
||||
uint16_t total_adv_tracked;
|
||||
uint8_t extended_scan_support;
|
||||
uint8_t debug_logging_supported;
|
||||
};
|
||||
|
||||
/* NOTE: these are not in command order */
|
||||
struct hci_multi_adv_params
|
||||
{
|
||||
uint8_t adv_type;
|
||||
uint8_t adv_channel_map;
|
||||
uint8_t own_addr_type;
|
||||
uint8_t peer_addr_type;
|
||||
uint8_t adv_filter_policy;
|
||||
int8_t adv_tx_pwr; /* -70 to +20 */
|
||||
uint8_t adv_instance;
|
||||
uint16_t adv_itvl_min;
|
||||
uint16_t adv_itvl_max;
|
||||
uint8_t peer_addr[BLE_DEV_ADDR_LEN];
|
||||
uint8_t own_addr[BLE_DEV_ADDR_LEN];
|
||||
};
|
||||
|
||||
/*
|
||||
* NOTE: structures are not defined for the following sub commands.
|
||||
* The format of these commands is:
|
||||
*
|
||||
* Multi-adv Set Advertising Data:
|
||||
* - Advertising data length (1)
|
||||
* - Advertising data (31)
|
||||
* - Advertising Instance (1)
|
||||
*
|
||||
* Multi-adv Set Scan Response Data:
|
||||
* - Scan response data length (1)
|
||||
* - Scan response data (31)
|
||||
* - Advertising Instance (1)
|
||||
*
|
||||
* Multi-adv Set Random Address:
|
||||
* - Random Address (6)
|
||||
* - Advertising Instance (1)
|
||||
*
|
||||
* Multi-adv Set Advertising Enable:
|
||||
* - Random Address (6)
|
||||
* - Advertising Instance (1)
|
||||
*
|
||||
* All of these commands generate a Command Complete with this format:
|
||||
* - Status (1)
|
||||
* - Multi-adv opcode (1)
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* H_BLE_HCI_VENDOR_ */
|
||||
@@ -41,9 +41,6 @@ syscfg.defs:
|
||||
Enables the BLE whitelist for controlling who to connect to or
|
||||
accept a connection from. (0/1)
|
||||
value: 1
|
||||
BLE_ANDROID_MULTI_ADV_SUPPORT:
|
||||
description: 'Support for Android Vendor multi-advertisers HCI commands'
|
||||
value: 0
|
||||
BLE_MULTI_ADV_INSTANCES:
|
||||
description: >
|
||||
This is the number of multi-advertising instances. This is NOT the
|
||||
|
||||
Reference in New Issue
Block a user