2 * Copyright © 2011 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.
21 import java.awt.event.*;
23 import javax.swing.filechooser.FileNameExtensionFilter;
24 import javax.swing.table.*;
28 import java.util.prefs.*;
29 import java.util.concurrent.*;
33 public class AltosEepromLog {
42 int hour, minute, second;
45 public AltosEepromLog(AltosSerial serial_line, int in_serial,
46 int in_start_block, int in_end_block)
47 throws InterruptedException, TimeoutException {
50 boolean has_date = false, has_time = false, has_lat = false, has_lon = false;
52 start_block = in_start_block;
53 end_block = in_end_block;
56 if (in_end_block > in_start_block + 2)
57 in_end_block = in_start_block + 2;
59 for (block = in_start_block; block < in_end_block; block++) {
60 AltosEepromBlock eeblock = new AltosEepromBlock(serial_line, block);
61 if (eeblock.has_flight) {
62 flight = eeblock.flight;
65 if (eeblock.has_date) {
67 month = eeblock.month;
71 if (eeblock.has_time) {
73 minute = eeblock.minute;
74 second = eeblock.second;
77 if (eeblock.has_lat) {
81 if (eeblock.has_lon) {
85 if (has_date && has_time && has_lat && has_lon)
87 if (has_gps && has_flight)
90 System.out.printf("Serial %d start block %d end block %d\n",
91 serial, start_block, end_block);
93 System.out.printf("Flight %d\n", flight);
95 System.out.printf("%d-%d-%d %d:%02d:%02d Lat %f Lon %f\n",
96 year, month, day, hour, minute, second, lat, lon);