aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml3
-rw-r--r--res/values-fr/strings.xml30
-rw-r--r--res/values/strings.xml23
-rw-r--r--res/xml/pref.xml39
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java21
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java29
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java141
-rw-r--r--src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java5
8 files changed, 228 insertions, 63 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c87f911..6a5b512 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -49,6 +49,9 @@
<action android:name="org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.STOP_GPS_PROVIDER">
<category android:name="android.intent.category.DEFAULT" />
</action>
+ <action android:name="org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.CONFIGURE_SIRF_GPS">
+ <category android:name="android.intent.category.DEFAULT" />
+ </action>
</intent-filter>
</service>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index e80bca0..d679378 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -22,7 +22,7 @@
<string name="pref_start_gps_title">Start/Stop GPS</string>
<string name="pref_start_gps_summary_off">Le GPS Bluetooth est arrêté</string>
<string name="pref_start_gps_summary_on">Le GPS Bluetooth est démarré</string>
- <string name="pref_start_gps_params_title">Options du GPS</string>
+ <string name="pref_start_gps_params_title">Options du GPS (SiRF)</string>
<string name="pref_gps_location_provider_title">Location provider options</string>
<string name="pref_gps_location_provider_summary">Le GPS Bluetooth remplacera le GPS interne</string>
<string name="pref_replace_std_gps_title">Remplacer le GPS interne</string>
@@ -45,6 +45,34 @@
<string name="pref_bluetooth_device_title">Sélection du GPS</string>
<string name="pref_bluetooth_device_summary">"Périphérique actuel : %s"</string>
+ <string name="pref_sirf_gps_title">GPS SiRF</string>
+ <string name="pref_sirf_gps_summary_off">"Ne pas utiliser les paramètres SiRF"</string>
+ <string name="pref_sirf_gps_summary_on">"Utiliser les paramètres SiRF"</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>
+ <string name="pref_enable_vtg_title">Activation NMEA VTG</string>
+ <string name="pref_enable_vtg_summary_off">NMEA VTG désactivé</string>
+ <string name="pref_enable_vtg_summary_on">NMEA VTG activé</string>
+ <string name="pref_enable_gsa_title">Activation NMEA GSA</string>
+ <string name="pref_enable_gsa_summary_off">NMEA GSA désactivé</string>
+ <string name="pref_enable_gsa_summary_on">NMEA GSA activé</string>
+ <string name="pref_enable_gsv_title">Activation NMEA GSV</string>
+ <string name="pref_enable_gsv_summary_off">NMEA GSV désactivé</string>
+ <string name="pref_enable_gsv_summary_on">NMEA GSV activé</string>
+ <string name="pref_enable_zda_title">Activation NMEA ZDA</string>
+ <string name="pref_enable_zda_summary_off">NMEA ZDA désactivé</string>
+ <string name="pref_enable_zda_summary_on">NMEA ZDA activé</string>
+ <string name="pref_enable_sbas_title">SBAS (WAAS/EGNOS)</string>
+ <string name="pref_enable_sbas_summary_off">SBAS désactivé</string>
+ <string name="pref_enable_sbas_summary_on">SBAS activé</string>
+ <string name="pref_enable_nmea_title">Mode NMEA/SiRF</string>
+ <string name="pref_enable_nmea_summary_off">Mode SiRF binaire activé</string>
+ <string name="pref_enable_nmea_summary_on">Mode NMEA activé</string>
+ <string name="pref_enable_static_navigation_title">Navigation Statique</string>
+ <string name="pref_enable_static_navigation_summary_off">Navigation Statique désactivée</string>
+ <string name="pref_enable_static_navigation_summary_on">Navigation Statique activée</string>
+
<string name="msg_gps_provider_started">GPS Bluetooth... démarré</string>
<string name="msg_gps_provider_stopped">GPS Bluetooth... arrêté</string>
<string name="msg_gps_provider_already_started">GPS Bluetooth... déjà démarré</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c049a20..50d5994 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -36,8 +36,8 @@
<string name="sirf_nmea_to_binary">PSRF100,0,38400,8,1,0</string>
- <string name="sirf_nmea_waas_on">PSRF151,01</string>
- <string name="sirf_nmea_waas_off">PSRF151,00</string>
+ <string name="sirf_nmea_sbas_on">PSRF151,01</string>
+ <string name="sirf_nmea_sbas_off">PSRF151,00</string>
<!--
<string name="sirf_sbas_on">$PSRF151,01*0F</string>
@@ -47,8 +47,11 @@
<string name="sirf_bin_static_nav_off">8F00</string>
<string name="sirf_bin_to_nmea">8702</string>
<string name="sirf_bin_to_nmea_38400">810201010001050105010001000100010001000100019600</string>
+ <string name="sirf_bin_to_nmea_38400_alt">8102%02X01%02X01%02X01%02X01%02X01%02X01%02X01%02X01%02X0100019600</string>
<string name="sirf_bin_dgps_ext_on">85020000000000</string>
<string name="sirf_bin_dgps_sbas_on">85010000000000</string>
+ <string name="sirf_software_version">8400</string>
+
<!--
<string name="sirf_bin_to_nmea4800_1">A0A20018 8102010100010501050100010001000100010001000112C0 016AB0B3</string>
@@ -68,6 +71,7 @@
<string name="pref_trackfile_prefix_key">trackFilePrefix</string>
<string name="pref_bluetooth_device_key">bluetoothDevice</string>
+ <string name="pref_sirf_gps_key">sirfGps</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>
@@ -75,6 +79,7 @@
<string name="pref_sirf_enable_zda_key">enableZDA</string>
<string name="pref_sirf_enable_sbas_key">enableSBAS</string>
<string name="pref_sirf_enable_nmea_key">enableNMEA</string>
+ <string name="pref_sirf_enable_static_navigation_key">enableStaticNavigation</string>
<string name="defaultTrackMinDistance">0.0</string>
<string name="defaultTrackMinTime">0</string>
@@ -85,7 +90,7 @@
<string name="pref_start_gps_title">Start/Stop GPS</string>
<string name="pref_start_gps_summary_off">Bluetooth GPS is off</string>
<string name="pref_start_gps_summary_on">Bluetooth GPS is on</string>
- <string name="pref_start_gps_params_title">SiRF GPS Options</string>
+ <string name="pref_start_gps_params_title">GPS Options (SiRF)</string>
<string name="pref_gps_location_provider_title">Location provider options</string>
<string name="pref_gps_location_provider_summary">Bluetooth GPS will replace internal GPS</string>
<string name="pref_replace_std_gps_title">Replace internal GPS</string>
@@ -111,6 +116,9 @@
<string name="pref_bluetooth_device_title">Choose Bluetooth GPS</string>
<string name="pref_bluetooth_device_summary">"Current device: %s"</string>
+ <string name="pref_sirf_gps_title">SiRF GPS</string>
+ <string name="pref_sirf_gps_summary_off">"Use SiRF Options"</string>
+ <string name="pref_sirf_gps_summary_on">"Don't SiRF Options"</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>
@@ -126,10 +134,15 @@
<string name="pref_enable_zda_title">Enable NMEA ZDA</string>
<string name="pref_enable_zda_summary_off">NMEA ZDA sentences are off</string>
<string name="pref_enable_zda_summary_on">NMEA ZDA sentences are on</string>
- <string name="pref_enable_sbas_title">Enable SBAS (WAAS/EGNOS)</string>
+ <string name="pref_enable_sbas_title">SBAS (WAAS/EGNOS)</string>
<string name="pref_enable_sbas_summary_off">SBAS is off</string>
<string name="pref_enable_sbas_summary_on">SBAS is on</string>
-
+ <string name="pref_enable_nmea_title">NMEA/Binary mode</string>
+ <string name="pref_enable_nmea_summary_off">Binary mode is on</string>
+ <string name="pref_enable_nmea_summary_on">NMEA mode is on</string>
+ <string name="pref_enable_static_navigation_title">Static Navigation</string>
+ <string name="pref_enable_static_navigation_summary_off">Static Navigation disabled</string>
+ <string name="pref_enable_static_navigation_summary_on">Static Navigation enabled</string>
<string name="msg_gps_provider_started">Bluetooth GPS... started</string>
<string name="msg_gps_provider_stopped">Bluetooth GPS... stopped</string>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index d54c3ff..0faee9f 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -54,45 +54,70 @@
android:defaultValue="@string/defaultMockGpsName"
android:summary="@string/pref_mock_gps_name_summary" />
</PreferenceScreen>
+ <CheckBoxPreference
+ android:key="@string/pref_sirf_gps_key"
+ android:persistent="true"
+ android:defaultValue="false"
+ android:disableDependentsState="false"
+ android:title="@string/pref_sirf_gps_title"
+ android:summaryOn="@string/pref_sirf_gps_summary_on"
+ android:summaryOff="@string/pref_sirf_gps_summary_off" />
<PreferenceScreen
android:title="@string/pref_start_gps_params_title"
- android:shouldDisableView = "true"
- android:enabled="true" >
+ android:dependency="@string/pref_sirf_gps_key"
+ android:shouldDisableView = "true" >
<CheckBoxPreference
android:key="@string/pref_sirf_enable_gsa_key"
android:persistent="true"
- android:disableDependentsState="true"
android:title="@string/pref_enable_gsa_title"
android:summaryOn="@string/pref_enable_gsa_summary_on"
android:summaryOff="@string/pref_enable_gsa_summary_off" />
<CheckBoxPreference
android:key="@string/pref_sirf_enable_gsv_key"
android:persistent="true"
- android:disableDependentsState="true"
android:title="@string/pref_enable_gsv_title"
android:summaryOn="@string/pref_enable_gsv_summary_on"
android:summaryOff="@string/pref_enable_gsv_summary_off" />
<CheckBoxPreference
android:key="@string/pref_sirf_enable_vtg_key"
android:persistent="true"
- android:disableDependentsState="true"
android:title="@string/pref_enable_vtg_title"
android:summaryOn="@string/pref_enable_vtg_summary_on"
android:summaryOff="@string/pref_enable_vtg_summary_off" />
<CheckBoxPreference
android:key="@string/pref_sirf_enable_gll_key"
android:persistent="true"
- android:disableDependentsState="true"
android:title="@string/pref_enable_gll_title"
android:summaryOn="@string/pref_enable_gll_summary_on"
android:summaryOff="@string/pref_enable_gll_summary_off" />
<CheckBoxPreference
android:key="@string/pref_sirf_enable_zda_key"
android:persistent="true"
- android:disableDependentsState="true"
android:title="@string/pref_enable_zda_title"
android:summaryOn="@string/pref_enable_zda_summary_on"
android:summaryOff="@string/pref_enable_zda_summary_off" />
+ <CheckBoxPreference
+ android:key="@string/pref_sirf_enable_sbas_key"
+ android:persistent="true"
+ android:defaultValue="true"
+ android:title="@string/pref_enable_sbas_title"
+ android:summaryOn="@string/pref_enable_sbas_summary_on"
+ android:summaryOff="@string/pref_enable_sbas_summary_off" />
+ <CheckBoxPreference
+ android:key="@string/pref_sirf_enable_nmea_key"
+ android:enabled="false"
+ android:persistent="true"
+ android:defaultValue="true"
+ android:title="@string/pref_enable_nmea_title"
+ android:summaryOn="@string/pref_enable_nmea_summary_on"
+ android:summaryOff="@string/pref_enable_nmea_summary_off" />
+ <CheckBoxPreference
+ android:key="@string/pref_sirf_enable_static_navigation_key"
+ android:persistent="true"
+ android:defaultValue="false"
+ android:title="@string/pref_enable_static_navigation_title"
+ android:summaryOn="@string/pref_enable_static_navigation_summary_on"
+ android:summaryOff="@string/pref_enable_static_navigation_summary_off" />
</PreferenceScreen>
<CheckBoxPreference
android:enabled="true"
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index 4b51281..8a373b7 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -299,16 +299,19 @@ public class BlueetoothGpsManager {
private void notifyNmeaSentence(final String nmeaSentence){
if (enabled){
- parser.parseNmeaSentence(nmeaSentence);
+ final String recognizedSentence = parser.parseNmeaSentence(nmeaSentence);
final long timestamp = System.currentTimeMillis();
- synchronized(nmeaListeners) {
- for(final NmeaListener listener : nmeaListeners){
- notificationPool.execute(new Runnable(){
- @Override
- public void run() {
- listener.onNmeaReceived(timestamp, nmeaSentence);
- }
- });
+ if (recognizedSentence != null){
+ Log.e("BT test", "NMEA : "+timestamp+" "+recognizedSentence);
+ synchronized(nmeaListeners) {
+ for(final NmeaListener listener : nmeaListeners){
+ notificationPool.execute(new Runnable(){
+ @Override
+ public void run() {
+ listener.onNmeaReceived(timestamp, recognizedSentence);
+ }
+ });
+ }
}
}
}
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index d3939c5..5d079a0 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -157,16 +157,27 @@ 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)){
- CheckBoxPreference pref = (CheckBoxPreference)(findPreference(key));
- if (pref.isChecked() != sharedPref.getBoolean(key, false)){
- pref.setChecked(sharedPref.getBoolean(key, false));
- } else {
- Intent configIntent = new Intent(BluetoothGpsProviderService.ACTION_CONFIGURE_SIRF_GPS);
- configIntent.putExtra(key, pref.isChecked());
- startService(configIntent);
- }
+ } else if (BluetoothGpsProviderService.PREF_SIRF_ENABLE_GLL.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_VTG.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_GSA.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_GSV.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_ZDA.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_SBAS.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_NMEA.equals(key)
+ || BluetoothGpsProviderService.PREF_SIRF_ENABLE_STATIC_NAVIGATION.equals(key)
+ ){
+ enableSirfFeature(key);
}
this.updateDevicePreferenceList();
}
+ private void enableSirfFeature(String key){
+ CheckBoxPreference pref = (CheckBoxPreference)(findPreference(key));
+ if (pref.isChecked() != sharedPref.getBoolean(key, false)){
+ pref.setChecked(sharedPref.getBoolean(key, false));
+ } else {
+ Intent configIntent = new Intent(BluetoothGpsProviderService.ACTION_CONFIGURE_SIRF_GPS);
+ configIntent.putExtra(key, pref.isChecked());
+ startService(configIntent);
+ }
+ }
} \ No newline at end of file
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 022823f..1fffc86 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -73,6 +73,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String PREF_TRACK_FILE_PREFIX = "trackFilePrefix";
public static final String PREF_BLUETOOTH_DEVICE = "bluetoothDevice";
+ public static final String PREF_SIRF_GPS = "sirfGps";
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";
@@ -80,6 +81,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String PREF_SIRF_ENABLE_ZDA = "enableZDA";
public static final String PREF_SIRF_ENABLE_SBAS = "enableSBAS";
public static final String PREF_SIRF_ENABLE_NMEA = "enableNMEA";
+ public static final String PREF_SIRF_ENABLE_STATIC_NAVIGATION = "enableStaticNavigation";
private LocationManager lm;
@@ -125,19 +127,23 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
gpsManager.enableMockLocationProvider(mockProvider);
// gpsManager.enableMockLocationProvider(LocationManager.GPS_PROVIDER);
gpsManager.enable();
- String command1 = this.getString(R.string.sirf_nmea_gga_on);
- String command2 = this.getString(R.string.sirf_nmea_gsa_off);
- String command3 = this.getString(R.string.sirf_nmea_gsv_off);
- String command4 = this.getString(R.string.sirf_nmea_vtg_off);
- String command5 = this.getString(R.string.sirf_nmea_gll_off);
- String command6 = this.getString(R.string.sirf_nmea_rmc_on);
- gpsManager.sendNmeaCommand(command1);
- gpsManager.sendNmeaCommand(command2);
- gpsManager.sendNmeaCommand(command3);
- gpsManager.sendNmeaCommand(command4);
- gpsManager.sendNmeaCommand(command5);
- gpsManager.sendNmeaCommand(command6);
+// String command1 = this.getString(R.string.sirf_nmea_gga_on);
+// String command2 = this.getString(R.string.sirf_nmea_gsa_off);
+// String command3 = this.getString(R.string.sirf_nmea_gsv_off);
+// String command4 = this.getString(R.string.sirf_nmea_vtg_off);
+// String command5 = this.getString(R.string.sirf_nmea_gll_off);
+// String command6 = this.getString(R.string.sirf_nmea_rmc_on);
+// gpsManager.sendNmeaCommand(command1);
+// gpsManager.sendNmeaCommand(command2);
+// gpsManager.sendNmeaCommand(command3);
+// gpsManager.sendNmeaCommand(command4);
+// gpsManager.sendNmeaCommand(command5);
+// gpsManager.sendNmeaCommand(command6);
+// Bundle extras = intent.getExtras();
+ if (sharedPreferences.getBoolean(PREF_SIRF_GPS, false)){
+ enableSirfConfig(sharedPreferences);
+ }
if (! sharedPreferences.getBoolean(PREF_START_GPS_PROVIDER, false)){
edit.putBoolean(PREF_START_GPS_PROVIDER,true);
edit.commit();
@@ -201,25 +207,66 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
} else if (ACTION_CONFIGURE_SIRF_GPS.equals(intent.getAction())){
if (gpsManager != null){
Bundle extras = intent.getExtras();
- if (extras.containsKey(PREF_SIRF_ENABLE_GLL)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GLL, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_VTG)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_VTG, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_GSA)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GSA, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_GSV)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GSV, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_ZDA)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_ZDA, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_SBAS)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_SBAS, false));
- } else if (extras.containsKey(PREF_SIRF_ENABLE_NMEA)){
- enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_NMEA, true));
- }
+ enableSirfConfig(extras);
}
}
}
+ private void enableSirfConfig(Bundle extras){
+ if (extras.containsKey(PREF_SIRF_ENABLE_GLL)){
+ enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GLL, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_VTG)){
+ enableNmeaVTG(extras.getBoolean(PREF_SIRF_ENABLE_VTG, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_GSA)){
+ enableNmeaGSA(extras.getBoolean(PREF_SIRF_ENABLE_GSA, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_GSV)){
+ enableNmeaGSV(extras.getBoolean(PREF_SIRF_ENABLE_GSV, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_ZDA)){
+ enableNmeaZDA(extras.getBoolean(PREF_SIRF_ENABLE_ZDA, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_SBAS)){
+ enableSBAS(extras.getBoolean(PREF_SIRF_ENABLE_SBAS, true));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_STATIC_NAVIGATION)){
+ enableStaticNavigation(extras.getBoolean(PREF_SIRF_ENABLE_STATIC_NAVIGATION, false));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_NMEA)){
+ enableNMEA(extras.getBoolean(PREF_SIRF_ENABLE_NMEA, true));
+ }
+ }
+ private void enableSirfConfig(SharedPreferences extras){
+ if (extras.contains(PREF_SIRF_ENABLE_GLL)){
+ enableNmeaGLL(extras.getBoolean(PREF_SIRF_ENABLE_GLL, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_VTG)){
+ enableNmeaVTG(extras.getBoolean(PREF_SIRF_ENABLE_VTG, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_GSA)){
+ enableNmeaGSA(extras.getBoolean(PREF_SIRF_ENABLE_GSA, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_GSV)){
+ enableNmeaGSV(extras.getBoolean(PREF_SIRF_ENABLE_GSV, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_ZDA)){
+ enableNmeaZDA(extras.getBoolean(PREF_SIRF_ENABLE_ZDA, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_SBAS)){
+ enableSBAS(extras.getBoolean(PREF_SIRF_ENABLE_SBAS, true));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_STATIC_NAVIGATION)){
+ enableStaticNavigation(extras.getBoolean(PREF_SIRF_ENABLE_STATIC_NAVIGATION, false));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_NMEA)){
+ enableNMEA(extras.getBoolean(PREF_SIRF_ENABLE_NMEA, true));
+ }
+ gpsManager.sendNmeaCommand(this.getString(R.string.sirf_nmea_gga_on));
+ gpsManager.sendNmeaCommand(this.getString(R.string.sirf_nmea_rmc_on));
+ }
+
private void enableNmeaGLL(boolean enable){
if (gpsManager != null){
if (enable){
@@ -273,9 +320,9 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
private void enableSBAS(boolean enable){
if (gpsManager != null){
if (enable){
- gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_waas_on));
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_sbas_on));
} else {
- gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_waas_off));
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_sbas_off));
}
}
}
@@ -283,9 +330,41 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
private void enableNMEA(boolean enable){
if (gpsManager != null){
if (enable){
- gpsManager.sendNmeaCommand(getString(R.string.sirf_bin_to_nmea));
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+// SharedPreferences.Editor edit = sharedPreferences.edit();
+ int gll = (sharedPreferences.getBoolean(PREF_SIRF_ENABLE_GLL, false)) ? 1 : 0 ;
+ int vtg = (sharedPreferences.getBoolean(PREF_SIRF_ENABLE_VTG, false)) ? 1 : 0 ;
+ int gsa = (sharedPreferences.getBoolean(PREF_SIRF_ENABLE_GSA, false)) ? 5 : 0 ;
+ int gsv = (sharedPreferences.getBoolean(PREF_SIRF_ENABLE_GSV, false)) ? 5 : 0 ;
+ int zda = (sharedPreferences.getBoolean(PREF_SIRF_ENABLE_ZDA, false)) ? 1 : 0 ;
+ int mss = 0;
+ int epe = 0;
+ int gga = 1;
+ int rmc = 1;
+ String command = getString(R.string.sirf_bin_to_nmea_38400_alt, gga, gll, gsa, gsv, rmc, vtg, mss, epe, zda);
+ gpsManager.sendSirfCommand(command);
+// gpsManager.sendSirfCommand(getString(R.string.sirf_bin_to_nmea));
} else {
- gpsManager.sendSirfCommand(getString(R.string.sirf_nmea_to_binary));
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_to_binary));
+ }
+ }
+ }
+
+ private void enableStaticNavigation(boolean enable){
+ if (gpsManager != null){
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+// SharedPreferences.Editor edit = sharedPreferences.edit();
+ boolean isInNmeaMode = sharedPreferences.getBoolean(PREF_SIRF_ENABLE_NMEA, false);
+ if (isInNmeaMode){
+ enableNMEA(false);
+ }
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_bin_static_nav_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_bin_static_nav_off));
+ }
+ if (isInNmeaMode){
+ enableNMEA(true);
}
}
}
diff --git a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
index 5a3ac08..b690285 100644
--- a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
+++ b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
@@ -178,11 +178,13 @@ public class NmeaParser {
}
// parse NMEA Sentence
- public void parseNmeaSentence(String gpsSentence){
+ public String parseNmeaSentence(String gpsSentence){
+ String nmeaSentence = null;
Log.e("BT test", "data: "+System.currentTimeMillis()+" "+gpsSentence);
Pattern xx = Pattern.compile("\\$([^*$]*)\\*([0-9A-F][0-9A-F])?\r\n");
Matcher m = xx.matcher(gpsSentence);
if (m.matches()){
+ nmeaSentence = m.group(0);
String sentence = m.group(1);
String checkSum = m.group(2);
Log.e("BT test", "data: "+System.currentTimeMillis()+" "+sentence+" cheksum; "+checkSum +" control: "+String.format("%X",computeChecksum(sentence)));
@@ -448,6 +450,7 @@ public class NmeaParser {
// Mode indicator, (A=autonomous, D=differential, E=Estimated, N=not valid, S=Simulator )
}
}
+ return nmeaSentence;
}
public double parseNmeaLatitude(String lat,String orientation){