Some more bug fixes.. Server and Client should be finished now! (Save a

few bugs for later)


git-svn-id: http://www.neo1973-germany.de/svn@163 46df4e5c-bc4e-4628-a0fc-830ba316316d
main
edistar 16 years ago
parent 8e0227ac88
commit 44271cfda6

@ -84,7 +84,6 @@ class TrackClient:
# set username and password globally in the class
self.__username = username
self.__pwhash = pwhash
self.SendData(self.__username, self.__pwhash, action="START")
def SendData(self, username, pwhash, action, data=""):

@ -4,8 +4,8 @@ from socket import *
from WriteGPX import *
class TrackServer:
def __init__(self, host='localhost', port='49152', hashfile='hashfile', datadir = '.'):
self.InitSocker(host, port)
def __init__(self, host='', port='49152', hashfile='hashfile', datadir = './'):
self.InitSocket(host, port)
self.InitHashdb(hashfile)
self.InitTrackDict()
self.datadir = datadir
@ -31,8 +31,8 @@ class TrackServer:
self.__addr = (str(host),int(port))
# Create socket and bind it to the address
self.__UDPSock = socket(AF_INET,SOCK_DGRAM)
self.__UDPSock.bind(sel.__addr)
self.UDPSock = socket(AF_INET,SOCK_DGRAM)
self.UDPSock.bind(self.__addr)
# Debug message:
print "UDP Socket for %s at port %s created" % (host, port)
@ -66,9 +66,10 @@ class TrackServer:
# if a track has already started it needs to be closed (finished)
if self.TrackDict[username]:
self.TrackDict[username].close()
print "Track closed because %s requested a new track" % (username)
# start the new track
self.TrackDict[username] = WriteGPX("%s%s%s" % (self.datadir, username, time.strftime("%Y%m%d%H%M%S")))
print "Created track", self.TrackDict[username]
print "Created track %s%s%s" % (self.datadir, username, time.strftime("%Y%m%d%H%M%S"))
def CloseTrack(self, username):
if self.TrackDict[username]:
@ -89,6 +90,6 @@ instance = TrackServer()
#Receive messages
while 1:
data,addr = UDPSock.recvfrom(1024)
data,addr = instance.UDPSock.recvfrom(1024)
print "Following data received:", data
instance.Parser(data)

@ -32,7 +32,7 @@ class WriteGPX:
self.trackpoint = '<trkpt lat="%s" lon="%s">\n\
<ele>%s</ele>\n\
<time>%s</time>\n\
</trkpt>\n' % (lat, lon, ele, time)
</trkpt>\n' % (lat, lon, ele, time)
with open(self.filename,'a') as file:
file.write(self.trackpoint)

@ -1,3 +1,8 @@
from PyTrackerClient import *
import curses
test=TrackClient('edistar','refeco3','80.61.221.9')
test.StartTrack()
# I need an event to call test.StopTrack!
# How do I do that? Best would be KeyPressed("q") or something
ecore.main_loop_begin()

Loading…
Cancel
Save