telegps: use new eeprom reading code
[fw/altos] / telegps / TeleGPS.java
index d347fe4180be80c419a24aefc6934e79e97ee34e..cf2cbd4fefce4e114fb8605cbdda3a2a5ff535cb 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -72,7 +73,7 @@ public class TeleGPS
 
        JTabbedPane             pane;
 
 
        JTabbedPane             pane;
 
-       AltosUIMapNew           map;
+       AltosUIMap              map;
        TeleGPSInfo             gps_info;
        TeleGPSState            gps_state;
        AltosInfoTable          info_table;
        TeleGPSInfo             gps_info;
        TeleGPSState            gps_state;
        AltosInfoTable          info_table;
@@ -174,7 +175,7 @@ public class TeleGPS
        }
 
        void load_maps() {
        }
 
        void load_maps() {
-               new AltosUIMapPreloadNew(this);
+               new AltosUIMapPreload(this);
        }
 
        void disconnect() {
        }
 
        void disconnect() {
@@ -567,7 +568,7 @@ public class TeleGPS
                /* Make the tabbed pane use the rest of the window space */
                bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH));
 
                /* Make the tabbed pane use the rest of the window space */
                bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH));
 
-               map = new AltosUIMapNew();
+               map = new AltosUIMap();
                pane.add(map.getName(), map);
                displays.add(map);
 
                pane.add(map.getName(), map);
                displays.add(map);
 
@@ -613,16 +614,23 @@ public class TeleGPS
 
        static AltosStateIterable record_iterable(File file) {
                FileInputStream in;
 
        static AltosStateIterable record_iterable(File file) {
                FileInputStream in;
-               try {
-                       in = new FileInputStream(file);
-               } catch (Exception e) {
-                       System.out.printf("Failed to open file '%s'\n", file);
-                       return null;
-               }
-               if (file.getName().endsWith("telem"))
-                       return new AltosTelemetryFile(in);
-               else
-                       return new AltosEepromFile(in);
+                if (file.getName().endsWith("telem")) {
+                        try {
+                                in = new FileInputStream(file);
+                                return new AltosTelemetryFile(in);
+                        } catch (Exception e) {
+                                System.out.printf("Failed to open file '%s'\n", file);
+                        }
+                } else {
+
+                        try {
+                                AltosEepromFile f = new AltosEepromFile(new FileReader(file));
+                                return f;
+                        } catch (Exception e) {
+                                System.out.printf("Failed to open file '%s'\n", file);
+                        }
+                }
+                return null;
        }
 
        static AltosReplayReader replay_file(File file) {
        }
 
        static AltosReplayReader replay_file(File file) {