Issue 3: Build H1 test
This commit is contained in:
@@ -19,6 +19,9 @@ Implements the following commands:
|
|||||||
CMD> WN LMW,DUMMY,H10,+HH:MM,yyyy-mm-dd,HH:MM,DATB
|
CMD> WN LMW,DUMMY,H10,+HH:MM,yyyy-mm-dd,HH:MM,DATB
|
||||||
ANS< ! 1/10/0;2/10/0;....
|
ANS< ! 1/10/0;2/10/0;....
|
||||||
|
|
||||||
|
CMD> WN LMW,DUMMY,H1,+HH:MM,yyyy-mm-dd,HH:MM,DATA
|
||||||
|
ANS< ! 1/10,;2/10;....
|
||||||
|
|
||||||
CMD> LO
|
CMD> LO
|
||||||
ANS< !
|
ANS< !
|
||||||
|
|
||||||
@@ -57,18 +60,19 @@ class sipProtocol(socketserver.BaseRequestHandler):
|
|||||||
except:
|
except:
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
def meting(self):
|
def number(self, b):
|
||||||
|
if b[0] == b'0':
|
||||||
|
return(int(b[0:1]))
|
||||||
|
else:
|
||||||
|
return(int(b[0:2]))
|
||||||
|
|
||||||
|
def meting(self, delta=10):
|
||||||
res = ""
|
res = ""
|
||||||
sep = "! "
|
sep = "! "
|
||||||
if self.data[18:19] == b'0':
|
elem = self.data.decode().split(",")
|
||||||
h = int(self.data[19:20].decode())
|
h = self.number(elem[3][1:3])
|
||||||
else:
|
m = self.number(elem[3][4:6])
|
||||||
h = int(self.data[18:20].decode())
|
aantal = 1+(60*h+m)//delta
|
||||||
if self.data[21:22] == b'0':
|
|
||||||
m = int(self.data[22:23].decode())
|
|
||||||
else:
|
|
||||||
m = int(self.data[21:23].decode())
|
|
||||||
aantal = 1+(60*h+m)//10
|
|
||||||
if self.data[-1:] == b'A':
|
if self.data[-1:] == b'A':
|
||||||
data = "%i/10"
|
data = "%i/10"
|
||||||
else:
|
else:
|
||||||
@@ -86,8 +90,10 @@ class sipProtocol(socketserver.BaseRequestHandler):
|
|||||||
self.send("!")
|
self.send("!")
|
||||||
elif self.match("TI LMW"):
|
elif self.match("TI LMW"):
|
||||||
self.send("! 20-JAN-01 00:00:00")
|
self.send("! 20-JAN-01 00:00:00")
|
||||||
elif self.match("WN LMW,DUMMY,H10"):
|
elif self.match("WN LMW,DUMMY,H10,"):
|
||||||
self.meting()
|
self.meting(10)
|
||||||
|
elif self.match("WN LMW,DUMMY,H1,"):
|
||||||
|
self.meting(1)
|
||||||
elif self.match("LOGOUTCOUNT"):
|
elif self.match("LOGOUTCOUNT"):
|
||||||
self.send(str(logoutcount))
|
self.send(str(logoutcount))
|
||||||
elif self.match("LO"):
|
elif self.match("LO"):
|
||||||
|
Reference in New Issue
Block a user