Commit 57a0c540 authored by liyuanhong's avatar liyuanhong

修改了不报数据导致连接断开的问题

parent a6cf06dd
......@@ -90,6 +90,7 @@ class DelaySend():
##############################################################################
def getEventPkg(self):
if os.path.exists(self.baseUrl + self.din + '/event.txt'):
with open(self.baseUrl + self.din + "/event.txt", "r", encoding="utf-8") as fi:
content = fi.readlines()
pkg = ""
......@@ -127,8 +128,12 @@ class DelaySend():
for txt in msgs:
fi2.write(txt + "\n")
return msgs
else:
print("event.txt is not exist")
return ["4040000b00034d1215010100010003f50b"]
def getGpsPkg(self):
if os.path.exists(self.baseUrl + self.din + '/gps.txt'):
with open(self.baseUrl + self.din + "/gps.txt", "r", encoding="utf-8") as fi:
content = fi.readlines()
pkg = ""
......@@ -166,8 +171,12 @@ class DelaySend():
for txt in msgs:
fi2.write(txt + "\n")
return msgs
else:
print("gps.txt is not exist")
return ["4040000b00034d1215010100010003f50b"]
def getObdPkg(self):
if os.path.exists(self.baseUrl + self.din + '/obd.txt'):
with open(self.baseUrl + self.din + "/obd.txt", "r", encoding="utf-8") as fi:
content = fi.readlines()
pkg = ""
......@@ -177,7 +186,6 @@ class DelaySend():
onePkg = i[21:].replace("\n", "")
onePkg = onePkg[30:][:-4]
onePkg = onePkg[2:]
print(onePkg)
pkg = pkg + onePkg
pkgCounts = pkgCounts + 1
if len(pkg) > 2000:
......@@ -205,6 +213,9 @@ class DelaySend():
for txt in msgs:
fi2.write(txt + "\n")
return msgs
else:
print("obd.txt is not exist")
return ["4040000b00034d1215010100010003f50b"]
def getLenOfFile(self):
with open(self.baseUrl + "event_big.txt", "r", encoding="utf-8") as fi:
......@@ -215,6 +226,7 @@ class DelaySend():
for msg in msgs:
msg = msg.replace("\n", "")
self.service.serviceSendMsg(msg,"0")
time.sleep(0.05)
def sendDelayMsgs(self):
time.sleep(0.1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment