+ int process = 0;
+ /* Handle batch-mode */
+ if (args.length == 1 && args[0].equals("--help")) {
+ System.out.printf("Usage: altosui [OPTION]... [FILE]...\n");
+ System.out.printf(" Options:\n");
+ System.out.printf(" --fetchmaps <lat> <lon>\tpre-fetch maps for site map view\n");
+ System.out.printf(" --replay <filename>\t\trelive the glory of past flights \n");
+ System.out.printf(" --csv\tgenerate comma separated output for spreadsheets, etc\n");
+ System.out.printf(" --kml\tgenerate KML output for use with Google Earth\n");
+ } else if (args.length == 3 && args[0].equals("--fetchmaps")) {
+ double lat = Double.parseDouble(args[1]);
+ double lon = Double.parseDouble(args[2]);
+ AltosSiteMap.prefetchMaps(lat, lon, 5, 5);
+ } else 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);
+ AltosFlightUI flight_ui = new AltosFlightUI(new AltosVoice(), reader);
+ flight_ui.set_exit_on_close();
+ return;
+ } else if (args.length > 0) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("--kml"))
+ process |= process_kml;
+ else if (args[i].equals("--csv"))
+ process |= process_csv;
+ else
+ process_file(args[i], process);
+ }
+ } else {
+ AltosUI altosui = new AltosUI();
+ altosui.setVisible(true);
+
+ AltosDevice[] devices = AltosDevice.list(AltosDevice.product_basestation);
+ for (int i = 0; i < devices.length; i++)
+ altosui.telemetry_window(devices[i]);
+ }