BLE MESH string sending

flachvr
Posts: 1
Joined: Thu Jun 18, 2020 1:27 pm

BLE MESH string sending

Postby flachvr » Thu Jun 18, 2020 1:32 pm

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 !

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: BLE MESH string sending

Postby abansal22 » Tue Aug 25, 2020 11:24 am

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.

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: BLE MESH string sending

Postby abansal22 » Tue Sep 01, 2020 11:56 am

Hello,

completed and tested the user property model. Please let me know if you still need help!

RodrigoSchardong
Posts: 2
Joined: Thu Apr 08, 2021 12:08 pm

Re: BLE MESH string sending

Postby RodrigoSchardong » Wed Sep 15, 2021 8:42 pm

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.

mp54000
Posts: 2
Joined: Wed Jan 26, 2022 12:15 am

Re: BLE MESH string sending

Postby mp54000 » Wed Jan 26, 2022 12:17 am

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

mp54000
Posts: 2
Joined: Wed Jan 26, 2022 12:15 am

Re: BLE MESH string sending

Postby mp54000 » Wed Feb 02, 2022 5:11 am

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):

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);
             }
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.

Stella
Posts: 1
Joined: Fri Jun 10, 2022 10:42 am

Re: BLE MESH string sending

Postby Stella » Fri Jun 10, 2022 11:02 am

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.

abansal22 wrote:
Tue Sep 01, 2020 11:56 am
Hello,

completed and tested the user property model. Please let me know if you still need help!

celia diaz
Posts: 6
Joined: Thu Mar 07, 2024 12:01 pm

Re: BLE MESH string sending

Postby celia diaz » Mon Apr 08, 2024 10:56 am

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!

Who is online

Users browsing this forum: Baidu [Spider] and 59 guests