diff options
author | Herbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com> | 2010-09-26 02:30:14 +0200 |
---|---|---|
committer | Herbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com> | 2010-09-26 02:30:14 +0200 |
commit | 79add8afa37d4e125a0eec577a1f3e10f92b2a07 (patch) | |
tree | 1a1a9d6970488dc31c193d27d1779aaba14396d9 /src/org/broeuschmeul/android/gps/nmea | |
parent | 73845df38038160c4eb9696cccc5babcce6dc216 (diff) | |
download | BlueGPS-79add8afa37d4e125a0eec577a1f3e10f92b2a07.zip BlueGPS-79add8afa37d4e125a0eec577a1f3e10f92b2a07.tar.gz BlueGPS-79add8afa37d4e125a0eec577a1f3e10f92b2a07.tar.bz2 |
Code cleanup
Diffstat (limited to 'src/org/broeuschmeul/android/gps/nmea')
-rw-r--r-- | src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java index b690285..2f67441 100644 --- a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java +++ b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java @@ -45,22 +45,22 @@ public class NmeaParser { private float precision = 10f;
private boolean mockGpsEnabled = false;
private String mockLocationProvider = null;
-
+
private int mockStatus = LocationProvider.OUT_OF_SERVICE;
-
+
private Location fix = new Location(mockLocationProvider);
-
+
public NmeaParser(){
this(5f);
}
public NmeaParser(float precision){
this.precision = precision;
}
-
+
public void setLocationManager(LocationManager lm){
this.lm = lm;
}
-
+
public void enableMockLocationProvider(String gpsName){
LocationProvider prov;
if (gpsName != null && gpsName != "" ){
@@ -75,7 +75,6 @@ public class NmeaParser { }
lm.addTestProvider(mockLocationProvider, false, true,false, false, true, true, true, Criteria.POWER_HIGH, Criteria.ACCURACY_FINE);
if (! LocationManager.GPS_PROVIDER.equals(mockLocationProvider)){
- // mockGpsEnabled = locationManager.isProviderEnabled(mockLocationProvider);
lm.setTestProviderEnabled(mockLocationProvider, true);
}
mockGpsEnabled = true;
@@ -88,7 +87,7 @@ public class NmeaParser { }
}
}
-
+
public void disableMockLocationProvider(){
LocationProvider prov;
if (mockLocationProvider != null && mockLocationProvider != "" && mockGpsEnabled){
@@ -98,10 +97,8 @@ public class NmeaParser { }
mockGpsEnabled = false;
if (! LocationManager.GPS_PROVIDER.equals(mockLocationProvider)){
- // mockGpsEnabled = locationManager.isProviderEnabled(mockLocationProvider);
lm.setTestProviderEnabled(mockLocationProvider, false);
}
- // locationManager.setTestProviderEnabled(mockLocationProvider, mockGpsEnabled);
prov = lm.getProvider(mockLocationProvider);
if (prov != null){
Log.e("BT test", "Mock provider: "+prov.getName()+" "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+lm.isProviderEnabled(mockLocationProvider));
@@ -132,7 +129,7 @@ public class NmeaParser { public boolean isMockGpsEnabled() {
return mockGpsEnabled;
}
-
+
public void setMockLocationProviderOutOfService(){
notifyStatusChanged(LocationProvider.OUT_OF_SERVICE, null, System.currentTimeMillis());
}
@@ -143,9 +140,8 @@ public class NmeaParser { public String getMockLocationProvider() {
return mockLocationProvider;
}
-
+
private void notifyFix(Location fix){
- //R.drawable.stat
fixTime = null;
hasGGA = false;
hasRMC=false;
@@ -158,9 +154,8 @@ public class NmeaParser { this.fix = null;
}
}
-
+
private void notifyStatusChanged(int status, Bundle extras, long updateTime){
- //R.drawable.stat
fixTime = null;
hasGGA = false;
hasRMC=false;
@@ -168,15 +163,15 @@ public class NmeaParser { Log.e(this.getClass().getSimpleName(), "New mockStatus: "+System.currentTimeMillis()+" "+status);
if (lm != null && mockGpsEnabled){
lm.setTestProviderStatus(mockLocationProvider, status, extras, updateTime);
-// lm.setTestProviderStatus(mockLocationProvider, status, extras, SystemClock.elapsedRealtime());
-// lm.setTestProviderStatus(mockLocationProvider, status, extras, 50);
+ // lm.setTestProviderStatus(mockLocationProvider, status, extras, SystemClock.elapsedRealtime());
+ // lm.setTestProviderStatus(mockLocationProvider, status, extras, 50);
Log.e(this.getClass().getSimpleName(), "New mockStatus notified to Location Manager: " + status + " "+mockLocationProvider);
}
this.fix = null;
this.mockStatus = status;
}
}
-
+
// parse NMEA Sentence
public String parseNmeaSentence(String gpsSentence){
String nmeaSentence = null;
|