public class DefaultServerReconnectFilter extends java.lang.Object implements ServerReconnectFilter
ServerReconnectFilter
that attempts a certain number of retries. An instance of this class is set by default
for all new BleServer
instances using DEFAULT_CONNECTION_FAIL_RETRY_COUNT
.
Use BleServer.setListener_ReconnectFilter(ServerReconnectFilter)
to override the default behavior.ServerReconnectFilter.ConnectFailEvent, ServerReconnectFilter.Status
ReconnectFilter.AutoConnectUsage, ReconnectFilter.ConnectFailPlease, ReconnectFilter.ConnectionLostEvent, ReconnectFilter.ConnectionLostPlease, ReconnectFilter.DefaultNullReconnectFilter, ReconnectFilter.Type
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_FAIL_RETRY_COUNT
The default retry count provided to
DefaultServerReconnectFilter . |
static int |
DEFAULT_FAIL_COUNT_BEFORE_USING_AUTOCONNECT
The default connection fail limit past which
DefaultServerReconnectFilter will start returning ReconnectFilter.ConnectFailPlease.retryWithAutoConnectTrue() . |
Constructor and Description |
---|
DefaultServerReconnectFilter() |
DefaultServerReconnectFilter(Interval reconnectRate__SHORT_TERM,
Interval reconnectRate__LONG_TERM,
Interval timeout__SHORT_TERM,
Interval timeout__LONG_TERM) |
DefaultServerReconnectFilter(int retryCount,
int failCountBeforeUsingAutoConnect) |
DefaultServerReconnectFilter(int retryCount,
int failCountBeforeUsingAutoConnect,
Interval reconnectRate__SHORT_TERM,
Interval reconnectRate__LONG_TERM,
Interval timeout__SHORT_TERM,
Interval timeout__LONG_TERM) |
Modifier and Type | Method and Description |
---|---|
int |
getRetryCount() |
ReconnectFilter.ConnectFailPlease |
onConnectFailed(ServerReconnectFilter.ConnectFailEvent e)
This is called when connecting to a previously unconnected device fails.
|
ReconnectFilter.ConnectionLostPlease |
onConnectionLost(ReconnectFilter.ConnectionLostEvent event)
This is called when a connected device loses it's connection, outside of you calling
BleDevice.disconnect() |
public static final int DEFAULT_CONNECTION_FAIL_RETRY_COUNT
DefaultServerReconnectFilter
.
So if you were to call BleDevice.connect()
and all connections failed, in total the
library would try to connect 2+1 times.public static final int DEFAULT_FAIL_COUNT_BEFORE_USING_AUTOCONNECT
DefaultServerReconnectFilter
will start returning ReconnectFilter.ConnectFailPlease.retryWithAutoConnectTrue()
.public DefaultServerReconnectFilter()
public DefaultServerReconnectFilter(int retryCount, int failCountBeforeUsingAutoConnect)
public DefaultServerReconnectFilter(Interval reconnectRate__SHORT_TERM, Interval reconnectRate__LONG_TERM, Interval timeout__SHORT_TERM, Interval timeout__LONG_TERM)
public final int getRetryCount()
public final ReconnectFilter.ConnectFailPlease onConnectFailed(ServerReconnectFilter.ConnectFailEvent e)
ReconnectFilter
ReconnectFilter.ConnectFailPlease
as return values to either
retry, or stop retrying to connect.onConnectFailed
in interface ReconnectFilter<ServerReconnectFilter.ConnectFailEvent>
public ReconnectFilter.ConnectionLostPlease onConnectionLost(ReconnectFilter.ConnectionLostEvent event)
ReconnectFilter
BleDevice.disconnect()
onConnectionLost
in interface ReconnectFilter<ServerReconnectFilter.ConnectFailEvent>