Skip to content

Commit 9a71a74

Browse files
committed
Merge branch 'bugfix/ble_mesh_misc_updates' into 'master'
Bugfix/ble mesh misc updates Closes BLEMESH-223 See merge request espressif/esp-idf!9492
2 parents 8c01b60 + 578f775 commit 9a71a74

File tree

92 files changed

+2125
-2076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2125
-2076
lines changed

components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
4242

4343
// Create a semaphore
4444
if ((semaphore = xSemaphoreCreateCounting(1, 0)) == NULL) {
45-
BT_ERR("%s, Failed to allocate memory for the semaphore", __func__);
45+
BT_ERR("Failed to create semaphore");
4646
return ESP_ERR_NO_MEM;
4747
}
4848

@@ -57,7 +57,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
5757

5858
if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) != BT_STATUS_SUCCESS) {
5959
vSemaphoreDelete(semaphore);
60-
BT_ERR("%s, BLE Mesh initialise failed", __func__);
60+
BT_ERR("Failed to start mesh init");
6161
return ESP_FAIL;
6262
}
6363

components/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ uint16_t esp_ble_mesh_get_primary_element_address(void)
3232
return btc_ble_mesh_get_primary_addr();
3333
}
3434

35-
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model, uint16_t group_addr)
35+
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
36+
uint16_t group_addr)
3637
{
3738
if (model == NULL) {
3839
return NULL;
@@ -54,15 +55,16 @@ uint8_t esp_ble_mesh_get_element_count(void)
5455
}
5556

5657
esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
57-
uint16_t company_id, uint16_t model_id)
58+
uint16_t company_id, uint16_t model_id)
5859
{
5960
if (element == NULL) {
6061
return NULL;
6162
}
6263
return btc_ble_mesh_model_find_vnd(element, company_id, model_id);
6364
}
6465

65-
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element, uint16_t model_id)
66+
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
67+
uint16_t model_id)
6668
{
6769
if (element == NULL) {
6870
return NULL;

components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
#define ESP_BLE_MESH_TX_SDU_MAX ((CONFIG_BLE_MESH_ADV_BUF_COUNT - 3) * 12)
2424

2525
static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
26-
esp_ble_mesh_msg_ctx_t *ctx,
27-
uint32_t opcode,
28-
btc_ble_mesh_model_act_t act,
29-
uint16_t length, uint8_t *data,
30-
int32_t msg_timeout, bool need_rsp,
31-
esp_ble_mesh_dev_role_t device_role)
26+
esp_ble_mesh_msg_ctx_t *ctx,
27+
uint32_t opcode,
28+
btc_ble_mesh_model_act_t act,
29+
uint16_t length, uint8_t *data,
30+
int32_t msg_timeout, bool need_rsp,
31+
esp_ble_mesh_dev_role_t device_role)
3232
{
3333
btc_ble_mesh_model_args_t arg = {0};
3434
uint8_t op_len = 0, mic_len = 0;
@@ -39,12 +39,12 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
3939
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
4040

4141
if (ctx && ctx->addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
42-
BT_ERR("%s, Invalid destination address 0x0000", __func__);
42+
BT_ERR("Invalid destination address 0x0000");
4343
return ESP_ERR_INVALID_ARG;
4444
}
4545

4646
if (device_role > ROLE_FAST_PROV) {
47-
BT_ERR("%s, Invalid device role 0x%02x", __func__, device_role);
47+
BT_ERR("Invalid device role 0x%02x", device_role);
4848
return ESP_ERR_INVALID_ARG;
4949
}
5050

@@ -63,7 +63,7 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
6363

6464
if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
6565
if (op_len + length > model->pub->msg->size) {
66-
BT_ERR("%s, Model publication msg size %d is too small", __func__, model->pub->msg->size);
66+
BT_ERR("Too small publication msg size %d", model->pub->msg->size);
6767
return ESP_ERR_INVALID_ARG;
6868
}
6969
}
@@ -75,7 +75,7 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
7575
}
7676

7777
if (op_len + length + mic_len > MIN(ESP_BLE_MESH_SDU_MAX_LEN, ESP_BLE_MESH_TX_SDU_MAX)) {
78-
BT_ERR("%s, Data length %d is too large", __func__, length);
78+
BT_ERR("Too large data length %d", length);
7979
return ESP_ERR_INVALID_ARG;
8080
}
8181

@@ -176,8 +176,9 @@ esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model)
176176
}
177177

178178
esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
179-
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
180-
uint16_t length, uint8_t *data)
179+
esp_ble_mesh_msg_ctx_t *ctx,
180+
uint32_t opcode,
181+
uint16_t length, uint8_t *data)
181182
{
182183
if (model == NULL || ctx == NULL ||
183184
ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
@@ -190,9 +191,11 @@ esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
190191
}
191192

192193
esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
193-
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
194-
uint16_t length, uint8_t *data, int32_t msg_timeout,
195-
bool need_rsp, esp_ble_mesh_dev_role_t device_role)
194+
esp_ble_mesh_msg_ctx_t *ctx,
195+
uint32_t opcode,
196+
uint16_t length, uint8_t *data,
197+
int32_t msg_timeout, bool need_rsp,
198+
esp_ble_mesh_dev_role_t device_role)
196199
{
197200
if (model == NULL || ctx == NULL ||
198201
ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
@@ -218,8 +221,8 @@ esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcod
218221
}
219222

220223
esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
221-
esp_ble_mesh_server_state_type_t type,
222-
esp_ble_mesh_server_state_value_t *value)
224+
esp_ble_mesh_server_state_type_t type,
225+
esp_ble_mesh_server_state_value_t *value)
223226
{
224227
btc_ble_mesh_model_args_t arg = {0};
225228
btc_msg_t msg = {0};
@@ -294,7 +297,8 @@ uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name)
294297
return bt_mesh_provisioner_get_node_index(name);
295298
}
296299

297-
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr, uint8_t *data, uint16_t length)
300+
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
301+
uint8_t *data, uint16_t length)
298302
{
299303
btc_ble_mesh_prov_args_t arg = {0};
300304
btc_msg_t msg = {0};
@@ -396,7 +400,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr)
396400
}
397401

398402
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
399-
uint16_t net_idx, uint16_t app_idx)
403+
uint16_t net_idx, uint16_t app_idx)
400404
{
401405
btc_ble_mesh_prov_args_t arg = {0};
402406
btc_msg_t msg = {0};
@@ -419,7 +423,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
419423
}
420424

421425
esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
422-
uint16_t net_idx, uint16_t app_idx)
426+
uint16_t net_idx, uint16_t app_idx)
423427
{
424428
btc_ble_mesh_prov_args_t arg = {0};
425429
btc_msg_t msg = {0};
@@ -447,7 +451,7 @@ const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint
447451
}
448452

449453
esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
450-
uint16_t model_id, uint16_t company_id)
454+
uint16_t model_id, uint16_t company_id)
451455
{
452456
btc_ble_mesh_prov_args_t arg = {0};
453457
btc_msg_t msg = {0};

components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers)
9090
}
9191

9292
esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32],
93-
uint8_t private_key[32])
93+
uint8_t private_key[32])
9494
{
9595
btc_ble_mesh_prov_args_t arg = {0};
9696
btc_msg_t msg = {0};
@@ -179,7 +179,7 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name)
179179

180180
#if (CONFIG_BLE_MESH_PROVISIONER)
181181
esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32],
182-
uint8_t pub_key_y[32])
182+
uint8_t pub_key_y[32])
183183
{
184184
btc_ble_mesh_prov_args_t arg = {0};
185185
btc_msg_t msg = {0};
@@ -292,7 +292,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t beare
292292
}
293293

294294
esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t *add_dev,
295-
esp_ble_mesh_dev_add_flag_t flags)
295+
esp_ble_mesh_dev_add_flag_t flags)
296296
{
297297
btc_ble_mesh_prov_args_t arg = {0};
298298
btc_msg_t msg = {0};
@@ -318,8 +318,10 @@ esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t
318318
}
319319

320320
esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16],
321-
esp_ble_mesh_bd_addr_t addr, esp_ble_mesh_addr_type_t addr_type,
322-
esp_ble_mesh_prov_bearer_t bearer, uint16_t oob_info, uint16_t unicast_addr)
321+
esp_ble_mesh_bd_addr_t addr,
322+
esp_ble_mesh_addr_type_t addr_type,
323+
esp_ble_mesh_prov_bearer_t bearer,
324+
uint16_t oob_info, uint16_t unicast_addr)
323325
{
324326
btc_ble_mesh_prov_args_t arg = {0};
325327
btc_msg_t msg = {0};
@@ -377,7 +379,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_
377379
}
378380

379381
esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len,
380-
uint8_t offset, bool prov_after_match)
382+
uint8_t offset, bool prov_after_match)
381383
{
382384
btc_ble_mesh_prov_args_t arg = {0};
383385
btc_msg_t msg = {0};

components/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ esp_err_t esp_ble_mesh_proxy_gatt_disable(void)
6060
}
6161

6262
esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr,
63-
esp_ble_mesh_addr_type_t addr_type, uint16_t net_idx)
63+
esp_ble_mesh_addr_type_t addr_type,
64+
uint16_t net_idx)
6465
{
6566
btc_ble_mesh_prov_args_t arg = {0};
6667
btc_msg_t msg = {0};
@@ -100,8 +101,8 @@ esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle)
100101
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
101102
}
102103

103-
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
104-
uint16_t net_idx, esp_ble_mesh_proxy_filter_type_t filter_type)
104+
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx,
105+
esp_ble_mesh_proxy_filter_type_t filter_type)
105106
{
106107
btc_ble_mesh_prov_args_t arg = {0};
107108
btc_msg_t msg = {0};
@@ -124,8 +125,8 @@ esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
124125
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
125126
}
126127

127-
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
128-
uint16_t net_idx, uint16_t *addr, uint16_t addr_num)
128+
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx,
129+
uint16_t *addr, uint16_t addr_num)
129130
{
130131
btc_ble_mesh_prov_args_t arg = {0};
131132
btc_msg_t msg = {0};
@@ -149,8 +150,8 @@ esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
149150
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
150151
}
151152

152-
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle,
153-
uint16_t net_idx, uint16_t *addr, uint16_t addr_num)
153+
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx,
154+
uint16_t *addr, uint16_t addr_num)
154155
{
155156
btc_ble_mesh_prov_args_t arg = {0};
156157
btc_msg_t msg = {0};

components/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_local_data_operation_api.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ uint16_t esp_ble_mesh_get_primary_element_address(void);
5555
* to 0x0000 in order to unsubscribe the model from the group.
5656
*
5757
*/
58-
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model, uint16_t group_addr);
58+
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
59+
uint16_t group_addr);
5960

6061
/**
6162
* @brief Find the BLE Mesh element pointer via the element address.
@@ -87,7 +88,7 @@ uint8_t esp_ble_mesh_get_element_count(void);
8788
*
8889
*/
8990
esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
90-
uint16_t company_id, uint16_t model_id);
91+
uint16_t company_id, uint16_t model_id);
9192

9293
/**
9394
* @brief Find the SIG model with the given element and Model id.
@@ -98,7 +99,8 @@ esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *
9899
* @return Pointer to the SIG Model on success, or NULL on failure which means the SIG Model is not found.
99100
*
100101
*/
101-
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element, uint16_t model_id);
102+
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
103+
uint16_t model_id);
102104

103105
/**
104106
* @brief Get the Composition data which has been registered.

components/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_networking_api.h

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C" {
2323

2424
/** @brief: event, event code of user-defined model events; param, parameters of user-defined model events */
2525
typedef void (* esp_ble_mesh_model_cb_t)(esp_ble_mesh_model_cb_event_t event,
26-
esp_ble_mesh_model_cb_param_t *param);
26+
esp_ble_mesh_model_cb_param_t *param);
2727

2828
/**
2929
* @brief Register BLE Mesh callback for user-defined models' operations.
@@ -104,8 +104,9 @@ esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model);
104104
*
105105
*/
106106
esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
107-
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
108-
uint16_t length, uint8_t *data);
107+
esp_ble_mesh_msg_ctx_t *ctx,
108+
uint32_t opcode,
109+
uint16_t length, uint8_t *data);
109110

110111
/**
111112
* @brief Send client model message (such as model get, set, etc).
@@ -123,9 +124,11 @@ esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
123124
*
124125
*/
125126
esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
126-
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
127-
uint16_t length, uint8_t *data, int32_t msg_timeout,
128-
bool need_rsp, esp_ble_mesh_dev_role_t device_role);
127+
esp_ble_mesh_msg_ctx_t *ctx,
128+
uint32_t opcode,
129+
uint16_t length, uint8_t *data,
130+
int32_t msg_timeout, bool need_rsp,
131+
esp_ble_mesh_dev_role_t device_role);
129132

130133
/**
131134
* @brief Send a model publication message.
@@ -166,8 +169,8 @@ esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcod
166169
*
167170
*/
168171
esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
169-
esp_ble_mesh_server_state_type_t type,
170-
esp_ble_mesh_server_state_value_t *value);
172+
esp_ble_mesh_server_state_type_t type,
173+
esp_ble_mesh_server_state_value_t *value);
171174

172175
/**
173176
* @brief Reset the provisioning procedure of the local BLE Mesh node.
@@ -226,7 +229,8 @@ uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name);
226229
* @return ESP_OK on success or error code otherwise.
227230
*
228231
*/
229-
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr, uint8_t *data, uint16_t length);
232+
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
233+
uint8_t *data, uint16_t length);
230234

231235
/**
232236
* @brief This function is called to get the provisioned node information
@@ -329,7 +333,8 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr);
329333
* @return ESP_OK on success or error code otherwise.
330334
*
331335
*/
332-
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16], uint16_t net_idx, uint16_t app_idx);
336+
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
337+
uint16_t net_idx, uint16_t app_idx);
333338

334339
/**
335340
* @brief This function is used to update a local AppKey for Provisioner.
@@ -342,7 +347,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
342347
*
343348
*/
344349
esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
345-
uint16_t net_idx, uint16_t app_idx);
350+
uint16_t net_idx, uint16_t app_idx);
346351

347352
/**
348353
* @brief This function is called by Provisioner to get the local app key value.
@@ -370,7 +375,7 @@ const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint
370375
*
371376
*/
372377
esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
373-
uint16_t model_id, uint16_t company_id);
378+
uint16_t model_id, uint16_t company_id);
374379

375380
/**
376381
* @brief This function is called by Provisioner to add local network key.

0 commit comments

Comments
 (0)