Skip to content

Commit

Permalink
feat(mesh): Add support for Duplicate Exception list update VSC for
Browse files Browse the repository at this point in the history
Nimble
  • Loading branch information
rahult-github committed Aug 23, 2023
1 parent 6e3c700 commit acc08b9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
1 change: 0 additions & 1 deletion components/bt/esp_ble_mesh/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions components/bt/porting/nimble/include/nimble/hci_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit acc08b9

Please sign in to comment.