public class I2cDeviceSynchReadHistoryImpl extends java.lang.Object implements I2cDeviceSynchReadHistory
I2cDeviceSynchReadHistoryImpl is a helper class providing an implementation
of the I2c read history queue| Modifier 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,
TimestampedI2cDatas 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
TimestampedI2cDatas 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()
I2cDeviceSynchReadHistoryTimestampedI2cDatas are (optionally)
placed as they become available.
To access these TimestampedI2cDatas, 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 TimestampedI2cDatas 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 I2cDeviceSynchReadHistoryTimestampedI2cDatas may be retrieved.I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)public void setHistoryQueueCapacity(int capacity)
I2cDeviceSynchReadHistoryTimestampedI2cDatas that will simultaneously be stored in the
history queue. If the queue is full and new TimestampedI2cDatas 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 I2cDeviceSynchReadHistorycapacity - the maximum number of items that may be stored in the history queueI2cDeviceSynchReadHistory.getHistoryQueue(),
I2cDeviceSynchReadHistory.getHistoryQueueCapacity()public int getHistoryQueueCapacity()
I2cDeviceSynchReadHistorygetHistoryQueueCapacity in interface I2cDeviceSynchReadHistoryI2cDeviceSynchReadHistory.setHistoryQueueCapacity(int),
I2cDeviceSynchReadHistory.getHistoryQueue()public void addToHistoryQueue(TimestampedI2cData data)