|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unikassel.android.sdcframework.util.LifeCycleObjectImpl
de.unikassel.android.sdcframework.devices.SensorDeviceManagerImpl
public final class SensorDeviceManagerImpl
Implementation of the sensor device manager implementation. It does create
and supervises all sensor devices for available supported sensor types and is
managing the sample observation and configuration updates for the device
module.
The sensor device manager is the main interface to the device module.
To receive sensor samples an observer
for the type
Sample must register here.
SensorDeviceFactory
,
ObservableEventSource
Field Summary | |
---|---|
private SensorDeviceFactory |
deviceFactory
the sensor device factory |
private Map<SensorDeviceIdentifier,SensorDevice> |
mapDevices
The sensor device map |
private ApplicationPreferenceManager |
preferenceManager
The preference manager |
Constructor Summary | |
---|---|
SensorDeviceManagerImpl(ApplicationPreferenceManager preferenceManager)
Constructor |
Method Summary | |
---|---|
boolean |
accept(SensorDeviceVisitor visitor)
Method to accept a visitor |
private void |
configureDevices(Context applicationContext)
Does configure all devices with preference settings. |
private void |
configureLocationTracker(boolean active)
Method to configure the location tracker |
private void |
createSensorDevices(Context applicationContext)
Does create sensor device for all known available sensors |
private void |
destroyDevices(Context applicationContext)
Does destroy the devices and scanner |
private void |
disableDeviceScanning(Context context)
Does disable all running device scanners |
void |
enableLocationInfoPerSample(boolean enable)
Method to enable location information per sample |
private SensorDeviceConfiguration |
getConfiguration(SensorDeviceIdentifier deviceIdentifier,
Context applicationContext)
Does determine the current device configuration |
SensorDeviceFactory |
getDeviceFactory()
Getter for the device factory |
Collection<SensorDevice> |
getDevices()
Getter for the devices |
private Map<SensorDeviceIdentifier,SensorDevice> |
getMapDevices()
Getter for the devices map |
ApplicationPreferenceManager |
getPreferenceManager()
Getter for the application preference manager |
void |
onCreate(Context applicationContext)
Creation method |
void |
onDestroy(Context applicationContext)
Destroy method |
void |
onPause(Context applicationContext)
Pause method |
void |
onResume(Context applicationContext)
Resume method |
void |
registerEventObserver(EventObserver<? extends Sample> observer)
Does register an observer |
void |
removeAllObservers()
Does remove all registered observers |
private void |
setMapDevices(Map<SensorDeviceIdentifier,SensorDevice> mapDevices)
Setter for the devices map |
void |
unregisterEventObserver(EventObserver<? extends Sample> observer)
Does delete a registered observer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final SensorDeviceFactory deviceFactory
private final ApplicationPreferenceManager preferenceManager
private Map<SensorDeviceIdentifier,SensorDevice> mapDevices
Constructor Detail |
---|
public SensorDeviceManagerImpl(ApplicationPreferenceManager preferenceManager) throws InvalidParameterException
preferenceManager
- the application preference manager
InvalidParameterException
- in case of invalid parametersMethod Detail |
---|
public SensorDeviceFactory getDeviceFactory()
public final ApplicationPreferenceManager getPreferenceManager()
private Map<SensorDeviceIdentifier,SensorDevice> getMapDevices()
private void setMapDevices(Map<SensorDeviceIdentifier,SensorDevice> mapDevices)
mapDevices
- the devices map to setpublic Collection<SensorDevice> getDevices()
private void createSensorDevices(Context applicationContext)
applicationContext
- the application contextprivate void disableDeviceScanning(Context context)
context
- the application contextprivate void configureDevices(Context applicationContext)
applicationContext
- the application contextprivate SensorDeviceConfiguration getConfiguration(SensorDeviceIdentifier deviceIdentifier, Context applicationContext)
deviceIdentifier
- the device identifierapplicationContext
- the application context
public void onCreate(Context applicationContext)
LifeCycleObject
onCreate
in interface LifeCycleObject
onCreate
in class LifeCycleObjectImpl
applicationContext
- the application contextpublic void onResume(Context applicationContext)
LifeCycleObject
onResume
in interface LifeCycleObject
onResume
in class LifeCycleObjectImpl
applicationContext
- the application contextprivate void configureLocationTracker(boolean active)
active
- flag is location tracker is active or notpublic void onPause(Context applicationContext)
LifeCycleObject
onPause
in interface LifeCycleObject
onPause
in class LifeCycleObjectImpl
applicationContext
- the application contextpublic void onDestroy(Context applicationContext)
LifeCycleObject
onDestroy
in interface LifeCycleObject
onDestroy
in class LifeCycleObjectImpl
applicationContext
- the application contextprivate void destroyDevices(Context applicationContext)
applicationContext
- the application contextpublic boolean accept(SensorDeviceVisitor visitor)
VisitableDevice
accept
in interface VisitableDevice
visitor
- the visitor to accept
public void registerEventObserver(EventObserver<? extends Sample> observer)
ObserverRegistration
registerEventObserver
in interface ObserverRegistration<Sample>
observer
- the observer to addpublic void unregisterEventObserver(EventObserver<? extends Sample> observer)
ObserverRegistration
unregisterEventObserver
in interface ObserverRegistration<Sample>
observer
- the observer to deletepublic void removeAllObservers()
ObserverRegistration
removeAllObservers
in interface ObserverRegistration<Sample>
public void enableLocationInfoPerSample(boolean enable)
SensorDeviceManager
enableLocationInfoPerSample
in interface SensorDeviceManager
enable
- if true, location information will be added to each sample
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |