|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.android.activityminer.logic.util.AbstractActivatableComponentImpl
org.android.activityminer.logic.devices.LocationDataSource
public final class LocationDataSource
Implementation of the location data source, using the location manager to get location information form the gps or network provider.
| Nested Class Summary | |
|---|---|
private class |
LocationDataSource.InternalLoactionListener
The location listener. |
| Field Summary | |
|---|---|
private LocationDataSource.InternalLoactionListener |
activeLocationListener
The listener for active location providers. |
private List<String> |
activeProviders
The list of available providers |
private LocationDataCache |
cache
The data cache to hold samples for scan access. |
private Context |
context
The Android context |
private Location |
currentSample
The most recent sample |
private long |
lowerFrequency
The lower frequency for location updates (depends on the sample rate ) |
private LocationDataSource.InternalLoactionListener |
passiveLocationListener
The listener for the passive location provider. |
private Object |
waitLock
The wait lock for synchronization on new location fixes on activation. |
| Constructor Summary | |
|---|---|
LocationDataSource(Context context,
long sampleRate)
Constructor |
|
| Method Summary | |
|---|---|
int |
getAvailableProviderCount()
Getter for the count of available active providers. |
protected Location |
getBestLocation(Location location,
Location currentBestLocation)
Determines whether one Location reading is better than the current Location fix. |
private boolean |
isPassiveProvider(String provider)
Test method for the passive provider |
private boolean |
isProviderEnabled(LocationManager locationManager,
String provider)
Test method for availability of a provider. |
private boolean |
isSameProvider(String provider1,
String provider2)
Checks whether two providers are the same. |
protected void |
onActivationStateChange(boolean active)
Handler for activation state changes |
void |
onDestroy()
This method is for cleanup in case of termination. |
private void |
onLocationChanged(Location location)
Handler for location changes |
private void |
onProviderDisabled(String provider)
Handler for provider disabled events. |
private void |
onProviderEnabled(String provider)
Handler for provider enabled events |
private void |
registerListener(LocationManager locationManager,
String provider)
Does register the active provider listener for the given provider. |
private void |
registerProviderListeners()
Does register the sensor listener for the device type |
void |
setSampleRate(long sampleRate)
Setter for the actual sample rate |
NetworkLocationData |
takeSample(Long ts)
Getter for the current sample |
private void |
unregisterProviderListeners()
Does unregister the sensor listener for the device type |
private void |
updateAvailableProviders()
Does update the list of available providers. |
void |
waitForActualLocationFix()
This method can be called from the sample taking process to synchronize for the next new location fix. |
| Methods inherited from class org.android.activityminer.logic.util.AbstractActivatableComponentImpl |
|---|
isActive, setActivationState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final LocationDataSource.InternalLoactionListener activeLocationListener
private final LocationDataSource.InternalLoactionListener passiveLocationListener
private final Context context
private Location currentSample
private final Object waitLock
private long lowerFrequency
private final List<String> activeProviders
private final LocationDataCache cache
| Constructor Detail |
|---|
public LocationDataSource(Context context,
long sampleRate)
context - the contextsampleRate - the sample rate| Method Detail |
|---|
public final void setSampleRate(long sampleRate)
sampleRate - the actual sample rate to setprivate final void registerProviderListeners()
private final void registerListener(LocationManager locationManager,
String provider)
locationManager - the location manager instanceprovider - the providerprivate final void updateAvailableProviders()
private final boolean isProviderEnabled(LocationManager locationManager,
String provider)
locationManager - the location managerprovider - the provider to test for
private final void unregisterProviderListeners()
protected final Location getBestLocation(Location location,
Location currentBestLocation)
location - The new Location that you want to evaluatecurrentBestLocation - The current Location fix, to which you want to compare the new one
private final boolean isSameProvider(String provider1,
String provider2)
provider1 - first providerprovider2 - second provider
private final void onLocationChanged(Location location)
location - the locationpublic final NetworkLocationData takeSample(Long ts)
SensorDataSource
takeSample in interface SensorDataSource<NetworkLocationData>ts - the requested time stamp
private final void onProviderEnabled(String provider)
provider - the providerprivate final void onProviderDisabled(String provider)
provider - the providerprivate final boolean isPassiveProvider(String provider)
provider - the provider
protected final void onActivationStateChange(boolean active)
AbstractActivatableComponentImpl
onActivationStateChange in class AbstractActivatableComponentImplactive - the new activation statepublic final int getAvailableProviderCount()
public final void waitForActualLocationFix()
public final void onDestroy()
SensorDataSource
onDestroy in interface SensorDataSource<NetworkLocationData>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||