Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openXG-WIC-Opencpc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
openXG-WIC-Opencpc
Commits
21b45a50
Commit
21b45a50
authored
Mar 25, 2018
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改发现的BUG
parent
a6f6ac04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
hfv/listenSer.py
hfv/listenSer.py
+0
-6
hfv/workProcess.py
hfv/workProcess.py
+6
-1
No files found.
hfv/listenSer.py
View file @
21b45a50
...
...
@@ -128,12 +128,6 @@ def sendBySocket(ip, port, cmd):
print
(
"Error receiving data: %s"
%
err_msg
)
s
.
close
()
return
(
-
1
,
err_msg
)
try
:
response
=
s
.
recv
(
1024
).
decode
()
except
socket
.
error
as
err_msg
:
print
(
"Error receiving data: %s"
%
err_msg
)
s
.
close
()
return
(
-
1
,
err_msg
)
print
(
str
(
response
))
s
.
close
()
...
...
hfv/workProcess.py
View file @
21b45a50
...
...
@@ -70,15 +70,20 @@ def mainWhileProcess(input_ctime):
(
condition
,
command
)
=
task
.
split
(
';'
)
(
ip
,
port
,
method
)
=
command
.
split
(
':'
)
# 构建控制指令
method
=
'device&'
+
method
# 读取传感器数值
(
status
,
output
)
=
sendCommandToDevice
(
method
)
# 针对dht11的数据格式做一个简单的数据预处理
output
=
output
.
split
(
'&'
)[
0
]
if
status
==
-
1
:
print
(
"get device data failed! ip: %s, method: %s"
%
(
ip
,
method
))
continue
if
compare
(
condition
[
0
],
float
(
output
),
float
(
condition
[
1
:])):
# 当结果为真,向目标传感器发出指令
(
status
,
output
)
=
sendBySocket
(
ip
,
port
,
method
)
(
status
,
output
)
=
sendBySocket
(
ip
,
int
(
port
)
,
method
)
print
(
output
)
else
:
pass
...
...
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