Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
Opencps
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
WirelessInformationCollaborate
Opencps
Commits
20b06049
Commit
20b06049
authored
Apr 21, 2018
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通过docker容器测试的程序
parent
04509291
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
hfv/getData.py
hfv/getData.py
+1
-1
hfv/listenSer.py
hfv/listenSer.py
+2
-2
hfv/workProcess.py
hfv/workProcess.py
+1
-0
No files found.
hfv/getData.py
View file @
20b06049
...
@@ -65,5 +65,5 @@ while True:
...
@@ -65,5 +65,5 @@ while True:
print
(
'0'
)
print
(
'0'
)
msg
=
'device&%s&0'
%
os
.
getenv
(
'HOSTNAME'
)
msg
=
'device&%s&0'
%
os
.
getenv
(
'HOSTNAME'
)
(
status
,
recvdata
)
=
sendBySocket
(
ip
,
int
(
port
),
m
ethod
)
(
status
,
recvdata
)
=
sendBySocket
(
ip
,
int
(
port
),
m
sg
)
time
.
sleep
(
ctime
)
time
.
sleep
(
ctime
)
hfv/listenSer.py
View file @
20b06049
...
@@ -29,7 +29,7 @@ from controllMatrix import *
...
@@ -29,7 +29,7 @@ from controllMatrix import *
# 两种控制模式,controller:控制器写入控制命令,device:接收其他传感器控制命令
# 两种控制模式,controller:控制器写入控制命令,device:接收其他传感器控制命令
controlModeList
=
[
'controller'
,
'device'
]
controlModeList
=
[
'controller'
,
'device'
]
controlMethodList
=
[
'addInput'
,
'addOutput'
,
'rm'
,
'clear'
,
'period'
,
'show'
,
'start'
,
'stop'
]
controlMethodList
=
[
'addInput'
,
'addOutput'
,
'
addCach'
,
'
rm'
,
'clear'
,
'period'
,
'show'
,
'start'
,
'stop'
]
class
ThreadedTCPRequestHandler
(
socketserver
.
BaseRequestHandler
):
class
ThreadedTCPRequestHandler
(
socketserver
.
BaseRequestHandler
):
'''
'''
...
@@ -156,6 +156,7 @@ def executeCommand(command, information):
...
@@ -156,6 +156,7 @@ def executeCommand(command, information):
circleTime
)
=
information
circleTime
)
=
information
return
insertDB
(
taskMatrixJOSN
,
deviceTypeListJOSN
,
deviceListJOSN
,
\
return
insertDB
(
taskMatrixJOSN
,
deviceTypeListJOSN
,
deviceListJOSN
,
\
int
(
taskStatus
),
int
(
circleTime
))
int
(
taskStatus
),
int
(
circleTime
))
elif
command
==
'addCach'
:
elif
command
==
'addCach'
:
data
=
information
[
0
]
data
=
information
[
0
]
data
=
json
.
loads
(
data
)
data
=
json
.
loads
(
data
)
...
@@ -163,7 +164,6 @@ def executeCommand(command, information):
...
@@ -163,7 +164,6 @@ def executeCommand(command, information):
(
status
,
output
)
=
insertDataIntoDataCach
(
data
[
0
][
i
])
(
status
,
output
)
=
insertDataIntoDataCach
(
data
[
0
][
i
])
(
status
,
output
)
=
updateDataCach
(
data
[
0
][
i
],
data
[
1
][
i
])
(
status
,
output
)
=
updateDataCach
(
data
[
0
][
i
],
data
[
1
][
i
])
return
(
status
,
output
)
return
(
status
,
output
)
elif
command
==
'show'
:
elif
command
==
'show'
:
DBName
=
information
[
0
]
DBName
=
information
[
0
]
return
showDatabase
(
DBName
)
return
showDatabase
(
DBName
)
...
...
hfv/workProcess.py
View file @
20b06049
from
controllMatrix
import
*
from
controllMatrix
import
*
from
resolveMatrix
import
runTask
from
resolveMatrix
import
runTask
import
os
import
os
import
socket
# 发送控制指令到传感器设备,参数cmd,控制命令
# 发送控制指令到传感器设备,参数cmd,控制命令
def
sendCommandToDevice
(
cmd
):
def
sendCommandToDevice
(
cmd
):
...
...
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