|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.util.ObservableEventSourceImpl<Sample>
de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner
de.unikassel.android.sdcframework.devices.SampleTakingDeviceScanner
public abstract class SampleTakingDeviceScanner
Base class for sensor device scanner types, which do active take a sample of
the associated device in the configured frequency.
The timing is done by the usage of an OS handler to schedule the timed task.
This scanner is designed to work together with devices implementing the
SampleProvidingSensorDevice interface.
SampleProvidingSensorDevice
,
AccelerometerDeviceScanner
,
GSMDeviceScanner
,
GPSDeviceScanner
Field Summary | |
---|---|
private Handler |
handler
The handler used for timing instead of a timer object |
private SampleTakingTask |
timerTask
The timer task to be executed on timer event |
Constructor Summary | |
---|---|
SampleTakingDeviceScanner()
Constructor |
Method Summary | |
---|---|
protected Handler |
getHandler()
Getter for the handler |
protected SampleTakingTask |
getTimerTask()
Getter for the timer task |
protected boolean |
isCompatibleDevice(SensorDevice device)
Validation method for a compatible device type |
void |
onDestroy(Context context)
Is called when the owner destroys this scanner |
private void |
setHandler(Handler handler)
Setter for the handler |
private void |
setTimerTask(SampleTakingTask timerTask)
Setter for the timer task |
boolean |
start(Context context)
Does start sampling |
boolean |
stop(Context context)
Does stop sampling |
void |
takeSample()
The cyclic executed method to take a sample from the device |
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner |
---|
enable, getDevice, isActive, isEnabled, setActive, setDevice |
Methods inherited from class de.unikassel.android.sdcframework.util.ObservableEventSourceImpl |
---|
getObservers, hasObservers, notify, onObserverRegistration, onObserverUnregistration, registerEventObserver, removeAllObservers, unregisterEventObserver |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObservableEventSource |
---|
hasObservers, notify |
Methods inherited from interface de.unikassel.android.sdcframework.util.facade.ObserverRegistration |
---|
registerEventObserver, removeAllObservers, unregisterEventObserver |
Field Detail |
---|
private Handler handler
private SampleTakingTask timerTask
Constructor Detail |
---|
public SampleTakingDeviceScanner()
Method Detail |
---|
protected boolean isCompatibleDevice(SensorDevice device)
AbstractSensorDeviceScanner
isCompatibleDevice
in class AbstractSensorDeviceScanner
device
- the device to test for compatibilitypublic void takeSample()
protected final Handler getHandler()
private final void setHandler(Handler handler)
handler
- the handler to setprotected final SampleTakingTask getTimerTask()
private final void setTimerTask(SampleTakingTask timerTask)
timerTask
- the timer task to setpublic boolean start(Context context)
SensorDeviceScanner
context
- the application context
public boolean stop(Context context)
SensorDeviceScanner
context
- the application context
public void onDestroy(Context context)
SensorDeviceScanner
onDestroy
in interface SensorDeviceScanner
onDestroy
in class AbstractSensorDeviceScanner
context
- the application context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |