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.