|
||||||||||
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.AbstractLocationDevice
public abstract class AbstractLocationDevice
Implementation of an abstract location provider based sensor device as sample providing device.
ScannerStateAwareSensorDevice
,
SampleProvidingSensorDevice
Nested Class Summary | |
---|---|
private class |
AbstractLocationDevice.ProviderLocationListener
Internal location listener implementation |
private class |
AbstractLocationDevice.ProviderStateListener
Internal location provider state listener implementation |
Field Summary | |
---|---|
private Context |
context
The service application context |
private LocationSampleData |
currentSampleData
The current available sample |
private boolean |
isLocationListenerRegistered
Flag if location listener is registered |
private boolean |
isStateListenerRegistered
Flag if state listener is registered |
private AbstractLocationDevice.ProviderLocationListener |
locationListener
The GPS location listener used for sampling |
private static int |
LOWER_FREQUENCY
The lower frequency to avoid battery drain |
private String |
provider
The location provider |
private AbstractLocationDevice.ProviderStateListener |
stateListener
The GPS state listener used for adding/removal of location listener |
Constructor Summary | |
---|---|
AbstractLocationDevice(Context context,
SensorDeviceIdentifier id,
String provider)
Constructor |
Method Summary | |
---|---|
void |
doHandleLocationChanged(Location location)
Handler for the location changed event |
protected void |
doSignalDeviceNotEnabledInSystem(Context applicationContext)
Method to signal the user that the device is disabled in the system and needed by this service. |
private Context |
getContext()
Getter for the context |
protected abstract SampleData |
getCurrentSampleData()
Method to get the current sample data |
protected abstract int |
getDeviceDisabledMessageID()
Method to get the device disabled message |
protected LocationSampleData |
getLocationData()
Getter for the currentSampleData |
private AbstractLocationDevice.ProviderLocationListener |
getLocationListener()
Getter for the locationListener |
private LocationManager |
getLocationManager()
Getter for the locationManager |
protected int |
getLowerFrequency()
The minimum frequency for location updates |
protected float |
getMinDistance()
The minimum distance in meters for location updates |
Sample |
getSample()
Getter for a device sample |
private AbstractLocationDevice.ProviderStateListener |
getStateListener()
Getter for the stateListener |
boolean |
hasSample()
Test method for a sample available |
boolean |
isAirplaneModeOn(Context applicationContext)
Getter for the state of the airplaine mode |
boolean |
isDeviceInSystemEnabled(Context context)
Test method for the system wide enabled state of the device |
boolean |
isLocationListenerRegistered()
Getter for the isLocationListenerRegistered flag |
boolean |
isStateListenerRegistered()
Getter for the isStateListenerRegistered flag |
protected void |
onConfigurationChanged()
Callback to signal configuration of device has changed |
void |
onCreate(Context context)
Is called when this device is created |
void |
onDestroy(Context context)
Is called when the owner destroys this device |
protected void |
onScannerRunningStateChange(boolean isRunning,
Context context)
Handler to react on scanner state changes. |
private void |
registerLocationListener()
Does register the location listener |
private void |
registerStateListener()
Does register the GPS state listener |
private void |
setContext(Context context)
Setter for the context |
private void |
setLocationListener(AbstractLocationDevice.ProviderLocationListener locationListener)
Setter for the locationListener |
private void |
setLocationListenerRegistered(boolean isLocationListenerRegistered)
Setter for the isLocationListenerRegistered flag |
private void |
setStateListener(AbstractLocationDevice.ProviderStateListener stateListener)
Setter for the stateListener |
void |
setStateListenerRegistered(boolean isStateListenerRegistered)
Setter for the isStateListenerRegistered flag |
private void |
unregisterLocationListener()
Does unregister the location listener |
private void |
unregisterStateListener()
Does unregister the GPS state listener |
Methods inherited from class de.unikassel.android.sdcframework.devices.ScannerStateAwareSensorDevice |
---|
enableDeviceScanning |
Methods inherited from class de.unikassel.android.sdcframework.devices.AbstractSensorDevice |
---|
accept, doHandleDeviceDisabledBySystem, doHandleDeviceEnabledBySystem, getConfiguration, getDeviceIdentifier, getScanner, isDeviceScanningEnabled, setDeviceIdentifier, setScanner, updateConfiguration |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int LOWER_FREQUENCY
private Context context
private AbstractLocationDevice.ProviderLocationListener locationListener
private AbstractLocationDevice.ProviderStateListener stateListener
private final LocationSampleData currentSampleData
private boolean isLocationListenerRegistered
private boolean isStateListenerRegistered
private final String provider
Constructor Detail |
---|
public AbstractLocationDevice(Context context, SensorDeviceIdentifier id, String provider)
context
- the contextid
- the sensor device identifierprovider
- the network providerMethod Detail |
---|
private final void setContext(Context context)
context
- the context to setprivate final Context getContext()
private final LocationManager getLocationManager()
private final AbstractLocationDevice.ProviderLocationListener getLocationListener()
private final void setLocationListener(AbstractLocationDevice.ProviderLocationListener locationListener)
locationListener
- the locationListener to setprivate final void setStateListener(AbstractLocationDevice.ProviderStateListener stateListener)
stateListener
- the stateListener to setprivate final AbstractLocationDevice.ProviderStateListener getStateListener()
public final boolean isLocationListenerRegistered()
private final void setLocationListenerRegistered(boolean isLocationListenerRegistered)
isLocationListenerRegistered
- the isLocationListenerRegistered flag to setpublic boolean isStateListenerRegistered()
public void setStateListenerRegistered(boolean isStateListenerRegistered)
isStateListenerRegistered
- the isStateListenerRegistered flag to setprivate final void registerLocationListener()
protected int getLowerFrequency()
protected float getMinDistance()
private final void unregisterLocationListener()
private final void registerStateListener()
private final void unregisterStateListener()
public final void doHandleLocationChanged(Location location)
location
- the changed locationpublic 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 contextprotected final void onScannerRunningStateChange(boolean isRunning, Context context)
ScannerStateAwareSensorDevice
onScannerRunningStateChange
in class ScannerStateAwareSensorDevice
isRunning
- the current scanner state after state changecontext
- the contextprotected final void onConfigurationChanged()
AbstractSensorDevice
onConfigurationChanged
in class ScannerStateAwareSensorDevice
public final void onCreate(Context context)
SensorDevice
onCreate
in interface SensorDevice
onCreate
in class AbstractSensorDevice
context
- the application contextpublic final void onDestroy(Context context)
SensorDevice
onDestroy
in interface SensorDevice
onDestroy
in class AbstractSensorDevice
context
- the application contextpublic final boolean isAirplaneModeOn(Context applicationContext)
AbstractSensorDevice
isAirplaneModeOn
in class AbstractSensorDevice
applicationContext
- the application contex
public boolean hasSample()
SampleProvidingSensorDevice
hasSample
in interface SampleProvidingSensorDevice
protected LocationSampleData getLocationData()
public final Sample getSample()
SampleProvidingSensorDevice
getSample
in interface SampleProvidingSensorDevice
protected abstract SampleData getCurrentSampleData()
protected abstract int getDeviceDisabledMessageID()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |