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

Combine model Client and model Server in MESH

Hi,

I can run light_switch on one device as Client, another as Server.

Now I want 1 device to contain both Client model and Server model. Example: when I press on first kit, It will control the led on 2nd kit and when I press on 2nd kit, It will control the led on 1st kit.

I use light_switch_server example to add Client_models, such as:

static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");
    
    m_clients.settings.p_callbacks = &client_cbs;
    m_clients.settings.timeout = 0;
    m_clients.settings.force_segmented = APP_FORCE_SEGMENTATION;
    m_clients.settings.transmic_size = APP_MIC_SIZE;

    ERROR_CHECK(generic_onoff_client_init(&m_clients, 1));

    app_model_init();
}

I can combine it successfully, but the Kit run, the ERROR_CHECK(generic_onoff_client_init(&m_clients, 1)); return fail (weak.c)

What is the true way to combine these 2 models? Tks in advance.

Related