|
||||||||||
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.timeseries.SensorObservationTask
public final class SensorObservationTask
This class does implement a runnable task to be executed delayed by an OS
handler.
Every time this runnable is executed, it will post itself for another delayed
execution according to the configured frequency. Each time the task is
executed the sample taking method of the linked sensor scanner component is
invoked.
In case of delayed execution by the OS this task will calculate the optimal
next execution time to stay in sync.
Field Summary | |
---|---|
private long |
frequency
The execution time interval in milliseconds. |
private long |
initialDelay
The initial delay. |
private LooperThread |
looperThread
The looper thread with the handler to repost the task to, for delayed runnable execution. |
private long |
nextExpectedTime
The last call time |
private SensorScanner |
sensorScanner
The sensor observer. |
Constructor Summary | |
---|---|
SensorObservationTask(SensorScanner sensorScanner,
LooperThread looperThread,
long frequency,
long initialDelay)
Constructor |
Method Summary | |
---|---|
long |
getFrequency()
Getter for the frequency |
protected void |
onActivationStateChange(boolean active)
Handler for activation state changes |
void |
run()
|
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 |
Methods inherited from interface org.android.activityminer.logic.util.ActivatableComponent |
---|
isActive, setActivationState |
Field Detail |
---|
private final SensorScanner sensorScanner
private final LooperThread looperThread
private final long frequency
private final long initialDelay
private long nextExpectedTime
Constructor Detail |
---|
public SensorObservationTask(SensorScanner sensorScanner, LooperThread looperThread, long frequency, long initialDelay)
sensorScanner
- the sensor scanner instancelooperThread
- the looperThread with the handler to repost the task to for
delayed runnable executionfrequency
- the execution frequency in millisecondsinitialDelay
- the initial delayMethod Detail |
---|
public final long getFrequency()
TimerTask
getFrequency
in interface TimerTask
public final void run()
run
in interface Runnable
protected final void onActivationStateChange(boolean active)
AbstractActivatableComponentImpl
onActivationStateChange
in class AbstractActivatableComponentImpl
active
- the new activation state
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |