ESP32 BLE mesh saving state while relaying the message

senudajayalath
Posts: 17
Joined: Sun Jan 03, 2021 8:00 am

ESP32 BLE mesh saving state while relaying the message

Postby senudajayalath » Sun Sep 19, 2021 6:17 am

Hello,

I will first explain what my application does. I have about 4-5 devices forming a BLE mesh network. These devices are connected with a RFID reader and all the devices scan a specific set of tags. Since this is a collective effort when a reader scans a tag other devices in the mesh network should know as well. Therefore each node should save the state, emit message when a tag is scanned and also relay messages. So what is the best example code to start off with? According to my initial research the client modal and the server modal with relay enabled won't be sufficient, because each node has to save the state when a message is received and also send out a message when an event occurs.

I have seen that apart from client and server modals there is something called control modals with the below given definition,
In most applications, Server and Client models need to be used along with some control code that acts based on the received messages or user input. A combination of Server and/or Client model and a control logic results in a Control Model.


So is there an example for such a code in the espressif documents?. I could not find such an example. If there is something similar will I be able to achieve the relay functionality as well?

Thanks
Senuda Jayalath

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 BLE mesh saving state while relaying the message

Postby chegewara » Sun Sep 26, 2021 6:22 pm

What you do with received message is part of your own logic and you have to add it to existing examples or write everything from scratch.

For example, when you get ON/OFF example and you receive message ON, what you can do? You can do almost anything, like enable LED, enable microwave, enter deep sleep, send message thru UART, I2C or any other peripheral, you can even have mesh node connected over BLE as HID device and control PC. This is not part of specification.
Part of specification is ON/OFF model, which is sending ON/OFF value.
You can find more models, and i believe that best for you would be vendor model.

senudajayalath
Posts: 17
Joined: Sun Jan 03, 2021 8:00 am

Re: ESP32 BLE mesh saving state while relaying the message

Postby senudajayalath » Mon Sep 27, 2021 6:18 am

Hi, thanks for the reply

My issue is I want every node to send and receive messages. According to my knowledge the server model can't send a message when it wants. It can only reply to the client. So any trick to overcome this?

And also what is the difference between vendor model and generic on/off model?

Thanks

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 BLE mesh saving state while relaying the message

Postby chegewara » Mon Sep 27, 2021 6:47 am

https://docs.espressif.com/projects/esp ... -by-models

I didnt make it to send/publish message from server yet, but today is my first day when i am trying it.

You can set with nrf connect on android for example publish address and interval, but to me it seems to be broken/bugged in esp-idf (not sure, reported bug).
When you setup it then serer will try to publish data with that interval.

Who is online

Users browsing this forum: No registered users and 114 guests