Commit 20b06049 authored by joliu's avatar joliu

通过docker容器测试的程序

parent 04509291
......@@ -65,5 +65,5 @@ while True:
print('0')
msg = 'device&%s&0' % os.getenv('HOSTNAME')
(status, recvdata) = sendBySocket(ip, int(port), method)
(status, recvdata) = sendBySocket(ip, int(port), msg)
time.sleep(ctime)
......@@ -29,7 +29,7 @@ from controllMatrix import *
# 两种控制模式,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):
'''
......@@ -156,6 +156,7 @@ def executeCommand(command, information):
circleTime) = information
return insertDB(taskMatrixJOSN, deviceTypeListJOSN, deviceListJOSN,\
int(taskStatus), int(circleTime))
elif command == 'addCach':
data = information[0]
data = json.loads(data)
......@@ -163,7 +164,6 @@ def executeCommand(command, information):
(status, output) = insertDataIntoDataCach(data[0][i])
(status, output) = updateDataCach(data[0][i], data[1][i])
return (status, output)
elif command == 'show':
DBName = information[0]
return showDatabase(DBName)
......
from controllMatrix import *
from resolveMatrix import runTask
import os
import socket
# 发送控制指令到传感器设备,参数cmd,控制命令
def sendCommandToDevice(cmd):
......
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