|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.android.activityminer.logic.util.AbstractActivatableComponentImpl
org.android.activityminer.logic.devices.AccelerometerDataCache
public class AccelerometerDataCache
The data cache to hold accelerometer samples for scanner polls.
Nested Class Summary | |
---|---|
private class |
AccelerometerDataCache.CacheData
The cache data |
Field Summary | |
---|---|
protected ConcurrentLinkedQueue<AccelerometerDataCache.CacheData> |
cache
The sample cache. |
private AccelerometerDataCache.CacheData |
lastTakenSample
Last taken sample. |
private long |
maxToleratedGap
The maximum tolerated gap for samples before an error notification is fired |
private ObservableEventSource<SampleGapErrorEvent> |
observableGapErrorSource
The event source to delegate signaling of sample gap errors to. |
Constructor Summary | |
---|---|
AccelerometerDataCache(long sampleRate)
Constructor |
Method Summary | |
---|---|
void |
add(double[] currentData,
long ts)
Does add a new sample to the cache. |
boolean |
hasObservers()
|
void |
notify(SampleGapErrorEvent data)
|
protected void |
onActivationStateChange(boolean active)
Handler for activation state changes |
void |
registerEventObserver(EventObserver<? extends SampleGapErrorEvent> observer)
|
void |
removeAllObservers()
|
double[] |
takeSample(long ts)
Does return the closest sample data from cache |
void |
unregisterEventObserver(EventObserver<? extends SampleGapErrorEvent> observer)
|
Methods inherited from class org.android.activityminer.logic.util.AbstractActivatableComponentImpl |
---|
isActive, setActivationState |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final long maxToleratedGap
private final AccelerometerDataCache.CacheData lastTakenSample
private final ObservableEventSource<SampleGapErrorEvent> observableGapErrorSource
protected final ConcurrentLinkedQueue<AccelerometerDataCache.CacheData> cache
Constructor Detail |
---|
public AccelerometerDataCache(long sampleRate)
sampleRate
- the configured sample rateMethod Detail |
---|
public final double[] takeSample(long ts)
ts
- the time stamp
protected final void onActivationStateChange(boolean active)
AbstractActivatableComponentImpl
onActivationStateChange
in class AbstractActivatableComponentImpl
active
- the new activation statepublic final void add(double[] currentData, long ts)
currentData
- the accelerometer data to addts
- the original sample time stamppublic final void registerEventObserver(EventObserver<? extends SampleGapErrorEvent> observer)
registerEventObserver
in interface ObserverRegistration<SampleGapErrorEvent>
public final void unregisterEventObserver(EventObserver<? extends SampleGapErrorEvent> observer)
unregisterEventObserver
in interface ObserverRegistration<SampleGapErrorEvent>
public final void removeAllObservers()
removeAllObservers
in interface ObserverRegistration<SampleGapErrorEvent>
public final void notify(SampleGapErrorEvent data)
notify
in interface ObservableEventSource<SampleGapErrorEvent>
public final boolean hasObservers()
hasObservers
in interface ObservableEventSource<SampleGapErrorEvent>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |