whyerect
路人甲
路人甲
  • 注册日期2003-10-16
  • 发帖数2827
  • QQ
  • 铜币14枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1403回复:0

【转】基于Java的GPS接收机解析器 (2)

楼主#
更多 发布于:2004-02-20 02:16
/*
 *
 * GpsInfo.java
 *
 * This is a simple GPS data class, which provides methods to access and update
 * GPS data such as UTC time and Latitude, Longitude, and Altitude.
 *
 * Author : Qingye Jiang (John)
 *          HappyFox Engineering Solutions
 *          qjiang@tsinghua.edu
 *
 * 2001-10-15
 *
 */
  
public class GpsInfo
{
        /*
                GpsTime         : UTC of current position.
                Latitude        : Latitude of current position.
                Longitude       : Longitude of current position.
                Altitude        : Altitude of current position.
                Dilution        : Horizontal Dilution of precision.
                GeoSeparation   : Geoidal separation.
                DataAge         : Age of Differential GPS data.
                GpsQuality      : GPS Quality indicator.
                TotalSatellites : Number of satellites in use, 00-12.
                ReferenceID     : Differential reference station ID, 0000-1023.
                N_S             : North or Sourth.
                E_W             : East or West.
        */
  
  
        private float  GpsTime, Latitude, Longitude, Altitude;
        private float  Dilution, GeoSeparation, DataAge;
        private int    GpsQuality, TotalSatellites, ReferenceID;
        private String N_S, E_W;
  
        /**
         *
         * Constructor.
         *
         */
  
        public GpsInfo()
        {
                GpsTime         = 0;
                Latitude        = 0;
                Longitude       = 0;
                Altitude        = 0;
                GeoSeparation   = 0;
                DataAge         = 0;
                GpsQuality      = 0;
                TotalSatellites = 0;
                ReferenceID     = 0;
                N_S             = "N/A";
                E_W             = "N/A";
        }
  
  
        /**
         *
         * Method to set GPS time.
         *
         */
  
        public synchronized void SetTime(float time)
        {
                GpsTime  = time;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS Latitude.
         *
         */
  
    public synchronized void SetLatitude(float latitude)
    {
        Latitude = latitude;
        notifyAll();
    }
  
        /**
         *
         * Method to set GPS Longitude.
         *
         */
  
    public synchronized void SetLongitude(float longitude)
    {
        Longitude = longitude;
        notifyAll();
    }
  
        /**
         *
         * Method to set GPS Altitude.
         *
         */
  
    public synchronized void SetAltitude(float altitude)
    {
        Altitude = altitude;
        notifyAll();
    }
  
        /**
         *
         * Method to set GPS N_S information.
         *
         */
  
    public synchronized void SetNS(String ns)
    {
        N_S = ns;
        notifyAll();
    }
  
        /**
         *
         * Method to set GPS E_W information.
         *
         */
  
    public synchronized void SetEW(String ew)
    {
        E_W = ew;
        notifyAll();
    }
  
        /**
         *
         * Method to set GPS horizontal dilution of precision.
         *
         */
  
        public synchronized void SetDilution(float dilution)
        {
                Dilution = dilution;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS Geoidal separation.
         *
         */
  
        public synchronized void SetGeoSeparation(float separation)
        {
                GeoSeparation = separation;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS Data Age.
         *
         */
  
        public synchronized void SetDataAge(float age)
        {
                DataAge = age;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS Quality.
         *
         */
  
        public synchronized void SetGpsQuality(int quality)
        {
                GpsQuality = quality;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS total satellites.
         *
         */
  
        public synchronized void SetTotalSatellites(int total)
        {
                TotalSatellites = total;
                notifyAll();
        }
  
        /**
         *
         * Method to set GPS time.
         *
         */
  
        public synchronized void SetReferenceID(int id)
        {
                ReferenceID = id;
                notifyAll();
        }
  
        /**
         *
         * Method to retrieve GPS time.
         *
         */
  
    public float GetTime()
    {
        return GpsTime;
    }
  
        /**
         *
         * Method to retrieve GPS Latitude.
         *
         */
  
    public float GetLatitude()
    {
        return Latitude;
    }
  
        /**
         *
         * Method to retrieve GPS Longitude.
         *
         */
  
    public float GetLongitude()
    {
        return Longitude;
    }
  
        /**
         *
         * Method to retrieve GPS Altitude.
         *
         */
  
    public float GetAltitude()
    {
        return Altitude;
    }
  
        /**
         *
         * Method to retrieve GPS N_S information.
         *
         */
  
    public String GetNS()
    {
        return N_S;
    }
  
        /**
         *
         * Method to retrieve GPS E_W information.
         *
         */
  
    public String GetEW()
    {
        return E_W;
    }
  
        /**
         *
         * Method to retrieve GPS horizontal dilution of precision.
         *
         */
  
    public float GetDilution()
    {
        return Dilution;
    }
  
        /**
         *
         * Method to retrieve GPS Geoidal separation.
         *
         */
  
    public float GetGeoSeparation()
    {
        return GeoSeparation;
    }
  
        /**
         *
         * Method to retrieve GPS data age.
         *
         */
  
    public float GetDataAge()
    {
        return DataAge;
    }
  
        /**
         *
         * Method to retrieve GPS quality indicator.
         *
         */
  
    public int GetGpsQuality()
    {
        return GpsQuality;
    }
  
        /**
         *
         * Method to retrieve GPS total satellites.
         *
         */
  
    public int GetTotalSatellites()
    {
        return TotalSatellites;
    }
  
        /**
  
        /**
         *
         * Method to retrieve GPS reference station ID.
         *
         */
  
    public int GetReferenceID()
    {
        return ReferenceID;
    }
}
喜欢0 评分0
[face=隶书]
强极则辱 情深不寿
谦谦君子 温润如玉
[/face]
______________________________________
游客

返回顶部