- 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)
+ state = new AltosState();
+ else
+ state = state.clone();
+ telem.update_state(state);
+ return state;