AltosDevice device;
AltosSerial serial;
AltosLog log;
+ AltosRecord previous;
LinkedBlockingQueue<AltosLine> telem;
AltosLine l = telem.take();
if (l.line == null)
throw new IOException("IO error");
- return new AltosTelemetry(l.line);
+ AltosRecord next = AltosTelemetry.parse(l.line, previous);
+ previous = next;
+ return next;
}
void close(boolean interrupted) {
AltosPreferences.set_channel(device.getSerial(), channel);
}
+ void set_telemetry(int telemetry) {
+ serial.set_telemetry(telemetry);
+ AltosPreferences.set_telemetry(device.getSerial(), telemetry);
+ }
+
public AltosTelemetryReader (AltosDevice in_device)
throws FileNotFoundException, AltosSerialInUseException, IOException {
device = in_device;
serial = new AltosSerial(device);
log = new AltosLog(serial);
name = device.toShortString();
+ previous = null;
telem = new LinkedBlockingQueue<AltosLine>();
serial.set_radio();