.le.interval - in the course “Bluetooth Low Energy Fundamentals” (Lesson 3, Exercise 2), deprecation warning - “interval is deprecated.”

Hi there,

Just a minor flaw in the exercise, but a question concerning the callback from the event “le_param_updated”. In the solution to query the connection interval, it says that “interval” is deprecated.

structbt_conn_infoinfo;
int err = bt_conn_get_info(conn, &info);
double connection_interval = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval) * 1.25;

There is an easy fix for that

double connection_interval = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us) * 1.25;

The info.le.interval_us is a uint32_t, whereas the deprecated info.le.interval is a uint16_t. But now in the callback for the event “le_param_update” there is still the deprecated uint16_t interval.

void(struct bt_conn *conn, uint16_t interval, uint16_t latency, uint16_t timeout)

and as far as I saw, the interval in the callback is always 0. I am not sure if that is due to my phone though.

Kind regards, Dani

  • Hi Daniel, 

    Which SDK you are using ? Could you try switching to v3.2.0 ? 
    As far as I can see in the tab for 3.2.0 in the dev academy course we have updated it to interval_us . 

    Regarding le_param_update callback, could you print out other parameters ? Could you try to test with one of our sample, for example peripheral_power_profiling. Quite strange that you see interval= 0. 

  • For the first one, shame on me, I was not on the right tab. I work with SDK v3.2.0.

    Regarding the callback, I can print out other parameters which are not 0.

    I work with an nRF52840dk. Can you suggest another sample that I can run on my board?

  • Hi Daniel, 

    It's quite strange. 
    Could you try the attached project (v3.2.0). 
    I can see this on my UART log: 

    Advertising successfully started
    
    Connected
                                                                         
    Connection parameter updated
                                                      
    Connection interval: 1.25 * 6 ms, latency: 0, timeout: 10 * 500 ms
                
    Connection parameter updated
                                                      
    Connection interval: 1.25 * 24 ms, latency: 0, timeout: 10 * 500 ms
               
    Connection parameter updated
                                                      
    Connection interval: 1.25 * 24 ms, latency: 0, timeout: 10 * 42 ms
     
    

    If you still see the issue with this code, you may need to capture a sniffer trace so we can check what exactly happen over the BLE communication. 
    1830.peripheral_lbs.zip

Related