Ticket #21772: 21772.patch

File 21772.patch, 4.4 KB (added by taylor.smock, 4 years ago)
  • build.xml

     
    44    <!-- enter the SVN commit message -->
    55    <property name="commit.message" value="Changed constructor signature of plugin main class"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="14153"/>
     7    <property name="plugin.main.version" value="15496"/>
    88
    99    <!-- Configure these properties (replace "..." accordingly).
    1010         See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
  • src/org/openstreetmap/josm/plugins/globalsat/GlobalsatDg100.java

     
    2222import org.kaintoch.gps.globalsat.dg100.Response;
    2323import org.openstreetmap.josm.data.coor.LatLon;
    2424import org.openstreetmap.josm.data.gpx.GpxData;
    25 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack;
     25import org.openstreetmap.josm.data.gpx.GpxTrack;
    2626import org.openstreetmap.josm.data.gpx.WayPoint;
    2727import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     28import org.openstreetmap.josm.tools.Logging;
    2829
    2930import gnu.io.CommPortIdentifier;
    3031import gnu.io.PortInUseException;
     
    6667      , (byte) 0x01, (byte) 0x00, (byte) 0xBD, (byte) 0xB0, (byte) 0xB3
    6768    };*/
    6869    /** delete file: A0 A2 00 03 BA FF FF 02 B8 B0 B3 */
    69     private static byte[] dg100CmdDelFile =
     70    private static final byte[] dg100CmdDelFile =
    7071    {(byte) 0xA0, (byte) 0xA2, (byte) 0x00, (byte) 0x03, (byte) 0xBA,
    7172     (byte) 0xFF, (byte) 0xFF, (byte) 0x02, (byte) 0xB8, (byte) 0xB0, (byte) 0xB3
    7273    };
    7374    /** get file info: A0 A2 00 03 BB 00 00 00 BB B0 B3 */
    74     private static byte[] dg100CmdGetFileInfo =
     75    private static final byte[] dg100CmdGetFileInfo =
    7576    {(byte) 0xA0, (byte) 0xA2, (byte) 0x00, (byte) 0x03, (byte) 0xBB,
    7677     (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xBB, (byte) 0xB0, (byte) 0xB3
    7778    };
    7879    /** get gps recs: A0 A2 00 03 B5 00 02 00 B7 B0 B3 */
    79     private static byte[] dg100CmdGetGpsRecs =
     80    private static final byte[] dg100CmdGetGpsRecs =
    8081    {(byte) 0xA0, (byte) 0xA2, (byte) 0x00, (byte) 0x03, (byte) 0xB5,
    8182     (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0xB7, (byte) 0xB0, (byte) 0xB3
    8283    };
    8384    /** read config: A0 A2 00 01 B7 00 B7 B0 B3 */
    84     private static byte[] dg100CmdGetConfig =
     85    private static final byte[] dg100CmdGetConfig =
    8586    {(byte) 0xA0, (byte) 0xA2, (byte) 0x00, (byte) 0x01, (byte) 0xB7,
    8687     (byte) 0x00, (byte) 0xB7, (byte) 0xB0, (byte) 0xB3 };
    8788    /** set config: A0 A2 00 2A B8 jj kk ll ll ll ll mm nn nn nn nn
     
    8889        aa aa aa aa bb bb bb bb cc cc cc cc 00 00 gg hh
    8990        ii dd dd dd dd ee ee ee ee ff ff ff ff 01 xx xx
    9091        B0 B3 */
    91     private static byte[] dg100CmdSetConfig =
     92    private static final byte[] dg100CmdSetConfig =
    9293    {(byte) 0xA0, (byte) 0xA2, (byte) 0x00, (byte) 0x2A, (byte) 0xB8,
    9394     (byte) 0x02,
    9495     (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
     
    115116      , (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
    116117      , (byte) 0x00, (byte) 0xC0, (byte) 0xB0, (byte) 0xB3};*/
    117118
    118     private byte[] response = new byte[65536];
     119    private final byte[] response = new byte[65536];
    119120
    120     private CommPortIdentifier portIdentifier;
     121    private final CommPortIdentifier portIdentifier;
    121122    private SerialPort port = null;
    122123
    123124    private boolean canceled = false;
     
    165166                    last = r;
    166167                    progressMonitor.worked(1);
    167168                }
    168                 result.tracks.add(new ImmutableGpxTrack(Collections.singleton(seg), Collections.<String, Object>emptyMap()));
     169                result.tracks.add(new GpxTrack(Collections.singleton(seg), Collections.emptyMap()));
    169170            }
    170171            return result;
    171172        } finally {
     
    245246    }
    246247
    247248    private Response<?> sendCmdDelFiles() throws IOException, UnsupportedCommOperationException {
    248         System.out.println("deleting data...");
     249        Logging.info("GlobalSat: GlobalsatDg100: deleting data...");
    249250        int len = sendCmd(dg100CmdDelFile, response, -1);
    250251        return Response.parseResponse(response, len);
    251252    }