- public AltosEepromFile(FileInputStream input) {
- headers = new AltosEepromIterable(AltosEepromHeader.read(input));
-
- start = headers.state();
- if (start.state() != AltosLib.ao_flight_stateless)
- start.set_state(AltosLib.ao_flight_pad);
-
- if (start.log_format == AltosLib.MISSING) {
- if (start.product != null) {
- if (start.product.startsWith("TeleMetrum"))
- start.log_format = AltosLib.AO_LOG_FORMAT_FULL;
- else if (start.product.startsWith("TeleMini"))
- start.log_format = AltosLib.AO_LOG_FORMAT_TINY;
- }
- }
-
- switch (start.log_format) {
- case AltosLib.AO_LOG_FORMAT_FULL:
- body = new AltosEepromIterable(AltosEepromTM.read(input));
- break;
- case AltosLib.AO_LOG_FORMAT_TINY:
- body = new AltosEepromIterable(AltosEepromTm.read(input));
- break;
- case AltosLib.AO_LOG_FORMAT_TELEMETRY:
- case AltosLib.AO_LOG_FORMAT_TELESCIENCE:
- case AltosLib.AO_LOG_FORMAT_TELEMEGA:
- case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
- body = new AltosEepromIterable(AltosEepromMega.read(input, start.log_format));
- break;
- case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
- body = new AltosEepromIterable(AltosEepromMetrum2.read(input));
- break;
- case AltosLib.AO_LOG_FORMAT_TELEMINI:
- case AltosLib.AO_LOG_FORMAT_EASYMINI:
- body = new AltosEepromIterable(AltosEepromMini.read(input));
- break;
- case AltosLib.AO_LOG_FORMAT_TELEGPS:
- body = new AltosEepromIterable(AltosEepromGPS.read(input));
- break;
- default:
- body = new AltosEepromIterable(new LinkedList<AltosEeprom>());
- break;
- }
-
- /* Find boost tick */
- AltosState state = start.clone();
- for (AltosEeprom eeprom : body) {
- eeprom.update_state(state);
- state.finish_update();
- if (state.state() >= AltosLib.ao_flight_boost) {
- start.set_boost_tick(state.tick);
- break;
- }
- }