X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosGPS.java;h=f23842f3d947c09b135bbfabef197111a1ab9a71;hb=cef4e3ee95037050ae859fb2fdc0a57373764bd8;hp=f078a469a344ce850be94834e67ba7f20d9a47b1;hpb=69e6df07976a56b49e07c242cd6e5b2cbd2a578d;p=fw%2Faltos diff --git a/altoslib/AltosGPS.java b/altoslib/AltosGPS.java index f078a469..f23842f3 100644 --- a/altoslib/AltosGPS.java +++ b/altoslib/AltosGPS.java @@ -15,9 +15,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.AltosLib; +package org.altusmetrum.altoslib_1; -import java.lang.*; import java.text.*; public class AltosGPS { @@ -175,24 +174,26 @@ public class AltosGPS { lon = in_lon / 10.0e7; } - public void set_time(int hour, int minute, int second) { - hour = hour; - minute = minute; - second = second; + public void set_time(int in_hour, int in_minute, int in_second) { + hour = in_hour; + minute = in_minute; + second = in_second; } - public void set_date(int year, int month, int day) { - year = year; - month = month; - day = day; + public void set_date(int in_year, int in_month, int in_day) { + year = in_year; + month = in_month; + day = in_day; } - public void set_flags(int flags) { - flags = flags; + /* + public void set_flags(int in_flags) { + flags = in_flags; } + */ - public void set_altitude(int altitude) { - altitude = altitude; + public void set_altitude(int in_altitude) { + alt = in_altitude; } public void add_sat(int svid, int c_n0) { @@ -216,33 +217,38 @@ public class AltosGPS { } public AltosGPS(AltosGPS old) { - nsat = old.nsat; - locked = old.locked; - connected = old.connected; - lat = old.lat; /* degrees (+N -S) */ - lon = old.lon; /* degrees (+E -W) */ - alt = old.alt; /* m */ - year = old.year; - month = old.month; - day = old.day; - hour = old.hour; - minute = old.minute; - second = old.second; - - ground_speed = old.ground_speed; /* m/s */ - course = old.course; /* degrees */ - climb_rate = old.climb_rate; /* m/s */ - hdop = old.hdop; /* unitless? */ - h_error = old.h_error; /* m */ - v_error = old.v_error; /* m */ - - if (old.cc_gps_sat != null) { - cc_gps_sat = new AltosGPSSat[old.cc_gps_sat.length]; - for (int i = 0; i < old.cc_gps_sat.length; i++) { - cc_gps_sat[i] = new AltosGPSSat(); - cc_gps_sat[i].svid = old.cc_gps_sat[i].svid; - cc_gps_sat[i].c_n0 = old.cc_gps_sat[i].c_n0; + if (old != null) { + nsat = old.nsat; + locked = old.locked; + connected = old.connected; + lat = old.lat; /* degrees (+N -S) */ + lon = old.lon; /* degrees (+E -W) */ + alt = old.alt; /* m */ + year = old.year; + month = old.month; + day = old.day; + hour = old.hour; + minute = old.minute; + second = old.second; + + ground_speed = old.ground_speed; /* m/s */ + course = old.course; /* degrees */ + climb_rate = old.climb_rate; /* m/s */ + hdop = old.hdop; /* unitless? */ + h_error = old.h_error; /* m */ + v_error = old.v_error; /* m */ + + if (old.cc_gps_sat != null) { + cc_gps_sat = new AltosGPSSat[old.cc_gps_sat.length]; + for (int i = 0; i < old.cc_gps_sat.length; i++) { + cc_gps_sat[i] = new AltosGPSSat(); + cc_gps_sat[i].svid = old.cc_gps_sat[i].svid; + cc_gps_sat[i].c_n0 = old.cc_gps_sat[i].c_n0; + } } + } else { + ClearGPSTime(); + cc_gps_sat = null; } } }