You Are Here:

Community: Developer Discussion Boards

#1 Old Static Navigation on/off - 2007-11-27, 16:40

Join Date: Nov 2007
Posts: 5
vvj
Offline
Registered User
Answer please my question: whether Probably to realise
>> on/off function "Static Navigation" on phone with built in GPS (6110 Navigator, n95).

In this two script its work on bluetooth GPS(Sirf III)

staticnvon.py

Code:
import socket

def high_endian(value):
    h, l = divmod(value, 256)
    return chr(h) + chr(l)

def checksum(payload):
    csum = 0
    for c in payload:
        csum += ord(c)
    return high_endian(csum & 0x7FFF)

def sirf_message(payload):
    return ('\xA0\xA2' + high_endian(len(payload)) + payload +
            checksum(payload) + '\xB0\xB3')

def disable_static():
    return sirf_message('\x8F' + '\x00')

def enable_static():
    return sirf_message('\x8F' + '\x01')
    
def switch_to_nmea():
    mode = '\x02'
        # 0 = Enable NMEA debug messages
        # 1 = Disable NMEA debug messages
        # 2 = Do not change NMEA debug setting
    gga_rate = '\x01' # numer of GGA messages per second; 0 = off
    gga_checksum = '\x01' # 0 = off, 1 = on
    gll_rate = '\x01' # numer of GLL messages per second; 0 = off
    gll_checksum = '\x01' # 0 = off, 1 = on
    gsa_rate = '\x01' # numer of GSA messages per second; 0 = off
    gsa_checksum = '\x01' # 0 = off, 1 = on
    gsv_rate = '\x01' # numer of GSV messages per second; 0 = off
    gsv_checksum = '\x01' # 0 = off, 1 = on
    rmc_rate = '\x01' # numer of RMC messages per second; 0 = off
    rmc_checksum = '\x01' # 0 = off, 1 = on
    vtg_rate = '\x01' # numer of VTG messages per second; 0 = off
    vtg_checksum = '\x01' # 0 = off, 1 = on
    mss_rate = '\x01' # numer of MSS messages per second; 0 = off
    mss_checksum = '\x01' # 0 = off, 1 = on
    zda_rate = '\x01' # numer of ZDA messages per second; 0 = off
    zda_checksum = '\x01' # 0 = off, 1 = on
    baud_rate = high_endian(38400)
    return sirf_message('\x81' + mode + gga_rate + gga_checksum +
                        gll_rate + gll_checksum +
                        gsa_rate + gsa_checksum +
                        gsv_rate + gsv_checksum +
                        rmc_rate + rmc_checksum +
                        vtg_rate + vtg_checksum +
                        mss_rate + mss_checksum +
                        '\x00\x00' +
                        zda_rate + zda_checksum +
                        '\x00\x00' +
                        baud_rate)                     

#gps_addr='00:02:76:fd:a2:94'

gps_addr,services=socket.bt_discover()
target=(gps_addr,services.values()[0])

sock=socket.socket(socket.AF_BT, socket.SOCK_STREAM)
#target=(gps_addr,1)
sock.connect(target)

print 'Connected to the GPS'

print 'To SiRF'
temps="$PSRF100,0,38400,8,1,0*3C"
sock.send(temps)

print 'Enable Static Nav'
tempnv=enable_static()
sock.send(tempnv)

print 'Back to NMEA'
tempnm=switch_to_nmea()
sock.send(tempnm)

sock.close()

staticnvoff.py

Code:
import socket

def high_endian(value):
    h, l = divmod(value, 256)
    return chr(h) + chr(l)

def checksum(payload):
    csum = 0
    for c in payload:
        csum += ord(c)
    return high_endian(csum & 0x7FFF)

def sirf_message(payload):
    return ('\xA0\xA2' + high_endian(len(payload)) + payload +
            checksum(payload) + '\xB0\xB3')

def disable_static():
    return sirf_message('\x8F' + '\x00')

def enable_static():
    return sirf_message('\x8F' + '\x01')
    
def switch_to_nmea():
    mode = '\x02'
        # 0 = Enable NMEA debug messages
        # 1 = Disable NMEA debug messages
        # 2 = Do not change NMEA debug setting
    gga_rate = '\x01' # numer of GGA messages per second; 0 = off
    gga_checksum = '\x01' # 0 = off, 1 = on
    gll_rate = '\x01' # numer of GLL messages per second; 0 = off
    gll_checksum = '\x01' # 0 = off, 1 = on
    gsa_rate = '\x01' # numer of GSA messages per second; 0 = off
    gsa_checksum = '\x01' # 0 = off, 1 = on
    gsv_rate = '\x01' # numer of GSV messages per second; 0 = off
    gsv_checksum = '\x01' # 0 = off, 1 = on
    rmc_rate = '\x01' # numer of RMC messages per second; 0 = off
    rmc_checksum = '\x01' # 0 = off, 1 = on
    vtg_rate = '\x01' # numer of VTG messages per second; 0 = off
    vtg_checksum = '\x01' # 0 = off, 1 = on
    mss_rate = '\x01' # numer of MSS messages per second; 0 = off
    mss_checksum = '\x01' # 0 = off, 1 = on
    zda_rate = '\x01' # numer of ZDA messages per second; 0 = off
    zda_checksum = '\x01' # 0 = off, 1 = on
    baud_rate = high_endian(38400)
    return sirf_message('\x81' + mode + gga_rate + gga_checksum +
                        gll_rate + gll_checksum +
                        gsa_rate + gsa_checksum +
                        gsv_rate + gsv_checksum +
                        rmc_rate + rmc_checksum +
                        vtg_rate + vtg_checksum +
                        mss_rate + mss_checksum +
                        '\x00\x00' +
                        zda_rate + zda_checksum +
                        '\x00\x00' +
                        baud_rate)                     

#gps_addr='00:02:76:fd:a2:94'

gps_addr,services=socket.bt_discover()
target=(gps_addr,services.values()[0])

sock=socket.socket(socket.AF_BT, socket.SOCK_STREAM)
#target=(gps_addr,1)
sock.connect(target)

print 'Connected to the GPS'

print 'To SiRF'
temps="$PSRF100,0,38400,8,1,0*3C"
sock.send(temps)

print 'Disable Static Nav'
tempnv=disable_static()
sock.send(tempnv)

print 'Back to NMEA'
tempnm=switch_to_nmea()
sock.send(tempnm)

sock.close()
its script's from Richard's Stuff (http://wyzwun.googlepages.com/pythonforseries60)

Thank all very much!
(It is translated ru-en promt)
Reply With Quote

#2 Old Re: Static Navigation on/off - 2007-12-25, 08:32

Join Date: Dec 2007
Posts: 1
hopet
Offline
Registered User
I've hacked together slightly more elaborate application (and called it staticnv):

http://sitola.fi.muni.cz/~hopet/staticnv/

The code sniplets provided by Robert were just oversimplified for my configuration. The page describes also installation steps. It's also written using PyS60 and verified to work with my combination of Nokia 5500 (Symbian 60 3rd) and Nokia LD-3W Bluetooth GPS module. It shows also some rudimentary support for DGPS (rather as a sample to show how it works than anything useful).
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Python for UIQ cassioli Python 141 2008-06-11 19:16
Switch off Bluetooth Gps's Static Navigation aaaaapo Python 1 2007-06-06 10:18
GoogleIt deepika.mangla General Symbian C++ 4 2007-01-08 02:07
Linking Static DLL with another Static DLL symbianfresher General Symbian C++ 6 2006-01-09 05:23
some problems with label vivienzhung Mobile Java General 1 2002-10-21 10:52

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia