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

RSSI Value of the client from server

Hi,

I am trying to get the rssi value of the client from servers. I added health client model to server and added app_health_event_cb() funtion from provisioner in server. Also called it in here.

static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");
    m_server.get_cb = on_off_server_get_cb;
    m_server.set_cb = on_off_server_set_cb;
    ERROR_CHECK(simple_on_off_server_init(&m_server, 0));
    ERROR_CHECK(access_model_subscription_list_alloc(m_server.model_handle));
    //----added code----//
    /* This app requires following models :
    * health client : To be able to interact with other health servers */
    ERROR_CHECK(health_client_init(&m_dev_handles.m_health_client_instance, 0, app_health_event_cb));

    //----added code----//
}

But it is not working as it is working in provisioner.  No errors are coming.

1. Can we access rssi of client from servers?

2. Can I add Health client model in server?

3. Why this is not working as in provisioner?

  • Hi Arya, 

     

    If you have a look at the node_setup.c you can find that when the provisioner configure a node, it will set the publication address of the health server to the provisioner address. So they will only send health message to the provisioner. If you want to have other node to be able to receive health message you need to configure the publication address to the node or to a group address. And then you configure the health client to subscribe to that address. 

    Also you would need to bind the app key of the health client to the app key that the provisioner assign to the health server. 

    But for your purpose, I would suggest to use HeartBeat to detect RSSI and the TTL to other node. Please read more about that in the mesh spec (section 3.6.7). 

  • Hi Hung Bui,

    Can you help me some more for getting rssi from heartbeat messages? Now I am sending a message from client to server and from that packet I am receiving the rssi. How to do that through heartbeat messages?

  • Hi Arya, 

     

    I haven't done this myself. But my understanding on how to do this, is: first you need to configure your device to listen to particular heartbeat. You do that by calling config_client_heartbeat_subscription_set() from the config client (of the provisioner for example) to configure the source and the destination of heartbeats the node(s) should listen to. 

    Then in your node, if you have a matched heartbeat, you will receive an event TRANSPORT_CONTROL_OPCODE_HEARTBEAT and it will be processed in heartbeat_opcode_handle() inside that you have the RSSI value in p_rx_metadata to be used. 

     

  • Hi Hung Bui,

    I have one doubt, if we make one node as health client other than provisioner, will it also acts as health server to send its health status?

  • Hi , 
    Health server and health client are independent. You can have them both on one device, but they need to be on different elements. 

Related