update 更新界面显示_3
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
import logging
|
||||
|
||||
import Constant
|
||||
from COM.COM_TCP import TCPClient
|
||||
import queue
|
||||
import json
|
||||
from Model.RobotModel import DataAddress,DATARequest,DATAReply
|
||||
from Util.util_log import log
|
||||
|
||||
class RobotClient(TCPClient):
|
||||
|
||||
@ -33,13 +37,13 @@ class RobotClient(TCPClient):
|
||||
else:
|
||||
return True
|
||||
except Exception as e:
|
||||
print('连接断开')
|
||||
log.log_message(logging.ERROR,str_tcp_robot_connect_fail)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def send_Status(self):
|
||||
request = DATARequest()
|
||||
request = DATARequest()
|
||||
dataAddr = DataAddress()
|
||||
request.queryAddr.append(dataAddr)
|
||||
|
||||
@ -56,12 +60,17 @@ class RobotClient(TCPClient):
|
||||
data_status = DATAReply()
|
||||
data_status.__dict__ = response_message
|
||||
data_address_array = data_status.queryData
|
||||
data_Address = DataAddress()
|
||||
data_Address.setPosition(*data_address_array)
|
||||
self.status_model.setPosition(*data_address_array)
|
||||
try:
|
||||
self.status_model.curMode = int(data_address_array[0])
|
||||
self.status_model.setPosition(*data_address_array[1:13])
|
||||
self.status_model.curAlarm = int(data_address_array[13])
|
||||
self.status_model.isMoving = int(data_address_array[14])
|
||||
self.status_model.RemoteCmdLen = int(data_address_array[15])
|
||||
except:
|
||||
log.log_message(logging.ERROR,Constant.str_tcp_robot_data_error)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(e.with_traceback())
|
||||
#log.log_message(logging.ERROR,f'{e}')
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user