public static class ReconnectFilter.ConnectionLostPlease
extends java.lang.Object
ReconnectFilter.onConnectionLost(ConnectionLostEvent)
. Use static constructor methods to create instances.public static ReconnectFilter.ConnectionLostPlease retryInstantlyWithTimeout(Interval timeout)
ReconnectFilter.ConnectionLostEvent.type()
is either ReconnectFilter.Type.SHORT_TERM__SHOULD_TRY_AGAIN
or ReconnectFilter.Type.LONG_TERM__SHOULD_TRY_AGAIN
,
return this from ReconnectFilter.onConnectionLost(ConnectionLostEvent)
to instantly reconnect. This method will allow you to specify
how long the library should continue retrying.public static ReconnectFilter.ConnectionLostPlease retryInstantly()
ReconnectFilter.ConnectionLostEvent.type()
is either ReconnectFilter.Type.SHORT_TERM__SHOULD_TRY_AGAIN
or ReconnectFilter.Type.LONG_TERM__SHOULD_TRY_AGAIN
,
return this from ReconnectFilter.onConnectionLost(ConnectionLostEvent)
to instantly reconnect.public static ReconnectFilter.ConnectionLostPlease stopRetrying()
ReconnectFilter.onConnectionLost(ConnectionLostEvent)
to stop a reconnect attempt loop.
Note that BleDevice.disconnect()
BleServer.disconnect(String)
will also stop any ongoing reconnect loops.public static ReconnectFilter.ConnectionLostPlease retryIn(Interval interval)
ReconnectFilter.onConnectionLost(ConnectionLostEvent)
to retry after the given amount of time.public static ReconnectFilter.ConnectionLostPlease retryWithTimeout(Interval retryDelay, Interval retryTimeout)
ReconnectFilter.onConnectionLost(ConnectionLostEvent)
to retry after the given amount of time, and to keep
retrying until the given timeout has expired.public static ReconnectFilter.ConnectionLostPlease persist()
BleDevice
should keep BleDeviceState.RECONNECTING_LONG_TERM
or
BleDeviceState.RECONNECTING_SHORT_TERM
. Only use this method if you have not used
any method which sets a timeout, such as retryInstantlyWithTimeout(Interval)
, or
retryWithTimeout(Interval, Interval)
.public static ReconnectFilter.ConnectionLostPlease persistIf(boolean condition)
persist()
if the condition holds, stopRetrying()
otherwise. Only
use this method if you have not used any method which sets a timeout, such as
retryInstantlyWithTimeout(Interval)
, or retryWithTimeout(Interval, Interval)
.public static ReconnectFilter.ConnectionLostPlease stopRetryingIf(boolean condition)
stopRetrying()
if the condition holds, persist()
otherwise. Only
use this method if you have not used any method which sets a timeout, such as
retryInstantlyWithTimeout(Interval)
, or retryWithTimeout(Interval, Interval)
.