⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsa.java

📁 国外的一个开源gps模拟器源代码
💻 JAVA
字号:
/*
 * Copyright (c) 2007 by the University of Applied Sciences Northwestern Switzerland (FHNW)
 * 
 * This program can be redistributed or modified under the terms of the
 * GNU General Public License as published by the Free Software Foundation.
 * This program is distributed without any warranty or implied warranty
 * of merchantability or fitness for a particular purpose.
 *
 * See the GNU General Public License for more details.
 */

package ch.fhnw.imvs.gpssimulator.nmea;

import ch.fhnw.imvs.gpssimulator.data.GPSData;

public class GSA extends NMEASentence {

	@Override
	public String getName() { return "GPGSA"; }

	@Override
	public String getSentence(boolean content) {
		String sentence;
		if (content) {
			StringBuffer buf = new StringBuffer(getName());
			append(buf, GPSData.getStatus().name());
			append(buf, "3");					// 3: 3D-fix, 2: 2D-fix, 1: no-fix
			for (int i = 1; i <= 12; i++) {						
				append(buf, getSatelliteNumber(i));
			}
			append(buf, GPSData.getPDOP());
			append(buf, GPSData.getHDOP());
			append(buf, GPSData.getVDOP());
			sentence = buf.toString();;
		} else {
        	sentence = "GPGSA,V,,,,,,,,,,,,,,,,";
        }
		return sentence;
	}

	private String getSatelliteNumber(int number) {
		if (number <= GPSData.getSatellites()) {
			if (number > 9) {
				return "" + number;
			} else {
				return "0" + number;
			}
		} else {
			return "";
		}
	}
	


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -