ESP32 BLE Mesh proper way to send async. messages to mobile application

cowens
Posts: 6
Joined: Sat May 23, 2020 8:36 pm

ESP32 BLE Mesh proper way to send async. messages to mobile application

Postby cowens » Mon Jun 08, 2020 5:19 pm

Device: ESP32-WROOM-32E
IDF: v4.2

I have a mesh application that needs to be able to send asynchronous messages to a mobile application. My research shows that the Mesh Proxy Service can be utilized for this. I am struggling to determine how to appropriately access the Mesh Proxy Service via the ESP-IDF. I see there is a function, bt_mesh_proxy_send in proxy_server.c, prototype to follow.
  1. int bt_mesh_proxy_send(struct bt_mesh_conn *conn, u8_t type,
  2.                        struct net_buf_simple *msg)
I am unable to figure out how to use this properly or if this is even the correct approach to access the Mesh Proxy Service.

If this is the correct method, my questions are as follows,
  • Can this function be called at anytime by the application without causing issue?
  • How do I determine the correct "conn" and use this at run-time?
  • How can my application receive data from the phone via the Mesh Proxy Service?
I would greatly appreciate any assistance!

cowens
Posts: 6
Joined: Sat May 23, 2020 8:36 pm

Re: ESP32 BLE Mesh proper way to send async. messages to mobile application

Postby cowens » Tue Jun 09, 2020 8:47 pm

I would also appreciate any advice on how to properly receive data via the Mesh Proxy Service that doesn't correlate to any BLE Mesh elements/models.

esp_liu
Posts: 35
Joined: Wed Nov 28, 2018 4:12 am

Re: ESP32 BLE Mesh proper way to send async. messages to mobile application

Postby esp_liu » Tue Jun 23, 2020 6:05 am

cowens wrote:
Tue Jun 09, 2020 8:47 pm
I would also appreciate any advice on how to properly receive data via the Mesh Proxy Service that doesn't correlate to any BLE Mesh elements/models.
Hi @cowens

Sorry for the late reply.

For using mesh proxy service, you just need a mesh proxy node connected to the phone. When the proxy node receives a message from the other nodes, and the message is sent to the App, the proxy node will "relay" the message to the app from the mesh stack. And if the app sends a message to other nodes (not the proxy node), then the message will be received by the proxy node firstly, and the proxy node will "relay" the message to the other nodes using the BLE advertising bearer.

The workflow looks like this:
The App sends a message: phone -> GATT -> proxy node -> ADV -> other nodes
The App receives a message: phone <- GATT <- proxy node <- ADV <- other nodes

And from the application layer, there is no need to call the functions in the mesh stack. After the App is connected with the proxy node, just invoke the mesh application APIs to send messages. If the destination address of the message is the App, the App will receive it.

Thanks.

cowens
Posts: 6
Joined: Sat May 23, 2020 8:36 pm

Re: ESP32 BLE Mesh proper way to send async. messages to mobile application

Postby cowens » Thu Jun 25, 2020 9:58 pm

Thanks for the reply. I am not sure if this answers my question or not. I need to think about it a bit more. I will let you know if I have more questions. I really appreciate your help!

Who is online

Users browsing this forum: No registered users and 144 guests