feat(mesh): Add support for Duplicate Exception list update VSC for

Nimble
This commit is contained in:
Rahul Tank 2023-07-13 12:08:03 +05:30
parent 6e3c700bf6
commit acc08b9421
4 changed files with 45 additions and 6 deletions

View File

@ -8,7 +8,6 @@ if BLE_MESH
config BLE_MESH_USE_DUPLICATE_SCAN
bool "Support Duplicate Scan in BLE Mesh"
depends on BT_BLUEDROID_ENABLED
select BTDM_BLE_SCAN_DUPL if IDF_TARGET_ESP32
select BTDM_BLE_MESH_SCAN_DUPL_EN if IDF_TARGET_ESP32
select BT_CTRL_BLE_SCAN_DUPL if IDF_TARGET_ESP32C3

View File

@ -1,7 +1,7 @@
/*
* SPDX-FileCopyrightText: 2017 Nordic Semiconductor ASA
* SPDX-FileCopyrightText: 2015-2016 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -1943,9 +1943,43 @@ int bt_mesh_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
}
#if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN)
int bt_mesh_update_exceptional_list(uint8_t sub_code, uint8_t type, void *info)
int bt_mesh_update_exceptional_list(uint8_t sub_code, uint32_t type, void *info)
{
BT_ERR("Unsupported for NimBLE host");
return 0;
uint8_t value[6] = {0};
int rc = 0;
#if MYNEWT_VAL(BLE_HCI_VS)
struct ble_hci_vs_duplicate_exception_list_cp cmd;
#endif
if ((sub_code > BLE_MESH_EXCEP_LIST_SUB_CODE_CLEAN) ||
(sub_code < BLE_MESH_EXCEP_LIST_SUB_CODE_CLEAN &&
type > BLE_MESH_EXCEP_LIST_TYPE_MESH_PROXY_ADV) ||
(sub_code == BLE_MESH_EXCEP_LIST_SUB_CODE_CLEAN &&
!(type & BLE_MESH_EXCEP_LIST_CLEAN_ALL_LIST))) {
BT_ERR("%s, Invalid parameter", __func__);
return -EINVAL;
}
if (type == BLE_MESH_EXCEP_LIST_TYPE_MESH_LINK_ID) {
if (!info) {
BT_ERR("Invalid Provisioning Link ID");
return -EINVAL;
}
sys_memcpy_swap(value, info, sizeof(uint32_t));
}
BT_DBG("%s exceptional list, type 0x%08x", sub_code ? "Remove" : "Add", type);
#if MYNEWT_VAL(BLE_HCI_VS)
cmd.operation = sub_code;
cmd.type = htole32(type);
memcpy(&cmd.device_info, value, 6);
rc = ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_DUPLICATE_EXCEPTION_LIST,
&cmd, sizeof(cmd), NULL, 0);
#endif
return rc;
}
#endif

@ -1 +1 @@
Subproject commit e24f65acdafed8334c122acf06972545a184ba2f
Subproject commit 3172618555b02dad599e9a76f56f1d6a64557f78

View File

@ -1136,6 +1136,12 @@ struct ble_hci_vs_rd_static_addr_rp {
uint8_t addr[6];
} __attribute__((packed));
#define BLE_HCI_OCF_VS_DUPLICATE_EXCEPTION_LIST (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0108))
struct ble_hci_vs_duplicate_exception_list_cp {
uint8_t operation;
uint32_t type;
uint8_t device_info[6];
} __attribute__((packed));
#if SOC_BLE_POWER_CONTROL_SUPPORTED && MYNEWT_VAL(BLE_HCI_VS)
#define BLE_HCI_OCF_VS_PCL_SET_RSSI (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0111))