- if (eeprom_file == null) {
- eeprom_name = new AltosFile(serial,flight,"eeprom");
- eeprom_file = new FileWriter(eeprom_name);
- if (eeprom_file != null) {
- FlushPending(eeprom_file, eeprom_pending);
+
+ CheckFile(false);
+ if (!any_valid)
+ done = true;
+ }
+
+ void CaptureTelemetry(AltosEepromChunk eechunk) throws IOException {
+
+ }
+
+ void CaptureLog(AltosEepromLog log) throws IOException, InterruptedException, TimeoutException {
+ int block, state_block = 0;
+ int log_format = flights.config_data.log_format;
+
+ state = 0;
+ done = false;
+ start = true;
+
+ if (flights.config_data.serial == 0)
+ throw new IOException("no serial number found");
+
+ /* Reset per-capture variables */
+ flight = 0;
+ year = 0;
+ month = 0;
+ day = 0;
+ want_file = false;
+ eeprom_file = null;
+ eeprom_pending = new LinkedList<String>();
+
+ /* Set serial number in the monitor dialog window */
+ /* Now scan the eeprom, reading blocks of data and converting to .eeprom file form */
+
+ state = 0; state_block = log.start_block;
+ for (block = log.start_block; !done && block < log.end_block; block++) {
+ monitor.set_value(Altos.state_to_string[state], state, block - state_block);
+
+ AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block, block == log.start_block);
+
+ /*
+ * Guess what kind of data is there if the device
+ * didn't tell us
+ */
+
+ if (log_format == Altos.AO_LOG_FORMAT_UNKNOWN) {
+ if (block == log.start_block) {
+ if (eechunk.data(0) == Altos.AO_LOG_FLIGHT)
+ log_format = Altos.AO_LOG_FORMAT_FULL;
+ else
+ log_format = Altos.AO_LOG_FORMAT_TINY;
+ }
+ }
+
+ switch (log_format) {
+ case Altos.AO_LOG_FORMAT_FULL:
+ extension = "eeprom";
+ CaptureFull(eechunk);
+ break;
+ case Altos.AO_LOG_FORMAT_TINY:
+ extension = "eeprom";
+ CaptureTiny(eechunk);
+ break;
+ case Altos.AO_LOG_FORMAT_TELEMETRY:
+ extension = "telem";
+ CaptureTelemetry(eechunk);
+ break;
+ case Altos.AO_LOG_FORMAT_TELESCIENCE:
+ extension = "science";
+ CaptureTeleScience(eechunk);
+ break;