- try {
- for (;;) {
- String line = AltosRecord.gets(input);
- if (line == null) {
- break;
- }
- try {
- AltosTelemetry record = new AltosTelemetry(line);
- if (record == null)
- break;
- if (records.isEmpty()) {
- current_tick = record.tick;
- } else {
- int tick = record.tick | (current_tick & ~ 0xffff);
- if (tick < current_tick - 0x1000)
- tick += 0x10000;
- current_tick = tick;
- record.tick = current_tick;
- }
- if (!saw_boost && record.state >= Altos.ao_flight_boost)
- {
- saw_boost = true;
- boost_tick = record.tick;
- }
- records.add(record);
- } catch (ParseException pe) {
- System.out.printf("parse exception %s\n", pe.getMessage());
- } catch (AltosCRCException ce) {
- System.out.printf("crc error\n");
- }
- }
- } catch (IOException io) {
- System.out.printf("io exception\n");
- }
- record_iterator = records.iterator();
- try {
- input.close();
- } catch (IOException ie) {
- }