- public AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException {
- AltosLine l = telem.take();
- if (l.line == null)
- throw new IOException("IO error");
- AltosRecord next = AltosTelemetry.parse(l.line, previous);
- previous = next;
- return next;
+ public AltosState read() throws InterruptedException, ParseException, AltosCRCException, IOException {
+ AltosLine l;
+ do {
+ l = telem.take();
+ if (l.line == null)
+ throw new IOException("IO error");
+ } while (!link.get_monitor());
+ AltosTelemetry telem = AltosTelemetry.parse(l.line);
+ if (state == null) {
+ System.out.printf("Make state\n");
+ state = new AltosState(cal_data());
+ }
+ telem.provide_data(state);
+ return state;
+ }
+
+ public AltosCalData cal_data() {
+ if (cal_data == null) {
+ System.out.printf("Make cal data\n");
+ cal_data = new AltosCalData();
+ }
+ return cal_data;