Added rssi to csv log and added wifi prefix to all wifi related values
This commit is contained in:
parent
e9018290c9
commit
77fe316f14
1 changed files with 20 additions and 6 deletions
|
|
@ -32,7 +32,7 @@ public class CSVWriter {
|
|||
private static final Logger log = Logger.getLogger(CSVWriter.class);
|
||||
public static final String[] HEADINGS = new String[]{
|
||||
"Timestamp", "Behaviour", "RX Throughput(b/s)", "TX Throughput(b/s)",
|
||||
"RAT", "CellIds", "SSID"
|
||||
"RAT", "CellIds", "WIFI SSID", "WIFI RSSI"
|
||||
};
|
||||
public static final String DELIMITER = ";";
|
||||
protected static final SimpleDateFormat fileDateFormater = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
|
|
@ -73,6 +73,7 @@ public class CSVWriter {
|
|||
line.append(getRat(context)).append(DELIMITER);
|
||||
line.append(getCellIds(context)).append(DELIMITER);
|
||||
line.append(getSSID(context)).append(DELIMITER);
|
||||
line.append(getRssi(context)).append(DELIMITER);
|
||||
writeLine(line.toString());
|
||||
}
|
||||
|
||||
|
|
@ -92,9 +93,6 @@ public class CSVWriter {
|
|||
if(netInfo == null)
|
||||
return "n/a";
|
||||
|
||||
//WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
//WifiInfo wifiInfo = wm.getConnectionInfo();
|
||||
|
||||
if(netInfo.getType() == ConnectivityManager.TYPE_MOBILE){
|
||||
TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
switch(telMan.getNetworkType()){
|
||||
|
|
@ -111,6 +109,8 @@ public class CSVWriter {
|
|||
return netInfo.getTypeName();
|
||||
}
|
||||
|
||||
|
||||
//******************* MOBILE ********************************************
|
||||
private static String getCellIds(Context context){
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
||||
|
|
@ -163,19 +163,33 @@ public class CSVWriter {
|
|||
return ""+cid;
|
||||
}
|
||||
|
||||
private static String getSSID(Context context){
|
||||
//******************* WIFI ********************************************
|
||||
private static WifiInfo getWifiInfo(Context context){
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo netInfo = cm.getActiveNetworkInfo();
|
||||
if(netInfo == null || netInfo.getType() != ConnectivityManager.TYPE_WIFI)
|
||||
return "n/a";
|
||||
return null;
|
||||
|
||||
WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wm.getConnectionInfo();
|
||||
return wifiInfo;
|
||||
}
|
||||
private static String getSSID(Context context){
|
||||
WifiInfo wifiInfo = getWifiInfo(context);
|
||||
if(wifiInfo == null)
|
||||
return "n/a";
|
||||
return wifiInfo.getSSID().replace("\"", "");
|
||||
}
|
||||
|
||||
private static String getRssi(Context context){
|
||||
WifiInfo wifiInfo = getWifiInfo(context);
|
||||
if(wifiInfo == null)
|
||||
return "n/a";
|
||||
return ""+wifiInfo.getRssi();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected String getTime(){
|
||||
return dateFormater.format(System.currentTimeMillis());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue