•   over 5 years ago

Android - How To Decrease Slave Latency

Hello there. I would like to decrease the slave latency from 1 second to 300 milliseconds (if possible). I am able to connect to the Connection Control Service. However, I am not sure what to write to the Parameter Characteristic. Would you be able to help me?

  • 9 comments

  • Manager   •   over 5 years ago

    Hello shaq1nj,

    Here is what I have so far:
    For details on BLE connection parameters, refer to bluetooth.org site (https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters.xml)

    If they want to change connection interval to 300ms then they need to write the following byte value to characteristic ffffccc2-00f7-4000-b000-000000000000
    byte[] value={ (byte)0xF0, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x58, (byte)0x02};

    The characteristic is part of the connection control service ffffccc0-00f7-4000-b000-000000000000

    Note that Apple recommends that = + 20ms

    Hope this helps...let me know.

  •   •   over 5 years ago

    Thanks. That did help. I am still a little confused about the value you gave me. The first two bytes are for minimum connection interval, which are 0xF0 and 0x00. How many milliseconds is this, and how do you make the conversion? I have the same question for the third and fourth bytes (or maximum connection interval).

  • Manager   •   over 5 years ago

    Looking this up...

  • Manager   •   over 5 years ago

    Hi,
    Here's the info on how to convert connection interval to 2-byte hex value used in the connection control service.

    1. connect interval unit (decimal) = connection interval time (ms) / 1.25 ms
    2. convert connection interval unit to HEX
    3. Reverse the 2-byte HEX value

    For example: Connection interval 300ms.
    Connection interval unit (dec) = 300 ms / 1.25 ms = 240
    Convert 240 to Hex. 0x00F0
    Reverse 2-byte hex value: 0xF000

    Use 0xF0 0x00 as min connection interval in the byte array.

  • Manager   •   over 5 years ago

    Hi Robert,
    min latency = 0
    max latency = 1000 (dec)

    Note: When converting slave latency you don't need to divide by 1.25ms since this parameter is not time based. When converting supervision timeout you need to divide by 10ms

    Please refer to bluetooth.org link below for min/max values of connection interval, slave latency and supervision timeout.

    https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters.xml

    Regarding accelerometer UUID, we'll get back to you on that thread.

    Thanks for you patience.

  • Manager   •   over 5 years ago

    Hi Robert,

    By the way, for minimum connection interval, V.BTTN is able to support 7.5ms, as specified by bluetooth.org. However, greater interoperability with various smartphones, we recommend setting it to >= 20ms. Please keep in mind the smaller the interval the greater the impact it will have on V.BTTN's battery life.

  • Manager   •   over 5 years ago

    I'll have to see what data or estimates are available and get back to you.

  • Manager   •   over 5 years ago

    We don't have actual data. However, here are some rough estimates: ~135hr with 20ms interval and ~45hr with 7.5ms interval. Hopes that helps. note, this is with no LED or buzzer. Only accelerometer is on.

  • Manager   •   over 5 years ago

    if BT connection is dropped then all notifications will be disabled, so you'll need to "re-eanable" them (e.g. FFA5, FFF4, etc..) on connection.

    In terms of detection (FFF2) setting, on disconnect/out of range, it will be set to 0x02. This means V.BTTN will only detect long press while it is out of range.. So, if user long presses the button, it will queue the detection/event. Then on connection and reenabling of notification (FFF4), your app will immediately receive a long press notification.

Comments are closed.