|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.devices.AbstractSensorDevice
de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice
de.unikassel.android.sdcframework.devices.AbstractAndroidSensorDevice
public abstract class AbstractAndroidSensorDevice
Base class for an Android Sensor
type.
Does provide the sensor listener and the logic for listener registration
depending on the scanner running state. Any extending class has just to
implement the abstract handler methods for sensor changes and the methods
from the SampleProvidingSensorDevice
interface.
AccelerometerDevice
Field Summary | |
---|---|
private Sensor |
sensor
The corresponding Android sensor |
private int |
sensorDelay
The sensor delay |
private SensorEventListener |
sensorListener
The sensor listener |
Constructor Summary | |
---|---|
AbstractAndroidSensorDevice(SensorDeviceIdentifier deviceId,
int androidSensorType,
Context context,
int sensorDelay)
Constructor |
Method Summary | |
---|---|
protected void |
doHandleSensorAccuracyChanged(Sensor sensor,
int accuracy)
Handler for the sensor accuracy changed event |
protected abstract void |
doHandleSensorChanged(SensorEvent event)
Handler for the sensor changed event ( with incoming updated sensor data ) |
protected void |
doSignalDeviceNotEnabledInSystem(Context applicationContext)
Method to signal the user that the device is disabled in the system and needed by this service. |
protected abstract SampleData |
getCurrentSampleData()
Getter for the current sample data |
SensorEventListener |
getListener()
Getter for the sensor listener |
Sample |
getSample()
Getter for a device sample |
Sensor |
getSensor()
Getter for the sensor |
boolean |
isDeviceInSystemEnabled(Context context)
Test method for the system wide enabled state of the device |
protected void |
onScannerRunningStateChange(boolean isRunning,
Context context)
Handler to react on scanner state changes. |
private void |
registerListener(Context context)
Does register the sensor listener for the device type |
private void |
setListener(SensorEventListener sensorListener)
Setter for the sensor event listener |
private void |
unregisterListener(Context context)
Does unregister the sensor listener for the device type |
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 |
Field Detail |
---|
private SensorEventListener sensorListener
private final Sensor sensor
private final int sensorDelay
Constructor Detail |
---|
public AbstractAndroidSensorDevice(SensorDeviceIdentifier deviceId, int androidSensorType, Context context, int sensorDelay) throws InvalidParameterException
deviceId
- the device identifierandroidSensorType
- the Android sensor typecontext
- the application contextsensorDelay
- the sensor delay
InvalidParameterException
- if sensor type is unavailable or unknownMethod Detail |
---|
private final void setListener(SensorEventListener sensorListener)
sensorListener
- the sensor event listenerpublic final SensorEventListener getListener()
public final Sensor getSensor()
public final boolean isDeviceInSystemEnabled(Context context)
SensorDevice
isDeviceInSystemEnabled
in interface SensorDevice
context
- the application context
protected final void doSignalDeviceNotEnabledInSystem(Context applicationContext)
AbstractSensorDevice
doSignalDeviceNotEnabledInSystem
in class AbstractSensorDevice
applicationContext
- the application contextprivate final void registerListener(Context context)
context
- the application contextprivate final void unregisterListener(Context context)
context
- the application contextprotected final void onScannerRunningStateChange(boolean isRunning, Context context)
ScannerStateAwareSensorDevice
onScannerRunningStateChange
in class ScannerStateAwareSensorDevice
isRunning
- the current scanner state after state changecontext
- the contextprotected abstract void doHandleSensorChanged(SensorEvent event)
event
- the sensor event to handleprotected void doHandleSensorAccuracyChanged(Sensor sensor, int accuracy)
sensor
- the sensoraccuracy
- the accuracypublic final Sample getSample()
SampleProvidingSensorDevice
getSample
in interface SampleProvidingSensorDevice
protected abstract SampleData getCurrentSampleData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |