aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-06-28 23:24:27 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-06-28 23:24:27 +0200
commit903e8370e1829fc07b6efaea8286bb77e2f768a2 (patch)
treee3bff5b7c5545122fd2140caa4cccf1e754fd64f
parent52ba995dca3ca0ab6c7fb7e2cd7b5beca7463c85 (diff)
downloadBlueGPS-903e8370e1829fc07b6efaea8286bb77e2f768a2.zip
BlueGPS-903e8370e1829fc07b6efaea8286bb77e2f768a2.tar.gz
BlueGPS-903e8370e1829fc07b6efaea8286bb77e2f768a2.tar.bz2
G-Tablet - Internal GPS 1st beta test version
-rw-r--r--AndroidManifest.xml16
-rw-r--r--res/values-es/strings.xml129
-rw-r--r--res/values-fr/strings.xml126
-rw-r--r--res/values/constants.xml1
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/pref.xml3
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java300
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java59
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java18
9 files changed, 208 insertions, 448 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 04c3986..6f8846b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -19,11 +19,11 @@
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"
+ package="org.broeuschmeul.android.gps.internal.provider"
android:versionCode="122"
android:versionName="@string/versionName">
<application android:icon="@drawable/ic_launcher_bluegps" android:label="@string/app_name" android:allowClearUserData="true">
- <activity android:name=".BluetoothGpsActivity"
+ <activity android:name="org.broeuschmeul.android.gps.bluetooth.provider.BluetoothGpsActivity"
android:label="@string/app_name"
android:launchMode="singleTask" >
<intent-filter>
@@ -35,21 +35,21 @@
<!--
<service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" android:process=":BluetoothGpsProviderService" >
-->
- <service android:name=".BluetoothGpsProviderService" android:enabled="true" android:exported="true" >
+ <service android:name="org.broeuschmeul.android.gps.bluetooth.provider.BluetoothGpsProviderService" android:enabled="true" android:exported="true" >
<intent-filter>
- <action android:name="org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.START_TRACK_RECORDING">
+ <action android:name="org.broeuschmeul.android.gps.internal.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">
+ <action android:name="org.broeuschmeul.android.gps.internal.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">
+ <action android:name="org.broeuschmeul.android.gps.internal.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">
+ <action android:name="org.broeuschmeul.android.gps.internal.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">
+ <action android:name="org.broeuschmeul.android.gps.internal.provider.nmea.intent.action.CONFIGURE_SIRF_GPS">
<category android:name="android.intent.category.DEFAULT" />
</action>
</intent-filter>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
deleted file mode 100644
index 734cf08..0000000
--- a/res/values-es/strings.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2010, 2011 Herbert von Broeuschmeul
- Copyright (C) 2010, 2011 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/.
--->
-<!--
- Author: Colegota
--->
-<resources>
- <string name="app_name">BlueGps</string>
-
- <string name="pref_start_gps_title">Arrancar/Parar el GPS</string>
- <string name="pref_start_gps_summary_off">El GPS Bluetooth está parado</string>
- <string name="pref_start_gps_summary_on">El GPS Bluetooth está arrancado</string>
- <string name="pref_start_gps_params_title">Opciones del GPS (SiRF)</string>
- <string name="pref_gps_location_provider_title">Opciones de fuentes de ubicación</string>
- <string name="pref_gps_location_provider_summary">El GPS Bluetooth remplazará al GPS interno</string>
- <string name="pref_replace_std_gps_title">Reemplazar el GPS interno</string>
- <string name="pref_replace_std_gps_summary_on">El GPS Bluetooth remplazará al GPS interno</string>
- <string name="pref_replace_std_gps_summary_off">El GPS interno queda disponible</string>
- <string name="pref_force_enable_provider_title">Forzar el uso del GPS</string>
- <string name="pref_force_enable_provider_summary_on">Auto-activación de la fuente de ubicación, aunque se ha desactivado</string>
- <string name="pref_force_enable_provider_summary_off">Auto-activación de la fuente de ubicación, sólo si aún no existe</string>
- <string name="pref_mock_gps_name_title">Nombre de la fuente de ubicación</string>
- <string name="pref_mock_gps_name_summary">Nombre del GPS Bluetooth : %s</string>
- <string name="pref_connection_retries_title">Número de conexiones</string>
- <string name="pref_connection_retries_summary">"Número de intentos antes de cerrar : %s"</string>
- <string name="pref_recording_title">Activar/Desactivar el log NMEA</string>
- <string name="pref_recording_summary_off">Registro del GPS desactivado</string>
- <string name="pref_recording_summary_on">Registro del GPS activado</string>
- <string name="pref_recording_params_title">"Parámetros de registro"</string>
- <string name="pref_trackfile_prefix_title">Prefijo del fichero de track</string>
- <string name="pref_trackfile_prefix_summary">Indicar un prefijo para el fichero de trazas</string>
- <string name="pref_trackfile_directory_title">Directorio de trazas</string>
- <string name="pref_trackfile_directory_summary">Indicar un directorio para los ficheros de trazas</string>
- <string name="pref_bluetooth_device_title">Selección del GPS</string>
- <string name="pref_bluetooth_device_summary">"Dispositivo actual : %s"</string>
- <string name="pref_about_title">Acerca de</string>
- <string name="pref_about_summary"></string>
-
- <string name="pref_sirf_gps_title">GPS SiRF</string>
- <string name="pref_sirf_gps_summary_off">"No usar las opciones SiRF"</string>
- <string name="pref_sirf_gps_summary_on">"Usar las opciones SiRF"</string>
- <string name="pref_sirf_nmea_category_title">Elegir sentencias NMEA</string>
- <string name="pref_sirf_gps_category_title">Funcionamiento del GPS</string>
- <string name="pref_enable_gga_title">Activación NMEA GGA</string>
- <string name="pref_enable_gga_summary_off">NMEA GGA desactivado</string>
- <string name="pref_enable_gga_summary_on">NMEA GGA activado</string>
- <string name="pref_enable_rmc_title">Activación NMEA RMC</string>
- <string name="pref_enable_rmc_summary_off">NMEA RMC desactivado</string>
- <string name="pref_enable_rmc_summary_on">NMEA RMC activado</string>
- <string name="pref_enable_gll_title">Activación NMEA GLL</string>
- <string name="pref_enable_gll_summary_off">NMEA GLL desactivado</string>
- <string name="pref_enable_gll_summary_on">NMEA GLL activado</string>
- <string name="pref_enable_vtg_title">Activación NMEA VTG</string>
- <string name="pref_enable_vtg_summary_off">NMEA VTG desactivado</string>
- <string name="pref_enable_vtg_summary_on">NMEA VTG activado</string>
- <string name="pref_enable_gsa_title">Activación NMEA GSA</string>
- <string name="pref_enable_gsa_summary_off">NMEA GSA desactivado</string>
- <string name="pref_enable_gsa_summary_on">NMEA GSA activado</string>
- <string name="pref_enable_gsv_title">Activación NMEA GSV</string>
- <string name="pref_enable_gsv_summary_off">NMEA GSV desactivado</string>
- <string name="pref_enable_gsv_summary_on">NMEA GSV activado</string>
- <string name="pref_enable_zda_title">Activación NMEA ZDA</string>
- <string name="pref_enable_zda_summary_off">NMEA ZDA desactivado</string>
- <string name="pref_enable_zda_summary_on">NMEA ZDA activado</string>
- <string name="pref_enable_sbas_title">SBAS (WAAS/EGNOS)</string>
- <string name="pref_enable_sbas_summary_off">SBAS desactivado</string>
- <string name="pref_enable_sbas_summary_on">SBAS activado</string>
- <string name="pref_enable_nmea_title">Mode NMEA/SiRF</string>
- <string name="pref_enable_nmea_summary_off">Modo SiRF binario activado</string>
- <string name="pref_enable_nmea_summary_on">Modo NMEA activado</string>
- <string name="pref_enable_static_navigation_title">Navegación estática</string>
- <string name="pref_enable_static_navigation_summary_off">Navegación estática desactivado</string>
- <string name="pref_enable_static_navigation_summary_on">Navegación estática activado</string>
-
- <string name="msg_gps_provider_started">GPS Bluetooth... arrancado</string>
- <string name="msg_gps_provider_stopped">GPS Bluetooth... parado</string>
- <string name="msg_gps_provider_already_started">GPS Bluetooth... ya está arrancado</string>
- <string name="msg_gps_provider_stopped_by_problem">"¡Vaya, no puedo arrancar! %s"</string>
- <string name="msg_two_many_connection_problems">Problemas de conexión</string>
- <string name="msg_gps_provider_disabled">El GPS está desactivado</string>
- <string name="msg_bluetooth_unsupported">Bluetooth no disponible</string>
- <string name="msg_bluetooth_disabled">Bluetooth desactivado</string>
- <string name="msg_mock_location_disabled">Ubicaciones ficticias (Mock) no activadas</string>
- <string name="msg_bluetooth_gps_unavaible">Imposible conectarse al GPS</string>
- <string name="msg_nmea_recording_started">Registro de trazas NMEA... iniciado</string>
- <string name="msg_nmea_recording_stopped">Registro de trazas NMEA... parado</string>
- <string name="msg_nmea_recording_already_started">El registro de trazas GPS... ya está iniciado</string>
- <string name="foreground_service_started_notification_title">BlueGps</string>
- <string name="foreground_gps_provider_started_notification">GPS Bluetooth arrancado.</string>
- <string name="foreground_nmea_recording_started_notification">Registro de trazas NMEA en curso.</string>
- <string name="connection_problem_notification_title">BlueGps : problema de conexión</string>
- <plurals name="connection_problem_notification">
- <item quantity="one">"Un intento más antes de cerrar"</item>
- <item quantity="other">"Todavía %d intentos más antes de cerrar"</item>
- </plurals>
- <string name="service_closed_because_connection_problem_notification_title">BlueGps parado</string>
- <string name="service_closed_because_connection_problem_notification">"Motivo : %s"</string>
-
- <string name="about_title">Acerca de</string>
- <string name="about_version">Versión BluetoothGPS4Droid</string>
- <string name="about_copyright_1">Copyright (C) 2010 Herbert von Broeuschmeul</string>
- <string name="about_copyright_2">Copyright (C) 2010 BluetoothGPS4Droid Project</string>
- <string name="about_app_desc">Bluetooth GPS para Android es una aplicación
- que permite utilizar un GPS bluetooth externo con un terminal Android.
- </string>
- <string name="about_license">Es Software Libre
- distribuido gratuítamente bajo los términos de <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html"><b>la licencia GNU/GPL</b></a>.
- </string>
- <string name="about_sources">El código fuente se puede descargar libremente del repositorio Git en la página del proyecto:
- http://sourceforge.net/p/bluegps4droid
- </string>
-</resources>
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
deleted file mode 100644
index eb1025d..0000000
--- a/res/values-fr/strings.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2010, 2011 Herbert von Broeuschmeul
- Copyright (C) 2010, 2011 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/.
--->
-<resources>
- <string name="app_name">BlueGps</string>
-
- <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>
- <string name="pref_replace_std_gps_summary_on">Le GPS Bluetooth remplacera le GPS interne</string>
- <string name="pref_replace_std_gps_summary_off">Un nouveau location provider sera utilisé</string>
- <string name="pref_force_enable_provider_title">Forcer l\'activation du GPS</string>
- <string name="pref_force_enable_provider_summary_on">Auto-activation du provider, même si l\'utilisateur l\'a desactivé</string>
- <string name="pref_force_enable_provider_summary_off">Auto-activation du provider, uniquement s\'il n\'existe pas déjà</string>
- <string name="pref_mock_gps_name_title">Nom du location provider</string>
- <string name="pref_mock_gps_name_summary">Nom du GPS Bluetooth : %s</string>
- <string name="pref_connection_retries_title">Nombre de connexions</string>
- <string name="pref_connection_retries_summary">"Nombre d'essais avant fermeture : %s"</string>
- <string name="pref_recording_title">Activer/Désactiver NMEA log</string>
- <string name="pref_recording_summary_off">Enregistrement du GPS inactif</string>
- <string name="pref_recording_summary_on">Enregistrement du GPS actif</string>
- <string name="pref_recording_params_title">"Paramètres d'enregistrement"</string>
- <string name="pref_trackfile_prefix_title">Préfixe</string>
- <string name="pref_trackfile_prefix_summary">Indiquer un préfixe pour les fichiers de traces</string>
- <string name="pref_trackfile_directory_title">Dossier</string>
- <string name="pref_trackfile_directory_summary">Indiquer un répertoire pour les fichiers de traces</string>
- <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_about_title">À propos de</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>
- <string name="msg_gps_provider_stopped_by_problem">"Oups ! %s"</string>
- <string name="msg_two_many_connection_problems">Problèmes de connexion</string>
- <string name="msg_gps_provider_disabled">Le GPS est désactivé</string>
- <string name="msg_bluetooth_unsupported">Bluetooth non disponible</string>
- <string name="msg_bluetooth_disabled">Bluetooth désactivé</string>
- <string name="msg_mock_location_disabled">Positions fictives non autorisées</string>
- <string name="msg_bluetooth_gps_unavaible">Impossible de se connecter au GPS</string>
- <string name="msg_nmea_recording_started">Enregistrement des traces NMEA... démarré</string>
- <string name="msg_nmea_recording_stopped">Enregistrement des traces NMEA... arrêté</string>
- <string name="msg_nmea_recording_already_started">Enregistrement des traces GPS... déjà démarré</string>
- <string name="foreground_service_started_notification_title">BlueGps</string>
- <string name="foreground_gps_provider_started_notification">GPS Bluetooth démarré.</string>
- <string name="foreground_nmea_recording_started_notification">Enregistrement des données NMEA en cours.</string>
- <string name="connection_problem_notification_title">BlueGps : problème de connexion</string>
- <plurals name="connection_problem_notification">
- <item quantity="one">"Encore un essai avant fermeture"</item>
- <item quantity="other">"Encore %d essais avant fermeture"</item>
- </plurals>
- <string name="service_closed_because_connection_problem_notification_title">BlueGps arrêté</string>
- <string name="service_closed_because_connection_problem_notification">"Motif : %s"</string>
-
- <string name="about_title">À propos de</string>
- <string name="about_version">BluetoothGPS4Droid version</string>
- <string name="about_copyright_1">Copyright (C) 2010 Herbert von Broeuschmeul</string>
- <string name="about_copyright_2">Copyright (C) 2010 BluetoothGPS4Droid Project</string>
- <string name="about_app_desc">Bluetooth GPS for Android est une application
- qui permet d\'utiliser un GPS bluetooth externe avec un terminal Android.
- </string>
- <string name="about_license">Il s\'agit d\'un logiciel libre
- distribué gratuitement et régi par la <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html"><b>Licence publique générale de GNU</b></a>.
- </string>
- <string name="about_sources">Le code source est librement téléchargeable à partir du dépot Git sur le site web du projet :
- http://sourceforge.net/p/bluegps4droid
- </string>
-</resources>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index a56e393..e625125 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -49,6 +49,7 @@
<string name="defaultTrackFileDirectory">/sdcard/nmea</string>
<string name="defaultTrackFilePrefix">btnmeatrack</string>
<string name="defaultMockGpsName">bluetooth_gps</string>
+ <string name="defaultGpsDevice">/dev/ttyHS3</string>
<string name="sirf_nmea_gga_on">PSRF103,00,00,01,01</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 88b2bfa..949f22f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,7 +19,7 @@
along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
-->
<resources>
- <string name="app_name">BlueGps</string>
+ <string name="app_name">InternalGps</string>
<string name="pref_start_gps_title">Start/Stop GPS</string>
<string name="pref_start_gps_summary_off">Bluetooth GPS is off</string>
@@ -93,7 +93,7 @@
<string name="msg_two_many_connection_problems">Too many connection problems</string>
<string name="msg_gps_provider_disabled">GPS is disabled</string>
<string name="msg_bluetooth_unsupported">Bluetooth is not supported</string>
- <string name="msg_bluetooth_disabled">Bluetooth is disabled</string>
+<!-- <string name="msg_bluetooth_disabled">Bluetooth is disabled</string> -->
<string name="msg_mock_location_disabled">Mock locations disabled</string>
<string name="msg_bluetooth_gps_unavaible">Cannot connect to bluetooth GPS</string>
<string name="msg_nmea_recording_started">GPS NMEA recording... started</string>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index 92e2628..9ca8688 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -21,10 +21,11 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/app_name" >
- <ListPreference
+ <EditTextPreference
android:dialogTitle="@string/pref_bluetooth_device_title"
android:title="@string/pref_bluetooth_device_title"
android:key="@string/pref_bluetooth_device_key"
+ android:defaultValue="@string/defaultGpsDevice"
android:summary="@string/pref_bluetooth_device_summary" />
<CheckBoxPreference
android:dependency="@string/pref_bluetooth_device_key"
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index 4deba63..0c9f455 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -21,6 +21,8 @@
package org.broeuschmeul.android.gps.bluetooth.provider;
import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -36,6 +38,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import org.broeuschmeul.android.gps.internal.provider.R;
import org.broeuschmeul.android.gps.nmea.util.NmeaParser;
import org.broeuschmeul.android.gps.sirf.util.SirfUtils;
@@ -43,9 +46,9 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothSocket;
+//import android.bluetooth.BluetoothAdapter;
+//import android.bluetooth.BluetoothDevice;
+//import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.Intent;
@@ -81,7 +84,7 @@ public class BlueetoothGpsManager {
/**
* GPS bluetooth socket used for communication.
*/
- private final BluetoothSocket socket;
+ private final File gpsDev ;
/**
* GPS InputStream from which we read data.
*/
@@ -89,34 +92,34 @@ public class BlueetoothGpsManager {
/**
* GPS output stream to which we send data (SIRF III binary commands).
*/
- private final OutputStream out;
+ //private final OutputStream out;
/**
* GPS output stream to which we send data (SIRF III NMEA commands).
*/
- private final PrintStream out2;
+ //private final PrintStream out2;
/**
* A boolean which indicates if the GPS is ready to receive data.
* In fact we consider that the GPS is ready when it begins to sends data...
*/
private boolean ready = false;
- public ConnectedGps(BluetoothSocket socket) {
- this.socket = socket;
+ public ConnectedGps(File gpsDev) {
+ this.gpsDev = gpsDev;
InputStream tmpIn = null;
- OutputStream tmpOut = null;
- PrintStream tmpOut2 = null;
+ //OutputStream tmpOut = null;
+ //PrintStream tmpOut2 = null;
try {
- tmpIn = socket.getInputStream();
- tmpOut = socket.getOutputStream();
- if (tmpOut != null){
- tmpOut2 = new PrintStream(tmpOut, false, "US-ASCII");
- }
+ tmpIn = new FileInputStream(gpsDev);
+ //tmpOut = new FileOutputStream(gpsDev);
+ //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;
+ //out = tmpOut;
+ //out2 = tmpOut2;
}
public boolean isReady(){
@@ -156,38 +159,38 @@ public class BlueetoothGpsManager {
* Write to the connected OutStream.
* @param buffer The bytes to write
*/
- public void write(byte[] buffer) {
- try {
- do {
- Thread.sleep(100);
- } while ((enabled) && (! ready));
- if ((enabled) && (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);
- }
- }
+// public void write(byte[] buffer) {
+// try {
+// do {
+// Thread.sleep(100);
+// } while ((enabled) && (! ready));
+// if ((enabled) && (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 ((enabled) && (! ready));
- if ((enabled) && (ready)){
- out2.print(buffer);
- out2.flush();
- }
- } catch (InterruptedException e) {
- Log.e(LOG_TAG, "Exception during write", e);
- }
- }
+// public void write(String buffer) {
+// try {
+// do {
+// Thread.sleep(100);
+// } while ((enabled) && (! ready));
+// if ((enabled) && (ready)){
+// out2.print(buffer);
+// out2.flush();
+// }
+// } catch (InterruptedException e) {
+// Log.e(LOG_TAG, "Exception during write", e);
+// }
+// }
public void close(){
ready = false;
@@ -197,26 +200,27 @@ public class BlueetoothGpsManager {
} catch (IOException e) {
Log.e(LOG_TAG, "error while closing GPS NMEA output stream", e);
} finally {
- try {
- Log.d(LOG_TAG, "closing Bluetooth GPS input streams");
- out2.close();
- out.close();
- } catch (IOException e) {
- Log.e(LOG_TAG, "error while closing GPS input streams", e);
- } finally {
- try {
- Log.d(LOG_TAG, "closing Bluetooth GPS socket");
- socket.close();
- } catch (IOException e) {
- Log.e(LOG_TAG, "error while closing GPS socket", e);
- }
- }
+// try {
+// Log.d(LOG_TAG, "closing Bluetooth GPS input streams");
+// out2.close();
+// out.close();
+// } catch (IOException e) {
+// Log.e(LOG_TAG, "error while closing GPS input streams", e);
+// } finally {
+// try {
+// Log.d(LOG_TAG, "closing Bluetooth GPS socket");
+// socket.close();
+// } catch (IOException e) {
+// Log.e(LOG_TAG, "error while closing GPS socket", e);
+// }
+// }
}
}
}
private Service callingService;
- private BluetoothSocket gpsSocket;
+// private BluetoothSocket gpsSocket;
+ private File gpsDev ;
private String gpsDeviceAddress;
private NmeaParser parser = new NmeaParser(10f);
private boolean enabled = false;
@@ -294,17 +298,18 @@ public class BlueetoothGpsManager {
notificationManager.cancel(R.string.service_closed_because_connection_problem_notification_title);
if (! enabled){
Log.d(LOG_TAG, "enabling Bluetooth GPS manager");
- final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- if (bluetoothAdapter == null) {
- // Device does not support Bluetooth
- Log.e(LOG_TAG, "Device does not support Bluetooth");
- disable(R.string.msg_bluetooth_unsupported);
- } else if (!bluetoothAdapter.isEnabled()) {
- // Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- // startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
- Log.e(LOG_TAG, "Bluetooth is not enabled");
- disable(R.string.msg_bluetooth_disabled);
- } else if (Settings.Secure.getInt(callingService.getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0)==0){
+// final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+// if (bluetoothAdapter == null) {
+// // Device does not support Bluetooth
+// Log.e(LOG_TAG, "Device does not support Bluetooth");
+// disable(R.string.msg_bluetooth_unsupported);
+// } else if (!bluetoothAdapter.isEnabled()) {
+// // Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+// // startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
+// Log.e(LOG_TAG, "Bluetooth is not enabled");
+// disable(R.string.msg_bluetooth_disabled);
+// } else
+ if (Settings.Secure.getInt(callingService.getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0)==0){
Log.e(LOG_TAG, "Mock location provider OFF");
disable(R.string.msg_mock_location_disabled);
// } else if ( (! locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
@@ -313,19 +318,21 @@ public class BlueetoothGpsManager {
// Log.e(LOG_TAG, "GPS location provider OFF");
// disable(R.string.msg_gps_provider_disabled);
} else {
- final BluetoothDevice gpsDevice = bluetoothAdapter.getRemoteDevice(gpsDeviceAddress);
+// final BluetoothDevice gpsDevice = bluetoothAdapter.getRemoteDevice(gpsDeviceAddress);
+ final String gpsDevice = gpsDeviceAddress;
if (gpsDevice == null){
Log.e(LOG_TAG, "GPS device not found");
disable(R.string.msg_bluetooth_gps_unavaible);
} 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) {
- Log.e(LOG_TAG, "Error during connection", e);
- gpsSocket = null;
- }
- if (gpsSocket == null){
+ Log.e(LOG_TAG, "current device: "+gpsDevice );
+// try {
+// gpsSocket = gpsDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
+ gpsDev = new File(gpsDeviceAddress);
+// } catch (IOException e) {
+// Log.e(LOG_TAG, "Error during connection", e);
+// gpsDev = null;
+// }
+ if (gpsDev == null){
Log.e(LOG_TAG, "Error while establishing connection: no socket");
disable(R.string.msg_bluetooth_gps_unavaible);
} else {
@@ -334,36 +341,37 @@ public class BlueetoothGpsManager {
public void run() {
try {
connected = false;
- Log.v(LOG_TAG, "current device: "+gpsDevice.getName() + " -- " + gpsDevice.getAddress());
- if ((bluetoothAdapter.isEnabled()) && (nbRetriesRemaining > 0 )){
- try {
+ Log.v(LOG_TAG, "current device: "+gpsDevice);
+ if (/*(bluetoothAdapter.isEnabled()) && */(nbRetriesRemaining > 0 )){
+// try {
if (connectedGps != null){
connectedGps.close();
}
- if ((gpsSocket != null) && ((connectedGps == null) || (connectedGps.socket != gpsSocket))){
- Log.d(LOG_TAG, "trying to close old socket");
- gpsSocket.close();
- }
- } catch (IOException e) {
- Log.e(LOG_TAG, "Error during disconnection", 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){
- Log.e(LOG_TAG, "Error while establishing connection: no socket");
+// if ((gpsDev != null) && ((connectedGps == null) || (connectedGps.gpsDev != gpsDev))){
+// Log.d(LOG_TAG, "trying to close old socket");
+// gpsSocket.close();
+// }
+// } catch (IOException e) {
+// Log.e(LOG_TAG, "Error during disconnection", e);
+// }
+// try {
+// gpsSocket = gpsDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
+ gpsDev = new File(gpsDeviceAddress);
+// } catch (IOException e) {
+// Log.e(LOG_TAG, "Error during connection", e);
+// gpsDev = null;
+// }
+ if (gpsDev == null){
+ Log.e(LOG_TAG, "Error while establishing connection: no device");
disable(R.string.msg_bluetooth_gps_unavaible);
} else {
// Cancel discovery because it will slow down the connection
- bluetoothAdapter.cancelDiscovery();
+// bluetoothAdapter.cancelDiscovery();
// we increment the number of connection tries
// Connect the device through the socket. This will block
// until it succeeds or throws an exception
Log.v(LOG_TAG, "connecting to socket");
- gpsSocket.connect();
+// gpsDev.connect();
Log.d(LOG_TAG, "connected to socket");
connected = true;
// reset eventual disabling cause
@@ -372,17 +380,17 @@ public class BlueetoothGpsManager {
nbRetriesRemaining = 1+maxConnectionRetries ;
notificationManager.cancel(R.string.connection_problem_notification_title);
Log.v(LOG_TAG, "starting socket reading task");
- connectedGps = new ConnectedGps(gpsSocket);
+ connectedGps = new ConnectedGps(gpsDev);
connectionAndReadingPool.execute(connectedGps);
Log.v(LOG_TAG, "socket reading thread started");
}
// } else if (! bluetoothAdapter.isEnabled()) {
// setDisableReason(R.string.msg_bluetooth_disabled);
}
- } catch (IOException connectException) {
- // Unable to connect
- Log.e(LOG_TAG, "error while connecting to socket", connectException);
- // disable(R.string.msg_bluetooth_gps_unavaible);
+// } catch (IOException connectException) {
+// // Unable to connect
+// Log.e(LOG_TAG, "error while connecting to socket", connectException);
+// // disable(R.string.msg_bluetooth_gps_unavaible);
} finally {
nbRetriesRemaining--;
if (! connected) {
@@ -494,14 +502,14 @@ public class BlueetoothGpsManager {
if (connectedGps != null){
connectedGps.close();
}
- if ((gpsSocket != null) && ((connectedGps == null) || (connectedGps.socket != gpsSocket))){
- try {
- Log.d(LOG_TAG, "closing Bluetooth GPS socket");
- gpsSocket.close();
- } catch (IOException closeException) {
- Log.e(LOG_TAG, "error while closing socket", closeException);
- }
- }
+// if ((gpsDev != null) && ((connectedGps == null) || (connectedGps.gpsDev != gpsDev))){
+// try {
+// Log.d(LOG_TAG, "closing Bluetooth GPS socket");
+// gpsDev.close();
+// } catch (IOException closeException) {
+// Log.e(LOG_TAG, "error while closing socket", closeException);
+// }
+// }
}
}
};
@@ -672,22 +680,22 @@ public class BlueetoothGpsManager {
* @param command the complete NMEA sentence (i.e. $....*XY where XY is the checksum).
*/
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);
- }
- }
- });
- }
+ Log.e(LOG_TAG, "Disabled .... 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);
+// }
+// }
+// });
+// }
}
/**
@@ -697,23 +705,23 @@ public class BlueetoothGpsManager {
* (i.e. with the <em>Start Sequence</em>, <em>Payload Length</em>, <em>Payload</em>, <em>Message Checksum</em> and <em>End Sequence</em>).
*/
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);
- }
- }
- });
- }
+ Log.d(LOG_TAG, "Disabled 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);
+// }
+// }
+// });
+// }
}
/**
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 885148c..c483815 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -23,14 +23,17 @@ package org.broeuschmeul.android.gps.bluetooth.provider;
import java.util.HashSet;
import java.util.Set;
+import org.broeuschmeul.android.gps.internal.provider.R;
+
import android.app.AlertDialog;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
+//import android.bluetooth.BluetoothAdapter;
+//import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
+import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
@@ -55,7 +58,7 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
private static final String LOG_TAG = "BlueGPS";
private SharedPreferences sharedPref ;
- private BluetoothAdapter bluetoothAdapter = null;
+// private BluetoothAdapter bluetoothAdapter = null;
/** Called when the activity is first created. */
@Override
@@ -64,7 +67,7 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
addPreferencesFromResource(R.xml.pref);
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sharedPref.registerOnSharedPreferenceChangeListener(this);
- bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+// bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Preference pref = findPreference(BluetoothGpsProviderService.PREF_ABOUT);
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
@@ -86,12 +89,12 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
private void updateDevicePreferenceSummary(){
// update bluetooth device summary
- String deviceName = "";
- ListPreference prefDevices = (ListPreference)findPreference(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE);
- String deviceAddress = sharedPref.getString(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE, null);
- if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
- deviceName = bluetoothAdapter.getRemoteDevice(deviceAddress).getName();
- }
+// String deviceName = "";
+ EditTextPreference prefDevices = (EditTextPreference)findPreference(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE);
+ String deviceName = sharedPref.getString(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE, getString(R.string.defaultGpsDevice));
+// if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
+// deviceName = bluetoothAdapter.getRemoteDevice(deviceAddress).getName();
+// }
prefDevices.setSummary(getString(R.string.pref_bluetooth_device_summary, deviceName));
}
@@ -99,24 +102,24 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
// update bluetooth device summary
updateDevicePreferenceSummary();
// update bluetooth device list
- ListPreference prefDevices = (ListPreference)findPreference(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE);
- Set<BluetoothDevice> pairedDevices = new HashSet<BluetoothDevice>();
- if (bluetoothAdapter != null){
- pairedDevices = bluetoothAdapter.getBondedDevices();
- }
- String[] entryValues = new String[pairedDevices.size()];
- String[] entries = new String[pairedDevices.size()];
- int i = 0;
- // Loop through paired devices
- for (BluetoothDevice device : pairedDevices) {
- // Add the name and address to the ListPreference enties and entyValues
- Log.v(LOG_TAG, "device: "+device.getName() + " -- " + device.getAddress());
- entryValues[i] = device.getAddress();
- entries[i] = device.getName();
- i++;
- }
- prefDevices.setEntryValues(entryValues);
- prefDevices.setEntries(entries);
+// ListPreference prefDevices = (ListPreference)findPreference(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE);
+// Set<BluetoothDevice> pairedDevices = new HashSet<BluetoothDevice>();
+// if (bluetoothAdapter != null){
+// pairedDevices = bluetoothAdapter.getBondedDevices();
+// }
+// String[] entryValues = new String[pairedDevices.size()];
+// String[] entries = new String[pairedDevices.size()];
+// int i = 0;
+// // Loop through paired devices
+// for (BluetoothDevice device : pairedDevices) {
+// // Add the name and address to the ListPreference enties and entyValues
+// Log.v(LOG_TAG, "device: "+device.getName() + " -- " + device.getAddress());
+// entryValues[i] = device.getAddress();
+// entries[i] = device.getName();
+// i++;
+// }
+// prefDevices.setEntryValues(entryValues);
+// prefDevices.setEntries(entries);
Preference pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_TRACK_RECORDING);
pref.setEnabled(sharedPref.getBoolean(BluetoothGpsProviderService.PREF_START_GPS_PROVIDER, false));
pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_MOCK_GPS_NAME);
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 1290344..2b0ed3b 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -31,10 +31,12 @@ import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.broeuschmeul.android.gps.internal.provider.R;
+
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
-import android.bluetooth.BluetoothAdapter;
+//import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
@@ -56,11 +58,11 @@ import android.widget.Toast;
*/
public class BluetoothGpsProviderService extends Service implements NmeaListener, LocationListener {
- public static final String ACTION_START_TRACK_RECORDING = "org.broeuschmeul.android.gps.bluetooth.tracker.nmea.intent.action.START_TRACK_RECORDING";
- 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 ACTION_START_TRACK_RECORDING = "org.broeuschmeul.android.gps.internal.tracker.nmea.intent.action.START_TRACK_RECORDING";
+ public static final String ACTION_STOP_TRACK_RECORDING = "org.broeuschmeul.android.gps.internal.tracker.nmea.intent.action.STOP_TRACK_RECORDING";
+ public static final String ACTION_START_GPS_PROVIDER = "org.broeuschmeul.android.gps.internal.provider.nmea.intent.action.START_GPS_PROVIDER";
+ public static final String ACTION_STOP_GPS_PROVIDER = "org.broeuschmeul.android.gps.internal.provider.nmea.intent.action.STOP_GPS_PROVIDER";
+ public static final String ACTION_CONFIGURE_SIRF_GPS = "org.broeuschmeul.android.gps.internal.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";
@@ -107,14 +109,14 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
// super.onStart(intent, startId);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPreferences.edit();
- String deviceAddress = sharedPreferences.getString(PREF_BLUETOOTH_DEVICE, null);
+ String deviceAddress = sharedPreferences.getString(PREF_BLUETOOTH_DEVICE, getString(R.string.defaultGpsDevice));
int maxConRetries = Integer.parseInt(sharedPreferences.getString(PREF_CONNECTION_RETRIES, this.getString(R.string.defaultConnectionRetries)));
if (Config.LOGD){
Log.d(LOG_TAG, "prefs device addr: "+deviceAddress);
}
if (ACTION_START_GPS_PROVIDER.equals(intent.getAction())){
if (gpsManager == null){
- if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
+ if (true /*|| BluetoothAdapter.checkBluetoothAddress(deviceAddress)*/){
String mockProvider = LocationManager.GPS_PROVIDER;
if (! sharedPreferences.getBoolean(PREF_REPLACE_STD_GPS, true)){
mockProvider = sharedPreferences.getString(PREF_MOCK_GPS_NAME, getString(R.string.defaultMockGpsName));