mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
AndroidGCS: Logger now displays the number of bytes and objects logged.
This commit is contained in:
parent
9d2830b75f
commit
722b608b2b
@ -1,7 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_gravity="center_horizontal" >
|
||||
|
||||
</ListView>
|
||||
<TextView
|
||||
android:id="@+id/logger_number_of_objects_title"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="center"
|
||||
android:layout_row="0"
|
||||
android:layout_rowSpan="1"
|
||||
android:text="@string/number_of_objects" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logger_number_of_objects"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:layout_gravity="center"
|
||||
android:layout_row="0"
|
||||
android:layout_rowSpan="1"
|
||||
android:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logger_number_of_bytes_title"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0"
|
||||
android:layout_gravity="center"
|
||||
android:layout_row="1"
|
||||
android:layout_rowSpan="1"
|
||||
android:text="@string/number_of_bytes" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logger_number_of_bytes"
|
||||
android:layout_width="132dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:layout_gravity="center"
|
||||
android:layout_row="1"
|
||||
android:layout_rowSpan="1"
|
||||
android:text="" />
|
||||
|
||||
<Space
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_column="0"
|
||||
android:layout_row="0" />
|
||||
|
||||
<Space
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="69dp"
|
||||
android:layout_row="1" />
|
||||
|
||||
</GridLayout>
|
@ -12,6 +12,7 @@ import org.openpilot.uavtalk.UAVTalk;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class Logger extends ObjectManagerActivity {
|
||||
@ -25,6 +26,9 @@ public class Logger extends ObjectManagerActivity {
|
||||
private boolean logging;
|
||||
private FileOutputStream fileStream;
|
||||
private UAVTalk uavTalk;
|
||||
|
||||
private int writtenBytes;
|
||||
private int writtenObjects;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
@ -48,6 +52,8 @@ public class Logger extends ObjectManagerActivity {
|
||||
fileStream = new FileOutputStream(file);
|
||||
uavTalk = new UAVTalk(null, fileStream, objMngr);
|
||||
logging = true;
|
||||
writtenBytes = 0;
|
||||
writtenObjects = 0;
|
||||
} else {
|
||||
Log.e(TAG, "Unwriteable address");
|
||||
}
|
||||
@ -124,6 +130,12 @@ public class Logger extends ObjectManagerActivity {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
writtenBytes += obj.getNumBytes();
|
||||
writtenObjects ++;
|
||||
|
||||
((TextView) findViewById(R.id.logger_number_of_bytes)).setText(Integer.valueOf(writtenBytes).toString());
|
||||
((TextView) findViewById(R.id.logger_number_of_objects)).setText(Integer.valueOf(writtenObjects).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user