public abstract class RxBleTransaction extends java.lang.Object implements P_ITransaction
Modifier and Type | Class and Description |
---|---|
static class |
RxBleTransaction.RxAuth |
static class |
RxBleTransaction.RxInit |
static class |
RxBleTransaction.RxOta |
P_ITransaction.Type
Constructor and Description |
---|
RxBleTransaction() |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
<any> |
disableNotifies(java.util.List<BleNotify> notifies)
Forwards to
RxBleDevice.disableNotifies(List) |
<any> |
disableNotify(BleNotify notify)
Forwards to
RxBleDevice.disableNotify(BleNotify) |
<any> |
enableNotifies(java.util.List<BleNotify> notifies)
Forwards to
RxBleDevice.enableNotifies(List) |
<any> |
enableNotify(BleNotify notify)
Forwards to
RxBleDevice.enableNotify(BleNotify) |
boolean |
fail()
Call this from subclasses to indicate that the transaction has failed.
|
protected BleTransaction.Atomicity |
getAtomicity()
Default is
Boolean.FALSE . |
RxBleDevice |
getDevice()
Returns the device this transaction is running on.
|
double |
getTime()
Returns the total time that this transaction has been running.
|
P_ITransaction.Type |
getTransactionType() |
boolean |
isRunning()
Returns whether the transaction is currently running.
|
protected void |
onEnd(BleTransaction.EndReason reason)
Called when a transaction ends, either due to the transaction itself finishing itself
through
fail() or succeed() , or from the library implicitly ending
the transaction, for example if getDevice() becomes BleDeviceState.BLE_DISCONNECTED . |
<any> |
read(BleDescriptorRead read)
Forwards to
RxBleDevice.read(BleDescriptorRead) |
<any> |
read(BleRead read)
Forwards to
RxBleDevice.read(BleRead) |
<any> |
readMany(BleRead[] bleReads)
Forwards to
BleDevice.readMany(BleRead[]) |
<any> |
readMany(java.lang.Iterable<BleRead> bleReads)
Forwards to
BleDevice.readMany(Iterable) |
<any> |
readPhyOptions()
Forwards to
RxBleDevice.readPhyOptions() |
<any> |
readRssi()
Forwards to
RxBleDevice.readRssi() |
<any> |
setConnectionPriority(BleConnectionPriority connectionPriority)
|
<any> |
setMtu(int mtu)
Forwards to
RxBleDevice.negotiateMtu(int) |
<any> |
setMtuToDefault()
Forwards to
RxBleDevice.negotiateMtuToDefault() |
<any> |
setPhyOptions(Phy phyOptions)
Forwards to
RxBleDevice.setPhyOptions(Phy) |
protected abstract void |
start() |
boolean |
succeed()
Call this from subclasses to indicate that the transaction has succeeded.
|
protected void |
update(double timeStep)
Optional convenience method to override if you want to do periodic updates or time-based calculations.
|
<any> |
write(BleDescriptorWrite write)
Forwards to
RxBleDevice.write(BleDescriptorWrite) |
<any> |
write(BleWrite write)
Forwards to
RxBleDevice.write(BleWrite) |
protected abstract void start()
public P_ITransaction.Type getTransactionType()
getTransactionType
in interface P_ITransaction
protected void update(double timeStep)
protected void onEnd(BleTransaction.EndReason reason)
fail()
or succeed()
, or from the library implicitly ending
the transaction, for example if getDevice()
becomes BleDeviceState.BLE_DISCONNECTED
.
Override this method to wrap up any loose ends or notify UI or what have you.protected BleTransaction.Atomicity getAtomicity()
Boolean.FALSE
. Optionally override if you want your transaction's reads/writes to execute "atomically".
This means that if you're connected to multiple devices only the reads/writes of this transaction's device
will be executed until this transaction is finished.public RxBleDevice getDevice()
public boolean isRunning()
public void cancel()
public boolean fail()
GenericListener_Void.onEvent(Event)
when ReadWriteListener.Status
is something other
than ReadWriteListener.Status.SUCCESS
. If you do so,
DeviceReconnectFilter.ConnectFailEvent.txnFailReason()
will be set.false
if the transaction wasn't running to begin with.public boolean succeed()
Boolean.FALSE
if the transaction wasn't running to begin with.public double getTime()
update(double)
for example to fail()
or succeed()
a transaction that has taken longer than a certain
amount of time.BleTransaction.update(double)
public final <any> read(BleRead read)
RxBleDevice.read(BleRead)
public final <any> readMany(BleRead[] bleReads)
BleDevice.readMany(BleRead[])
public final <any> readMany(java.lang.Iterable<BleRead> bleReads)
BleDevice.readMany(Iterable)
public final <any> enableNotifies(java.util.List<BleNotify> notifies)
RxBleDevice.enableNotifies(List)
public final <any> enableNotify(BleNotify notify)
RxBleDevice.enableNotify(BleNotify)
public final <any> disableNotify(BleNotify notify)
RxBleDevice.disableNotify(BleNotify)
public final <any> disableNotifies(java.util.List<BleNotify> notifies)
RxBleDevice.disableNotifies(List)
public final <any> write(BleWrite write)
RxBleDevice.write(BleWrite)
public final <any> write(BleDescriptorWrite write)
RxBleDevice.write(BleDescriptorWrite)
public final <any> read(BleDescriptorRead read)
RxBleDevice.read(BleDescriptorRead)
public final <any> readRssi()
RxBleDevice.readRssi()
public final <any> setConnectionPriority(BleConnectionPriority connectionPriority)
public final <any> setMtuToDefault()
RxBleDevice.negotiateMtuToDefault()
public final <any> setMtu(int mtu)
RxBleDevice.negotiateMtu(int)
public final <any> setPhyOptions(Phy phyOptions)
RxBleDevice.setPhyOptions(Phy)
public final <any> readPhyOptions()
RxBleDevice.readPhyOptions()