You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
#include "CleanMachineExportManage.h"
|
|
|
|
|
|
|
|
|
|
|
|
CleanMachineExportManage::CleanMachineExportManage()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CleanMachineExportManage::~CleanMachineExportManage()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CleanMachineExportManage::InitCleanMachine(QString ip, int port)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_ip = ip;
|
|
|
|
|
|
m_port = port;
|
|
|
|
|
|
|
|
|
|
|
|
//TODO:<3A>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CleanMachineExportManage::ExecuteCommand(CommandType commandType)
|
|
|
|
|
|
{
|
|
|
|
|
|
QTcpSocket socket;
|
|
|
|
|
|
socket.connectToHost(m_ip, m_port);
|
|
|
|
|
|
//3S<33><53><EFBFBD>Ӳ<EFBFBD><D3B2>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>
|
|
|
|
|
|
if (!socket.waitForConnected(3000))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString commandStr;
|
|
|
|
|
|
if (COMMON_START_CLEAN == commandType)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandStr = "ClearDevice;StartProcess;End";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
socket.write(commandStr.toStdString().c_str());
|
|
|
|
|
|
socket.waitForBytesWritten(); // <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
bool isOk = socket.waitForReadyRead(10000); // <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݿɶ<DDBF>,<2C>ȴ<EFBFBD>10S<30><53><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
|
|
|
|
|
|
if (isOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString recvStr = QString::fromUtf8(socket.readAll());
|
|
|
|
|
|
|
|
|
|
|
|
bool commandExcecuteFlag = false;
|
|
|
|
|
|
if (COMMON_START_CLEAN == commandType && recvStr.indexOf("ClearDevice;StartProcess:Finish;End") >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
commandExcecuteFlag = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
socket.disconnectFromHost();
|
|
|
|
|
|
return commandExcecuteFlag;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
socket.disconnectFromHost();
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|