altosui: Add companion support to the flight UI and CSV conversion
[fw/altos] / altosui / AltosFlightUI.java
index f0626e7ccdfae49fbd35bf35ccad01619d951f9b..517680463c4f794ffb89ccdc7555c0e22e7c44f0 100644 (file)
@@ -39,8 +39,10 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
        AltosAscent     ascent;
        AltosDescent    descent;
        AltosLanded     landed;
        AltosAscent     ascent;
        AltosDescent    descent;
        AltosLanded     landed;
+       AltosCompanionInfo      companion;
        AltosSiteMap    sitemap;
        boolean         has_map;
        AltosSiteMap    sitemap;
        boolean         has_map;
+       boolean         has_companion;
 
        private AltosFlightStatus flightStatus;
        private AltosInfoTable flightInfo;
 
        private AltosFlightStatus flightStatus;
        private AltosInfoTable flightInfo;
@@ -96,7 +98,20 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                }
                flightStatus.show(state, crc_errors);
                flightInfo.show(state, crc_errors);
                }
                flightStatus.show(state, crc_errors);
                flightInfo.show(state, crc_errors);
-               if (state.gps != null) {
+
+               if (state.data.companion != null) {
+                       if (!has_companion) {
+                               pane.add("Companion", companion);
+                               has_companion= true;
+                       }
+                       companion.show(state, crc_errors);
+               } else {
+                       if (has_companion) {
+                               pane.remove(companion);
+                               has_companion = false;
+                       }
+               }
+               if (state.gps != null && state.gps.connected) {
                        if (!has_map) {
                                pane.add("Site Map", sitemap);
                                has_map = true;
                        if (!has_map) {
                                pane.add("Site Map", sitemap);
                                has_map = true;
@@ -216,6 +231,9 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                flightInfo = new AltosInfoTable();
                pane.add("Table", new JScrollPane(flightInfo));
 
                flightInfo = new AltosInfoTable();
                pane.add("Table", new JScrollPane(flightInfo));
 
+               companion = new AltosCompanionInfo();
+               has_companion = false;
+
                sitemap = new AltosSiteMap();
                has_map = false;
 
                sitemap = new AltosSiteMap();
                has_map = false;