/** * Title: GPS Simulator * Copyright: Copyright (c) 2002 * Company: University of Oregon Computer Science Dept. * * @author Jason Prideaux * @version 1.0 * */ package transport.protocol; import java.io.*; /* ====================================================================== */ /** This class is a NMEAMessage. A NMEAMessage is a GPS position * information message. It contains location, heading and even time * information pertaining to a specific agent. * */ public class NMEAMessage extends Sim2PMessage implements Serializable{ /** Nmea formatted message string. */ private String nmea; /** The latitude position for the receiving agent. */ private double latitude; /** The longitude position for the receiving agent. */ private double longitude; /** The heading for the receiving agent. */ private double heading; /** The time for the receiving agent. */ private long time; /* ===================================================================== */ /** This constructor initializes the nmea message. * * @param to The port the ipaq gps receiver is listening on. * @param from The port the ipaq gps receiver is listening on. * @param lat The port the ipaq gps receiver is listening on. * @param lon The port the ipaq gps receiver is listening on. * @param hea The port the ipaq gps receiver is listening on. * @param tim The port the ipaq gps receiver is listening on. * */ public NMEAMessage(int to, int from, double lat, double lon, double hea, long tim){ super(to, from); this.latitude = lat; this.longitude = lon; this.heading = hea; this.time = tim; } //Constructor /* ===================================================================== */ /** This constructor initializes the . * * @param nmea The port the ipaq gps receiver is listening on. * @param to The port the ipaq gps receiver is listening on. * @param from The port the ipaq gps receiver is listening on. * */ public NMEAMessage(String nmea, int to, int from){ super(to, from); this.nmea = nmea; } //Constructor /* ===================================================================== */ /** This method returns the String nmea message. * * @return String The message. * */ public String getNmea(){ return nmea; } //method: getNmea /* ===================================================================== */ /** This method returns the latitude of gps coordinate. * * @return double The latitude. * */ public double getLatitude(){ return latitude; } //method: getLatitude /* ===================================================================== */ /** This method returns the longitude of gps coordinate. * * @return double The longitude. * */ public double getLongitude(){ return longitude; } //method: getLongitude /* ===================================================================== */ /** This method returns the heading of gps coordinate. * * @return double The heading. * */ public double getHeading(){ return heading; } //method: getHeading /* ===================================================================== */ /** This method returns the time of gps coordinate. * * @return long The time. * */ public long getTime(){ return time; } //method: getTime } //class: NMEAMessage