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

How to relay message from one node to other in mesh network

Hi,

I have 3 of nRF52840 boards, SDK V2.2.0 and nRF SDK V15.0.0.

I already tested the light switch control example, and saw it working with one client and 2 servers and all the 2 servers within the client's range.

Now my question is,

1) How can i relay the message to node not in range?

2) For relay what changes are needed in code?

3) Can i use nRF mesh app to control set/reset?

  • 1) This should be done automatically if relaying is enabled on the node you want to relay from.

    2) Take a look at this code here, which shows the different code for setting the relay state:

    /** Values for the relay state. */
    typedef enum
    {
        CONFIG_RELAY_STATE_SUPPORTED_DISABLED = 0x00, /**< Relaying is supported, but disabled. */
        CONFIG_RELAY_STATE_SUPPORTED_ENABLED  = 0x01, /**< Relaying is supported and enabled. */
        CONFIG_RELAY_STATE_UNSUPPORTED        = 0x02  /**< Relaying is not supported. */
    } config_relay_state_t;

    Also take a look at send_relay_status() & handle_config_relay_set(). I believe the FW automatically sets the relay status to enabled.

    3) No, you cannot set/reset the relay status via the nRF Mesh app at the moment.

  • Take a look at this code here, which shows the different code for setting the relay state:

    i did not find the definition/declaration of relay status in code to make changes can you please guide me.

  • As you both commented here & here, relaying is enabled by default. It seems the relaying feature has been simplified in the latest mesh sdks (v3.0.0 & upwards). In Mesh SDK v3.0.0, you can take a look at the define MESH_FEATURE_RELAY_ENABLED in nrf_mesh_config_core.h. As defined there, relaying is enabled by default. Also take a look at this code in config_server.c of the light switch server example in mesh sdk v3.0.0:

    #if MESH_FEATURE_RELAY_ENABLED
        const config_server_evt_t evt = {
            .type = CONFIG_SERVER_EVT_RELAY_SET,
            .params.relay_set.enabled = (p_pdu->relay_state == CONFIG_RELAY_STATE_SUPPORTED_ENABLED),
            .params.relay_set.retransmit_count = p_pdu->relay_retransmit_count,
            .params.relay_set.interval_steps = p_pdu->relay_retransmit_interval_steps
        };
        app_evt_send(&evt);
    #endif /* MESH_FEATURE_RELAY_ENABLED */

    Have you tested the relaying feature out? Did you get it working? You could try sending reliable messages to ensure that packets reach the destination & get relayed properly. If you cannot get it working on mesh sdk v2.2.0 for whatever reason, I would try with mesh sdk v3.0.0 or higher.

  • hi bjorn kvaale 

    i want to send the message from client to relay node and relay node has to forward the message to server , which my server is far away from the client .  Relay feature is enabled by default , then what are all changes i want to do ? and then how to do this by using mesh app

    i hope you , you can help me

    thanks in advance

  • The relaying needs to be set in the FW itself. As of now, the mesh app cannot turn on or off relaying of specific nodes. I am not sure whether this will be supported in future releases, but I doubt it. You can either send a unicast message from the client to the server that is farthest away & have the relay node in between the client & the server or you can change the tx power of the client to limit the range of the client. This may be useful if you do not have a big space to test in. You want to make sure that the client is not in RF range of the furthest server, as then you cannot test to make sure the relaying works.

Related