public static class BondListener.BondEvent extends Event implements UsesCustomNull
BondListener.onEvent(BondEvent)
to provide more information about a BleDevice.bond()
attempt.Modifier and Type | Class and Description |
---|---|
static class |
BondListener.BondEvent.Type |
Modifier and Type | Method and Description |
---|---|
BleDevice |
device()
The
BleDevice that attempted to BleDevice.bond() . |
int |
failReason()
If
status() is BondListener.Status.FAILED_EVENTUALLY , this integer will
be one of the values enumerated in BluetoothDevice that start with UNBOND_REASON such as
BleStatuses.UNBOND_REASON_AUTH_FAILED . |
State.ChangeIntent |
intent()
Tells whether the bond was created through an explicit call through SweetBlue, or otherwise.
|
boolean |
isNull()
Returns
true if the object's state represents what would otherwise be Java's built-in null . |
java.lang.String |
macAddress()
Convience to return the mac address of
device() . |
BondListener.Status |
status()
The
BondListener.Status associated with this event. |
java.lang.String |
toString() |
BondListener.BondEvent.Type |
type()
Used to indicate whether this
BondListener.BondEvent is for bonding, or unbonding. |
boolean |
wasCancelled()
Forwards
BondListener.Status.wasCancelled() . |
boolean |
wasSuccess()
Shortcut for checking if
status() == BondListener.Status.SUCCESS . |
public final BleDevice device()
BleDevice
that attempted to BleDevice.bond()
.public final java.lang.String macAddress()
device()
.public final BondListener.Status status()
BondListener.Status
associated with this event.public final int failReason()
status()
is BondListener.Status.FAILED_EVENTUALLY
, this integer will
be one of the values enumerated in BluetoothDevice
that start with UNBOND_REASON
such as
BleStatuses.UNBOND_REASON_AUTH_FAILED
. Otherwise it will be equal to BleStatuses.BOND_FAIL_REASON_NOT_APPLICABLE
.
See also a publically accessible list in BleStatuses
.public final BondListener.BondEvent.Type type()
BondListener.BondEvent
is for bonding, or unbonding.public final State.ChangeIntent intent()
State.ChangeIntent.INTENTIONAL
, then BleDevice.bond()
(or overloads) were called.
If State.ChangeIntent.UNINTENTIONAL
,
then the bond was created "spontaneously" as far as SweetBlue is concerned, whether through another app, the OS Bluetooth
settings, or maybe from a request by the remote BLE device itself.public final boolean wasSuccess()
status()
== BondListener.Status.SUCCESS
.public final boolean wasCancelled()
BondListener.Status.wasCancelled()
.public final java.lang.String toString()
toString
in class java.lang.Object
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