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

RSSI value

Hi,

I'm using the light_switch example to implement mesh. How do I display the RSSI value of server on rtt viewer when the client receives the server status?

Regards,

Sunil

Parents
  • FormerMember
    0 FormerMember

    In light switch client example, that struct comes with access_message_rx_t in f.ex handle_status_cb() as p_message contains the RSSI. Printig it can be done the following way:

    simple_on_off_client.c
    
    static void handle_status_cb(access_model_handle_t handle, const access_message_rx_t * p_message, void * p_args)
    {
        simple_on_off_client_t * p_client = p_args;
        NRF_MESH_ASSERT(p_client->status_cb != NULL);
    
        if (!is_valid_source(p_client, p_message))
        {
            return;
        }
    
        // Print RSSI of server
         __LOG(LOG_SRC_APP,
                      LOG_LEVEL_INFO,
                      "RSSI: %d\n",
                        ((p_message->meta_data.p_core_metadata->source == NRF_MESH_RX_SOURCE_SCANNER)
                          ?p_message->meta_data.p_core_metadata->params.scanner.rssi
                           : 0));
    
        simple_on_off_msg_status_t * p_status =
            (simple_on_off_msg_status_t *) p_message->p_data;
        simple_on_off_status_t on_off_status = (p_status->present_on_off ?
                                                  SIMPLE_ON_OFF_STATUS_ON : SIMPLE_ON_OFF_STATUS_OFF);
        p_client->status_cb(p_client, on_off_status, p_message->meta_data.src.value);
    }
    

     

    The provisioner light switch example prints the RSSI in app_health_event_cb().

  • Hi Kristin,thanks for your advice and it works,but how to receive the servers' health status via client instead of provisioner ,I want to get the node address and RSSI when the servers send their health status instead the moment that I send a comment to the server? I asked the others but they give me the guide to you.

Reply Children
No Data
Related