×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    200

    NMEA Date & Time Sentence

    I seek local time details from an external GPS device. NMEA's ZDA sentence furnishes this information. See here for details.

    I wish to gain an understanding of how the different sentence types are generated and can be queried. As a starter, I have attempted the following...

    In the following code, replacing "$GPGGA" with "$GPZDA" yields no result.

    Code:
    import socket  
      
    address, services = socket.bt_discover()  
    print "Discovered: %s, %s" % (address, services)  
    target = (address, services.values()[0])  
      
    conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM)  
    conn.connect(target)  
    to_gps = conn.makefile("r", 0)  
      
    while True:  
            msg = to_gps.readline()  
            if msg.startswith("$GPGGA"):  
                    gps_data = msg.split(",")  
                    lat = gps_data[2]  
                    lon = gps_data[4]  
                    break  
      
    to_gps.close()  
    conn.close()  
    print "You are now at latitude %s and longitude %s" % (lat, lon)
    Would greatly appreciate assistance with addressing the concern.

    Best,
    wirefree

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: NMEA Date & Time Sentence

    Why don't you try

    Code:
    import socket  
      
    address, services = socket.bt_discover()  
    print "Discovered: %s, %s" % (address, services)  
    target = (address, services.values()[0])  
      
    conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM)  
    conn.connect(target)  
    to_gps = conn.makefile("r", 0)  
      
    while True:  
            msg = to_gps.readline()  
            print msg
            if msg.startswith("$GPZDA"):  
                    break 
      
    to_gps.close()  
    conn.close()
    This way you could at least see if a $GPZDA sentence is received and then figure out how to decode it.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

Similar Threads

  1. Date problem in python
    By mateen_maldar in forum Symbian
    Replies: 5
    Last Post: 2008-08-20, 11:58
  2. Getting current date and time
    By Deepa msc in forum Mobile Java General
    Replies: 6
    Last Post: 2008-06-25, 10:08
  3. Date & Time Editor in Form Resource.
    By Kavit Patel in forum Symbian
    Replies: 2
    Last Post: 2008-03-03, 06:26
  4. how to get the current time and date
    By Bhoopathi Kummara in forum Symbian
    Replies: 4
    Last Post: 2008-01-08, 11:32
  5. Pim toSerialFormat writes the current time and date
    By ianstrain in forum Mobile Java General
    Replies: 2
    Last Post: 2007-09-20, 10:09

Posting Permissions

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