diff --git a/PyTracker/trunk/PyTrackerClient.py b/PyTracker/trunk/PyTrackerClient.py index e6429c3..8cc777f 100644 --- a/PyTracker/trunk/PyTrackerClient.py +++ b/PyTracker/trunk/PyTrackerClient.py @@ -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=""): diff --git a/PyTracker/trunk/PyTrackerServer.py b/PyTracker/trunk/PyTrackerServer.py index 8316b5e..3870c6e 100644 --- a/PyTracker/trunk/PyTrackerServer.py +++ b/PyTracker/trunk/PyTrackerServer.py @@ -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) diff --git a/PyTracker/trunk/WriteGPX.py b/PyTracker/trunk/WriteGPX.py index 5f5e4de..7521343 100644 --- a/PyTracker/trunk/WriteGPX.py +++ b/PyTracker/trunk/WriteGPX.py @@ -32,7 +32,7 @@ class WriteGPX: self.trackpoint = '\n\ %s\n\ \n\ - \n' % (lat, lon, ele, time) +\n' % (lat, lon, ele, time) with open(self.filename,'a') as file: file.write(self.trackpoint) diff --git a/PyTracker/trunk/clientscript.py b/PyTracker/trunk/clientscript.py index 0d55228..12ca1b5 100644 --- a/PyTracker/trunk/clientscript.py +++ b/PyTracker/trunk/clientscript.py @@ -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()