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

Provisioner and server

Hey 

This is sumanth. I have worked on light switch example with server, client and mobile as provisioner. I would like to develop a mesh network where the server has to calculate the RSSI of client signal while receiving data and display it through UART or in mobile or store it in memory of server. I found a structure in nRF_mesh.h file which deals about the RSSI of received packet. How can i use this structure? and make it work.

second one is if i want to send data from server to UART, how can i achieve it? 

Thanking You

Sumanth 

Parents Reply Children
  • Oh. I see. 

    You need to use the function app_onoff_server_state_set_cb() in the app_onoff.c file. It looks like this:

    static void generic_onoff_state_set_cb(const generic_onoff_server_t * p_self,
                                           const access_message_rx_meta_t * p_meta,
                                           const generic_onoff_set_params_t * p_in,
                                           const model_transition_t * p_in_transition,
                                           generic_onoff_status_params_t * p_out)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "msg: SET: %d\n", p_in->on_off);
    
        app_onoff_server_t   * p_server = PARENT_BY_FIELD_GET(app_onoff_server_t, server, p_self);
    
        /* Update internal representation of OnOff value, process timing */
        p_server->value_updated = false;
        p_server->state.target_onoff = p_in->on_off;
        if (p_in_transition == NULL)
        {
            p_server->state.delay_ms = 0;
            p_server->state.remaining_time_ms = 0;
        }
        else
        {
            p_server->state.delay_ms = p_in_transition->delay_ms;
            p_server->state.remaining_time_ms = p_in_transition->transition_time_ms;
        }
    
        onoff_state_value_update(p_server);
        onoff_state_process_timing(p_server);
    
        /* Prepare response */
        if (p_out != NULL)
        {
            p_out->present_on_off = p_server->state.present_onoff;
            p_out->target_on_off = p_server->state.target_onoff;
            p_out->remaining_time_ms = p_server->state.remaining_time_ms;
        }
    }

    So as you can see, it has a pointer p_meta in the function variables.

Related