|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
/*
|
|
|
* SPDX-FileCopyrightText: 2017 Nordic Semiconductor ASA
|
|
* SPDX-FileCopyrightText: 2017 Nordic Semiconductor ASA
|
|
|
* SPDX-FileCopyrightText: 2015-2016 Intel Corporation
|
|
* 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
|
|
* 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)
|
|
#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
|
|
#endif
|