aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-02-03 18:56:53 +0100
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-02-03 18:56:53 +0100
commit8e61dce458a72bfede3249707f635ed43731bc13 (patch)
treefe52f53292cc90b1fedbcb26f1416273621c87dc
parent0ef4195e94f316df8ba4e9032c7f58722aad8cc8 (diff)
downloadBlueGPS-8e61dce458a72bfede3249707f635ed43731bc13.zip
BlueGPS-8e61dce458a72bfede3249707f635ed43731bc13.tar.gz
BlueGPS-8e61dce458a72bfede3249707f635ed43731bc13.tar.bz2
add more comments
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index de2e776..b233168 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -62,6 +62,10 @@ import android.util.Log;
* @author Herbert von Broeuschmeul
*
*/
+/**
+ * @author stalb
+ *
+ */
public class BlueetoothGpsManager {
private static final String LOG_TAG = "BlueGPS";
@@ -187,6 +191,11 @@ public class BlueetoothGpsManager {
private int nbRetriesRemaining;
private boolean connected = false;
+ /**
+ * @param callingService
+ * @param deviceAddress
+ * @param maxRetries
+ */
public BlueetoothGpsManager(Service callingService, String deviceAddress, int maxRetries) {
this.gpsDeviceAddress = deviceAddress;
this.callingService = callingService;
@@ -219,6 +228,9 @@ public class BlueetoothGpsManager {
disableReason = reasonId;
}
+ /**
+ * @return
+ */
public int getDisableReason(){
return disableReason;
}
@@ -230,6 +242,10 @@ public class BlueetoothGpsManager {
return enabled;
}
+ /**
+ * Enables the bluetooth GPS Provider.
+ * @return
+ */
public synchronized boolean enable() {
notificationManager.cancel(R.string.service_closed_because_connection_problem_notification_title);
if (! enabled){
@@ -342,6 +358,13 @@ public class BlueetoothGpsManager {
}
return this.enabled;
}
+
+ /**
+ * Disables the bluetooth GPS Provider if the maximal number of connection retries is exceeded.
+ * This is used when there are possibly non fatal connection problems.
+ * In these cases the provider will try to reconnect with the bluetooth device
+ * and only after a given retries number will give up and shutdown the service.
+ */
private synchronized void disableIfNeeded(){
if (enabled){
if (nbRetriesRemaining > 0){
@@ -364,12 +387,39 @@ public class BlueetoothGpsManager {
}
}
+ /**
+ * Disables the bluetooth GPS provider.
+ *
+ * It will:
+ * <ul>
+ * <li>close the connection with the bluetooth device</li>
+ * <li>disable the Mock Location Provider used for the bluetooth GPS</li>
+ * <li>stop the BlueGPS4Droid service</li>
+ * </ul>
+ * The reasonId parameter indicates the reason to close the bluetooth provider.
+ * If its value is zero, it's a normal shutdown (normally, initiated by the user).
+ * If it's non-zero this value should correspond a valid localized string id (res/values..../...)
+ * which will be used to display a notification.
+ *
+ * @param reasonId the reason to close the bluetooth provider.
+ */
public synchronized void disable(int reasonId) {
Log.d(LOG_TAG, "disabling Bluetooth GPS manager reason: "+callingService.getString(reasonId));
setDisableReason(reasonId);
disable();
}
+ /**
+ * Disables the bluetooth GPS provider.
+ *
+ * It will:
+ * <ul>
+ * <li>close the connection with the bluetooth device</li>
+ * <li>disable the Mock Location Provider used for the bluetooth GPS</li>
+ * <li>stop the BlueGPS4Droid service</li>
+ * </ul>
+ * If the bluetooth provider is closed because of a problem, a notification is displayed.
+ */
public synchronized void disable() {
notificationManager.cancel(R.string.connection_problem_notification_title);
if (getDisableReason() != 0){