summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2010-11-11 15:40:37 +1000
committerAnthony Towns <aj@erisian.com.au>2010-11-11 15:40:37 +1000
commit1f3e091efdfb2fe6f06a066cac60f5d267b94856 (patch)
tree8d4f322eb398424268df002ad63284a252d5d71b
parentb16b873723ee3e5097e6725c59ce191119439ad7 (diff)
add --replay command line argument
-rw-r--r--ao-tools/altosui/AltosUI.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/ao-tools/altosui/AltosUI.java b/ao-tools/altosui/AltosUI.java
index ded9e733..2861444d 100644
--- a/ao-tools/altosui/AltosUI.java
+++ b/ao-tools/altosui/AltosUI.java
@@ -456,7 +456,26 @@ public class AltosUI extends JFrame {
public static void main(final String[] args) {
int process = 0;
/* Handle batch-mode */
- if (args.length > 0) {
+ if (args.length == 2 && args[0].equals("--replay")) {
+ String filename = args[1];
+ FileInputStream in;
+ try {
+ in = new FileInputStream(filename);
+ } catch (Exception e) {
+ System.out.printf("Failed to open file '%s'\n", filename);
+ return;
+ }
+ AltosRecordIterable recs;
+ AltosReplayReader reader;
+ if (filename.endsWith("eeprom")) {
+ recs = new AltosEepromIterable(in);
+ } else {
+ recs = new AltosTelemetryIterable(in);
+ }
+ reader = new AltosReplayReader(recs.iterator(), filename);
+ new AltosFlightUI(new AltosVoice(), reader);
+ return;
+ } else if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--kml"))
process |= process_kml;