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?
I am still stuck on this, Could you help me with this issue ?
Sorry about that. This case did not show up in my list of unanswered cases unfortunately. The handle_incoming() function takes the message sent across the access layer & then handles the message depending on whether the mesh address is of type unicast or if it's a subscription address. I am also a bit unsure about the handle_incoming() function, but I have asked the mesh team that developed the sdk for help. I will update this comment as soon as I get a response from them.
Thank you, i understood how it works and i am now able to send and receive a simple message. I did not do the initializations, now it works and i am able to read the message in my server "main". Now i am trying to reverse the role, i suppose i have to implement a "simple message server" on the device that is actually the "simple message client" in order to be able to handle the incoming message correctly. Thanks for the help, i will come back if i face new issues.
Great! Good to hear you got it working.
I have still the same problem i send hello message from client and unable to read and print hello string on server side. can you please help me for the same. Where should i need to write code for print incoming message and change in server main file. Can please share your server main.c file with me.
Any help most appreciate for me...!
You have to use the "simple_message_server_init" defined in "simple_message_server.h" and the "access_model_subscription_list_alloc" as for the simple_on_off_server.You should use the "LOG_LEVEL_DBG1" in order to see the opcodes received and sent: "__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS, LOG_LEVEL_DBG1, LOG_CALLBACK_DEFAULT);"If you receive the correct opcode on the server but the message is not handled, you should observe step by step the "handle_incoming" function in access.c
Tomorrow i will see if i can send you my files.
Thanks Damien for your valuable reply,
I have already use "simple_message_server_init" in configuration setup function and as per told i use LOG_LEVEL_DBG1 for print incoming message. But unable to print please can you provide me your files as mentioned you at last line please.