public class I2cDeviceSynchReadHistoryImpl extends java.lang.Object implements I2cDeviceSynchReadHistory
I2cDeviceSynchReadHistoryImpl
is a helper class providing an implementation
of the I2c read history queueModifier and Type | Field and Description |
---|---|
protected java.util.concurrent.BlockingQueue<TimestampedI2cData> |
historyQueue |
protected int |
historyQueueCapacity |
protected java.lang.Object |
historyQueueLock |
Constructor and Description |
---|
I2cDeviceSynchReadHistoryImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addToHistoryQueue(TimestampedI2cData data) |
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. |
protected final java.lang.Object historyQueueLock
protected java.util.concurrent.BlockingQueue<TimestampedI2cData> historyQueue
protected int historyQueueCapacity
public java.util.concurrent.BlockingQueue<TimestampedI2cData> getHistoryQueue()
I2cDeviceSynchReadHistory
TimestampedI2cData
s are (optionally)
placed as they become available.
To access these TimestampedI2cData
s, call I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
to enable
the history queue. Once enabled, the history queue can be accessed using I2cDeviceSynchReadHistory.getHistoryQueue()
and the methods thereon used to access TimestampedI2cData
s as they become available.
When I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
is called, any history queue returned previously by
I2cDeviceSynchReadHistory.getHistoryQueue()
becomes invalid and must be re-fetched.
getHistoryQueue
in interface I2cDeviceSynchReadHistory
TimestampedI2cData
s may be retrieved.I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
public void setHistoryQueueCapacity(int capacity)
I2cDeviceSynchReadHistory
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 I2cDeviceSynchReadHistory.getHistoryQueue()
.
setHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
capacity
- the maximum number of items that may be stored in the history queueI2cDeviceSynchReadHistory.getHistoryQueue()
,
I2cDeviceSynchReadHistory.getHistoryQueueCapacity()
public int getHistoryQueueCapacity()
I2cDeviceSynchReadHistory
getHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
,
I2cDeviceSynchReadHistory.getHistoryQueue()
public void addToHistoryQueue(TimestampedI2cData data)