aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-18 22:43:56 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-18 22:43:56 +0200
commit142734b2aceda5e4374991dc18816ccfc5a28b91 (patch)
tree50d7e3b3166539889ea13f8fee33695204d14e24 /src
parenteddc206850ad7b7b624c3a71cae70ae37789602c (diff)
downloadBlueGPS-142734b2aceda5e4374991dc18816ccfc5a28b91.zip
BlueGPS-142734b2aceda5e4374991dc18816ccfc5a28b91.tar.gz
BlueGPS-142734b2aceda5e4374991dc18816ccfc5a28b91.tar.bz2
Code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java76
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java3
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java22
3 files changed, 1 insertions, 100 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index 2ccc28d..a86b701 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -29,7 +29,6 @@ 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;
@@ -42,14 +41,11 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.SharedPreferences;
-import android.location.Criteria;
import android.location.LocationManager;
-import android.location.LocationProvider;
import android.location.GpsStatus.NmeaListener;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
-import android.util.PrintStreamPrinter;
public class BlueetoothGpsManager {
@@ -83,10 +79,6 @@ public class BlueetoothGpsManager {
while((enabled && (s = reader.readLine()) != null)){
Log.e("BT test", "data: "+System.currentTimeMillis()+" "+s + "xxx");
notifyNmeaSentence(s+"\r\n");
-// parser.parseNmeaSentence(s);
-// // writer.println(s);
-// addNMEAString(s);
-// nmeaSentenceHandler.ob
}
} catch (IOException e) {
Log.e("BT test", "error while getting data", e);
@@ -94,30 +86,6 @@ public class BlueetoothGpsManager {
disable();
}
}
-
- /**
- * Write to the connected OutStream.
- * @param buffer The bytes to write
- */
- public void write(byte[] buffer) {
- try {
- out.write(buffer);
- } catch (IOException e) {
-// Log.e(TAG, "Exception during write", e);
- }
- }
- /**
- * Write to the connected OutStream.
- * @param buffer The data to write
- */
- public void write(String buffer) {
- try {
- out2.print(buffer);
- out.flush();
- } catch (IOException e) {
-// Log.e(TAG, "Exception during write", e);
- }
- }
}
private Service callingService;
@@ -130,12 +98,8 @@ public class BlueetoothGpsManager {
private List<NmeaListener> nmeaListeners = Collections.synchronizedList(new LinkedList<NmeaListener>());
private LocationManager locationManager;
private SharedPreferences sharedPreferences;
-// private boolean mockGpsEnabled = true;
-// private String mockLocationProvider = LocationManager.GPS_PROVIDER;
private ConnectedThread connectedThread;
-// private Handler nmeaSentenceHandler = new Handler();
-
public BlueetoothGpsManager(Service callingService, String deviceAddress) {
this.gpsDeviceAddress = deviceAddress;
this.callingService = callingService;
@@ -181,14 +145,6 @@ public class BlueetoothGpsManager {
if (gpsSocket == null){
Log.e("BT test", "Error while establishing connection: no socket");
} else {
-//// mockGpsEnabled = locationManager.isProviderEnabled(mockLocationProvider);
-// LocationProvider prov = locationManager.getProvider(mockLocationProvider);
-// Log.e("BT test", "Mock power: "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+locationManager.isProviderEnabled(mockLocationProvider));
-// locationManager.addTestProvider(mockLocationProvider, false, true,false, false,
-// true, true, true, Criteria.POWER_HIGH, Criteria.ACCURACY_FINE);
-//// locationManager.setTestProviderEnabled(mockLocationProvider, true);
-// prov = locationManager.getProvider(mockLocationProvider);
-// Log.e("BT test", "Mock power: "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+locationManager.isProviderEnabled(mockLocationProvider));
Runnable connectThread = new Runnable() {
@Override
@@ -201,26 +157,8 @@ public class BlueetoothGpsManager {
gpsSocket.connect();
connectedThread = new ConnectedThread(gpsSocket);
connectedThread.start();
-// String command = callingService.getString(R.string.sirf_gll_on);
-// String sentence = String.format((Locale)null,"$%s*%X\r\n", command, parser.computeChecksum(command));
-// String command1 = callingService.getString(R.string.sirf_gll_off);
-// String sentence1 = String.format((Locale)null,"$%s*%X\r\n", command1, parser.computeChecksum(command1));
-// String command2 = callingService.getString(R.string.sirf_vtg_off);
-// String sentence2 = String.format((Locale)null,"$%s*%X\r\n", command2, parser.computeChecksum(command2));
-// try {
-// Thread.sleep(5000);
-// } catch (InterruptedException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// Log.e("BT test", "sending NMEA sentence: "+"$PSRF105,1*3E\r\n");
-// connectedThread.write("$PSRF105,1*3E\r\n");
-// Log.e("BT test", "sending NMEA sentence: "+sentence1);
-// connectedThread.write(sentence1);
-// Log.e("BT test", "sending NMEA sentence: "+sentence2);
-// connectedThread.write(sentence2);
} catch (IOException connectException) {
- // Unable to connect; close everything and get out
+ // Unable to connect; So close everything and get out
Log.e("BT test", "error while connecting to socket", connectException);
disable();
// callingService.stopSelf();
@@ -250,18 +188,6 @@ public class BlueetoothGpsManager {
nmeaListeners.clear();
disableMockLocationProvider();
notificationPool.shutdown();
-//// locationManager.setTestProviderEnabled(mockLocationProvider, mockGpsEnabled);
-// LocationProvider prov = locationManager.getProvider(mockLocationProvider);
-// Log.e("BT test", "Mock power: "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+locationManager.isProviderEnabled(mockLocationProvider));
-// locationManager.clearTestProviderEnabled(mockLocationProvider);
-// prov = locationManager.getProvider(mockLocationProvider);
-// Log.e("BT test", "Mock power: "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+locationManager.isProviderEnabled(mockLocationProvider));
-// locationManager.clearTestProviderStatus(mockLocationProvider);
-// locationManager.removeTestProvider(mockLocationProvider);
-// prov = locationManager.getProvider(mockLocationProvider);
-// Log.e("BT test", "Mock power: "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+locationManager.isProviderEnabled(mockLocationProvider));
-// Log.e("BT test", "removed mock GPS");
-
callingService.stopSelf();
}
}
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 8ce8e62..22993bb 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -21,8 +21,6 @@
package org.broeuschmeul.android.gps.bluetooth.provider;
import java.util.Set;
-import java.util.prefs.Preferences;
-import java.util.zip.CheckedInputStream;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -35,7 +33,6 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
import android.preference.Preference.OnPreferenceChangeListener;
import android.util.Log;
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 2a30ea8..6ae24d6 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -88,12 +88,8 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
// super.onStart(intent, startId);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPreferences.edit();
-// long minTime = Long.parseLong(sharedPreferences.getString(PREF_TRACK_MIN_TIME, this.getString(R.string.defaultTrackMinTime)));
-// float minDistance = Float.parseFloat(sharedPreferences.getString(PREF_TRACK_MIN_DISTANCE, this.getString(R.string.defaultTrackMinDistance)));
String deviceAddress = sharedPreferences.getString(PREF_BLUETOOTH_DEVICE, null);
if (Config.LOGD){
-// Log.d(BluetoothGpsProviderService.class.getName(), "prefs minTime: "+minTime);
-// Log.d(BluetoothGpsProviderService.class.getName(), "prefs minDistance: "+minDistance);
Log.d(BluetoothGpsProviderService.class.getName(), "prefs device addr: "+deviceAddress);
}
if (ACTION_START_GPS_PROVIDER.equals(intent.getAction())){
@@ -287,22 +283,4 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public void onNmeaReceived(long timestamp, String data) {
addNMEAString(data);
}
-
-// private void startBluetoothGps(String deviceAddress){
-// Notification notification = new Notification(R.drawable.icon, this.getString(R.string.foreground_service_started_notification), System.currentTimeMillis());
-// Intent myIntent = new Intent(this, BluetoothGpsActivity.class);
-// 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_service_started_notification), myPendingIntent);
-// startForeground(R.string.foreground_service_started_notification, notification);
-// if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
-// gpsManager = new BlueetoothGpsManager(this, deviceAddress);
-// gpsManager.enable();
-// gpsManager.enableMockLocationProvider(LocationManager.GPS_PROVIDER);
-// toast.setText(this.getString(R.string.msg_started));
-// toast.show();
-//// } else {
-//// toast.setText(this.getString(R.string.msg_invalid_device));
-//// toast.show();
-// }
-// }
}