Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
new-socketemulator
Commits
57a0c540
Commit
57a0c540
authored
Sep 24, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了不报数据导致连接断开的问题
parent
a6cf06dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
111 deletions
+123
-111
lib/util/DelaySend.py
lib/util/DelaySend.py
+123
-111
No files found.
lib/util/DelaySend.py
View file @
57a0c540
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment