public class DefaultReconnectFilter extends java.lang.Object implements ReconnectFilter
ReconnectFilter
that uses ReconnectFilter.ConnectionLostPlease.retryInstantly()
for the
first reconnect attempt, and from then on uses the Interval
rate passed to the constructor. An instance of this class is held
in DefaultDeviceReconnectFilter
, and DefaultServerReconnectFilter
, to handle connection lost events ONLY. The logic is the same
between the two, hence this class exists for this purpose, and to adhere to the DRY principle. This class is not meant for public consumption.ReconnectFilter.AutoConnectUsage, ReconnectFilter.ConnectFailEvent, ReconnectFilter.ConnectFailPlease, ReconnectFilter.ConnectionLostEvent, ReconnectFilter.ConnectionLostPlease, ReconnectFilter.DefaultNullReconnectFilter, ReconnectFilter.Type
Modifier and Type | Field and Description |
---|---|
static Interval |
LONG_TERM_ATTEMPT_RATE |
static Interval |
LONG_TERM_TIMEOUT |
static Interval |
SHORT_TERM_ATTEMPT_RATE |
static Interval |
SHORT_TERM_TIMEOUT |
Constructor and Description |
---|
DefaultReconnectFilter() |
DefaultReconnectFilter(Interval reconnectRate__SHORT_TERM,
Interval reconnectRate__LONG_TERM,
Interval timeout__SHORT_TERM,
Interval timeout__LONG_TERM) |
Modifier and Type | Method and Description |
---|---|
ReconnectFilter.ConnectFailPlease |
onConnectFailed(ReconnectFilter.ConnectFailEvent event)
This is called when connecting to a previously unconnected device fails.
|
ReconnectFilter.ConnectionLostPlease |
onConnectionLost(ReconnectFilter.ConnectionLostEvent e)
This is called when a connected device loses it's connection, outside of you calling
BleDevice.disconnect() |
public static final Interval LONG_TERM_ATTEMPT_RATE
public static final Interval SHORT_TERM_ATTEMPT_RATE
public static final Interval SHORT_TERM_TIMEOUT
public static final Interval LONG_TERM_TIMEOUT
public ReconnectFilter.ConnectFailPlease onConnectFailed(ReconnectFilter.ConnectFailEvent event)
ReconnectFilter
ReconnectFilter.ConnectFailPlease
as return values to either
retry, or stop retrying to connect.onConnectFailed
in interface ReconnectFilter
public ReconnectFilter.ConnectionLostPlease onConnectionLost(ReconnectFilter.ConnectionLostEvent e)
ReconnectFilter
BleDevice.disconnect()
onConnectionLost
in interface ReconnectFilter