timeout__LONG_TERM value can't be changed

  • Hi,

    We are trying to adjust the LONG_TERM timeout of the DefaultDeviceReconnectFilter. We are instantiating it with:

    private final DeviceReconnectFilter defaultDeviceReconnectFilter = new DefaultDeviceReconnectFilter(Interval.ONE_SEC, Interval.secs(3), Interval.FIVE_SECS, Interval.secs(30));

    And pass it to the BleManager:


    This does not seem to have any effect. It still takes 5 minutes for SweetBlue to transition out of the LONG_TERM_RECONNECTING state, and breakpoints within onConnectionLost don't seem to get triggered, either.

    What are we missing?

  • It's possible this is a bug. Try setting the filter in the config for now:

    BleManagerConfig config = new BleManagerConfig();
    config.reconnectFilter = new DefaultDeviceReconnectFilter(...);
    BleManager manager = BleManager.get(context, config);

    We'll look into this more when we get back from the holiday break.

  • @ryanbis Thank you this works for now.
    Hope you had a nice holiday!

    Have you found a fix to this problem yet?



  • Sorry, we haven't had time to look at it yet. I plan to have it fixed for the next release though. I'll do my best to get some time on it this week.

  • I found the bug with this. The library simply wasn't checking the correct reconnect filters when checking for the timeout values. There are 4 different spots where the reconnectfilter can be set. Below is the priority of them:

    BleDeviceConfig instance on the device

    First non-null instance wins. This will make it's way into the 3.0.3 release, which I'm trying to get out in the next 2 weeks (hopefully sooner).

  • @ryanbis Awesome! We look forward to the release.