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

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

楼主#
更多 发布于:2004-02-20 02:19
/*
 *
 * TestGps.java
 *
 * This is a simple program to test the GpsReceiver class.
 *
 * Author : Qingye Jiang (John)
 *          HappyFox Engineering Solutions
 *          qjiang@tsinghua.edu
 *
 */
  
public class TestGps
{
        /*
         *
         * Testing program.
         *
         */
  
        public static void main(String[] args)
        {
                GpsInfo GpsData = new GpsInfo();
  
                // Input from the GPS receiver, which is connected to COM2 of th
                // "true" means record the GPS data into a file.
  
                //GpsReceiver GPS = new GpsReceiver("com2", 0, true);
                //GPS.StartReceiver();
  
                // Input from a file call "gps.dat", with an acceleration factor
                // "false" means do not record the GPS data into a file.
  
                GpsReceiver GPS = new GpsReceiver("COM1", 0, false);
                GPS.StartReceiver();
  
                for (int i = 0; i < 200; i++)
                {
                        GpsData = GPS.GetGpsData();
                        System.out.println(GpsData.GetTime());
                        System.out.println(GpsData.GetNS() + "  " + GpsData.GetL
                        System.out.println(GpsData.GetEW() + "  " + GpsData.GetL
                        System.out.println(GpsData.GetAltitude());
  
                        // If using a GPS receiver, uncommend the following slee
                        // to get real-time data.
                        try
                        {
                                Thread.sleep(1000);
                        } catch (InterruptedException e) {}
                }
  
                GPS.StopReceiver();
        }
}
喜欢0 评分0
[face=隶书]
强极则辱 情深不寿
谦谦君子 温润如玉
[/face]
______________________________________
游客

返回顶部