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

Sending Config Relay Set message through Config Client

Hello,

I'm working on Mesh SDK 2.1.1 and I'm trying to send a Relay Set message through Configuration Client.

I have changed the code of models_init_cb() function inside the main.c to initialize the Config Client Model:

static config_client_event_cb_t config_client_cb

(...)

static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");

    for (uint32_t i = 0; i < CLIENT_MODEL_INSTANCE_COUNT; ++i)
    {
        m_clients[i].status_cb = client_status_cb;
        m_clients[i].timeout_cb = client_publish_timeout_cb;
        ERROR_CHECK(simple_on_off_client_init(&m_clients[i], i + 1));
        ERROR_CHECK(access_model_subscription_list_alloc(m_clients[i].model_handle));
    }
    
    ERROR_CHECK(config_client_init(&config_client_cb));
}

The model seems to initialize properly, as I can see it after provisioning the node using the Android App and I'm able to bind an application key and to set a publication address.

Then I use the config_client_relay_set() function to set the relay configuration:

status = config_client_relay_set(CONFIG_RELAY_STATE_SUPPORTED_DISABLED, 7, 31);


However, I get the status NRF_ERROR_INVALID_PARAM.

After looking at what happens after executing the relay set function, I realized that this status comes from the function check_tx_params() in access.c more precisely from this Boolean check:

    else if ((p_rx_message == NULL &&
             (m_model_pool[handle].model_info.publish_appkey_handle  == DSM_HANDLE_INVALID ||
              m_model_pool[handle].model_info.publish_address_handle == DSM_HANDLE_INVALID)) ||
              !is_valid_opcode(p_tx_message->opcode))
    {
        *p_status = NRF_ERROR_INVALID_PARAM;
    }

Looking at what is inside the m_model_pool, I can see that for the Config Client Model, the values of both publish_appkey_handle and publish_address_handle correspond to DSM_HANDLE_INVALID.

So, what could be the cause?

Is it something missing from the Model initialization? Or how should I configure the application key and the publish address?

If I understood correctly the Configuration Client should work within the node it self, right?

Should I then define the publish address as the first node element, i.e., the address of the element that contains the Configuration Server, Configuration Client and Health Server?

And what about the application key?

Parents Reply Children
No Data
Related