2 * Copyright © 2010 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 import altosui.AltosRecord;
24 public class AltosCSV {
27 boolean header_written;
29 static final int ALTOS_CSV_VERSION = 1;
38 * time (seconds since boost)
48 * accelerometer speed (m/s)
49 * barometer speed (m/s)
58 * nsat (used for solution)
71 * C/N0 data for all 32 valid SDIDs
74 void write_general_header() {
75 out.printf("version serial flight call time");
78 void write_general(AltosRecord record) {
79 out.printf("%s,%d,%d,%s,%d",
80 record.version, record.serial, record.flight, record.callsign, record.tick);
83 void write_flight_header() {
84 out.printf("state state_name");
87 void write_flight(AltosRecord record) {
88 out.printf("%d,%s", record.state, record.state());
92 out.printf("# "); write_general_header();
93 out.printf(" "); write_flight_header();
97 public void write(AltosRecord record) {
98 if (!header_written) {
100 header_written = true;
102 write_general(record); out.printf(",");
103 write_flight(record);
107 public PrintStream out() {
111 public AltosCSV(File in_name) throws FileNotFoundException {
113 out = new PrintStream(name);