While downloading trackpoints from my GPS device (Garmin eTrex), errored trackpoints are getting transmitted twice.
To fix this, I've modified the "run()" method of the "GarminGPS.java" class like this:
[code]
/** This method is listening for input from the GPS. */
public void run() {
GarminPacket pack = null;
while (active) {
try {
if (input.available() == 0) {
try {
Thread.sleep(500);
} catch(InterruptedException e) {}
continue;
}
pack = new GarminPacket(input.readPacket());
// I moved the following lines from the
// "original position" to here
// move :: begin
// Send back ACK-packet.
try {
output.write( GarminPacket.createBasicPacket(GarminPacket.Pid_Ack_Byte, new int[] {pack.getID(), 0}));
} catch (IOException e) {
active = false;
}
fireGarminPacket(pack);
Distribute(pack);
// move :: end
} catch (IOException e) {
active = false;
return;
} catch (InvalidPacketException e) {
// Send back a NAK-packet.
try {
output.write( GarminPacket.createBasicPacket(GarminPacket.Pid_Nak_Byte, new int[] {pack.getID(), 0}));
} catch (IOException ex) {
active = false;
return;
}
}
// original position
} // End of while
}
[/code]