import altosui.AltosFlashUI;
import altosui.AltosLogfileChooser;
import altosui.AltosCSVUI;
+import altosui.AltosLine;
import libaltosJNI.*;
String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" };
Object[][] statusData = { { "0", "pad", "-50", "0" } };
+ java.net.URL imgURL = AltosUI.class.getResource("/images/altus-metrum-16x16.jpg");
+ if (imgURL != null)
+ setIconImage(new ImageIcon(imgURL).getImage());
+
AltosPreferences.init(this);
vbox = Box.createVerticalBox();
}
public void show(AltosState state, int crc_errors) {
+ if (state == null)
+ return;
flightStatusModel.set(state);
info_reset();
void init() { }
- AltosRecord read() throws InterruptedException, ParseException, AltosCRCException { return null; }
+ AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException { return null; }
void close() { }
}
}
} catch (InterruptedException ee) {
+ } catch (IOException ie) {
+ JOptionPane.showMessageDialog(AltosUI.this,
+ String.format("Error reading from \"%s\"", name),
+ "Telemetry Read Error",
+ JOptionPane.ERROR_MESSAGE);
} finally {
close();
idle_thread.interrupt();
class DeviceThread extends DisplayThread {
AltosSerial serial;
- LinkedBlockingQueue<String> telem;
+ LinkedBlockingQueue<AltosLine> telem;
- AltosRecord read() throws InterruptedException, ParseException, AltosCRCException {
- return new AltosTelemetry(telem.take());
+ AltosRecord read() throws InterruptedException, ParseException, AltosCRCException, IOException {
+ AltosLine l = telem.take();
+ if (l.line == null)
+ throw new IOException("IO error");
+ return new AltosTelemetry(l.line);
}
void close() {
serial.remove_monitor(telem);
}
- public DeviceThread(AltosSerial s) {
+ public DeviceThread(AltosSerial s, String in_name) {
serial = s;
- telem = new LinkedBlockingQueue<String>();
+ telem = new LinkedBlockingQueue<AltosLine>();
serial.add_monitor(telem);
- name = "telemetry";
+ name = in_name;
}
}
try {
stop_display();
serial_line.open(device);
- DeviceThread thread = new DeviceThread(serial_line);
+ DeviceThread thread = new DeviceThread(serial_line, device.getPath());
serial_line.set_channel(AltosPreferences.channel());
serial_line.set_callsign(AltosPreferences.callsign());
run_display(thread);