From 43f94e923a6a87520edcbb8fb4829e6ddf708908 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 14 May 2013 00:24:53 -0700 Subject: altoslib: Use sequence numbers to track GPS updates to AltosRecord State objects now record what GPS sequence ID they have to know when the GPS data has been updated. Record objects bump the GPS sequence each time new GPS data is recorded. This way, record objects aren't modified as they're iterated over to generate the list of state objects which makes it possible to iterate multiple times and get the same resulting set of states. Signed-off-by: Keith Packard --- altoslib/AltosTelemetryRecordLegacy.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'altoslib/AltosTelemetryRecordLegacy.java') diff --git a/altoslib/AltosTelemetryRecordLegacy.java b/altoslib/AltosTelemetryRecordLegacy.java index a734b188..f2d3f868 100644 --- a/altoslib/AltosTelemetryRecordLegacy.java +++ b/altoslib/AltosTelemetryRecordLegacy.java @@ -267,7 +267,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { if (map.has(AO_TELEM_GPS_STATE)) { record.gps = new AltosGPS(map); - record.new_gps = true; + record.gps_sequence++; } else record.gps = null; @@ -357,7 +357,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { } record.gps = new AltosGPS(words, i, record.version); - record.new_gps = true; + record.gps_sequence++; } public AltosTelemetryRecordLegacy(String line) throws ParseException, AltosCRCException { @@ -476,7 +476,7 @@ public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) { record.gps = new AltosGPS(); - record.new_gps = true; + record.gps_sequence++; record.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon; record.gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK); -- cgit v1.2.3