Hello,
I am new to ble mesh and I have troubles modifying the generic on/off example to suit my needs.
I need to send a string between two ESP32-WROOM. I use the nRF Mesh app as the provisionner.
I am trying to use user property model, but I am note sure about the accuracy of my choices.
Does anyone have a sample code or could help me understand better what I need to do for it to work ?
Thank you by advance for your time !
BLE MESH string sending
Re: BLE MESH string sending
hello,
I donot know how to send the string in the ble mesh. If you share the code with me I can help in debugging it.
I donot know how to send the string in the ble mesh. If you share the code with me I can help in debugging it.
Re: BLE MESH string sending
Hello,
completed and tested the user property model. Please let me know if you still need help!
completed and tested the user property model. Please let me know if you still need help!
-
- Posts: 2
- Joined: Thu Apr 08, 2021 12:08 pm
Re: BLE MESH string sending
I'm with the same issue. The client and server ble mesh codes are here in espressif github: https://github.com/espressif/esp-idf/tr ... _mesh_node.
I don't know if I need to change the model in SKD or do something in .c file.
I don't know if I need to change the model in SKD or do something in .c file.
Re: BLE MESH string sending
I also have the same issue, I'm unable to write a simple code that uses the user property model to pass strings. @abansal22 could you help us by providing a sample code that sends a string from a node to another, please? That would be immensely helpful
Re: BLE MESH string sending
Hey folks! Update on this matter, I was able to pass a string from a node to another by making a simple modification to the custom vendor model example (git patch below):
So, you can just press the button (GPIO 0, which should be the onboard button for most esp32 boards) in the client node, and you'll see the string "TEST STRING PASSING" in the console, that came from the server node.
Code: Select all
diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c
index ef9afa98de..80e11833bb 100644
--- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c
+++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/main/main.c
@@ -483,8 +483,10 @@ static void example_ble_mesh_custom_model_cb(esp_ble_mesh_model_cb_event_t event
case ESP_BLE_MESH_MODEL_OPERATION_EVT:
if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_STATUS) {
int64_t end_time = esp_timer_get_time();
- ESP_LOGI(TAG, "Recv 0x%06x, tid 0x%04x, time %lldus",
- param->model_operation.opcode, store.vnd_tid, end_time - start_time);
+ uint8_t *d = param->model_operation.msg;
+ char *levalue = (char *)d;
+ ESP_LOGI(TAG, "Recv 0x%06x, tid 0x%04x, time %lldus the string %s",
+ param->model_operation.opcode, store.vnd_tid, end_time - start_time, levalue);
}
break;
case ESP_BLE_MESH_MODEL_SEND_COMP_EVT:
diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c
index 4d4decff4f..10b67d2cb6 100644
--- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c
+++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/main/main.c
@@ -157,10 +157,11 @@ static void example_ble_mesh_custom_model_cb(esp_ble_mesh_model_cb_event_t event
case ESP_BLE_MESH_MODEL_OPERATION_EVT:
if (param->model_operation.opcode == ESP_BLE_MESH_VND_MODEL_OP_SEND) {
uint16_t tid = *(uint16_t *)param->model_operation.msg;
+ char *mydata = "TEST STRING PASSING";
ESP_LOGI(TAG, "Recv 0x%06x, tid 0x%04x", param->model_operation.opcode, tid);
esp_err_t err = esp_ble_mesh_server_model_send_msg(&vnd_models[0],
param->model_operation.ctx, ESP_BLE_MESH_VND_MODEL_OP_STATUS,
- sizeof(tid), (uint8_t *)&tid);
+ strlen(mydata)+1, (uint8_t *)mydata);
if (err) {
ESP_LOGE(TAG, "Failed to send message 0x%06x", ESP_BLE_MESH_VND_MODEL_OP_STATUS);
}
Re: BLE MESH string sending
hello, i'm new to ble mesh and i can't send string via ble mesh using user property model. Can you help me to implement sending string, RodrigoSchardong? i really need your help.
-
- Posts: 6
- Joined: Thu Mar 07, 2024 12:01 pm
Re: BLE MESH string sending
Hi! Has anyone tried to implement this sending the message to more than one node? I have implemented this same concept using the Vendor approach but I can't make it work for more than CLIENT-SERVER communication, I thought about implementing this same thing using the Fast Provisioning example to involve more nodes in the communication but I don't really know how to do it.
If anyone have any info or code snippet to begin with would be of so much help!
If anyone have any info or code snippet to begin with would be of so much help!
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 91 guests