public enum BleManagerState extends java.lang.Enum<BleManagerState> implements State
BleManager
can be in.
The manager can be in multiple states simultaneously.State.ChangeEvent<T_State extends State>, State.ChangeIntent
Enum Constant and Description |
---|
BLE_SCAN_READY
This state dictates that all permissions (if needed) have been granted to allow BLE scanning to return results.
|
BOOST_SCANNING
This is the state that
BleManager is in when BleManagerConfig.scanClassicBoostLength is not null , or
Interval.DISABLED . |
IDLE
This is the state that
BleManager is in when the update loop tick interval has been lowered, due to there being no
tasks in the queue for a time dictated by BleManagerConfig.minTimeToIdle . |
OFF
Analogous to
BluetoothAdapter.STATE_OFF . |
ON
Analogous to
BluetoothAdapter.STATE_ON . |
RESETTING
This is the state that
BleManager is in after calling BleManager.reset() . |
SCANNING
This is the state that
BleManager is in when scanning actually starts. |
SCANNING_PAUSED
This is the state that
BleManager is in when scanning has been paused (but will resume). |
STARTING_SCAN
This is the state that
BleManager is in after calling BleManager.startScan() or related overloads. |
TURNING_OFF
Analogous to
BluetoothAdapter.STATE_TURNING_OFF . |
TURNING_ON
Analogous to
BluetoothAdapter.STATE_TURNING_ON . |
Modifier and Type | Field and Description |
---|---|
static int |
FULL_MASK
Full bitwise mask made by ORing all
BleManagerState instances together. |
Modifier and Type | Method and Description |
---|---|
int |
bit() |
boolean |
didEnter(int oldStateBits,
int newStateBits)
Given an old and new state mask, for example from
DeviceStateListener.onEvent(com.idevicesinc.sweetblue.DeviceStateListener.StateEvent)
or ManagerStateListener.onEvent(com.idevicesinc.sweetblue.ManagerStateListener.StateEvent) , this method tells you whether the
the 'this' state was appended. |
boolean |
didExit(int oldStateBits,
int newStateBits)
Reverse of
State.didEnter(int, int) . |
int |
getNativeCode()
Returns the analogous native code, if applicable.
|
boolean |
isNull()
Returns
true if this state is meant to stand in for Java's built-in null . |
int |
or(BitwiseEnum state) |
boolean |
overlaps(int mask) |
static BleManagerState |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static BleManagerState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static BleManagerState[] |
VALUES() |
public static final BleManagerState OFF
BluetoothAdapter.STATE_OFF
.public static final BleManagerState TURNING_ON
BluetoothAdapter.STATE_TURNING_ON
.public static final BleManagerState ON
BluetoothAdapter.STATE_ON
.public static final BleManagerState TURNING_OFF
BluetoothAdapter.STATE_TURNING_OFF
.public static final BleManagerState IDLE
BleManager
is in when the update loop tick interval has been lowered, due to there being no
tasks in the queue for a time dictated by BleManagerConfig.minTimeToIdle
.public static final BleManagerState STARTING_SCAN
BleManager
is in after calling BleManager.startScan()
or related overloads. The BleManager
will only be in this state for a very short period before moving to SCANNING
.BleManager.startScan()
public static final BleManagerState BOOST_SCANNING
BleManager
is in when BleManagerConfig.scanClassicBoostLength
is not null
, or
Interval.DISABLED
. No devices will be discovered when in this state, it's simply here to make the BLE scan give more
reliable results, especially when looking for many devices. If you explicitly start a Bluetooth Classic scan, the manager will
not enter this state.public static final BleManagerState SCANNING
BleManager
is in when scanning actually starts.public static final BleManagerState SCANNING_PAUSED
BleManager
is in when scanning has been paused (but will resume). This is mainly used with any of the startPeriodicScan
methods in BleManager
.public static final BleManagerState BLE_SCAN_READY
BluetoothEnabler
.public static final BleManagerState RESETTING
BleManager
is in after calling BleManager.reset()
.public static final int FULL_MASK
BleManagerState
instances together.public static BleManagerState[] values()
for (BleManagerState c : BleManagerState.values()) System.out.println(c);
public static BleManagerState 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 static BleManagerState[] VALUES()
public int getNativeCode()
public int bit()
public boolean overlaps(int mask)
public boolean didEnter(int oldStateBits, int newStateBits)
State
DeviceStateListener.onEvent(com.idevicesinc.sweetblue.DeviceStateListener.StateEvent)
or ManagerStateListener.onEvent(com.idevicesinc.sweetblue.ManagerStateListener.StateEvent)
, this method tells you whether the
the 'this' state was appended.didEnter
in interface State
State.didExit(int, int)
public boolean didExit(int oldStateBits, int newStateBits)
State
State.didEnter(int, int)
.didExit
in interface State
State.didEnter(int, int)
public int or(BitwiseEnum state)
public boolean isNull()
State
true
if this state is meant to stand in for Java's built-in null
.isNull
in interface State
isNull
in interface UsesCustomNull