aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml131
-rw-r--r--readme.textile16
-rw-r--r--res/values-fr/strings.xml37
-rw-r--r--res/values/constants.xml44
-rw-r--r--res/values/strings.xml37
-rw-r--r--res/xml/pref.xml91
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java126
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java24
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java211
-rw-r--r--src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java8
-rw-r--r--src/org/broeuschmeul/android/gps/sirf/util/SirfUtils.java50
-rw-r--r--version.txt18
12 files changed, 701 insertions, 92 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ff68a9a..d9b0603 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,64 +1,67 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2010 Herbert von Broeuschmeul
- Copyright (C) 2010 BluetoothGPS4Droid Project
-
- This file is part of BluetoothGPS4Droid.
-
- BluetoothGPS4Droid is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- BluetoothGPS4Droid is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.broeuschmeul.android.gps.bluetooth.provider"
- android:versionCode="112"
- android:versionName="@string/versionName">
- <application android:icon="@drawable/icon" android:label="@string/app_name" android:allowClearUserData="true">
- <activity android:name=".BluetoothGpsActivity"
- android:label="@string/app_name"
- android:launchMode="singleTask" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
-<!--
- <service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" android:process=":BluetoothGpsProviderService" >
--->
- <service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" >
- <intent-filter>
- <action android:name="org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.START_TRACK_RECORDING">
- <category android:name="android.intent.category.DEFAULT" />
- </action>
- <action android:name="org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.STOP_TRACK_RECORDING">
- <category android:name="android.intent.category.DEFAULT" />
- </action>
- <action android:name="org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.START_GPS_PROVIDER">
- <category android:name="android.intent.category.DEFAULT" />
- </action>
- <action android:name="org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.STOP_GPS_PROVIDER">
- <category android:name="android.intent.category.DEFAULT" />
- </action>
- </intent-filter>
- </service>
-
- </application>
-
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
- <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
-
- <uses-sdk android:targetSdkVersion="5" android:minSdkVersion="5" />
-</manifest> \ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2010 Herbert von Broeuschmeul
+ Copyright (C) 2010 BluetoothGPS4Droid Project
+
+ This file is part of BluetoothGPS4Droid.
+
+ BluetoothGPS4Droid is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BluetoothGPS4Droid is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.broeuschmeul.android.gps.bluetooth.provider"
+ android:versionCode="120"
+ android:versionName="@string/versionName">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:allowClearUserData="true">
+ <activity android:name=".BluetoothGpsActivity"
+ android:label="@string/app_name"
+ android:launchMode="singleTask" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+<!--
+ <service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" android:process=":BluetoothGpsProviderService" >
+-->
+ <service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" >
+ <intent-filter>
+ <action android:name="org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.START_TRACK_RECORDING">
+ <category android:name="android.intent.category.DEFAULT" />
+ </action>
+ <action android:name="org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.STOP_TRACK_RECORDING">
+ <category android:name="android.intent.category.DEFAULT" />
+ </action>
+ <action android:name="org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.START_GPS_PROVIDER">
+ <category android:name="android.intent.category.DEFAULT" />
+ </action>
+ <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>
+
+ </application>
+
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+ <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
+
+ <uses-sdk android:targetSdkVersion="5" android:minSdkVersion="5" />
+</manifest>
diff --git a/readme.textile b/readme.textile
index da41bde..84bf765 100644
--- a/readme.textile
+++ b/readme.textile
@@ -1,19 +1,27 @@
-BlueGps4Droid 1.1.2
+BlueGps4Droid 1.2 alpha (2010-10-25)
+* SiRF configuration management (NMEA sentences - SBAS - Static Navigation)
+
+BlueGps4Droid 1.1.2 (2010-11-04)
* Add verifications: if bluetooth or mock locations are not enabled, the service is not started.
* Add alert messages to explain why the service cannot be started if bluetooth or mock locations are not enabled
* If device doesn't have an internal GPS, the bluetooth GPS provider will be enabled automatically
-BlueGps4Droid 1.1.1
+BlueGps4Droid 1.1.1 (2010-09-29)
* Bug fix (Ticket #4: Connection service is not properly closed https://sourceforge.net/p/bluegps4droid/tickets/4/).
* Add notifications when the connection with the GPS fails and when the connection service is closed because of two many connection retry.
* Add settings to choose the number of connection retries before exiting.
-BlueGps4Droid 1.1 (does not work properly because of bug #4. Use either version 1.0 or 1.1.1 !)
+BlueGps4Droid 1.1 (2010-09-26) - does not work properly because of bug #4. Use either version 1.0 or 1.1.1 !
* Reconnect automatically when the connection with the GPS is lost (5 attempts in 5 minutes)
* Replace Android default internal GPS or use a new location provider
* Send status notifications when GPS loses fix or is disconnected.
-BlueGps4Droid 1.0
+BlueGps4Droid 1.0.1 (2010-10-25)
+* Add verifications: if bluetooth or mock locations are not enabled, the service is not started.
+* Add alert messages to explain why the service cannot be started if bluetooth or mock locations are not enabled
+* If device doesn't have an internal GPS, the bluetooth GPS provider will be enabled automatically
+
+BlueGps4Droid 1.0 (2010-09-12)
* Connect to bluetooth GPS (NMEA) and replace the internal GPS of an Android device.
* Record GPS tracks in NMEA files
* Compatible with Android version 2.0 and above
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index b00db70..9b8ab51 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -24,6 +24,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 (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>
@@ -46,6 +47,42 @@
<string name="pref_about_title">À propos</string>
<string name="pref_about_summary"></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_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>
+ <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/constants.xml b/res/values/constants.xml
index 6ac5ca9..992fb83 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -19,7 +19,7 @@
along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
-->
<resources>
- <string name="versionName">1.1.2</string>
+ <string name="versionName">1.2.0</string>
<string name="pref_start_gps_key">startGps</string>
<string name="pref_gps_location_provider_key">gpsLocationProviderKey</string>
@@ -32,8 +32,50 @@
<string name="pref_bluetooth_device_key">bluetoothDevice</string>
<string name="pref_about_key">about</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>
+ <string name="pref_sirf_enable_gsv_key">enableGSV</string>
+ <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="defaultConnectionRetries">0</string>
<string name="defaultTrackFileDirectory">/sdcard/nmea</string>
<string name="defaultTrackFilePrefix">btnmeatrack</string>
<string name="defaultMockGpsName">bluetooth_gps</string>
+
+
+ <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>
+ <string name="sirf_nmea_gsa_off">PSRF103,02,00,00,01</string>
+ <string name="sirf_nmea_gsv_on">PSRF103,03,00,05,01</string>
+ <string name="sirf_nmea_gsv_off">PSRF103,03,00,00,01</string>
+ <string name="sirf_nmea_vtg_on">PSRF103,05,00,01,01</string>
+ <string name="sirf_nmea_vtg_off">PSRF103,05,00,00,01</string>
+ <string name="sirf_nmea_zda_on">PSRF103,08,00,01,01</string>
+ <string name="sirf_nmea_zda_off">PSRF103,08,00,00,01</string>
+
+ <string name="sirf_nmea_to_binary">PSRF100,0,38400,8,1,0</string>
+
+ <string name="sirf_nmea_sbas_on">PSRF151,01</string>
+ <string name="sirf_nmea_sbas_off">PSRF151,00</string>
+
+ <string name="sirf_bin_static_nav_on">8F01</string>
+ <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>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 62902d3..b9c4335 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,6 +24,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">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>
@@ -49,6 +50,42 @@
<string name="pref_about_title">About</string>
<string name="pref_about_summary"></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_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>
+ <string name="pref_enable_vtg_title">Enable NMEA VTG</string>
+ <string name="pref_enable_vtg_summary_off">NMEA VTG sentences are off</string>
+ <string name="pref_enable_vtg_summary_on">NMEA VTG sentences are on</string>
+ <string name="pref_enable_gsa_title">Enable NMEA GSA</string>
+ <string name="pref_enable_gsa_summary_off">NMEA GSA sentences are off</string>
+ <string name="pref_enable_gsa_summary_on">NMEA GSA sentences are on</string>
+ <string name="pref_enable_gsv_title">Enable NMEA GSV</string>
+ <string name="pref_enable_gsv_summary_off">NMEA GSV sentences are off</string>
+ <string name="pref_enable_gsv_summary_on">NMEA GSV sentences are on</string>
+ <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">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>
<string name="msg_gps_provider_already_started">Bluetooth GPS... is already on</string>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index af0cb0c..948e0c2 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -61,6 +61,97 @@
android:inputType="numberDecimal"
android:summary="@string/pref_connection_retries_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:dependency="@string/pref_sirf_gps_key"
+ android:orderingFromXml="true"
+ android:shouldDisableView = "true" >
+ <PreferenceCategory
+ android:order="200"
+ 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"
+ 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: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: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: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:title="@string/pref_enable_zda_title"
+ android:summaryOn="@string/pref_enable_zda_summary_on"
+ android:summaryOff="@string/pref_enable_zda_summary_off" />
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:order="100"
+ android:title="@string/pref_sirf_gps_category_title" >
+ <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" />
+ </PreferenceCategory>
+ </PreferenceScreen>
<CheckBoxPreference
android:enabled="true"
android:key="@string/pref_recording_key"
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index 335539a..39a0bf4 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -24,9 +24,12 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintStream;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -34,6 +37,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.broeuschmeul.android.gps.nmea.util.NmeaParser;
+import org.broeuschmeul.android.gps.sirf.util.SirfUtils;
import android.app.Notification;
import android.app.NotificationManager;
@@ -59,17 +63,32 @@ public class BlueetoothGpsManager {
private class ConnectedGps extends Thread {
private final InputStream in;
+ private final OutputStream out;
+ private final PrintStream out2;
+ private boolean ready = false;
public ConnectedGps(BluetoothSocket socket) {
InputStream tmpIn = null;
+ OutputStream tmpOut = null;
+ PrintStream tmpOut2 = null;
try {
tmpIn = socket.getInputStream();
+ tmpOut = socket.getOutputStream();
+ if (tmpOut != null){
+ tmpOut2 = new PrintStream(tmpOut, false, "US-ASCII");
+ }
} catch (IOException e) {
Log.e(LOG_TAG, "error while getting socket streams", e);
}
in = tmpIn;
+ out = tmpOut;
+ out2 = tmpOut2;
}
+ public boolean isReady(){
+ return ready;
+ }
+
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"US-ASCII"));
@@ -81,6 +100,7 @@ public class BlueetoothGpsManager {
s = reader.readLine();
Log.v(LOG_TAG, "data: "+System.currentTimeMillis()+" "+s);
notifyNmeaSentence(s+"\r\n");
+ ready = true;
lastRead = SystemClock.uptimeMillis();
} else {
Log.d(LOG_TAG, "data: not ready "+System.currentTimeMillis());
@@ -92,9 +112,45 @@ public class BlueetoothGpsManager {
Log.e(LOG_TAG, "error while getting data", e);
setMockLocationProviderOutOfService();
} finally {
+ ready = false;
disableIfNeeded();
}
}
+
+ /**
+ * Write to the connected OutStream.
+ * @param buffer The bytes to write
+ */
+ public void write(byte[] buffer) {
+ try {
+ do {
+ Thread.sleep(100);
+ } while (! ready);
+ out.write(buffer);
+ out.flush();
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "Exception during write", e);
+ } catch (InterruptedException e) {
+ Log.e(LOG_TAG, "Exception during write", e);
+ }
+ }
+ /**
+ * Write to the connected OutStream.
+ * @param buffer The data to write
+ */
+ public void write(String buffer) {
+ try {
+ do {
+ Thread.sleep(100);
+ } while (! ready);
+ out2.print(buffer);
+ out2.flush();
+ // } catch (IOException e) {
+ // Log.e("BT test", "Exception during write", e);
+ } catch (InterruptedException e) {
+ Log.e(LOG_TAG, "Exception during write", e);
+ }
+ }
}
private Service callingService;
@@ -187,15 +243,15 @@ public class BlueetoothGpsManager {
if (gpsDevice == null){
Log.e(LOG_TAG, "GPS device not found");
disable(R.string.msg_bluetooth_gps_unavaible);
- } else {
+ } else {
Log.e(LOG_TAG, "current device: "+gpsDevice.getName() + " -- " + gpsDevice.getAddress());
- try {
- gpsSocket = gpsDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
- } catch (IOException e) {
+ try {
+ gpsSocket = gpsDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
+ } catch (IOException e) {
Log.e(LOG_TAG, "Error during connection", e);
gpsSocket = null;
- }
- if (gpsSocket == null){
+ }
+ if (gpsSocket == null){
Log.e(LOG_TAG, "Error while establishing connection: no socket");
disable(R.string.msg_bluetooth_gps_unavaible);
} else {
@@ -272,7 +328,6 @@ public class BlueetoothGpsManager {
}
return this.enabled;
}
-
private synchronized void disableIfNeeded(){
if (enabled){
if (nbRetriesRemaining > 0){
@@ -315,11 +370,11 @@ public class BlueetoothGpsManager {
Log.d(LOG_TAG, "disabling Bluetooth GPS manager");
enabled = false;
if (gpsSocket != null){
- try {
- gpsSocket.close();
- } catch (IOException closeException) {
+ try {
+ gpsSocket.close();
+ } catch (IOException closeException) {
Log.e(LOG_TAG, "error while closing socket", closeException);
- }
+ }
}
nmeaListeners.clear();
disableMockLocationProvider();
@@ -412,5 +467,54 @@ public class BlueetoothGpsManager {
}
}
}
+ }
+
+ public void sendPackagedNmeaCommand(final String command){
+ Log.d(LOG_TAG, "sending NMEA sentence: "+command);
+ if (isEnabled()){
+ notificationPool.execute( new Runnable() {
+ @Override
+ public void run() {
+ while ((!enabled) || (!connected) || (connectedGps == null) || (!connectedGps.isReady())){
+ Log.v(LOG_TAG, "writing thread is not ready");
+ SystemClock.sleep(500);
+ }
+ if (isEnabled() && (connectedGps != null)){
+ connectedGps.write(command);
+ Log.d(LOG_TAG, "sent NMEA sentence: "+command);
+ }
+ }
+ });
+ }
+ }
+
+ public void sendPackagedSirfCommand(final String commandHexa){
+ Log.d(LOG_TAG, "sending SIRF sentence: "+commandHexa);
+ if (isEnabled()){
+ final byte[] command = SirfUtils.genSirfCommand(commandHexa);
+ notificationPool.execute( new Runnable() {
+ @Override
+ public void run() {
+ while ((!enabled) || (!connected) || (connectedGps == null) || (!connectedGps.isReady())){
+ Log.v(LOG_TAG, "writing thread is not ready");
+ SystemClock.sleep(500);
+ }
+ if (isEnabled() && (connectedGps != null)){
+ connectedGps.write(command);
+ Log.d(LOG_TAG, "sent SIRF sentence: "+commandHexa);
+ }
+ }
+ });
+ }
+ }
+
+ public void sendNmeaCommand(String sentence){
+ String command = String.format((Locale)null,"$%s*%X\r\n", sentence, parser.computeChecksum(sentence));
+ sendPackagedNmeaCommand(command);
+ }
+
+ public void sendSirfCommand(String payload){
+ String command = SirfUtils.createSirfCommandFromPayload(payload);
+ sendPackagedSirfCommand(command);
}
}
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 0b79286..858a0a1 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -193,7 +193,29 @@ 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)
+ || 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);
+ }
+ }
}
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 41ec34e..a2f1c8d 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -60,6 +60,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String ACTION_STOP_TRACK_RECORDING = "org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.STOP_TRACK_RECORDING";
public static final String ACTION_START_GPS_PROVIDER = "org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.START_GPS_PROVIDER";
public static final String ACTION_STOP_GPS_PROVIDER = "org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.STOP_GPS_PROVIDER";
+ public static final String ACTION_CONFIGURE_SIRF_GPS = "org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.CONFIGURE_SIRF_GPS";
public static final String PREF_START_GPS_PROVIDER = "startGps";
public static final String PREF_GPS_LOCATION_PROVIDER = "gpsLocationProviderKey";
public static final String PREF_REPLACE_STD_GPS = "replaceStdtGps";
@@ -74,6 +75,18 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
private static final String LOG_TAG = "BlueGPS";
// private static final String LOG_TAG = BluetoothGpsProviderService.class.getSimpleName();
+ 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";
+ public static final String PREF_SIRF_ENABLE_GSV = "enableGSV";
+ 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 BlueetoothGpsManager gpsManager = null;
private PrintWriter writer;
private File trackFile;
@@ -83,7 +96,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
@Override
public void onCreate() {
super.onCreate();
- toast = Toast.makeText(getApplicationContext(), "NMEA track recording... on", Toast.LENGTH_SHORT);
+ toast = Toast.makeText(getApplicationContext(), "NMEA track recording... on", Toast.LENGTH_SHORT);
}
@Override
@@ -105,6 +118,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
}
gpsManager = new BlueetoothGpsManager(this, deviceAddress, maxConRetries);
boolean enabled = gpsManager.enable();
+// Bundle extras = intent.getExtras();
if (sharedPreferences.getBoolean(PREF_START_GPS_PROVIDER, false) != enabled){
edit.putBoolean(PREF_START_GPS_PROVIDER,enabled);
edit.commit();
@@ -116,8 +130,11 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
PendingIntent myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setLatestEventInfo(getApplicationContext(), this.getString(R.string.foreground_service_started_notification_title), this.getString(R.string.foreground_gps_provider_started_notification), myPendingIntent);
startForeground(R.string.foreground_gps_provider_started_notification, notification);
+ if (sharedPreferences.getBoolean(PREF_SIRF_GPS, false)){
+ enableSirfConfig(sharedPreferences);
+ }
toast.setText(this.getString(R.string.msg_gps_provider_started));
- toast.show();
+ toast.show();
} else {
stopSelf();
}
@@ -167,6 +184,196 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
edit.commit();
}
stopSelf();
+ } else if (ACTION_CONFIGURE_SIRF_GPS.equals(intent.getAction())){
+ if (gpsManager != null){
+ Bundle extras = intent.getExtras();
+ enableSirfConfig(extras);
+ }
+ }
+ }
+
+ 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));
+ }
+ 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_STATIC_NAVIGATION)){
+ enableStaticNavigation(extras.getBoolean(PREF_SIRF_ENABLE_STATIC_NAVIGATION, false));
+ } else if (extras.containsKey(PREF_SIRF_ENABLE_NMEA)){
+ enableNMEA(extras.getBoolean(PREF_SIRF_ENABLE_NMEA, true));
+ }
+ if (extras.containsKey(PREF_SIRF_ENABLE_SBAS)){
+ 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));
+ }
+ 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_STATIC_NAVIGATION)){
+ enableStaticNavigation(extras.getBoolean(PREF_SIRF_ENABLE_STATIC_NAVIGATION, false));
+ } else if (extras.contains(PREF_SIRF_ENABLE_NMEA)){
+ enableNMEA(extras.getBoolean(PREF_SIRF_ENABLE_NMEA, true));
+ }
+ if (extras.contains(PREF_SIRF_ENABLE_SBAS)){
+ enableSBAS(extras.getBoolean(PREF_SIRF_ENABLE_SBAS, true));
+ }
+ 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){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gll_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gll_off));
+ }
+ }
+ }
+
+ private void enableNmeaVTG(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_vtg_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_vtg_off));
+ }
+ }
+ }
+
+ private void enableNmeaGSA(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gsa_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gsa_off));
+ }
+ }
+ }
+
+ private void enableNmeaGSV(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gsv_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_gsv_off));
+ }
+ }
+ }
+
+ private void enableNmeaZDA(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_zda_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_zda_off));
+ }
+ }
+ }
+
+ private void enableSBAS(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_sbas_on));
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_sbas_off));
+ }
+ }
+ }
+
+ private void enableNMEA(boolean enable){
+ if (gpsManager != null){
+ if (enable){
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ 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);
+ } else {
+ gpsManager.sendNmeaCommand(getString(R.string.sirf_nmea_to_binary));
+ }
+ }
+ }
+
+ private void enableStaticNavigation(boolean enable){
+ if (gpsManager != null){
+ SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean isInNmeaMode = sharedPreferences.getBoolean(PREF_SIRF_ENABLE_NMEA, true);
+ if (isInNmeaMode){
+ enableNMEA(false);
+ }
+ if (enable){
+ gpsManager.sendSirfCommand(getString(R.string.sirf_bin_static_nav_on));
+ } else {
+ gpsManager.sendSirfCommand(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 21df4ce..3d89efc 100644
--- a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
+++ b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
@@ -149,7 +149,7 @@ public class NmeaParser {
public boolean isMockGpsEnabled() {
return mockGpsEnabled;
}
-
+
public void setMockLocationProviderOutOfService(){
notifyStatusChanged(LocationProvider.OUT_OF_SERVICE, null, System.currentTimeMillis());
}
@@ -160,7 +160,7 @@ public class NmeaParser {
public String getMockLocationProvider() {
return mockLocationProvider;
}
-
+
private void notifyFix(Location fix) throws SecurityException {
fixTime = null;
hasGGA = false;
@@ -174,7 +174,7 @@ public class NmeaParser {
this.fix = null;
}
}
-
+
private void notifyStatusChanged(int status, Bundle extras, long updateTime){
fixTime = null;
hasGGA = false;
@@ -191,7 +191,7 @@ public class NmeaParser {
this.mockStatus = status;
}
}
-
+
// parse NMEA Sentence
public String parseNmeaSentence(String gpsSentence) throws SecurityException {
String nmeaSentence = null;
diff --git a/src/org/broeuschmeul/android/gps/sirf/util/SirfUtils.java b/src/org/broeuschmeul/android/gps/sirf/util/SirfUtils.java
new file mode 100644
index 0000000..cff60f7
--- /dev/null
+++ b/src/org/broeuschmeul/android/gps/sirf/util/SirfUtils.java
@@ -0,0 +1,50 @@
+package org.broeuschmeul.android.gps.sirf.util;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.util.Formatter;
+import java.util.Locale;
+
+public class SirfUtils {
+
+ private static final String start ="A0A2";
+ private static final String end ="B0B3";
+
+ public static byte[] genSirfCommand(String commandHexa){
+ int length = commandHexa.length()/2;
+ ByteBuffer command = ByteBuffer.allocate(length);
+ command.put(new BigInteger(commandHexa,16).toByteArray(), 1,length);
+ return command.array();
+ }
+
+ public static byte[] genSirfCommandFromPayload(String payload){
+ String commandHexa = createSirfCommandFromPayload(payload);
+ return genSirfCommand(commandHexa);
+ }
+
+ public static String createSirfCommandFromPayload(String payload){
+ int length = payload.length()/2;
+ String res;
+
+ byte[] command = new BigInteger(payload,16).toByteArray();
+
+ int checkSum = 0;
+ for (byte b : command){
+ checkSum += (b & 0xff);
+ }
+ checkSum &= 0x7FFF;
+
+ res = String.format((Locale)null, "%s%04X%s%04X%s", start, length, payload, checkSum, end);
+ return res;
+ }
+
+ public static String showSirfCommandFromPayload(String payload){
+ byte[] command = genSirfCommandFromPayload(payload);
+ StringBuilder out = new StringBuilder(payload.length()+16);
+ Formatter fmt = new Formatter(out, null);
+ for (byte b : command){
+ fmt.format("%02X", b);
+ }
+ return out.toString();
+ }
+}
diff --git a/version.txt b/version.txt
index 767abbf..1ecacdb 100644
--- a/version.txt
+++ b/version.txt
@@ -1,20 +1,28 @@
-BlueGps4Droid 1.1.2
+BlueGps4Droid 1.2 alpha (2010-10-25)
+ * SiRF configuration management (NMEA sentences - SBAS - Static Navigation)
+
+BlueGps4Droid 1.1.2 (2010-11-04)
* Add verifications: if bluetooth or mock locations are not enabled, the service is not started.
* Add alert messages to explain why the service cannot be started if bluetooth or mock locations are not enabled
* If device doesn't have an internal GPS, the bluetooth GPS provider will be enabled automatically
-BlueGps4Droid 1.1.1
+BlueGps4Droid 1.1.1 (2010-09-29)
* Bug fix (Ticket #4: Connection service is not properly closed https://sourceforge.net/p/bluegps4droid/tickets/4/).
* Add notifications when the connection with the GPS fails and when the connection service is closed because of two many connection retry.
* Add settings to choose the number of connection retries before exiting.
-BlueGps4Droid 1.1 (does not work properly because of bug #4. Use either version 1.0 or 1.1.1 !)
+BlueGps4Droid 1.1 (2010-09-26) - does not work properly because of bug #4. Use either version 1.0 or 1.1.1 !
* Reconnect automatically when the connection with the GPS is lost (5 attempts in 5 minutes)
* Replace Android default internal GPS or use a new location provider
* Send status notifications when GPS loses fix or is disconnected.
-BlueGps4Droid 1.0
+BlueGps4Droid 1.0.1 (2010-10-25)
+ * Add verifications: if bluetooth or mock locations are not enabled, the service is not started.
+ * Add alert messages to explain why the service cannot be started if bluetooth or mock locations are not enabled
+ * If device doesn't have an internal GPS, the bluetooth GPS provider will be enabled automatically
+
+BlueGps4Droid 1.0 (2010-09-12)
* Connect to bluetooth GPS (NMEA) and replace the internal GPS of an Android device.
* Record GPS tracks in NMEA files
* Compatible with Android version 2.0 and above
- * English and French translations \ No newline at end of file
+ * English and French translations