de.unikassel.android.sdcframework.devices
Class AbstractSensorDeviceScanner

Package class diagram package AbstractSensorDeviceScanner
java.lang.Object
  extended by de.unikassel.android.sdcframework.util.ObservableEventSourceImpl<Sample>
      extended by de.unikassel.android.sdcframework.devices.AbstractSensorDeviceScanner
All Implemented Interfaces:
SensorDeviceScanner, ObservableEventSource<Sample>, ObserverRegistration<Sample>
Direct Known Subclasses:
ContentProviderDeviceScanner, SampleReceivingDeviceScanner, SampleTakingDeviceScanner

public abstract class AbstractSensorDeviceScanner
extends ObservableEventSourceImpl<Sample>
implements SensorDeviceScanner


Field Summary
private  SensorDevice device
          the scanned sensor device
private  AtomicBoolean isActive
          The active state flag
 
Constructor Summary
AbstractSensorDeviceScanner()
          Constructor
 
Method Summary
 boolean enable(boolean enable, Context context)
          Does set the enabled state for the scanner.
 SensorDevice getDevice()
          Getter for the sensor device
protected  boolean isActive()
          Getter for the scanner activation state
protected abstract  boolean isCompatibleDevice(SensorDevice device)
          Validation method for a compatible device type
 boolean isEnabled()
          Getter for the enabled state
 void onDestroy(Context context)
          Is called when the owner destroys this scanner
protected  void setActive(boolean active)
          Setter for the scanner activation state
 void setDevice(SensorDevice device, Context context)
          Setter for the sensor device
 
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.devices.facade.SensorDeviceScanner
start, stop
 
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

device

private SensorDevice device
the scanned sensor device


isActive

private final AtomicBoolean isActive
The active state flag

Constructor Detail

AbstractSensorDeviceScanner

public AbstractSensorDeviceScanner()
Constructor

Method Detail

setDevice

public final void setDevice(SensorDevice device,
                            Context context)
Description copied from interface: SensorDeviceScanner
Setter for the sensor device

Specified by:
setDevice in interface SensorDeviceScanner
Parameters:
device - the sensor device to set
context - the application context

isCompatibleDevice

protected abstract boolean isCompatibleDevice(SensorDevice device)
Validation method for a compatible device type

Parameters:
device - the device to test for compatibility

getDevice

public final SensorDevice getDevice()
Description copied from interface: SensorDeviceScanner
Getter for the sensor device

Specified by:
getDevice in interface SensorDeviceScanner
Returns:
the sensor device

isEnabled

public final boolean isEnabled()
Description copied from interface: SensorDeviceScanner
Getter for the enabled state

Specified by:
isEnabled in interface SensorDeviceScanner
Returns:
true if scanner is running, false otherwise

setActive

protected final void setActive(boolean active)
Setter for the scanner activation state

Parameters:
active - the state to set

isActive

protected final boolean isActive()
Getter for the scanner activation state

Returns:
the scanner activation state

enable

public final boolean enable(boolean enable,
                            Context context)
Description copied from interface: SensorDeviceScanner
Does set the enabled state for the scanner. Will invoke call to start() or stop() depending on current running state.

Specified by:
enable in interface SensorDeviceScanner
Parameters:
enable - enabled state for the scanner to set
context - the application context
Returns:
true if successful enabled, false otherwise

onDestroy

public void onDestroy(Context context)
Description copied from interface: SensorDeviceScanner
Is called when the owner destroys this scanner

Specified by:
onDestroy in interface SensorDeviceScanner
Parameters:
context - the application context