转向从机型配置文件获取参数
This commit is contained in:
@ -21,15 +21,16 @@ def traversal_files(_path, _w2t):
|
||||
return dirs, files
|
||||
|
||||
|
||||
def init_logdb(_conn, _cursor):
|
||||
_conn = sqlite3.connect(":memory:", isolation_level=None, check_same_thread=False, cached_statements=4096)
|
||||
_cursor = _conn.cursor()
|
||||
_cursor.execute("PRAGMA journal_mode=wal")
|
||||
_cursor.execute("PRAGMA wal_checkpoint=TRUNCATE")
|
||||
_cursor.execute("PRAGMA synchronous=normal")
|
||||
_cursor.execute("PRAGMA temp_store=memory")
|
||||
_cursor.execute("PRAGMA mmap_size=30000000000")
|
||||
_cursor.execute(
|
||||
def init_logdb(conn, cursor):
|
||||
conn = sqlite3.connect(":memory:", isolation_level=None, check_same_thread=False, cached_statements=2048)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("PRAGMA journal_mode=wal")
|
||||
cursor.execute("PRAGMA wal_checkpoint=TRUNCATE")
|
||||
cursor.execute("PRAGMA synchronous=normal")
|
||||
cursor.execute("PRAGMA temp_store=memory")
|
||||
cursor.execute("PRAGMA mmap_size=30000000000")
|
||||
cursor.execute("PRAGMA cache_size=200000")
|
||||
cursor.execute(
|
||||
"""
|
||||
create table if not exists logs(
|
||||
id integer primary key autoincrement,
|
||||
@ -40,7 +41,7 @@ def init_logdb(_conn, _cursor):
|
||||
)
|
||||
"""
|
||||
)
|
||||
return _conn, _cursor
|
||||
return conn, cursor
|
||||
|
||||
|
||||
def db_lock(func):
|
||||
@ -61,7 +62,7 @@ def insert_logdb(_level, _module, _content):
|
||||
global conn, cursor, lock
|
||||
if "move.monitor" in _content:
|
||||
return
|
||||
data = [_level, _module, repr(_content)]
|
||||
data = [_level, _module, _content]
|
||||
cursor.execute("insert into logs (level, module, content) values (?, ?, ?)", data)
|
||||
|
||||
|
||||
@ -89,7 +90,6 @@ class GetThreadResult(threading.Thread):
|
||||
|
||||
def get_result(self):
|
||||
threading.Thread.join(self) # 等待线程执行完毕
|
||||
# noinspection PyBroadException
|
||||
try:
|
||||
return self.result
|
||||
except Exception:
|
||||
@ -99,35 +99,18 @@ class GetThreadResult(threading.Thread):
|
||||
# PREFIX = 'assets' # for pyinstaller packaging
|
||||
PREFIX = '../assets' # for source code testing and debug
|
||||
log_path = f"{PREFIX}/logs"
|
||||
conn = None
|
||||
cursor = None
|
||||
levels = ["DEBUG", "INFO", "WARNING", "ERROR"]
|
||||
db_state = "readwrite"
|
||||
data_dp = {}
|
||||
data_at = {}
|
||||
w2t = None
|
||||
running = False
|
||||
stop = True
|
||||
tl_prg = None
|
||||
f_records = None
|
||||
data_dp, data_at = {}, {}
|
||||
conn, cursor, w2t, tl_prg, f_records, stop, running = None, None, None, None, None, True, False
|
||||
|
||||
ip_addr = "192.168.0.160"
|
||||
ssh_port = 22
|
||||
socket_port = 5050
|
||||
xService_port = 6666
|
||||
external_port = 8080
|
||||
modbus_port = 502
|
||||
upgrade_port = 4567
|
||||
username = "luoshi"
|
||||
password = "luoshi2019" # for real robot
|
||||
# password = "forpqart" # for robot vm
|
||||
ssh_port, socket_port, xService_port, external_port, modbus_port, upgrade_port = 22, 5050, 6666, 8080, 502, 4567
|
||||
username, password = "luoshi", "luoshi2019"
|
||||
interval = 0.5 # interval after actions being triggered, such as modbus/socket/external communication operations
|
||||
RADIAN = 57.3 # 180 / 3.1415926
|
||||
MAX_FRAME_SIZE = 1024
|
||||
c_md = None
|
||||
c_hr = None
|
||||
c_ec = None
|
||||
c_pd = None
|
||||
c_md, c_hr, c_ec, c_pd = None, None, None, None
|
||||
lock = threading.Lock()
|
||||
|
||||
conn, cursor = init_logdb(conn, cursor)
|
||||
|
@ -11,7 +11,6 @@ import time
|
||||
from common import clibs
|
||||
|
||||
from os import listdir
|
||||
from threading import Thread
|
||||
# from pymodbus.payload import BinaryPayloadDecoder, BinaryPayloadBuilder
|
||||
# from pymodbus.constants import Endian
|
||||
import os.path
|
||||
@ -290,7 +289,7 @@ class ModbusRequest(object):
|
||||
|
||||
|
||||
class HmiRequest(object):
|
||||
socket.setdefaulttimeout(clibs.interval * 10)
|
||||
socket.setdefaulttimeout(clibs.interval * 6)
|
||||
|
||||
def __init__(self, ip, port, port_xs):
|
||||
self.__ip = ip
|
||||
@ -312,38 +311,15 @@ class HmiRequest(object):
|
||||
self.__is_debug = True
|
||||
|
||||
self.__socket_conn()
|
||||
self.__t_heartbeat = Thread(target=self.__heartbeat)
|
||||
self.__t_heartbeat = threading.Thread(target=self.__heartbeat)
|
||||
self.__t_heartbeat.daemon = True
|
||||
self.__t_heartbeat.start()
|
||||
self.__t_unpackage = Thread(target=self.__unpackage, args=(self.__c,))
|
||||
self.__t_unpackage = threading.Thread(target=self.__unpackage, args=(self.__c,))
|
||||
self.__t_unpackage.daemon = True
|
||||
self.__t_unpackage.start()
|
||||
self.__t_unpackage_xs = Thread(target=self.__unpackage_xs, args=(self.__c_xs,))
|
||||
self.__t_unpackage_xs = threading.Thread(target=self.__unpackage_xs, args=(self.__c_xs,))
|
||||
self.__t_unpackage_xs.daemon = True
|
||||
self.__t_unpackage_xs.start()
|
||||
# self.__t_heartbeat = None
|
||||
# self.__t_unpackage = None
|
||||
# self.__t_unpackage_xs = None
|
||||
# self.__t_is_alive = Thread(target=self.__is_alive)
|
||||
# self.__t_is_alive.daemon = True
|
||||
# self.__t_is_alive.start()
|
||||
# time.sleep(3)
|
||||
|
||||
def __is_alive(self):
|
||||
while not self.__close_hmi:
|
||||
if not self.__is_connected:
|
||||
self.__socket_conn()
|
||||
if self.__is_connected:
|
||||
self.__t_heartbeat = Thread(target=self.__heartbeat)
|
||||
self.__t_heartbeat.daemon = True
|
||||
self.__t_heartbeat.start()
|
||||
self.__t_unpackage = Thread(target=self.__unpackage, args=(self.__c,))
|
||||
self.__t_unpackage.daemon = True
|
||||
self.__t_unpackage.start()
|
||||
self.__t_unpackage_xs = Thread(target=self.__unpackage_xs, args=(self.__c_xs,))
|
||||
self.__t_unpackage_xs.daemon = True
|
||||
self.__t_unpackage_xs.start()
|
||||
time.sleep(3)
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
@ -351,7 +327,6 @@ class HmiRequest(object):
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
# self.__close_hmi = True
|
||||
self.__is_connected = False
|
||||
time.sleep(clibs.interval*2)
|
||||
self.__c.close()
|
||||
@ -458,7 +433,7 @@ class HmiRequest(object):
|
||||
self.__index += pkg_value
|
||||
# with open(f"{clibs.log_path}/response.txt", mode="a", encoding="utf-8") as f_res:
|
||||
# f_res.write(f"{json.loads(self.__response.decode())}" + "\n")
|
||||
clibs.insert_logdb("DEBUG", "openapi", self.__response.decode())
|
||||
clibs.insert_logdb("DEBUG", "openapi", str(json.loads(self.__response.decode())))
|
||||
self.__response = b""
|
||||
self.__leftovers = 0
|
||||
self.__is_first_frame = True
|
||||
@ -506,7 +481,7 @@ class HmiRequest(object):
|
||||
if self.__valid_data_length == 0:
|
||||
# with open(f"{clibs.log_path}/response.txt", mode="a", encoding="utf-8") as f_res:
|
||||
# f_res.write(f"{json.loads(self.__response.decode())}" + "\n")
|
||||
clibs.insert_logdb("DEBUG", "openapi", self.__response.decode())
|
||||
clibs.insert_logdb("DEBUG", "openapi", str(json.loads(self.__response.decode())))
|
||||
self.__response = b""
|
||||
self.__is_first_frame = True
|
||||
continue # 此时应该重新 get_headers
|
||||
@ -538,7 +513,7 @@ class HmiRequest(object):
|
||||
self.__leftovers = 0
|
||||
# with open(f"{clibs.log_path}/response.txt", mode="a", encoding="utf-8") as f_res:
|
||||
# f_res.write(f"{json.loads(self.__response.decode())}" + "\n")
|
||||
clibs.insert_logdb("DEBUG", "openapi", self.__response.decode())
|
||||
clibs.insert_logdb("DEBUG", "openapi", str(json.loads(self.__response.decode())))
|
||||
self.__response = b""
|
||||
self.__is_first_frame = True
|
||||
elif len(data) < self.__leftovers:
|
||||
@ -596,7 +571,7 @@ class HmiRequest(object):
|
||||
if self.__valid_data_length == 0:
|
||||
# with open(f"{clibs.log_path}/response.txt", mode="a", encoding="utf-8") as f_res:
|
||||
# f_res.write(f"{json.loads(self.__response.decode())}" + "\n")
|
||||
clibs.insert_logdb("DEBUG", "openapi", self.__response.decode())
|
||||
clibs.insert_logdb("DEBUG", "openapi", str(json.loads(self.__response.decode())))
|
||||
self.__response = b""
|
||||
self.__is_first_frame = True
|
||||
continue
|
||||
@ -626,7 +601,7 @@ class HmiRequest(object):
|
||||
if self.__valid_data_length == 0:
|
||||
# with open(f"{clibs.log_path}/response.txt", mode="a", encoding="utf-8") as f_res:
|
||||
# f_res.write(f"{json.loads(self.__response.decode())}" + "\n")
|
||||
clibs.insert_logdb("DEBUG", "openapi", self.__response.decode())
|
||||
clibs.insert_logdb("DEBUG", "openapi", str(json.loads(self.__response.decode())))
|
||||
self.__response = b""
|
||||
self.__is_first_frame = True
|
||||
continue
|
||||
@ -701,20 +676,20 @@ class HmiRequest(object):
|
||||
self.__response_xs = response
|
||||
|
||||
def get_from_id(self, msg_id, state):
|
||||
f_text = f"%{msg_id}%"
|
||||
f_text, res = f"%{msg_id}%", 0
|
||||
if state is None:
|
||||
self.close()
|
||||
clibs.w2t(f"请求 {msg_id} 发送失败......", "red", "ReqSendFailed")
|
||||
clibs.w2t(f"请求 {msg_id} 发送失败......\n", "red", "ReqSendFailed")
|
||||
for _ in range(3):
|
||||
time.sleep(clibs.interval * 2)
|
||||
try:
|
||||
clibs.lock.acquire(True)
|
||||
clibs.cursor.execute(f"select content from logs where content like '{f_text}'")
|
||||
res = len(clibs.cursor.fetchall())
|
||||
records = clibs.cursor.fetchall()
|
||||
finally:
|
||||
clibs.lock.release()
|
||||
if res >= 2:
|
||||
break
|
||||
if len(records) == 2:
|
||||
return records
|
||||
else:
|
||||
clibs.insert_logdb("ERROR", "openapi", f"hr: 无法找到请求 {msg_id} 的响应")
|
||||
self.close()
|
||||
@ -739,7 +714,8 @@ class HmiRequest(object):
|
||||
with open(f"{clibs.PREFIX}/files/protocols/{command}.json", encoding="utf-8", mode="r") as f_json:
|
||||
req = json.load(f_json)
|
||||
except Exception as Err:
|
||||
clibs.insert_logdb("ERROR", "openapi", f"hr: 暂不支持 {command} 功能,或确认该功能存在... {Err}")
|
||||
clibs.insert_logdb("ERROR", "openapi", f"hr-execution: 暂不支持 {command} 功能,或确认该功能存在... {Err}")
|
||||
clibs.w2t(f"hr-execution: 暂不支持 {command} 功能,或确认该功能存在... {Err}", "red")
|
||||
|
||||
if p_flag == 0: # for old protocols
|
||||
match command:
|
||||
@ -1863,7 +1839,7 @@ class ExternalCommunication(object):
|
||||
self.exec_desc = " :--: 返回 true 表示执行成功,false 失败"
|
||||
|
||||
def socket_client(self):
|
||||
self.__c = socket(AF_INET, SOCK_STREAM)
|
||||
self.__c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
try:
|
||||
self.__c.connect((clibs.ip_addr, clibs.external_port))
|
||||
clibs.insert_logdb("INFO", "openapi", f"ec: 外部通信连接成功...")
|
||||
@ -2127,31 +2103,35 @@ class ExternalCommunication(object):
|
||||
|
||||
|
||||
class PreDos(object):
|
||||
def __init__(self):
|
||||
def __init__(self, ip, port, username, password):
|
||||
self.__ssh = None
|
||||
self.__sftp = None
|
||||
self.ip = ip
|
||||
self.port = port
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
def __ssh2server(self):
|
||||
try:
|
||||
self.__ssh = SSHClient()
|
||||
self.__ssh.set_missing_host_key_policy(AutoAddPolicy())
|
||||
self.__ssh.connect(clibs.ip_addr, clibs.ssh_port, username=clibs.username, password=clibs.password)
|
||||
self.__ssh.connect(hostname=self.ip, port=self.port, username=self.username, password=self.password)
|
||||
self.__sftp = self.__ssh.open_sftp()
|
||||
except Exception as Err:
|
||||
msg = f"predos: SSH 无法连接到 {clibs.ip_addr}:{clibs.ssh_port},需检查网络连通性或者登录信息是否正确 {Err}"
|
||||
msg = f"predos: SSH 无法连接到 {self.ip}:{self.port},需检查网络连通性或者登录信息是否正确 {Err}"
|
||||
clibs.insert_logdb("ERROR", "openapi", msg)
|
||||
clibs.w2t(msg, "red", f"SSHError: cannot connected to {clibs.ip_addr}:{clibs.ssh_port}")
|
||||
clibs.w2t(msg, "red", f"SSHError: cannot connected to {self.ip}:{self.port}")
|
||||
|
||||
def push_prj_to_server(self, prj_file):
|
||||
# prj_file:本地工程完整路径
|
||||
self.__ssh2server()
|
||||
prj_name = prj_file.split("\\")[-1].split("/")[-1].split(".")[0]
|
||||
prj_name = prj_file.split("/")[-1].split(".")[0]
|
||||
self.__sftp.put(prj_file, f"/tmp/{prj_name}.zip")
|
||||
cmd = f"cd /tmp; mkdir {prj_name}; unzip -d {prj_name} -q {prj_name}.zip; rm -rf /tmp/{prj_name}.zip; "
|
||||
cmd += f"sudo rm -rf /home/luoshi/bin/controller/projects/{prj_name}; "
|
||||
cmd += f"sudo mv /tmp/{prj_name}/ /home/luoshi/bin/controller/projects/"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
stdout.read().decode() # 需要read一下才能正常执行
|
||||
stderr.read().decode()
|
||||
self.__ssh.close()
|
||||
@ -2163,14 +2143,14 @@ class PreDos(object):
|
||||
cmd = f"cd /tmp/; sudo rm -rf {prj_name}*; sudo cp -rf /home/luoshi/bin/controller/projects/{prj_name} .; "
|
||||
cmd += f"sudo zip -q -r {prj_name}.zip {prj_name}/; sudo rm -rf {prj_name}"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
print(stdout.read().decode()) # 需要read一下才能正常执行
|
||||
print(stderr.read().decode())
|
||||
|
||||
self.__sftp.get(f"/tmp/{prj_name}.zip", local_prj_path)
|
||||
cmd = f"sudo rm -rf /tmp/{prj_name}.zip"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
print(stdout.read().decode()) # 需要read一下才能正常执行
|
||||
print(stderr.read().decode())
|
||||
|
||||
@ -2184,7 +2164,7 @@ class PreDos(object):
|
||||
self.__sftp.put(local_file, f"/tmp/{filename}")
|
||||
cmd = f"sudo mv /tmp/{filename} {server_file}"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
stdout.read().decode() # 需要read一下才能正常执行
|
||||
stderr.read().decode()
|
||||
self.__ssh.close()
|
||||
@ -2195,21 +2175,21 @@ class PreDos(object):
|
||||
self.__ssh2server()
|
||||
cmd = f"sudo cp {server_file} /tmp/"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
stdout.read().decode() # 需要read一下才能正常执行
|
||||
stderr.read().decode()
|
||||
filename = server_file.split("/")[-1]
|
||||
self.__sftp.get(f"/tmp/{filename}", f"{local_file}")
|
||||
cmd = f"sudo rm -rf /tmp/{filename}"
|
||||
stdin, stdout, stderr = self.__ssh.exec_command(cmd, get_pty=True)
|
||||
stdin.write(clibs.password + "\n")
|
||||
stdin.write(self.password + "\n")
|
||||
stdout.read().decode() # 需要read一下才能正常执行
|
||||
stderr.read().decode()
|
||||
self.__ssh.close()
|
||||
|
||||
|
||||
def robot_init():
|
||||
hr = HmiRequest()
|
||||
hr = clibs.c_hr
|
||||
pd = PreDos()
|
||||
# 推送配置文件
|
||||
clibs.insert_logdb("INFO", "openapi", "init: 推送配置文件 fieldbus_device.json/registers.json/registers.xml 到控制器,并配置 IO 设备,设备号为 7...")
|
||||
@ -2254,7 +2234,7 @@ def robot_init():
|
||||
hr.reload_fieldbus()
|
||||
hr.set_fieldbus_device_params("autotest", True)
|
||||
|
||||
md = ModbusRequest()
|
||||
md = clibs.c_md
|
||||
# 触发急停并恢复
|
||||
md.r_soft_estop(0)
|
||||
md.r_soft_estop(1)
|
||||
@ -2323,12 +2303,12 @@ def fw_updater(local_file_path):
|
||||
fw_size = os.path.getsize(local_file_path)
|
||||
if fw_size > 10000000:
|
||||
# get previous version of xCore
|
||||
hr = HmiRequest()
|
||||
hr = clibs.c_hr
|
||||
version_previous = hr.get_robot_params["version"]
|
||||
hr.close()
|
||||
|
||||
# var def
|
||||
remote_file_path = './upgrade/lircos.zip'
|
||||
remote_file_path = "./upgrade/lircos.zip"
|
||||
fw_content = bytearray()
|
||||
package_data = bytearray()
|
||||
package_data_with_head = bytearray()
|
||||
@ -2336,7 +2316,7 @@ def fw_updater(local_file_path):
|
||||
# socket connect
|
||||
clibs.insert_logdb("INFO", "openapi", f"update firmware: 正在连接 {clibs.ip_addr}:{clibs.upgrade_port}...")
|
||||
try:
|
||||
tcp_socket = socket(AF_INET, SOCK_STREAM)
|
||||
tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
tcp_socket.connect((clibs.ip_addr, clibs.upgrade_port))
|
||||
tcp_socket.setblocking(True)
|
||||
except Exception as Err:
|
||||
@ -2345,13 +2325,13 @@ def fw_updater(local_file_path):
|
||||
|
||||
# get firmware content of binary format
|
||||
clibs.insert_logdb("INFO", "openapi", f"update firmware: 正在读取 {local_file_path} 文件内容...")
|
||||
with open(local_file_path, 'rb') as f_fw:
|
||||
with open(local_file_path, "rb") as f_fw:
|
||||
fw_content += f_fw.read()
|
||||
|
||||
# construct package data: http://confluence.i.rokae.com/pages/viewpage.action?pageId=15634148
|
||||
clibs.insert_logdb("INFO", "openapi", "update firmware: 正在构造数据包,以及包头...")
|
||||
# 1 protocol id
|
||||
protocol_id = c_ushort(htons(0)) # 2 bytes
|
||||
protocol_id = c_ushort(socket.htons(0)) # 2 bytes
|
||||
package_data += protocol_id
|
||||
|
||||
# 2 write type
|
||||
@ -2369,7 +2349,7 @@ def fw_updater(local_file_path):
|
||||
i += 2
|
||||
|
||||
# 4 remote path len
|
||||
remote_file_path_len = c_ushort(htons(len(remote_file_path)))
|
||||
remote_file_path_len = c_ushort(socket.htons(len(remote_file_path)))
|
||||
package_data += remote_file_path_len
|
||||
|
||||
# 5 remote path
|
||||
@ -2380,7 +2360,7 @@ def fw_updater(local_file_path):
|
||||
|
||||
# construct communication protocol: http://confluence.i.rokae.com/pages/viewpage.action?pageId=15634045
|
||||
# 1 get package data with header
|
||||
package_size = c_uint(htonl(len(package_data)))
|
||||
package_size = c_uint(socket.htonl(len(package_data)))
|
||||
package_type = c_ubyte(1) # 0-无协议 1-文件 2-json
|
||||
package_reserve = c_ubyte(0) # 预留位
|
||||
|
||||
@ -2409,7 +2389,7 @@ def fw_updater(local_file_path):
|
||||
|
||||
if fw_size > 10000000:
|
||||
# get current version of xCore
|
||||
hr = HmiRequest()
|
||||
hr = clibs.c_hr
|
||||
version_current = hr.get_robot_params["version"]
|
||||
hr.close()
|
||||
|
||||
@ -2429,7 +2409,7 @@ class UpgradeJsonCmd(object):
|
||||
# socket connect
|
||||
clibs.insert_logdb("INFO", "clibs", f"正在连接 {clibs.ip_addr}:{clibs.upgrade_port}...")
|
||||
try:
|
||||
self.__c = socket(AF_INET, SOCK_STREAM)
|
||||
self.__c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.__c.connect((clibs.ip_addr, clibs.upgrade_port))
|
||||
self.__c.setblocking(True)
|
||||
self.__c.settimeout(3)
|
||||
@ -2439,16 +2419,16 @@ class UpgradeJsonCmd(object):
|
||||
|
||||
@staticmethod
|
||||
def __do_package(cmd):
|
||||
package_size = struct.pack('!I', len(cmd))
|
||||
package_type = struct.pack('B', 2)
|
||||
reserved_byte = struct.pack('B', 0)
|
||||
package_size = struct.pack("!I", len(cmd))
|
||||
package_type = struct.pack("B", 2)
|
||||
reserved_byte = struct.pack("B", 0)
|
||||
return package_size + package_type + reserved_byte + cmd
|
||||
|
||||
def __recv_result(self, cmd):
|
||||
time.sleep(2)
|
||||
try:
|
||||
res = self.__c.recv(10240).decode()
|
||||
except timeout:
|
||||
except Exception:
|
||||
res = "ResponseNone"
|
||||
clibs.insert_logdb("INFO", "openapi", f"upgrade: 请求命令 {cmd.decode()} 的返回信息:\n{res[8:]}")
|
||||
self.__c.close()
|
||||
@ -2457,7 +2437,7 @@ class UpgradeJsonCmd(object):
|
||||
def __exec(self, command: dict):
|
||||
try:
|
||||
self.__c.recv(10240)
|
||||
except timeout:
|
||||
except Exception:
|
||||
pass
|
||||
cmd = json.dumps(command, separators=(",", ":")).encode("utf-8")
|
||||
self.__c.sendall(self.__do_package(cmd))
|
||||
|
Reference in New Issue
Block a user