.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

Parents Reply Children
  • 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