Access primary address of ESP-BLE-MESH publishing node in ESP-IDF

468 Views Asked by At

I have a simple BLE mesh (using Espressif's ESP-BLE-MESH) consisting of two nodes; one containing 3 generic onoff server elements publishing to a group, and one containing a single generic onoff client subscribed to that group. Each node is a little ESP32 dev board with an RGB LED built in. I'm programming in C, using the ESP-IDF extension for Visual Studio Code.

I want the 3 onoff servers to control the R, G and B of the LED, respectively, but all I have to distinguish a server from the others is the address of its element, which is the primary address of the node + some offset. I want to get that offset to determine which of R, G and B are being switched, but I can't figure out how to access the primary address of the publishing node to work that out. I've trawled the documentation and tried every member of the esp_ble_mesh_generic_client_cb_param_t struct passed to the example_ble_mesh_generic_client_cb function, going down such rabbit holes as param->params->model->pub->publish_addr, but have been unsuccessful. Is what I'm trying to achieve even possible?

Server and client code used: ble mesh node

0

There are 0 best solutions below