Results 1 to 8 of 8
  1. #1
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    208
    Rep Power
    11

    Default GPS programming.

    Hi . Ive done a program that reads from a GPS device from a serialport. My only problem is that it gives me strange stuff.

    The strings i get look like this:
    NMEA Sentence [$GPRMC,160718.0�00,A,5746.587�4,N,01150.6604,E,0.3 0�,125.53,050211�,,,A*6C]

    where � = a square.

    how can i fix this? thanks

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    10

    Default

    I think you need set encoding for input stream.
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    208
    Rep Power
    11

    Default

    Thank you for your reply . how can i do that? There is no such class ?

  4. #4
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    10

    Default

    How you get this string. Can you show snippet code, which get string?
    Skype: petrarsentev
    http://TrackStudio.com

  5. #5
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    208
    Rep Power
    11

    Unhappy

    I know its a lot of trash in it ... but Ive edited it soo much trying to get to the problem =P any ideas?

    /CODE WAS HERE/

    Removed because my teachers will kill me if their "search bot" finds my code online.
    Last edited by santa; 02-06-2011 at 10:23 AM. Reason: removing code

  6. #6
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    10

    Default

    You can try follows
    Java Code:
    String encoding = "UTF-8"; //need encoding
    InputStreamReader reader = new InputStreamReader(inStream, encoding);
    Skype: petrarsentev
    http://TrackStudio.com

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default

    Quote Originally Posted by santa View Post
    The strings i get look like this:
    NMEA Sentence [$GPRMC,160718.0�00,A,5746.587�4,N,01150.6604,E,0.3 0�,125.53,050211�,,,A*6C]

    where � = a square.
    What should that String look like according to that GPS device manual?

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  8. #8
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    208
    Rep Power
    11

    Default

    I think i fixed it by just removing the unknown signs.. because it added them randomly and without them it seems to be the correct length

Similar Threads

  1. GPS programming =)
    By santa in forum New To Java
    Replies: 6
    Last Post: 01-23-2011, 06:06 PM
  2. programming
    By shazeb in forum New To Java
    Replies: 9
    Last Post: 10-31-2010, 02:45 PM
  3. GUI Programming Help
    By sirwiggles in forum New To Java
    Replies: 4
    Last Post: 04-28-2009, 04:53 AM
  4. New to Programming . . .Need Help
    By DSutta22 in forum New To Java
    Replies: 2
    Last Post: 09-10-2008, 05:19 AM
  5. programming
    By abcdefg in forum New To Java
    Replies: 9
    Last Post: 03-10-2008, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •