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.
98 lines
1.5 KiB
C++
98 lines
1.5 KiB
C++
#include "GaZManageExport.h"
|
|
|
|
|
|
|
|
GaZManageExport::GaZManageExport()
|
|
{
|
|
if (m_gazSocket == nullptr)
|
|
{
|
|
m_gazSocket = new QTcpSocket();
|
|
}
|
|
}
|
|
|
|
|
|
GaZManageExport::~GaZManageExport()
|
|
{
|
|
}
|
|
|
|
bool GaZManageExport::InitGaz(QString ip, int port)
|
|
{
|
|
m_ip = ip;
|
|
m_port = port;
|
|
|
|
//所有轴回原点
|
|
bool isSuccess = ExecuteCommand("#1W0\r");
|
|
if (!isSuccess)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//设置晶圆尺寸
|
|
isSuccess = ExecuteCommand("#1WAS12\r");
|
|
if (!isSuccess)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//设置角度
|
|
isSuccess = ExecuteCommand("#1WOP0\r");
|
|
if (!isSuccess)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool GaZManageExport::MoveToPreparePos()
|
|
{
|
|
//设置角度
|
|
bool isSuccess = ExecuteCommand("#1G12\r");
|
|
if (!isSuccess)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool GaZManageExport::DOAlign()
|
|
{
|
|
//设置角度
|
|
bool isSuccess = ExecuteCommand("#1G17\r");
|
|
if (!isSuccess)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool GaZManageExport::ExecuteCommand(QString commandStr)
|
|
{
|
|
bool isFlag = false;
|
|
|
|
m_gazSocket->connectToHost(m_ip, m_port);
|
|
|
|
//所有轴回原点
|
|
m_gazSocket->write(commandStr.toStdString().c_str());
|
|
m_gazSocket->waitForBytesWritten(); // 确保数据完全发送
|
|
m_gazSocket->waitForReadyRead(3000); // 等待服务器响应
|
|
QString recvStr = QString::fromUtf8(m_gazSocket->readAll());
|
|
int index = 0;
|
|
index = recvStr.indexOf("ACK");
|
|
if (index >= 0)
|
|
{
|
|
m_gazSocket->waitForReadyRead(30000); // 等待服务器响应
|
|
recvStr = QString::fromUtf8(m_gazSocket->readAll());
|
|
index = recvStr.indexOf("INF");
|
|
if (index >= 0)
|
|
{
|
|
isFlag = true;
|
|
}
|
|
}
|
|
|
|
m_gazSocket->disconnectFromHost();
|
|
return isFlag;
|
|
}
|