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

Getting current connection interval

In NCS, is there a way to get the currently used connection interval ?

  • Inside connected(), set through bt_conn_cb_register(&conn_callbacks), where conn_callbacks has a field that contains a pointer to connected() do the following:

    static void connected(struct bt_conn *conn, u8_t err)
    {
        struct bt_conn_info info;
        if(!bt_conn_get_info(conn, &info))
    	{
    		printk("Connection interval: %u\n", info.le.interval);
    	}
        .
        .
        //Other necessary code
        .
        .
    }

    Inside le_param_updated(), which is set through bt_conn_cb_register() as well, do the following:

    static void le_param_updated(struct bt_conn *conn, u16_t interval, u16_t latency, u16_t timeout)
    {
        struct bt_conn_info info;
        if(!bt_conn_get_info(conn, &info))
    	{
    		printk("Connection interval: %u\n", info.le.interval);
    	}
        .
        .
        //Other necessary code
        .
        .
    }

    Best regards,

    Simon

Related