Issue 3: Build H1 test

This commit is contained in:
Marcel Nijenhof
2021-08-30 16:05:25 +02:00
parent d711b51ce5
commit 2f4f2eef3f

View File

@@ -19,6 +19,9 @@ Implements the following commands:
CMD> WN LMW,DUMMY,H10,+HH:MM,yyyy-mm-dd,HH:MM,DATB
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
ANS< !
@@ -57,18 +60,19 @@ class sipProtocol(socketserver.BaseRequestHandler):
except:
self.data = None
def meting(self):
res = ""
sep = "! "
if self.data[18:19] == b'0':
h = int(self.data[19:20].decode())
else:
h = int(self.data[18:20].decode())
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
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 = ""
sep = "! "
elem = self.data.decode().split(",")
h = self.number(elem[3][1:3])
m = self.number(elem[3][4:6])
aantal = 1+(60*h+m)//delta
if self.data[-1:] == b'A':
data = "%i/10"
else:
@@ -86,8 +90,10 @@ class sipProtocol(socketserver.BaseRequestHandler):
self.send("!")
elif self.match("TI LMW"):
self.send("! 20-JAN-01 00:00:00")
elif self.match("WN LMW,DUMMY,H10"):
self.meting()
elif self.match("WN LMW,DUMMY,H10,"):
self.meting(10)
elif self.match("WN LMW,DUMMY,H1,"):
self.meting(1)
elif self.match("LOGOUTCOUNT"):
self.send(str(logoutcount))
elif self.match("LO"):