de.unikassel.android.sdcframework.devices
Class SamplingCausingAndroidSensorDevice

Package class diagram package SamplingCausingAndroidSensorDevice
java.lang.Object
  extended by de.unikassel.android.sdcframework.devices.AbstractSensorDevice
      extended by de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice
          extended by de.unikassel.android.sdcframework.devices.AbstractAndroidSensorDevice
              extended by 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

Constructor Summary
SamplingCausingAndroidSensorDevice(SensorDeviceIdentifier deviceId, int androidSensorType, Context context, int sensorDelay)
          Constructor
 
Method Summary
 void doHandleSensorChanged(SensorEvent event)
          Handler for the sensor changed event ( with incoming updated sensor data )
private  void triggerSampling()
          Method to trigger sampling
protected abstract  boolean update(SensorEvent event)
          Method to update the sensor data
 
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractAndroidSensorDevice
doHandleSensorAccuracyChanged, doSignalDeviceNotEnabledInSystem, getCurrentSampleData, getListener, getSample, getSensor, isDeviceInSystemEnabled, onScannerRunningStateChange
 
Methods inherited from class de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice
enableDeviceScanning, onConfigurationChanged
 
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
 
Methods inherited from interface de.unikassel.android.sdcframework.devices.facade.SampleProvidingSensorDevice
hasSample
 

Constructor Detail

SamplingCausingAndroidSensorDevice

public SamplingCausingAndroidSensorDevice(SensorDeviceIdentifier deviceId,
                                          int androidSensorType,
                                          Context context,
                                          int sensorDelay)
                                   throws InvalidParameterException
Constructor

Parameters:
deviceId - the device identifier
androidSensorType - the Android sensor type
context - the application context
sensorDelay - the sensor delay
Throws:
InvalidParameterException - if sensor type is unavailable or unknown
Method Detail

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