summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-18 19:12:38 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-18 19:12:38 +0200
commit42423ebf890bc51a9d8d24539fb05a200d878885 (patch)
tree956218cce68e85c85b940b4378ce7630bf8e99cb /src
parent40eb17c3c472bf088568abe7082427f1ab891399 (diff)
Version 0.5.5
- Add state to speed display
Diffstat (limited to 'src')
-rw-r--r--src/de/blinkt/openvpn/LogWindow.java6
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java20
-rw-r--r--src/de/blinkt/openvpn/OpenVPNThread.java2
-rw-r--r--src/de/blinkt/openvpn/OpenVpnManagementThread.java11
-rw-r--r--src/de/blinkt/openvpn/Settings_Authentication.java1
-rw-r--r--src/de/blinkt/openvpn/Settings_IP.java1
-rw-r--r--src/de/blinkt/openvpn/Settings_Routing.java1
7 files changed, 24 insertions, 18 deletions
diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java
index 2e2612d3..b38951df 100644
--- a/src/de/blinkt/openvpn/LogWindow.java
+++ b/src/de/blinkt/openvpn/LogWindow.java
@@ -28,9 +28,9 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import de.blinkt.openvpn.OpenVPN.LogListener;
-import de.blinkt.openvpn.OpenVPN.SpeedListener;
+import de.blinkt.openvpn.OpenVPN.StateListener;
-public class LogWindow extends ListActivity implements SpeedListener {
+public class LogWindow extends ListActivity implements StateListener {
private String[] mBconfig=null;
@@ -270,7 +270,7 @@ public class LogWindow extends ListActivity implements SpeedListener {
}
@Override
- public void updateSpeed(final String logmessage) {
+ public void updateState(final String logmessage) {
runOnUiThread(new Runnable() {
@Override
diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java
index 1d9eb6e0..40fe3afd 100644
--- a/src/de/blinkt/openvpn/OpenVPN.java
+++ b/src/de/blinkt/openvpn/OpenVPN.java
@@ -10,15 +10,15 @@ public class OpenVPN {
public static LinkedList<String> logbuffer = new LinkedList<String>();
private static Vector<LogListener> logListener=new Vector<OpenVPN.LogListener>();
- private static Vector<SpeedListener> speedListener=new Vector<OpenVPN.SpeedListener>();
+ private static Vector<StateListener> stateListener=new Vector<OpenVPN.StateListener>();
private static String[] mBconfig;
public interface LogListener {
void newLog(String logmessage);
}
- public interface SpeedListener {
- void updateSpeed(String logmessage);
+ public interface StateListener {
+ void updateState(String logmessage);
}
synchronized static void logMessage(int level,String prefix, String message)
@@ -46,12 +46,12 @@ public class OpenVPN {
}
- synchronized static void addSpeedListener(SpeedListener sl){
- speedListener.add(sl);
+ synchronized static void addSpeedListener(StateListener sl){
+ stateListener.add(sl);
}
- synchronized static void removeSpeedListener(SpeedListener sl) {
- speedListener.remove(sl);
+ synchronized static void removeSpeedListener(StateListener sl) {
+ stateListener.remove(sl);
}
@@ -77,9 +77,9 @@ public class OpenVPN {
}
- public static void updateSpeedString(String msg) {
- for (SpeedListener sl : speedListener) {
- sl.updateSpeed(msg);
+ public static void updateStateString(String msg) {
+ for (StateListener sl : stateListener) {
+ sl.updateState(msg);
}
}
}
diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java
index 89cd0a59..dcd5f4ec 100644
--- a/src/de/blinkt/openvpn/OpenVPNThread.java
+++ b/src/de/blinkt/openvpn/OpenVPNThread.java
@@ -58,7 +58,7 @@ public class OpenVPNThread implements Runnable {
//mInterface = null;
- mService.getHandler().sendEmptyMessage(R.string.disconnected);
+ OpenVPN.updateStateString("No process running");
// Not a good place to do it, but will do
OpenVPN.logBuilderConfig(null);
Log.i(TAG, "Exiting");
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
index 82d6f00d..c10cdb1e 100644
--- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
@@ -161,10 +161,13 @@ public class OpenVpnManagementThread implements Runnable {
} else if (cmd.equals("HOLD")) {
managmentCommand("hold release\n");
managmentCommand("bytecount " + mBytecountinterval + "\n");
+ managmentCommand("state on\n");
} else if (cmd.equals("NEED-OK")) {
processNeedCommand(argument);
} else if (cmd.equals("BYTECOUNT")){
processByteCount(argument);
+ } else if (cmd.equals("STATE")){
+ processState(argument);
} else if (cmd.equals("LOG")) {
String[] args = argument.split(",",3);
// 0 unix time stamp
@@ -183,6 +186,12 @@ public class OpenVpnManagementThread implements Runnable {
}
}
+ private void processState(String argument) {
+ String[] args = argument.split(",",2);
+ OpenVPN.updateStateString(args[1]);
+ }
+
+
private void processByteCount(String argument) {
// >BYTECOUNT:{BYTES_IN},{BYTES_OUT}
int comma = argument.indexOf(',');
@@ -200,7 +209,7 @@ public class OpenVpnManagementThread implements Runnable {
humanReadableByteCount(diffin, false),
humanReadableByteCount(out, false),
humanReadableByteCount(diffout, false));
- OpenVPN.updateSpeedString(netstat);
+ OpenVPN.updateStateString(netstat);
}
diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java
index 6d6960e9..b2e84087 100644
--- a/src/de/blinkt/openvpn/Settings_Authentication.java
+++ b/src/de/blinkt/openvpn/Settings_Authentication.java
@@ -9,7 +9,6 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceFragment;
import android.preference.SwitchPreference;
diff --git a/src/de/blinkt/openvpn/Settings_IP.java b/src/de/blinkt/openvpn/Settings_IP.java
index f1e495c8..d6fd19d4 100644
--- a/src/de/blinkt/openvpn/Settings_IP.java
+++ b/src/de/blinkt/openvpn/Settings_IP.java
@@ -4,7 +4,6 @@ import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.SwitchPreference;
diff --git a/src/de/blinkt/openvpn/Settings_Routing.java b/src/de/blinkt/openvpn/Settings_Routing.java
index 8305f4db..202c45c1 100644
--- a/src/de/blinkt/openvpn/Settings_Routing.java
+++ b/src/de/blinkt/openvpn/Settings_Routing.java
@@ -4,7 +4,6 @@ import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceManager;
public class Settings_Routing extends OpenVpnPreferencesFragment implements OnPreferenceChangeListener {