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
This commit is contained in:
parent
8e0227ac88
commit
44271cfda6
4 changed files with 13 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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…
Reference in a new issue