| Reply | « Previous Thread | Next Thread » |
|
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()
Thank all very much! (It is translated ru-en promt) |
|
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 | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| 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 |