fix(ble_mesh): Miscellaneous update for ble mesh

This commit is contained in:
wangjialiang
2023-09-15 10:51:56 +08:00
parent 14ca0f3db6
commit 8eed3a2467
44 changed files with 228 additions and 83 deletions

View File

@@ -7,15 +7,15 @@ This component is a part of Espressif IoT Development Framework (ESP-IDF). For t
The ESP-BLE-MESH networking enables many-to-many (m:m) device communications and is optimized for creating large-scale device networks.
### [ESP-BLE-MESH Documentation](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/index.html)
### [ESP-BLE-MESH Documentation](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-index.html)
- [Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-index.html#getting-started-with-esp-ble-mesh)
- [Architecture](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-architecture.html)
- [Feature List](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-feature-list.html)
- [FAQ](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-faq.html)
- [API Reference](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/esp-ble-mesh.html)
- [Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/index.html##getting-started-with-ble-mesh)
- [Architecture](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/arhitecture.html)
- [Feature List](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/ble_mesh-feature-list.html)
- [FAQ](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/ble_mesh_faq.html)
- [API Reference](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/ble_mesh.html)
### [ESP-BLE-MESH Examples](https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/esp_ble_mesh)
- Refer to **ESP-BLE-MESH Examples** of [Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/index.html##getting-started-with-ble-mesh) for the tutorials of ESP BLE Mesh examples.
- Refer to **ESP-BLE-MESH Examples** of [Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp-ble-mesh/ble-mesh-index.html#getting-started-with-esp-ble-mesh) for the tutorials of ESP BLE Mesh examples.

View File

@@ -952,7 +952,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
return -EADDRNOTAVAIL;
}
tx.sub = bt_mesh_subnet_get(ctx.net_idx);
tx.sub = bt_mesh_subnet_get(key->net_idx);
if (!tx.sub) {
BT_ERR("Publish, NetKey 0x%04x not found", ctx.net_idx);
return -EADDRNOTAVAIL;

View File

@@ -1132,7 +1132,10 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
bt_mesh_net_local();
err = 0;
goto done;
/* If it is a group address, it still needs to be relayed */
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
goto done;
}
}
if ((bearer & BLE_MESH_ADV_BEARER) &&

View File

@@ -404,7 +404,8 @@ static void prov_retransmit(struct k_work *work)
struct bt_mesh_prov_link *link = work->user_data;
int64_t timeout = TRANSACTION_TIMEOUT;
if (!bt_mesh_atomic_test_bit(link->flags, LINK_ACTIVE)) {
if (!bt_mesh_atomic_test_bit(link->flags, LINK_ACTIVE) &&
!bt_mesh_atomic_test_bit(link->flags, LINK_CLOSING)) {
BT_WARN("Link not active");
return;
}

View File

@@ -368,7 +368,9 @@ static int provisioner_start_prov_pb_adv(const uint8_t uuid[16], const bt_mesh_a
}
for (i = 0; i < CONFIG_BLE_MESH_PBA_SAME_TIME; i++) {
if (!bt_mesh_atomic_test_bit(prov_links[i].flags, LINK_ACTIVE)) {
if (!bt_mesh_atomic_test_bit(prov_links[i].flags, LINK_ACTIVE) &&
!bt_mesh_atomic_test_bit(prov_links[i].flags, LINK_CLOSING)
) {
memcpy(prov_links[i].uuid, uuid, 16);
prov_links[i].oob_info = oob_info;
if (addr) {
@@ -1177,9 +1179,9 @@ static void prov_capabilities(struct bt_mesh_prov_link *link,
algorithms = net_buf_simple_pull_be16(buf);
BT_INFO("Algorithms: 0x%04x", algorithms);
if (algorithms != BIT(PROV_ALG_P256_CMAC_AES128)
if (!(algorithms & BIT(PROV_ALG_P256_CMAC_AES128))
#if CONFIG_BLE_MESH_PROV_EPA
&& algorithms != BIT(PROV_ALG_P256_HMAC_SHA256)
&& !(algorithms & BIT(PROV_ALG_P256_HMAC_SHA256))
#endif
) {
BT_ERR("Invalid algorithms 0x%04x", algorithms);

View File

@@ -624,7 +624,7 @@ typedef enum {
/** Parameters of directed forwarding table entry change */
typedef struct {
esp_ble_mesh_df_table_action_t action; /*!< Action of directed forarding table */
esp_ble_mesh_df_table_action_t action; /*!< Action of directed forwarding table */
/** Union of directed forwarding table information */
union {
/** Structure of directed forwarding table add and remove */
@@ -633,7 +633,7 @@ typedef struct {
esp_ble_mesh_uar_t path_target; /*!< Primary element address of the Path Target */
esp_ble_mesh_uar_t *dep_origin_data; /*!< List of the primary element addresses of the dependent nodes of the Path Origin */
uint32_t dep_origin_num; /*!< Number of entries in the Dependent_Origin_Listfield of the message */
uint32_t dep_origin_num; /*!< Number of entries in the Dependent_Origin_List field of the message */
esp_ble_mesh_uar_t *dep_target_data; /*!< List of the primary element addresses of the dependent nodes of the Path Target */
uint32_t dep_target_num; /*!< Number of entries in the Dependent_Target_List field of the message */

View File

@@ -20,7 +20,7 @@ extern int bt_mesh_get_transfer_progress(void *model, uint16_t unicast_addr,
uint8_t *block_percent, uint8_t *chunk_percent);
extern int bt_mesh_get_blob_reception_progress(void *model, uint8_t *reception_progress);
esp_err_t esp_ble_mesh_register_blob_transfer_client_callback(esp_ble_mesh_mbt_client_cb_t callback)
esp_err_t esp_ble_mesh_register_mbt_client_callback(esp_ble_mesh_mbt_client_cb_t callback)
{
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);

View File

@@ -102,7 +102,7 @@ typedef struct {
uint16_t app_idx; /*!< AppKey Index state */
uint8_t transfer_ttl; /*!< Transfer TTL state */
uint8_t unicast_addr_count; /*!< The count of unicast address */
uint16_t *unicast_addr; /*!< Unlicast address list */
uint16_t *unicast_addr; /*!< Unicast address list */
} esp_ble_mesh_retrieve_capabilities_t; /*!< Parameters of BLOB retrieve capabilities */
/** Parameters of BLOB transfer */
@@ -111,7 +111,7 @@ typedef struct {
uint8_t msg_role; /*!< Role of the device - Node/Provisioner */
uint8_t unicast_addr_count; /*!< The count of unicast address */
uint16_t *unicast_addr; /*!< Unlicast address list */
uint16_t *unicast_addr; /*!< Unicast address list */
uint16_t multicast_addr; /*!< Multicast Address state */
uint16_t app_idx; /*!< AppKey Index state */
uint8_t transfer_ttl; /*!< Transfer TTL state */
@@ -164,7 +164,7 @@ typedef struct {
uint16_t app_idx; /*!< AppKey Index state */
uint8_t transfer_ttl; /*!< Transfer TTL state */
uint8_t unicast_addr_count; /*!< The count of unicast address */
uint16_t *unicast_addr; /*!< Unlicast address list */
uint16_t *unicast_addr; /*!< Unicast address list */
} esp_ble_mesh_determine_transfer_status_t; /*!< Parameters of determine Block Status message */
/** Parameters of cancel transfer message */
@@ -176,7 +176,7 @@ typedef struct {
uint16_t app_idx; /*!< AppKey Index state */
uint8_t transfer_ttl; /*!< Transfer TTL state */
uint8_t unicast_addr_count; /*!< The count of unicast address */
uint16_t *unicast_addr; /*!< Unlicast address list */
uint16_t *unicast_addr; /*!< Unicast address list */
uint8_t blob_id[ESP_BLE_MESH_BLOB_ID_SIZE]; /*!< BLOB identifier list */
} esp_ble_mesh_cancel_transfer_t; /*!< Parameters of cancel transfer message */

View File

@@ -4143,8 +4143,9 @@ static const bt_mesh_ext_config_t bt_mesh_ext_cfg = {
.struct_model_op_size = sizeof(struct bt_mesh_model_op),
.struct_model_op_off_min_len = offsetof(struct bt_mesh_model_op, min_len),
.struct_model_op_off_func = offsetof(struct bt_mesh_model_op, func),
#if 0
.struct_model_cb_size = sizeof(struct bt_mesh_model_cb),
#if CONFIG_BLE_MESH_DEINIT
.struct_model_cb_off_deinit = offsetof(struct bt_mesh_model_cb, deinit),
#endif
.struct_send_cb_size = sizeof(struct bt_mesh_send_cb),