altosui: Include device name in Table view
authorKeith Packard <keithp@keithp.com>
Sat, 7 Sep 2013 01:24:46 +0000 (18:24 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 7 Sep 2013 01:24:46 +0000 (18:24 -0700)
It's part of the telemetry, so we might as well display it

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosLib.java
altosui/AltosInfoTable.java

index f8a3974a0b56f8dea046f4e46786149f0b524b95..46031912858b4950de3876b0956ab4fe43b3d2a6 100644 (file)
@@ -418,4 +418,24 @@ public class AltosLib {
        public static File replace_extension(File input, String extension) {
                return new File(replace_extension(input.getPath(), extension));
        }
+
+       public static String product_name(int product_id) {
+               switch (product_id) {
+               case product_altusmetrum: return "AltusMetrum";
+               case product_telemetrum: return "TeleMetrum";
+               case product_teledongle: return "TeleDongle";
+               case product_teleterra: return "TeleTerra";
+               case product_telebt: return "TeleBT";
+               case product_telelaunch: return "TeleLaunch";
+               case product_telelco: return "TeleLco";
+               case product_telescience: return "Telescience";
+               case product_telepyro: return "TelePyro";
+               case product_telemega: return "TeleMega";
+               case product_megadongle: return "MegaDongle";
+               case product_telegps: return "TeleGPS";
+               case product_easymini: return "EasyMini";
+               case product_telemini: return "TeleMini";
+               default: return "unknown";
+               }
+       }
 }
index b181dbd9f73e9424ffab21736b95f529714c5102..feafed21f32a852e0ecf3d8cec954fe65a97ed21 100644 (file)
@@ -107,6 +107,8 @@ public class AltosInfoTable extends JTable {
        public void show(AltosState state, AltosListenerState listener_state) {
                info_reset();
                if (state != null) {
+                       if (state.device_type != AltosLib.MISSING)
+                               info_add_row(0, "Device", "%s", AltosLib.product_name(state.device_type));
                        if (state.altitude() != AltosLib.MISSING)
                                info_add_row(0, "Altitude", "%6.0f    m", state.altitude());
                        if (state.ground_altitude() != AltosLib.MISSING)