This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Provisioner node : Unhandled mesh event

Hi,

I'm working on sending string data over mesh by following this case, my message is printed on server side in mesh_msg_handle() function (access.c file), but I want to print it in server main.c file, from what i see in the provisioner log : Unhandled mesh event: 4, my message is not handled after handle_incoming() function. i don't understand how it works after debugging this function I'm using mesh SDK v2.0.1.

Also from what i learn in that case is that i have to do the initialization of the simple message model on both client and server side, i added that with the initialization of the on_off model but it shows error like NRF_NO_MEM on client side (No more memory available to allocate model) and NRF_FORBIDDEN on server side (multiple instances per element is not allowed), after that i tried  to replace the simple_on_off model configuration by simple_message model configuration in node_setup.c file,  but it fails and configuration of nodes won't happen.

Am I allowed to add simple message model configuration in node_setup.c file like the simple on_off model so the message can be handled?

Thank you,

Best regards

Parents
  • This link might be useful for creating new models. I would definitely try to add the simple message model like it has been done in the simple on_off model to handle the messages. In general, just try to see how the light switch example has initialized the simple on off model & do something similar for your own model.

  • Thank you for your reply, i don't understand why errors occur when i do the initialization of simple_message model with simple_on_off initialization, and this new model considered as on_off model intance that cannot be in the same element 

  • Yes I'am using the simple_on_off model in addition to the simple_message model and on server side I did make callback function like so : 

    and initialization in server main.c like so

    i believe there is something wrong here or related with configuration of new model, in the provisioner.c I only added this two lines in main provisioner.c to configure my new model, am i supposed to do something else ?

    /*Bind message client to App key, and configure publication key */
    ERROR_CHECK(access_model_application_bind(m_message_client.model_handle, m_dev_handles.m_appkey_handle));
    ERROR_CHECK(access_model_publish_application_set(m_message_client.model_handle, m_dev_handles.m_appkey_handle));

  • Are you calling this callback function when you receive a message like I have explained in my previous comment (i.e. calling the callback function inside the function that handles all of the mesh messages)? 

  • I thought it was called with the initialization of the message model server, so do I have to call this function in rx_set_unreliable_cb() because I used simple_message_client_set_unreliable() function on client side to send my message  

    static void rx_set_unreliable_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args)
    {
        simple_message_server_t * p_server = p_args;
        NRF_MESH_ASSERT(p_server->set_cb != NULL);
        p_server->set_cb(p_server, p_message->meta_data.src, p_message->meta_data.dst, p_message->p_data,p_message->length);
        
    }

    As you can see i modified this function and set_cb is called inside it and initialized in models_init_cb() function in main.c server node, is that what you told me to do?

  • Again, take a look at the health comment I mentioned before & make sure that you really understand it. Then, you can do something similar. As I mentioned before, every time a mesh message is handled:

    "The handle_fault_status() function inside health_client.c handles the incoming health message, sets the event type to HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED & calls the event_handler() at the bottom, which happens to be the app_health_event_cb() function"

    The event_handler() call happens to be the call to app_health_event_cb(). You need to call the callback function every time you get a new mesh message.

  • Thank you for your help, I solved it , i'am now able to print my message on server main.c file and my message is handled, it was about the configuration of new model in the provisioner node_setup.c, i followed exactly the configuration of simple_on_off model, i just needed to bind the appkey to my new model, now i want to relay my message to another node, could you please guide me on that?

Reply
  • Thank you for your help, I solved it , i'am now able to print my message on server main.c file and my message is handled, it was about the configuration of new model in the provisioner node_setup.c, i followed exactly the configuration of simple_on_off model, i just needed to bind the appkey to my new model, now i want to relay my message to another node, could you please guide me on that?

Children
Related