mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'revert/ble_mesh_example_changes' into 'master'
fix(ble_mesh): Check if role needed based on idf version See merge request espressif/esp-idf!26095
This commit is contained in:
commit
272b4091f1
@ -129,6 +129,9 @@ void example_send_self_prov_node_addr(struct k_work *work)
|
||||
.app_idx = fast_prov_srv->app_idx,
|
||||
.dst = fast_prov_srv->prim_prov_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_self_prov_node_addr(model, &info, node_addr_send.addr);
|
||||
if (err != ESP_OK) {
|
||||
@ -178,6 +181,9 @@ static void example_get_all_node_addr(struct k_work *work)
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 10000,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_all_node_addr_get(model, &info);
|
||||
if (err != ESP_OK) {
|
||||
@ -232,10 +238,16 @@ esp_err_t example_fast_prov_client_recv_timeout(uint32_t opcode, esp_ble_mesh_mo
|
||||
set.ctx_flags = BIT(6);
|
||||
set.group_addr = fast_prov_srv->group_addr;
|
||||
}
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
info.role = ROLE_FAST_PROV;
|
||||
#endif
|
||||
#else
|
||||
set.ctx_flags = 0x037F;
|
||||
memcpy(&set.node_addr_cnt, &node->node_addr_cnt,
|
||||
sizeof(example_node_info_t) - offsetof(example_node_info_t, node_addr_cnt));
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
info.role = ROLE_PROVISIONER;
|
||||
#endif
|
||||
#endif
|
||||
err = example_send_fast_prov_info_set(model, &info, &set);
|
||||
if (err != ESP_OK) {
|
||||
@ -254,6 +266,9 @@ esp_err_t example_fast_prov_client_recv_timeout(uint32_t opcode, esp_ble_mesh_mo
|
||||
.app_idx = fast_prov_srv->app_idx,
|
||||
.dst = fast_prov_srv->prim_prov_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_self_prov_node_addr(model, &info, node_addr_send.addr);
|
||||
if (err != ESP_OK) {
|
||||
@ -281,6 +296,9 @@ esp_err_t example_fast_prov_client_recv_timeout(uint32_t opcode, esp_ble_mesh_mo
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 10000,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_all_node_addr_get(model, &info);
|
||||
if (err != ESP_OK) {
|
||||
@ -378,6 +396,9 @@ esp_err_t example_fast_prov_client_recv_status(esp_ble_mesh_model_t *model,
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->group_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
err = example_send_generic_onoff_set(cli_model, &info, LED_ON, 0x00, false);
|
||||
if (err != ESP_OK) {
|
||||
|
@ -351,6 +351,9 @@ esp_err_t example_send_config_appkey_add(esp_ble_mesh_model_t *model,
|
||||
common.ctx.addr = info->dst;
|
||||
common.ctx.send_ttl = 0;
|
||||
common.msg_timeout = info->timeout;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common.msg_role = info->role;
|
||||
#endif
|
||||
|
||||
return esp_ble_mesh_config_client_set_state(&common, &set);
|
||||
}
|
||||
@ -372,6 +375,9 @@ esp_err_t example_send_generic_onoff_get(esp_ble_mesh_model_t *model,
|
||||
common.ctx.addr = info->dst;
|
||||
common.ctx.send_ttl = 0;
|
||||
common.msg_timeout = info->timeout;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common.msg_role = info->role;
|
||||
#endif
|
||||
|
||||
return esp_ble_mesh_generic_client_get_state(&common, &get);
|
||||
}
|
||||
@ -403,6 +409,9 @@ esp_err_t example_send_generic_onoff_set(esp_ble_mesh_model_t *model,
|
||||
common.ctx.addr = info->dst;
|
||||
common.ctx.send_ttl = 0;
|
||||
common.msg_timeout = info->timeout;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common.msg_role = info->role;
|
||||
#endif
|
||||
|
||||
return esp_ble_mesh_generic_client_set_state(&common, &set);
|
||||
}
|
||||
|
@ -168,6 +168,9 @@ static void provisioner_prov_complete(int node_index, const uint8_t uuid[16], ui
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
esp_ble_mesh_cfg_app_key_add_t add_key = {
|
||||
.net_idx = prov_info.net_idx,
|
||||
@ -424,6 +427,9 @@ static void example_config_client_callback(esp_ble_mesh_cfg_client_cb_event_t ev
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_info_set(fast_prov_client.model, &info, &set);
|
||||
if (err != ESP_OK) {
|
||||
@ -446,6 +452,9 @@ static void example_config_client_callback(esp_ble_mesh_cfg_client_cb_event_t ev
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_PROVISIONER,
|
||||
#endif
|
||||
};
|
||||
esp_ble_mesh_cfg_app_key_add_t add_key = {
|
||||
.net_idx = prov_info.net_idx,
|
||||
|
@ -282,6 +282,9 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_config_appkey_add(config_client.model, &info, NULL);
|
||||
if (err != ESP_OK) {
|
||||
@ -605,6 +608,9 @@ static void example_ble_mesh_config_client_cb(esp_ble_mesh_cfg_client_cb_event_t
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_info_set(fast_prov_client.model, &info, &set);
|
||||
if (err != ESP_OK) {
|
||||
@ -627,6 +633,9 @@ static void example_ble_mesh_config_client_cb(esp_ble_mesh_cfg_client_cb_event_t
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_config_appkey_add(config_client.model, &info, NULL);
|
||||
if (err != ESP_OK) {
|
||||
|
@ -182,6 +182,9 @@ void example_ble_mesh_send_gen_onoff_set(void)
|
||||
common.ctx.addr = 0xFFFF; /* to all nodes */
|
||||
common.ctx.send_ttl = 3;
|
||||
common.msg_timeout = 0; /* 0 indicates that timeout value from menuconfig will be used */
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common.msg_role = ROLE_NODE;
|
||||
#endif
|
||||
|
||||
set.onoff_set.op_en = false;
|
||||
set.onoff_set.onoff = store.onoff;
|
||||
|
@ -181,6 +181,9 @@ static esp_err_t example_ble_mesh_set_msg_common(esp_ble_mesh_client_common_para
|
||||
common->ctx.addr = node->unicast;
|
||||
common->ctx.send_ttl = MSG_SEND_TTL;
|
||||
common->msg_timeout = MSG_TIMEOUT;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common->msg_role = MSG_ROLE;
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@ -101,6 +101,9 @@ static void example_ble_mesh_set_msg_common(esp_ble_mesh_client_common_param_t *
|
||||
common->ctx.addr = node->unicast_addr;
|
||||
common->ctx.send_ttl = MSG_SEND_TTL;
|
||||
common->msg_timeout = MSG_TIMEOUT;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common->msg_role = MSG_ROLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static esp_err_t prov_complete(uint16_t node_index, const esp_ble_mesh_octet16_t uuid,
|
||||
|
@ -155,6 +155,9 @@ static void example_ble_mesh_set_msg_common(esp_ble_mesh_client_common_param_t *
|
||||
common->ctx.addr = node->unicast_addr;
|
||||
common->ctx.send_ttl = MSG_SEND_TTL;
|
||||
common->msg_timeout = MSG_TIMEOUT;
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
common->msg_role = MSG_ROLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static esp_err_t prov_complete(uint16_t node_index, const esp_ble_mesh_octet16_t uuid,
|
||||
|
@ -294,6 +294,9 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_config_appkey_add(config_client.model, &info, NULL);
|
||||
if (err != ESP_OK) {
|
||||
@ -617,6 +620,9 @@ static void example_ble_mesh_config_client_cb(esp_ble_mesh_cfg_client_cb_event_t
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_fast_prov_info_set(fast_prov_client.model, &info, &set);
|
||||
if (err != ESP_OK) {
|
||||
@ -639,6 +645,9 @@ static void example_ble_mesh_config_client_cb(esp_ble_mesh_cfg_client_cb_event_t
|
||||
.app_idx = node->app_idx,
|
||||
.dst = node->unicast_addr,
|
||||
.timeout = 0,
|
||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 2, 0)
|
||||
.role = ROLE_FAST_PROV,
|
||||
#endif
|
||||
};
|
||||
err = example_send_config_appkey_add(config_client.model, &info, NULL);
|
||||
if (err != ESP_OK) {
|
||||
|
Loading…
Reference in New Issue
Block a user