Skip to content

Commit

Permalink
Merge branch 'bugfix/sync_zephyr_bt_mesh_bugfix_v3.3' into 'release/v…
Browse files Browse the repository at this point in the history
…3.3'

Bugfix/sync zephyr bt mesh bugfix (v3.3)

See merge request espressif/esp-idf!8689
  • Loading branch information
Isl2017 committed May 13, 2020
2 parents b3c40e8 + 46a8982 commit 19893ab
Show file tree
Hide file tree
Showing 69 changed files with 2,841 additions and 1,467 deletions.
2 changes: 2 additions & 0 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/mesh_common/mesh_buf.c"
"esp_ble_mesh/mesh_common/mesh_common.c"
"esp_ble_mesh/mesh_common/mesh_kernel.c"
"esp_ble_mesh/mesh_common/mesh_mutex.c"
"esp_ble_mesh/mesh_common/mesh_timer.c"
"esp_ble_mesh/mesh_common/mesh_util.c"
"esp_ble_mesh/mesh_core/storage/settings_nvs.c"
"esp_ble_mesh/mesh_core/access.c"
Expand Down
2 changes: 0 additions & 2 deletions components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include <stdint.h>

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#include <stdint.h>

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <stdint.h>
#include <string.h>

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down Expand Up @@ -71,9 +69,9 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
}

if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
mic_len = 4;
mic_len = ESP_BLE_MESH_MIC_SHORT;
} else {
mic_len = ctx->send_rel ? 8 : 4;
mic_len = ctx->send_rel ? ESP_BLE_MESH_MIC_LONG : ESP_BLE_MESH_MIC_SHORT;
}

if (op_len + length + mic_len > MIN(ESP_BLE_MESH_SDU_MAX_LEN, ESP_BLE_MESH_TX_SDU_MAX)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <stdint.h>
#include <string.h>

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down
2 changes: 0 additions & 2 deletions components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <stdint.h>
#include <string.h>

#include "btc/btc_manage.h"

#include "esp_err.h"

#include "btc_ble_mesh_prov.h"
Expand Down
9 changes: 8 additions & 1 deletion components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ extern "C" {
/*!< The maximum length of a BLE Mesh message, including Opcode, Payload and TransMIC */
#define ESP_BLE_MESH_SDU_MAX_LEN 384

/*!< Length of a short Mesh MIC. */
#define ESP_BLE_MESH_MIC_SHORT 4

/*!< Length of a long Mesh MIC. */
#define ESP_BLE_MESH_MIC_LONG 8

/*!< The maximum length of a BLE Mesh provisioned node name */
#define ESP_BLE_MESH_NODE_NAME_MAX_LEN 31

Expand Down Expand Up @@ -369,7 +375,8 @@ typedef struct {

uint16_t publish_addr; /*!< Publish Address. */
uint16_t app_idx:12, /*!< Publish AppKey Index. */
cred:1; /*!< Friendship Credentials Flag. */
cred:1, /*!< Friendship Credentials Flag. */
send_rel:1; /*!< Force reliable sending (segment acks) */

uint8_t ttl; /*!< Publish Time to Live. */
uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */
Expand Down
4 changes: 1 addition & 3 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
#include <string.h>
#include <errno.h>

#include "btc_ble_mesh_config_model.h"
#include "foundation.h"
#include "mesh_common.h"
#include "cfg_cli.h"

#include "btc_ble_mesh_config_model.h"
#include "esp_ble_mesh_config_model_api.h"

#define CID_NVAL 0xffff
Expand Down
4 changes: 1 addition & 3 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <string.h>
#include <errno.h>

#include "mesh_common.h"
#include "generic_client.h"

#include "btc_ble_mesh_generic_model.h"
#include "generic_client.h"
#include "esp_ble_mesh_generic_model_api.h"

/* Generic Client Models related functions */
Expand Down
6 changes: 2 additions & 4 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include <string.h>
#include <errno.h>

#include "btc_ble_mesh_health_model.h"
#include "foundation.h"
#include "mesh_common.h"
#include "health_srv.h"
#include "health_cli.h"

#include "btc_ble_mesh_health_model.h"
#include "esp_ble_mesh_defs.h"
#include "esp_ble_mesh_health_model_api.h"

extern s32_t health_msg_timeout;

Expand Down
4 changes: 1 addition & 3 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <string.h>
#include <errno.h>

#include "mesh_common.h"
#include "lighting_client.h"

#include "btc_ble_mesh_lighting_model.h"
#include "lighting_client.h"
#include "esp_ble_mesh_lighting_model_api.h"

/* Lighting Client Models related functions */
Expand Down
27 changes: 12 additions & 15 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
#include <string.h>
#include <errno.h>

#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "btc_ble_mesh_prov.h"
#include "btc_ble_mesh_config_model.h"
#include "btc_ble_mesh_health_model.h"
#include "btc_ble_mesh_generic_model.h"
#include "btc_ble_mesh_time_scene_model.h"
#include "btc_ble_mesh_sensor_model.h"
#include "btc_ble_mesh_lighting_model.h"

#include "adv.h"
#include "mesh_kernel.h"
#include "mesh_proxy.h"
#include "mesh.h"
#include "access.h"
Expand All @@ -39,15 +45,6 @@
#include "client_common.h"
#include "state_binding.h"

#include "btc_ble_mesh_prov.h"
#include "btc_ble_mesh_config_model.h"
#include "btc_ble_mesh_health_model.h"
#include "btc_ble_mesh_generic_model.h"
#include "btc_ble_mesh_time_scene_model.h"
#include "btc_ble_mesh_sensor_model.h"
#include "btc_ble_mesh_lighting_model.h"

#include "esp_ble_mesh_defs.h"
#include "esp_ble_mesh_common_api.h"
#include "esp_ble_mesh_provisioning_api.h"
#include "esp_ble_mesh_networking_api.h"
Expand Down Expand Up @@ -1965,8 +1962,8 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
break;
}
case BTC_BLE_MESH_ACT_SERVER_MODEL_SEND: {
/* arg->model_send.length contains opcode & message, 4 is used for TransMIC */
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + 4);
/* arg->model_send.length contains opcode & payload, plus extra 4-bytes TransMIC */
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + BLE_MESH_MIC_SHORT);
if (!buf) {
BT_ERR("%s, Failed to allocate memory", __func__);
break;
Expand All @@ -1983,8 +1980,8 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
}
case BTC_BLE_MESH_ACT_CLIENT_MODEL_SEND: {
bt_mesh_role_param_t common = {0};
/* arg->model_send.length contains opcode & message, 4 is used for TransMIC */
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + 4);
/* arg->model_send.length contains opcode & message, plus extra 4-bytes TransMIC */
struct net_buf_simple *buf = bt_mesh_alloc_buf(arg->model_send.length + BLE_MESH_MIC_SHORT);
if (!buf) {
BT_ERR("%s, Failed to allocate memory", __func__);
break;
Expand Down
4 changes: 1 addition & 3 deletions components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <string.h>
#include <errno.h>

#include "mesh_common.h"
#include "sensor_client.h"

#include "btc_ble_mesh_sensor_model.h"
#include "sensor_client.h"
#include "esp_ble_mesh_sensor_model_api.h"

/* Sensor Client Models related functions */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include <string.h>
#include <errno.h>

#include "mesh_common.h"
#include "time_scene_client.h"

#include "btc_ble_mesh_time_scene_model.h"
#include "time_scene_client.h"
#include "esp_ble_mesh_time_scene_model_api.h"

/* Time and Scenes Client Models related functions */
Expand Down
1 change: 1 addition & 0 deletions components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define _BTC_BLE_MESH_PROV_H_

#include "btc/btc_manage.h"
#include "mesh_byteorder.h"
#include "mesh_main.h"
#include "provisioner_prov.h"
#include "esp_ble_mesh_defs.h"
Expand Down
Loading

0 comments on commit 19893ab

Please sign in to comment.