I followed this thread (Link) to implement a simple message model on the light switch example from nRF SDK for Mesh v1.0.1. I created a "send_simple_message" function with all the given code that i call in a function called when a button is pushed on the client. It seems the message is sent since i receive a "0" status after "access_model_publish". From the server, the led still change its state when i push the button; but i don't know how to read the message (and how to receive it).
access_model_publish". From the server, the led still change its state when i push the button; but i don't know how to read the message (and how to receive it).
Do i have to use the "simple_message_init" function and the others functions defined in the model, how to and when ?Has somebody implemented the simple message model and could help me?Thanks.
If you take a look at the mesh light switch example in the mesh sdk v1.0.1 inside the main.c file, you can see the nrf_mesh_node_config() function call at the bottom of the int main(void) function. Going to the definition of the nrf_mesh_node_config() file, the access layer gets initialized inside the access_init() function. Inside the access_init() function, there is a line:
m_evt_handler.evt_cb = mesh_evt_cb;
Going to the definition of mesh_evt_cb, you can see that whenever the NRF_MESH_EVT_MESSAGE_RECEIVED event occurs, the mesh_msg_handle() function gets called. It seems that this mesh_msg_handle() function, which is defined in access.c, handles the incoming mesh messages on the server side. This is defined similarly on the client side too (can be checked by looking at the client mesh example). The mesh simple model is given in the link you provided, so that should work correctly.
What exactly is not working in the link you provided. Is it the provisioning or is it something else?
On the servers, i receive the "simple_message_OPCODE_SEND", and in "mesh_msg_handle()" (in access.c) I am able to print my "Hello" message.So I receive it, my problem is now that it seems the message is not handled... I think I do not understand completely where the message goes after "mesh_msg_handle()" or exactly after "handle_incoming" ( I do not understand how this function works) .