* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
- public AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException {
+ public AltosState read() throws InterruptedException, ParseException, AltosCRCException, IOException {
- AltosRecord next = AltosTelemetry.parse(l.line, previous);
- previous = next;
- return next;
+ AltosTelemetry telem = AltosTelemetry.parse(l.line);
+ if (state == null)
+ state = new AltosState();
+ else
+ state = state.clone();
+ telem.update_state(state);
+ return state;
public AltosTelemetryReader (AltosLink in_link)
throws IOException, InterruptedException, TimeoutException {
link = in_link;
public AltosTelemetryReader (AltosLink in_link)
throws IOException, InterruptedException, TimeoutException {
link = in_link;
- log = new AltosLog(link);
- name = link.name;
- previous = null;
- telem = new LinkedBlockingQueue<AltosLine>();
- frequency = AltosPreferences.frequency(link.serial);
- set_frequency(frequency);
- telemetry = AltosPreferences.telemetry(link.serial);
- set_telemetry(telemetry);
- link.add_monitor(telem);
+ try {
+ log = new AltosLog(link);
+ name = link.name;
+ telem = new LinkedBlockingQueue<AltosLine>();
+ frequency = AltosPreferences.frequency(link.serial);
+ set_frequency(frequency);
+ telemetry = AltosPreferences.telemetry(link.serial);
+ set_telemetry(telemetry);
+ link.add_monitor(telem);
+ } finally {
+ close(true);
+ }