Read NMEA data from the GPS device

advertisements

I am working with gps system. I want to read data from GPS device. I am using NMEA protocol. I am getting Data from Device but it is some what like ecoded ASCII string which i don't get. So Is there any way to get desire data. My Code is as under..

// My Code //
ServerSocket ss = new ServerSocket(1500);
Socket s1 = ss.accept();
While(s1 != null)
{
     InputStream is = s1.getInputStream();
     BufferedReader br = new InputStreamReader(is);

     String result = br.readLine();
     System.out.println(result)l

}

but i am getting encoded out put or something. So reply me correct way to read NMEA data.


if you are getting NMEA data, its should be something of format:

$GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70

  1   220516     Time Stamp
  2   A          validity - A-ok, V-invalid
  3   5133.82    current Latitude
  4   N          North/South
  5   00042.24   current Longitude
  6   W          East/West
  7   173.8      Speed in knots
  8   231.8      True course
  9   130694     Date Stamp
  10  004.2      Variation
  11  W          East/West
  12  *70        checksum

Now you just need to extract Longitude,Latitude etc. using simple java.