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

Send string in a Mesh. With nRF52DK

Hello:

I have to nRF52DK boards and I am able to run the ligth_switch example, but the thing that I want to do is send a message, "hello" from one node to other. I saw the example in the Q&A, here but the example talks about the Mesh SDK v1.0.0. and I have the nrf5SDKforMeshv310src examples.

In the code I can't figure how to send a string.

Could you give me some clues to do it?

Thank you.

Parents
  • Hi Guillermo

    Due to the Easter holiday you will have to expect a delay in replies, sorry for the inconvenience!

    We do not have any examples of this for Mesh 3.1. But I suggest you have a look at or Getting started guide on how to creale your own models in mesh. Alternatively, it is possible to use the nrf_mesh_packet_send() API for access to the lower layers in the spec, found here on our GitHub.

    Best regards,

    Simon

  • Hi Simonr:

    Don't worry it is Easter Holiday in my country too.

    I will check and I give you some feedback as soon as I try it.

  • Hello, did you have some success on this? I have the same problem too.
    I was trying to implement a Library called 'simple message' but it only works with the old Mesh SDK 1.0
    If anyone could help me showing me some tutorial for sending and receiving strings in mesh

Reply
  • Hello, did you have some success on this? I have the same problem too.
    I was trying to implement a Library called 'simple message' but it only works with the old Mesh SDK 1.0
    If anyone could help me showing me some tutorial for sending and receiving strings in mesh

Children
  • hello ,Did you do it? I had the same problem

  • Hello Sir  I got the messages to be sent and received over the light_switch example by modifying the type of every data variable to uint8_t * (you can notice that every data variables have the same bool type).

    After that, I force the message to be unsegmented, that means that the message will only support like 9 characters, so, it's good to be aware about that.

    then, I used a new opcode for receiving and sending string data over there.

    These are the functions to be changed over the Generic OnOff client code on the generic_onoff_client.c

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    static uint8_t message_set_packet_create(generic_onoff_set_msg_pkt_t *p_set, const generic_onoff_set_params_t * p_params,
    const model_transition_t * p_transition)
    {
    p_set->on_off= p_params->on_off;
    p_set->tid = p_params->tid;
    if (p_transition != NULL)
    {
    p_set->transition_time = model_transition_time_encode(p_transition->transition_time_ms);
    p_set->delay = model_delay_encode(p_transition->delay_ms);
    return GENERIC_ONOFF_SET_MAXLEN; //I put a value of 9 over there
    }
    else
    {
    return GENERIC_ONOFF_SET_MINLEN;
    }
    }
    uint32_t generic_onoff_client_set(generic_onoff_client_t * p_client, const generic_onoff_set_params_t * p_params,
    const model_transition_t * p_transition)
    {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    This code is part of the Generic OnOff Server's code and should be modified.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    //This one is the new function that I use with the operational code
    static void handle_send_status(access_model_handle_t model_handle, const access_message_rx_t * p_rx_msg, void * p_args){
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "A/C state: %s\n", p_rx_msg->p_data);
    }
    static const access_opcode_handler_t m_opcode_handlers[] =
    {
    {ACCESS_OPCODE_SIG(GENERIC_ONOFF_OPCODE_SET), handle_set},
    {ACCESS_OPCODE_SIG(GENERIC_ONOFF_OPCODE_SET_UNACKNOWLEDGED), handle_set},
    {ACCESS_OPCODE_SIG(GENERIC_ONOFF_OPCODE_GET), handle_get},
    {ACCESS_OPCODE_SIG(OPCODE_SEND_STATUS), handle_send_status}, //I added this one
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi JEFT 

    Thanks , I'm also looking to do the same , but sending an Integer. 

    Could you share your project \ modified files ?  

    I don't see where you set the msg "hello" in your example. 

    Thanks,Ran 

  • hi ..JEFT  ...  i want to send a string from client to server ... same as you ... can you tell me where you set a data ?

    please help out 

    Thanks&Regards ,

    pspavi

  • Hi Pspavi,

    Even i am trying to send a string from client to server have you got any solution if so can you please share

    Thanks,

    Krupa