public static enum DeviceReconnectFilter.Status extends java.lang.Enum<DeviceReconnectFilter.Status> implements UsesCustomNull
Modifier and Type | Method and Description |
---|---|
boolean |
allowsRetry()
Whether this status honors a
ReconnectFilter.ConnectFailPlease.isRetry() . |
boolean |
isNull()
Returns
true if the object's state represents what would otherwise be Java's built-in null . |
boolean |
shouldBeReportedToUser()
Convenience method that returns whether this status is something that your app user would usually care about.
|
static DeviceReconnectFilter.Status |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DeviceReconnectFilter.Status[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
boolean |
wasCancelled()
Returns true for
EXPLICIT_DISCONNECT or BLE_TURNING_OFF . |
public static final DeviceReconnectFilter.Status NULL
null
wherever needed. As of now, the DeviceReconnectFilter.ConnectFailEvent.status()
given
to ReconnectFilter.onConnectFailed(ReconnectFilter.ConnectFailEvent)
will *never* be NULL
.public static final DeviceReconnectFilter.Status ALREADY_CONNECTING_OR_CONNECTED
BleDevice.connect()
or its overloads
but DeviceReconnectFilter.ConnectFailEvent.device()
is already
BleDeviceState.BLE_CONNECTING
or BleDeviceState.BLE_CONNECTED
.public static final DeviceReconnectFilter.Status NULL_DEVICE
BleDevice.connect()
(or various overloads) was called on BleDevice.NULL
.public static final DeviceReconnectFilter.Status NATIVE_CONNECTION_FAILED
BluetoothDevice.connectGatt(android.content.Context, boolean, BluetoothGattCallback)
because it (a) DeviceReconnectFilter.Timing.IMMEDIATELY
returned null
, (b) DeviceReconnectFilter.Timing.EVENTUALLY
returned a bad
ReconnectFilter.ConnectFailEvent.gattStatus()
, or (c) DeviceReconnectFilter.Timing.TIMED_OUT
.public static final DeviceReconnectFilter.Status DISCOVERING_SERVICES_FAILED
BluetoothGatt.discoverServices()
either (a) DeviceReconnectFilter.Timing.IMMEDIATELY
returned false
,
(b) DeviceReconnectFilter.Timing.EVENTUALLY
returned a bad ReconnectFilter.ConnectFailEvent.gattStatus()
, or (c) DeviceReconnectFilter.Timing.TIMED_OUT
.public static final DeviceReconnectFilter.Status BONDING_FAILED
BluetoothDevice.createBond()
either (a) DeviceReconnectFilter.Timing.IMMEDIATELY
returned false
,
(b) DeviceReconnectFilter.Timing.EVENTUALLY
returned a bad DeviceReconnectFilter.ConnectFailEvent.bondFailReason()
, or (c) DeviceReconnectFilter.Timing.TIMED_OUT
.
BleDeviceConfig.bondingFailFailsConnection
must be true
for this DeviceReconnectFilter.Status
to be applicable.BondListener
public static final DeviceReconnectFilter.Status AUTHENTICATION_FAILED
BleTransaction
instance passed to BleDevice.connect(BleTransaction.Auth)
or
BleDevice.connect(BleTransaction.Auth, BleTransaction.Init)
failed through BleTransaction.fail()
.public static final DeviceReconnectFilter.Status INITIALIZATION_FAILED
BleTransaction
instance passed to BleDevice.connect(BleTransaction.Init)
or
BleDevice.connect(BleTransaction.Auth, BleTransaction.Init)
failed through BleTransaction.fail()
.public static final DeviceReconnectFilter.Status ROGUE_DISCONNECT
NATIVE_CONNECTION_FAILED
but only occurs after the device is BleDeviceState.BLE_CONNECTED
and we're going through
BleDeviceState.DISCOVERING_SERVICES
, or BleDeviceState.AUTHENTICATING
, or what have you. It might
be from the device turning off, or going out of range, or any other random reason.public static final DeviceReconnectFilter.Status IMPLICIT_DISCONNECT
BleDevice.unbond()
was called while the device
was connected, or the MTU write test failed.public static final DeviceReconnectFilter.Status EXPLICIT_DISCONNECT
BleDevice.disconnect()
was called sometime during the connection process.public static final DeviceReconnectFilter.Status BLE_TURNING_OFF
BleManager.reset()
or BleManager.turnOff()
(or
overloads) were called sometime during the connection process.
Basic testing reveals that this value will also be used when a
user turns off BLE by going through their OS settings, airplane
mode, etc., but it's not absolutely *certain* that this behavior
is consistent across phones. For example there might be a phone
that kills all connections before going through the ble turn-off
process, in which case SweetBlue doesn't know the difference and
ROGUE_DISCONNECT
will be used.public static DeviceReconnectFilter.Status[] values()
for (DeviceReconnectFilter.Status c : DeviceReconnectFilter.Status.values()) System.out.println(c);
public static DeviceReconnectFilter.Status valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final boolean wasCancelled()
EXPLICIT_DISCONNECT
or BLE_TURNING_OFF
.public final boolean allowsRetry()
ReconnectFilter.ConnectFailPlease.isRetry()
. Returns false
if wasCancelled()
or
this
is ALREADY_CONNECTING_OR_CONNECTED
.public final boolean isNull()
UsesCustomNull
true
if the object's state represents what would otherwise be Java's built-in null
.isNull
in interface UsesCustomNull
public final boolean shouldBeReportedToUser()
true
then perhaps you should pop up a Toast
or something of that nature.