de.unikassel.android.sdcframework.devices
Class SamplingCausingAndroidSensorDevice
java.lang.Object
de.unikassel.android.sdcframework.devices.AbstractSensorDevice
de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice
de.unikassel.android.sdcframework.devices.AbstractAndroidSensorDevice
de.unikassel.android.sdcframework.devices.SamplingCausingAndroidSensorDevice
- All Implemented Interfaces:
- SampleProvidingSensorDevice, SensorDevice, VisitableDevice
- Direct Known Subclasses:
- LightDevice, ProximityDevice, TemperatureDevice
public abstract class SamplingCausingAndroidSensorDevice
- extends AbstractAndroidSensorDevice
Base class for Android Sensor based devices, which do cause sampling in case
of sensor data change events. This class is intended to work together with a
PassiveSampleTakingDeviceScanner
.
- See Also:
TemperatureDevice
,
LightDevice
,
ProximityDevice
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDevice |
accept, doHandleDeviceDisabledBySystem, doHandleDeviceEnabledBySystem, getConfiguration, getDeviceIdentifier, getScanner, isAirplaneModeOn, isDeviceScanningEnabled, onCreate, onDestroy, setDeviceIdentifier, setScanner, updateConfiguration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SamplingCausingAndroidSensorDevice
public SamplingCausingAndroidSensorDevice(SensorDeviceIdentifier deviceId,
int androidSensorType,
Context context,
int sensorDelay)
throws InvalidParameterException
- Constructor
- Parameters:
deviceId
- the device identifierandroidSensorType
- the Android sensor typecontext
- the application contextsensorDelay
- the sensor delay
- Throws:
InvalidParameterException
- if sensor type is unavailable or unknown
triggerSampling
private final void triggerSampling()
- Method to trigger sampling
doHandleSensorChanged
public final void doHandleSensorChanged(SensorEvent event)
- Description copied from class:
AbstractAndroidSensorDevice
- Handler for the sensor changed event ( with incoming updated sensor data )
- Specified by:
doHandleSensorChanged
in class AbstractAndroidSensorDevice
- Parameters:
event
- the sensor event to handle
update
protected abstract boolean update(SensorEvent event)
- Method to update the sensor data
- Parameters:
event
- the sensor event to handle
- Returns:
- true if data have been updated, false otherwise