我創建了一個非常簡單的應用程序來讀取從Java中的GPS信息。信息以NMEA0183格式在COM1上發送。GPS FIX數據,從COM端口讀取端口
除了我無法找到我的位置,因爲RMC和GGA的句子都是空的,一切都很好。我收到了其他與衛星信息和定位的句子,但我想要的只是我現在的位置(長/緯度)。當我檢查超級終端中的數據時,數據即將出現。
這裏是我目前得到的一些例子:
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,2,1,08,03,00,000,,06,00,000,,11,00,000,,14,00,000,*72
$GPGSV,2,2,08,19,00,000,,20,00,000,,22,00,000,,24,00,000,*7D
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,13,004,,11,55,235,,14,47,126,*78
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,13,004,,11,55,235,,14,47,126,*78
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
$GPGGA,,,,,,0,00,,,M,,M,,*66
$GPVTG,0.0,T,,,000.0,N,000.0,K,A*40
$GPGSV,3,1,12,03,21,351,,06,12,004,,11,55,235,,14,47,126,*79
$GPGSV,3,2,12,19,49,331,,20,19,272,,22,24,115,,24,41,227,*75
$GPGSV,3,3,12,31,16,048,,32,43,267,,09,00,160,,12,00,129,*71
$GPGSA,M,1,,,,,,,,,,,,,-1.0,-1.0,-1.0*10
而且我也甲肝probleam檢查GPS設備連接或沒有到計算機。我正在使用rxtxcomm.jar進行COM端口讀取。
代碼開放的COM端口如下
CommPortIdentifier port_id = CommPortIdentifier.getPortIdentifier(serial_port_name_);
serial_port = (SerialPort)port_id.open("Gps",2000);
serial_port.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN);
serial_port_.setSerialPortParams(speed,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
我認爲波特率是4800.正如Jeremy所說,目前沒有任何衛星。 – dbasnett