aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-28 01:30:00 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-28 01:30:00 +0200
commit0dd6c90ef7fecb75723593eee91117f00359ca41 (patch)
tree577389a05f0a797c96d7b21fcee578551d9f949c
parent04001207adcf5575c813797d9897e5dd2a672938 (diff)
downloadBlueGPS-0dd6c90ef7fecb75723593eee91117f00359ca41.zip
BlueGPS-0dd6c90ef7fecb75723593eee91117f00359ca41.tar.gz
BlueGPS-0dd6c90ef7fecb75723593eee91117f00359ca41.tar.bz2
Add preferences to enable/disable GGA and RMC NMEA sentences
Add preferences to enable/disable GGA and RMC NMEA sentences. Actually by default theses two preferences are enabled and cannot be disable: we need them to generate the GPS fixes
-rw-r--r--res/values-fr/strings.xml6
-rw-r--r--res/values/constants.xml4
-rw-r--r--res/values/strings.xml6
-rw-r--r--res/xml/pref.xml16
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java2
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java35
6 files changed, 69 insertions, 0 deletions
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index c13a079..0e3f14b 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -50,6 +50,12 @@
<string name="pref_sirf_gps_summary_on">"Utiliser les paramètres SiRF"</string>
<string name="pref_sirf_nmea_category_title">Choix des trames NMEA</string>
<string name="pref_sirf_gps_category_title">Fonctionnement du GPS</string>
+ <string name="pref_enable_gga_title">Activation NMEA GGA</string>
+ <string name="pref_enable_gga_summary_off">NMEA GGA désactivé</string>
+ <string name="pref_enable_gga_summary_on">NMEA GGA activé</string>
+ <string name="pref_enable_rmc_title">Activation NMEA RMC</string>
+ <string name="pref_enable_rmc_summary_off">NMEA RMC désactivé</string>
+ <string name="pref_enable_rmc_summary_on">NMEA RMC activé</string>
<string name="pref_enable_gll_title">Activation NMEA GLL</string>
<string name="pref_enable_gll_summary_off">NMEA GLL désactivé</string>
<string name="pref_enable_gll_summary_on">NMEA GLL activé</string>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index b46b97d..f02034e 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -30,6 +30,8 @@
<string name="pref_bluetooth_device_key">bluetoothDevice</string>
<string name="pref_sirf_gps_key">sirfGps</string>
+ <string name="pref_sirf_enable_gga_key">enableGGA</string>
+ <string name="pref_sirf_enable_rmc_key">enableRMC</string>
<string name="pref_sirf_enable_gll_key">enableGLL</string>
<string name="pref_sirf_enable_vtg_key">enableVTG</string>
<string name="pref_sirf_enable_gsa_key">enableGSA</string>
@@ -46,7 +48,9 @@
<string name="sirf_nmea_gga_on">PSRF103,00,00,01,01</string>
+ <string name="sirf_nmea_gga_off">PSRF103,00,00,00,01</string>
<string name="sirf_nmea_rmc_on">PSRF103,04,00,01,01</string>
+ <string name="sirf_nmea_rmc_off">PSRF103,04,00,00,01</string>
<string name="sirf_nmea_gll_on">PSRF103,01,00,01,01</string>
<string name="sirf_nmea_gll_off">PSRF103,01,00,00,01</string>
<string name="sirf_nmea_gsa_on">PSRF103,02,00,05,01</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 98403fe..1cf26f2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -53,6 +53,12 @@
<string name="pref_sirf_gps_summary_on">"Don't SiRF Options"</string>
<string name="pref_sirf_nmea_category_title">Choice of NMEA sentences</string>
<string name="pref_sirf_gps_category_title">GPS operation</string>
+ <string name="pref_enable_gga_title">Enable NMEA GGA</string>
+ <string name="pref_enable_gga_summary_off">NMEA GGA sentences are off</string>
+ <string name="pref_enable_gga_summary_on">NMEA GGA sentences are on</string>
+ <string name="pref_enable_rmc_title">Enable NMEA RMC</string>
+ <string name="pref_enable_rmc_summary_off">NMEA RMC sentences are off</string>
+ <string name="pref_enable_rmc_summary_on">NMEA RMC sentences are on</string>
<string name="pref_enable_gll_title">Enable NMEA GLL</string>
<string name="pref_enable_gll_summary_off">NMEA GLL sentences are off</string>
<string name="pref_enable_gll_summary_on">NMEA GLL sentences are on</string>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index efe9f60..da66b50 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -79,6 +79,22 @@
android:orderingFromXml="true"
android:title="@string/pref_sirf_nmea_category_title" >
<CheckBoxPreference
+ android:key="@string/pref_sirf_enable_gga_key"
+ android:enabled="false"
+ android:persistent="true"
+ android:defaultValue="true"
+ android:title="@string/pref_enable_gga_title"
+ android:summaryOn="@string/pref_enable_gga_summary_on"
+ android:summaryOff="@string/pref_enable_gga_summary_off" />
+ <CheckBoxPreference
+ android:key="@string/pref_sirf_enable_rmc_key"
+ android:enabled="false"
+ android:persistent="true"
+ android:defaultValue="true"
+ android:title="@string/pref_enable_rmc_title"
+ android:summaryOn="@string/pref_enable_rmc_summary_on"
+ android:summaryOff="@string/pref_enable_rmc_summary_off" />
+ <CheckBoxPreference
android:key="@string/pref_sirf_enable_gsa_key"
android:persistent="true"
android:title="@string/pref_enable_gsa_title"
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index a398e19..d87c2f8 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -155,6 +155,8 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
} else if (BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE.equals(key)){
updateDevicePreferenceSummary();
} else if (BluetoothGpsProviderService.PREF_SIRF_ENABLE_GLL.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_GGA.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_RMC.equals(key)
|| BluetoothGpsProviderService.PREF_SIRF_ENABLE_VTG.equals(key)
|| BluetoothGpsProviderService.PREF_SIRF_ENABLE_GSA.equals(key)
|| BluetoothGpsProviderService.PREF_SIRF_ENABLE_GSV.equals(key)
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 37ce43a..fad8a4e 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -74,6 +74,8 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String PREF_BLUETOOTH_DEVICE = "bluetoothDevice";
public static final String PREF_SIRF_GPS = "sirfGps";
+ public static final String PREF_SIRF_ENABLE_GGA = "enableGGA";
+ public static final String PREF_SIRF_ENABLE_RMC = "enableRMC";
public static final String PREF_SIRF_ENABLE_GLL = "enableGLL";
public static final String PREF_SIRF_ENABLE_VTG = "enableVTG";
public static final String PREF_SIRF_ENABLE_GSA = "enableGSA";
@@ -189,6 +191,12 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
}
private void enableSirfConfig(Bundle extras){
+ if (extras.containsKey(PREF_SIRF_ENABLE_GGA)){
+ enableNmeaGGA(extras.getBoolean(PREF_SIRF_ENABLE_GGA, true));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_RMC)){
+ enableNmeaRMC(extras.getBoolean(PREF_SIRF_ENABLE_RMC, true));
+ }
if (extras.containsKey(PREF_SIRF_ENABLE_GLL)){
enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GLL, false));
}
@@ -213,6 +221,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
enableSBAS(extras.getBoolean(PREF_SIRF_ENABLE_SBAS, true));
}
}
+
private void enableSirfConfig(SharedPreferences extras){
if (extras.contains(PREF_SIRF_ENABLE_GLL)){
enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GLL, false));
@@ -239,6 +248,32 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
}
gpsManager.sendNmeaCommand(this.getString(R.string.sirf_nmea_gga_on));
gpsManager.sendNmeaCommand(this.getString(R.string.sirf_nmea_rmc_on));
+ if (extras.contains(PREF_SIRF_ENABLE_GGA)){
+ enableNmeaGGA(extras.getBoolean(PREF_SIRF_ENABLE_GGA, true));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_RMC)){
+ enableNmeaRMC(extras.getBoolean(PREF_SIRF_ENABLE_RMC, true));
+ }
+ }
+
+ private void enableNmeaGGA(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gga_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gga_off));
+ }
+ }
+ }
+
+ private void enableNmeaRMC(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_rmc_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_rmc_off));
+ }
+ }
}
private void enableNmeaGLL(boolean enable){