aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-06-30 22:24:35 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2012-10-10 03:25:43 +0200
commita44b685ada973fd128f6ec6fda32a99799712c44 (patch)
tree73131713bbeae2f642f58d196ebadc130c7564ee /src
parent56f4b61c61a2b5cd119cfc9ae2b9e8f1dee7f804 (diff)
downloadBlueGPS-a44b685ada973fd128f6ec6fda32a99799712c44.zip
BlueGPS-a44b685ada973fd128f6ec6fda32a99799712c44.tar.gz
BlueGPS-a44b685ada973fd128f6ec6fda32a99799712c44.tar.bz2
beautify code
Diffstat (limited to 'src')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index 22b12fb..3f2718f 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -233,7 +233,7 @@ public class BlueetoothGpsManager {
private Context appContext;
private NotificationManager notificationManager;
private int maxConnectionRetries;
- private int nbRetriesRemaining;
+// private int nbRetriesRemaining;
private long retriesTimeout = 0L;
private boolean connected = false;
@@ -246,7 +246,7 @@ public class BlueetoothGpsManager {
this.gpsDeviceAddress = deviceAddress;
this.callingService = callingService;
this.maxConnectionRetries = maxRetries;
- this.nbRetriesRemaining = 1+maxRetries;
+// this.nbRetriesRemaining = 1+maxRetries;
this.appContext = callingService.getApplicationContext();
locationManager = (LocationManager)callingService.getSystemService(Context.LOCATION_SERVICE);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(callingService);
@@ -337,7 +337,7 @@ public class BlueetoothGpsManager {
try {
connected = false;
Log.v(LOG_TAG, "current device: "+gpsDevice.getName() + " -- " + gpsDevice.getAddress());
- if ((bluetoothAdapter.isEnabled()) && (nbRetriesRemaining > 0 )){
+ if ((bluetoothAdapter.isEnabled()) /*&& (nbRetriesRemaining > 0 )*/){
try {
if (connectedGps != null){
connectedGps.close();
@@ -371,22 +371,22 @@ public class BlueetoothGpsManager {
// reset eventual disabling cause
// setDisableReason(0);
// connection obtained so reset the number of connection try
- nbRetriesRemaining = 1+maxConnectionRetries ;
+ // nbRetriesRemaining = 1+maxConnectionRetries ;
notificationManager.cancel(R.string.connection_problem_notification_title);
Log.v(LOG_TAG, "starting socket reading task");
connectedGps = new ConnectedGps(gpsSocket);
connectionAndReadingPool.execute(connectedGps);
Log.v(LOG_TAG, "socket reading thread started");
}
-// } else if (! bluetoothAdapter.isEnabled()) {
-// setDisableReason(R.string.msg_bluetooth_disabled);
+ } 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);
} finally {
- nbRetriesRemaining--;
+ // nbRetriesRemaining--;
if (! connected) {
disableIfNeeded();
}
@@ -422,14 +422,14 @@ public class BlueetoothGpsManager {
if (retriesTimeout > currentTime){
// if (nbRetriesRemaining > 0){
// Unable to connect
- nbRetriesRemaining = 1 + (int)((retriesTimeout - currentTime)/60000) ;
+ int nbRetriesRemaining = 1 + (int)((retriesTimeout - currentTime)/60000) ;
connectionProblemNotification.when = System.currentTimeMillis();
String pbMessage = appContext.getResources().getQuantityString(R.plurals.connection_problem_notification, nbRetriesRemaining, nbRetriesRemaining);
connectionProblemNotification.setLatestEventInfo(appContext,
appContext.getString(R.string.connection_problem_notification_title),
pbMessage,
connectionProblemNotification.contentIntent);
-// connectionProblemNotification.number = 1 + maxConnectionRetries - (int)((retriesTimeout - currentTime)/60000);
+// connectionProblemNotification.number = maxConnectionRetries - (int)((retriesTimeout - currentTime)/60000);
connectionProblemNotification.number = 1 + maxConnectionRetries - nbRetriesRemaining;
notificationManager.notify(R.string.connection_problem_notification_title, connectionProblemNotification);
Log.e(LOG_TAG, "Unable to establish connection since "+connectionProblemNotification.number + " still " + nbRetriesRemaining +" remaining");