开发者

GPS FIX data, reading from com Port

I'm creating a very simple application to read the info from a GPS in java. The information is sent on the COM1 in the NMEA0183 format.

Everything works good except that I can't find my position because the RMC and GGA sentence are empty. I receive other sentence with the satellite informations and positioning, but all I want is my current pos开发者_Go百科ition (long/lat). when I check the data in hyper terminal the data is comming.

Here is some example of what I currently receive:

$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

And I also hav a probleam to check the GPS device is connected or not to the computer. I am using rxtxcomm.jar for com port reading.

Code for opening com port is as following

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);


According to the GSV sentences, you have no signal from any of the satellites in the list (signal to noise ratio field for all of them is empty). You won't get position information until you get some signal strength. The GPS receiver needs to be outside ideally, but it might work if you put it next to a window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜