[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] Total Bandwidth prep code
commit 5b6e83c6f6373147712dd49c404785c1839f7e65
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date: Tue Jul 26 13:16:30 2011 -0400
Total Bandwidth prep code
---
res/layout/layout_main.xml | 3 +-
src/org/torproject/android/Orbot.java | 13 +++++++-
.../torproject/android/service/ITorService.aidl | 5 +++
src/org/torproject/android/service/TorService.java | 33 +++++++++++++------
4 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml
index 4fae719..1a25feb 100644
--- a/res/layout/layout_main.xml
+++ b/res/layout/layout_main.xml
@@ -105,7 +105,8 @@
android:gravity="center_vertical|center_horizontal"
android:textStyle="bold" />
</RelativeLayout>
-
+</RelativeLayout>
+
</LinearLayout>
</FrameLayout>
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 68e4aaf..f9c949d 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -768,7 +768,18 @@ public class Orbot extends Activity implements TorConstants, OnLongClickListener
uploadText.setText(formatCount(datacount.Upload));
downloadText.invalidate();
uploadText.invalidate();
-
+
+ try {
+ String TotalUpload = mService.getInfo("traffic/written");
+ String TotalDownload = mService.getInfo("traffic/read");
+ StringBuilder sb = new StringBuilder();
+ sb.append("Total Upload " + TotalUpload);
+ sb.append("Total Download" + TotalDownload);
+ Log.d(TAG,sb.toString());
+ } catch (RemoteException e) {
+ Log.d(TAG,"Total bandwidth error"+e.getMessage());
+ }
+
break;
default:
diff --git a/src/org/torproject/android/service/ITorService.aidl b/src/org/torproject/android/service/ITorService.aidl
index e643b4d..07fa808 100644
--- a/src/org/torproject/android/service/ITorService.aidl
+++ b/src/org/torproject/android/service/ITorService.aidl
@@ -48,4 +48,9 @@ interface ITorService {
*/
String getConfiguration (String name);
+ /**
+ * Get information
+ */
+ String getInfo (String args);
+
}
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 01c693c..23921a9 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import net.freehaven.tor.control.ConfigEntry;
@@ -1120,14 +1121,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
sb.append("kb read / ");
sb.append(written/1000);
sb.append("kb written");
- /* try {
- sb.append("Total upload :"+conn.getInfo("traffic/written"));
- sb.append("Total Download "+conn.getInfo("traffic/read"));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- */
+
logNotice(sb.toString());
}
@@ -1136,7 +1130,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
}
-
+
public void circuitStatus(String status, String circID, String path) {
@@ -1274,8 +1268,25 @@ public class TorService extends Service implements TorServiceConstants, TorConst
}
}
-
-
+
+
+ public String getInfo (String key) {
+ try
+ {
+ if(conn !=null)
+ {
+ String m = conn.getInfo(key);
+ return m;
+
+ }
+ }
+ catch(IOException ioe)
+ {
+ Log.e(TAG,"Unable to get Tor information",ioe);
+ logNotice("Unable to get Tor information"+ioe.getMessage());
+ }
+ return null;
+ }
public String getConfiguration (String name)
{
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits