public interface I2cDeviceSynchReadHistory
I2cDeviceSynchReadHistory
provides a means by which one can be guaranteed
to be informed of all data read by through an I2cDeviceSynch
. This is
provided by means of a queue into which all data retrieved is (optionally) be stored.
This functionality can be useful in I2c devices in which the mere act of reading data causes state transitions in the actual device itself. For such devices, the history queue can (e.g.) assist the software driver layer for the device in reliably tracking the device state.
Implementations of I2cDeviceSynchReadHistory
are commonly retrieved by casting from
an implementation of I2cDeviceSynch
or I2cDeviceSynchSimple
(but don't forget
to first test using instanceOf
).
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.BlockingQueue<TimestampedI2cData> |
getHistoryQueue()
(Advanced) Returns a queue into which, if requested,
TimestampedI2cData s are (optionally)
placed as they become available. |
int |
getHistoryQueueCapacity()
Returns the current capacity of the history queue.
|
void |
setHistoryQueueCapacity(int capacity)
Sets the maximum number of
TimestampedI2cData s that will simultaneously be stored in the
history queue. |
void setHistoryQueueCapacity(int capacity)
TimestampedI2cData
s that will simultaneously be stored in the
history queue. If the queue is full and new TimestampedI2cData
s become available, older
data will be discarded. The history queue initially has a capacity of zero.
Note that calling this method invalidates any history queue retrieved previously
through getHistoryQueue()
.
capacity
- the maximum number of items that may be stored in the history queuegetHistoryQueue()
,
getHistoryQueueCapacity()
int getHistoryQueueCapacity()
setHistoryQueueCapacity(int)
,
getHistoryQueue()
java.util.concurrent.BlockingQueue<TimestampedI2cData> getHistoryQueue()
TimestampedI2cData
s are (optionally)
placed as they become available.
To access these TimestampedI2cData
s, call setHistoryQueueCapacity(int)
to enable
the history queue. Once enabled, the history queue can be accessed using getHistoryQueue()
and the methods thereon used to access TimestampedI2cData
s as they become available.
When setHistoryQueueCapacity(int)
is called, any history queue returned previously by
getHistoryQueue()
becomes invalid and must be re-fetched.
TimestampedI2cData
s may be retrieved.setHistoryQueueCapacity(int)