Python on Symbian development can become very difficult, my typical routine goes like that:
- conneting phone via USB
- sending files
- disconneting USB
- setting up console
- connecting via BT
- testing
- disconnecting
Too much time to lose in that process, so I made simple script:
import urllib
def update(host,dict):
""" Function managing update via HTTP
'host' is host where to look for files
'dict' is dictionary composed from name of module,
and place in file system for it"""for key in dict:
code = urllib.urlopen(host+key).read()
filename = u"%s%s" % (dict[key],key)
f = file(filename, "w")
f.write(code)
f.close()
print("module "+key+" updated")
URL = "http://192.168.1.2/mpm/code/"
MODULES = { u"mpmc.py" : u"E:\\Python\\",
u"mpmdb.py": u"E:\\Python\\lib\\",
u"mpmnet.py": u"E:\\Python\\lib\\",
u"mpmgps.py": u"E:\\Python\\lib\\",
u"mpmv.py": u"E:\\Python\\lib\\",
u"mpmloc.py" : u"E:\\Python\\lib\\",
u"updater.py" : u"E:\\Python\\",
u"mpmcom.py" : u"E:\\Python\\lib\\",}
update(URL, MODULES)
But this still isn’t enough to ease the development process, that’s the place for PUTools. Documentation is written for Windows, but it’s easy to use on Linux, only differences there are is that to create BT serial port on PC:
#sudo sdptool add --channel=3 SP #sudo rfcomm listen /dev/rfcomm2 3
and in the configuration com port should be set to full path to the device:
COM_PORT = /dev/rfcomm2'