Wangcheng wrote: ↑Thu Aug 29, 2019 11:42 am
Danialgreen wrote: ↑Wed Aug 28, 2019 7:32 am
Hi Espressif,
For the ESP32 fast provisioner client and server example, I configured my own pair of opcodes for sending and receive customer messages through the vendor model. The fast server model is able to receive customer messages from the fast client(by unicast address). However when the fast server sends status msg back to the fast client model. the function:
Code: Select all
node = bt_mesh_is_model_message_publish(model, ctx, buf, false);
return a Null value. I checked the code, I found in
Code: Select all
bt_mesh_client_pick_node(sys_slist_t *list, u16_t tx_dst)
it try to find the corresponding node with the same unicast address in a list from the fast client model->user_data->internal_data . For my code, this list is empty. In order to find the node, should I call some function to assign node list to the (bt_mesh_internal_data_t *)cli->internal_data?
Thank you!
Hi Danialgreen,
1. You should not call the initialization function of the vender model. esp_ble_mesh_client_model_init .
2. If you still can't solve your problem, you need to provide a log, we will continue to pay attention.
Hi Wangcheng,
The code below is the log for fast provisioner client: after the fast server receives the message of opcode 0xc802e5 from fast provisioner client, it sends status msg back to the fast client model.
I expect to receive “ESP_BLE_MESH_MODEL_OPERATION_EVT” instead of “ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT”
Code: Select all
I (11163) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT
I (11163) FAST_PROV_CLIENT_DEMO: Node index: 0x0, unicast address: 0x05, element num: 1, netkey index: 0x00
I (11173) FAST_PROV_CLIENT_DEMO: Node uuid: dddd30aea40ea8320000000000000000
I (11183) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT , err_code: 0
*******Test_received rssi: -44I (11663) FAST_PROV_CLIENT_DEMO: example_config_cl ient_callback, error_code = 0x00, event = 0x01, addr: 0x0005
I (11663) FAST_PROV_OP: min: 0x0006, max: 0x7fff
I (11673) FAST_PROV_OP: flags: 0x00, iv_index: 0x00000000
I (11683) FAST_PROV_OP: net_idx: 0x0000, group_addr: 0xc000
I (11683) FAST_PROV_OP: action: 0x81
I (11693) FAST_PROV_OP: match_val: dd dd
I (11693) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_SEND_COMP_EVT, err_code 0
*******Test_received rssi: -51I (12183) FAST_PROV_CLIENT_DEMO: example_custom_mo del_callback: Fast Prov Client Model receives status, opcode 0xc102e5
I (12183) fast prov client receives_T_O: 7f 00 00 00 00 00 00 00 00
I (12193) fast prov info status: 7f 00 00 00 00 00 00 00 00
I (13153) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT, bearer PB-ADV reason 0x00
I (13153) FAST_PROV_CLIENT_DEMO: PB-ADV link close, reason 0x00
W (15713) BLE_MESH: No matching TX context for ack
W (16113) BLE_MESH: No matching TX context for ack
W (16313) BLE_MESH: No matching TX context for ack
I (72203) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_SEND_COMP_EVT, err_code 0
*******Test_received rssi: -50I (72243) FAST_PROV_CLIENT_DEMO: example_custom_model_callback: Fast Prov Client Model receives status, opcode 0xc702e5
I (72243) fast prov client receives_T_O: 06 00
I (72253) Node address_T_O: 06 00
**************Give somaphore for LED**************
I (72273) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_SEND_COMP_EVT, err_code 0
*******Test_received rssi: -51************5***
I (72523) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_CLIENT_RECV_PUBLISH_MSG_EVT, opcode 0xc902e5
I (75263) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_SEND_COMP_EVT, err_code 0
*******Test_received rssi: -46************5***
I (75403) FAST_PROV_CLIENT_DEMO: ESP_BLE_MESH_MODEL_CLIENT_RECV_PUBLISH_MSG_EVT, opcode 0xc902e5
This is the mesh_client_model_op_cb function where I found the problem:
Code: Select all
static void btc_ble_mesh_client_model_op_cb(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
node = bt_mesh_is_model_message_publish(model, ctx, buf, false);
if (node == NULL) {
msg.act = ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT;
mesh_param.client_recv_publish_msg.opcode = mesh_opcode;
mesh_param.client_recv_publish_msg.model = (esp_ble_mesh_model_t *)model;
mesh_param.client_recv_publish_msg.ctx = (esp_ble_mesh_msg_ctx_t *)ctx;
mesh_param.client_recv_publish_msg.length = buf->len;
mesh_param.client_recv_publish_msg.msg = buf->data;
} else {
msg.act = ESP_BLE_MESH_MODEL_OPERATION_EVT;
mesh_param.model_operation.opcode = mesh_opcode;
mesh_param.model_operation.model = (esp_ble_mesh_model_t *)model;
mesh_param.model_operation.ctx = (esp_ble_mesh_msg_ctx_t *)ctx;
mesh_param.model_operation.length = buf->len;
mesh_param.model_operation.msg = buf->data;
}
it try to find the corresponding node with the same unicast address in a list from the fast client user_data. For my code, this list is empty which print a ("**********5***").
Code: Select all
bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf,
bool need_pub)
{
cli = (bt_mesh_client_common_t *)model->user_data;
rsp = ctx->recv_op;
data = (bt_mesh_internal_data_t *)cli->internal_data;
if ((node = bt_mesh_client_pick_node(&data->queue, ctx->addr)) == NULL) {
printf("**********5***");
BT_DBG("Unexpected status message 0x%x", rsp);
if (cli->publish_status && need_pub) {
cli->publish_status(rsp, model, ctx, buf);
}
return NULL;
}
I think I implement my opcode pair the same way as other opcodes in fast provisioner client and server example,
it will be great if you have some hints for this problem, thank you!