diff --git a/src/com/upc/pbe/upcnews/BandwidthMeasurer.java b/src/com/upc/pbe/upcnews/BandwidthMeasurer.java index ea54fb3..b50b0c1 100644 --- a/src/com/upc/pbe/upcnews/BandwidthMeasurer.java +++ b/src/com/upc/pbe/upcnews/BandwidthMeasurer.java @@ -4,24 +4,23 @@ import android.net.TrafficStats; import android.util.Log; //Mesura la velocitat (Bandwidth) d'Internet -public class BandwidthMeasurer -{ - private final static String TAG = "Mesurador"; - public double Measure(long rxBytes, long Time) - { +public class BandwidthMeasurer { + private final static String TAG = "Mesurador de bandwith"; + + public double Measure(long rxBytes, long time) { long AfterTime = System.currentTimeMillis(); - double bps; + double bps; long TotalRxAfterTest = TrafficStats.getTotalRxBytes(); - double TimeDifference = AfterTime - Time; + double TimeDifference = AfterTime - time; double rxDiff = TotalRxAfterTest - rxBytes; - Log.d(TAG,"Diferencia de temps = " + TimeDifference/1000); + Log.d(TAG, "Diferencia de temps = " + TimeDifference / 1000); Log.d(TAG, "Diferencia de bytes = " + rxDiff); - if(rxDiff != 0){ - bps = ((rxDiff*8) / (TimeDifference/1000)); // total de rx en bits per second. - Log.d(TAG, "Velocitat actual (KB/s): " + (bps / 8e3)); - } - else{ - bps = -1; //No s'han trasmes dades + if (rxDiff != 0) { + bps = ((rxDiff * 8) / (TimeDifference / 1000)); // total de rx en + // bits per segon. + Log.d(TAG, "Velocitat actual (KB/s): " + (bps / 8e3)); + } else { + bps = -1; // No s'han trasmès dades } return bps; } diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index 15049f1..ccc1988 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -130,8 +130,8 @@ public class MainActivity extends Activity implements OnClickListener /* * COSAS POR HACER - * (NORMAL) Poner la defaultURL al server de PBE - * (WHISLIST) Hacer streaming DE VERDAD (appendeando los videos, seria IMPRESIONANTE) + * (ABANS DE LA PRESENTACIÓ) Poner la defaultURL al server de PBE + * (WHISLIST FOR IMANOL) Hacer streaming DE VERDAD (appendeando los videos, seria IMPRESIONANTE) * Borrar esta puta mierda */ }