642 lines
20 KiB
C++
642 lines
20 KiB
C++
#include "IPG_laser.h"
|
||
#include "deviceinfo.h"
|
||
#include "deviceproxy.h"
|
||
#include "rs_settings.h"
|
||
|
||
IPGLaser* IPGLaser::uniqueInstance = nullptr;
|
||
IPGLaser* IPGLaser::instance()
|
||
{
|
||
if (!uniqueInstance) {
|
||
uniqueInstance = new IPGLaser();
|
||
}
|
||
return uniqueInstance;
|
||
}
|
||
IPGLaser::IPGLaser()
|
||
{
|
||
|
||
}
|
||
IPGLaser::~IPGLaser()
|
||
{
|
||
|
||
}
|
||
int IPGLaser::LaserClose()
|
||
{
|
||
/*****写入数据*****/
|
||
/*激光器关闭*/
|
||
::EnterCriticalSection(&mCsRead);
|
||
char WriteBuff1[20] = {0};
|
||
WriteBuff1[0] = '$';
|
||
WriteBuff1[1] = '3';
|
||
WriteBuff1[2] = '1';
|
||
WriteBuff1[3] = 0x0D;
|
||
WriteBuff1[4] = 0;
|
||
int ret = SendCmd(reinterpret_cast<char*>(WriteBuff1), strlen(WriteBuff1) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret != 0)
|
||
{
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return -1;
|
||
}
|
||
|
||
/*激光器使能关闭*/
|
||
char WriteBuff2[20] = {0};
|
||
WriteBuff2[0] = '$';
|
||
WriteBuff2[1] = '4';
|
||
WriteBuff2[2] = '3';
|
||
WriteBuff2[3] = 0x0D;
|
||
WriteBuff2[4] = 0;
|
||
ret = SendCmd(reinterpret_cast<char*>(WriteBuff2), strlen(WriteBuff2) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret != 0)
|
||
{
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return -1;
|
||
}
|
||
::LeaveCriticalSection(&mCsRead);
|
||
DEVICE_INFO->printDeviceSystemInfo(QString("激光器关闭"));
|
||
return ret;
|
||
}
|
||
int IPGLaser::LaserOpen()
|
||
{
|
||
/*****写入数据*****/
|
||
/*激光使能打开*/
|
||
::EnterCriticalSection(&mCsRead);
|
||
char WriteBuff1[20] = {0};
|
||
WriteBuff1[0] = '$';
|
||
WriteBuff1[1] = '4';
|
||
WriteBuff1[2] = '2';
|
||
WriteBuff1[3] = 0x0D;
|
||
WriteBuff1[4] = 0;
|
||
int ret = SendCmd(reinterpret_cast<char*>(WriteBuff1), strlen(WriteBuff1) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret != 0)
|
||
{
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return -1;
|
||
}
|
||
/*激光器出光*/
|
||
char WriteBuff2[20] = {0};
|
||
WriteBuff2[0] = '$';
|
||
WriteBuff2[1] = '3';
|
||
WriteBuff2[2] = '0';
|
||
WriteBuff2[3] = 0x0D;
|
||
WriteBuff2[4] = 0;
|
||
ret = SendCmd(reinterpret_cast<char*>(WriteBuff2), strlen(WriteBuff2) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret != 0)
|
||
{
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return -1;
|
||
}
|
||
::LeaveCriticalSection(&mCsRead);
|
||
DEVICE_INFO->printDeviceSystemInfo(QString("激光器打开"));
|
||
return ret;
|
||
}
|
||
int IPGLaser::SetSingleParam(QString strCmd,QString Strvalue)
|
||
{
|
||
char WriteBuff[50] = {0};
|
||
if ((Strvalue.count() > 20) || (Strvalue.count() <= 0))
|
||
{
|
||
return -1;
|
||
}
|
||
if ((strCmd.count() > 20) || (strCmd.count() <= 1))
|
||
{
|
||
return -1;
|
||
}
|
||
Sleep(20);
|
||
::EnterCriticalSection(&mCsRead);
|
||
WriteBuff[0] = '$';
|
||
WriteBuff[1] = strCmd.at(0).toLatin1();
|
||
WriteBuff[2] = strCmd.at(1).toLatin1();
|
||
WriteBuff[3] = ';';
|
||
|
||
int i;
|
||
for (i=0;i<Strvalue.count();i++)
|
||
{
|
||
//if (Strvalue.at(i).toLatin1() != '\r')
|
||
WriteBuff[4 + i] = Strvalue.at(i).toLatin1();
|
||
}
|
||
WriteBuff[4 + i] = 0x0D;
|
||
|
||
int ret = SendCmd(reinterpret_cast<char*>(WriteBuff), strlen(WriteBuff) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret == 0)
|
||
{
|
||
// if (revData[0] != '#')
|
||
// return -1;
|
||
}
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return ret;
|
||
}
|
||
int IPGLaser::SwitchMode(bool flag)
|
||
{
|
||
char WriteBuff[50] = {0};
|
||
|
||
::EnterCriticalSection(&mCsRead);
|
||
if (flag)
|
||
{
|
||
WriteBuff[0] = '$';
|
||
WriteBuff[1] = 32;
|
||
WriteBuff[2] = 34;
|
||
WriteBuff[3] = ';';
|
||
WriteBuff[4] = 31;
|
||
WriteBuff[5] = 31;
|
||
WriteBuff[6] = 34;
|
||
WriteBuff[7] = 30;
|
||
WriteBuff[8] = 34;
|
||
WriteBuff[9] = 33;
|
||
WriteBuff[10] = 36;
|
||
WriteBuff[11] = 38;
|
||
WriteBuff[12] = 0x0D;
|
||
}
|
||
else
|
||
{
|
||
WriteBuff[0] = '$';
|
||
WriteBuff[1] = 32;
|
||
WriteBuff[2] = 34;
|
||
WriteBuff[3] = ';';
|
||
WriteBuff[4] = 31;
|
||
WriteBuff[5] = 31;
|
||
WriteBuff[6] = 34;
|
||
WriteBuff[7] = 31;
|
||
WriteBuff[8] = 32;
|
||
WriteBuff[9] = 36;
|
||
WriteBuff[10] = 38;
|
||
WriteBuff[11] = 38;
|
||
WriteBuff[12] = 0x0D;
|
||
}
|
||
|
||
Sleep(20);
|
||
|
||
int ret = SendCmd(reinterpret_cast<char*>(WriteBuff), strlen(WriteBuff) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret == 0)
|
||
{
|
||
// if (revData[0] != '#')
|
||
// return -1;
|
||
}
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return ret;
|
||
}
|
||
int IPGLaser::SetParam(int index)
|
||
{
|
||
int ret =0;
|
||
if (index == 1)
|
||
{
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration1);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition1);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power1);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump1);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 2)
|
||
{
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration2);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition2);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power2);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump2);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 3)
|
||
{
|
||
if (PulseDuration3 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration3);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition3);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power3);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump3);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 4)
|
||
{
|
||
if (PulseDuration4 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration4);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition4);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power4);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump4);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 5)
|
||
{
|
||
if (PulseDuration5 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration5);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition5);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power5);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump5);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 6)
|
||
{
|
||
if (PulseDuration6 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration6);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition6);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power6);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump6);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else if (index == 7)
|
||
{
|
||
if (PulseDuration7 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration7);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition7);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power7);
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump7);
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
else //if (index == 8)
|
||
{
|
||
if (PulseDuration8 == "")
|
||
return -1;
|
||
ret = IPGLASER->SetSingleParam("69",PulseDuration8);//68
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("28",PulseRepetition8);//29
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("32",Power8);//33
|
||
if (ret != 0)
|
||
return ret;
|
||
ret = IPGLASER->SetSingleParam("64",Prepump8);//65
|
||
if (ret != 0)
|
||
return ret;
|
||
}
|
||
|
||
return ret;
|
||
}
|
||
int IPGLaser::GetLaserSts()
|
||
{
|
||
char WriteBuff[50] = {0};
|
||
|
||
memset(revData,0,4096);
|
||
char tmpbuf[10] = {0};
|
||
::EnterCriticalSection(&mCsRead);
|
||
WriteBuff[0] = '$';
|
||
WriteBuff[1] = '4';
|
||
WriteBuff[2] = 0x0D;
|
||
|
||
int ret = SendCmd(reinterpret_cast<char*>(WriteBuff), strlen(WriteBuff) ,reinterpret_cast<unsigned char*>(revData), &revDataLen);
|
||
if (ret == 0)
|
||
{
|
||
if (revDataLen < 3)
|
||
return -1;
|
||
memcpy_s(tmpbuf,10,&revData[2],revDataLen-3);
|
||
int value = atoi(tmpbuf);
|
||
return value;
|
||
}
|
||
::LeaveCriticalSection(&mCsRead);
|
||
return ret;
|
||
}
|
||
int IPGLaser::UpdateIPGPara()
|
||
{
|
||
|
||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||
|
||
PP_Enable = RS_SETTINGS->readEntry("/PPEnable");
|
||
|
||
Power1 = RS_SETTINGS->readEntry("/PP1");
|
||
Prepump1 = RS_SETTINGS->readEntry("/PG1");
|
||
PulseRepetition1 = RS_SETTINGS->readEntry("/AM1");
|
||
PulseDuration1 = RS_SETTINGS->readEntry("/MODE1");
|
||
|
||
Power2 = RS_SETTINGS->readEntry("/PP2");
|
||
Prepump2 = RS_SETTINGS->readEntry("/PG2");
|
||
PulseRepetition2 = RS_SETTINGS->readEntry("/AM2");
|
||
PulseDuration2 = RS_SETTINGS->readEntry("/MODE2");
|
||
|
||
Power3 = RS_SETTINGS->readEntry("/PP3");
|
||
Prepump3 = RS_SETTINGS->readEntry("/PG3");
|
||
PulseRepetition3 = RS_SETTINGS->readEntry("/AM3");
|
||
PulseDuration3 = RS_SETTINGS->readEntry("/MODE3");
|
||
|
||
Power4 = RS_SETTINGS->readEntry("/PP4");
|
||
Prepump4 = RS_SETTINGS->readEntry("/PG4");
|
||
PulseRepetition4 = RS_SETTINGS->readEntry("/AM4");
|
||
PulseDuration4 = RS_SETTINGS->readEntry("/MODE4");
|
||
|
||
Power5 = RS_SETTINGS->readEntry("/PP5");
|
||
Prepump5 = RS_SETTINGS->readEntry("/PG5");
|
||
PulseRepetition5 = RS_SETTINGS->readEntry("/AM5");
|
||
PulseDuration5 = RS_SETTINGS->readEntry("/MODE5");
|
||
|
||
Power6 = RS_SETTINGS->readEntry("/PP6");
|
||
Prepump6 = RS_SETTINGS->readEntry("/PG6");
|
||
PulseRepetition6 = RS_SETTINGS->readEntry("/AM6");
|
||
PulseDuration6 = RS_SETTINGS->readEntry("/MODE6");
|
||
|
||
Power7 = RS_SETTINGS->readEntry("/PP7");
|
||
Prepump7 = RS_SETTINGS->readEntry("/PG7");
|
||
PulseRepetition7 = RS_SETTINGS->readEntry("/AM7");
|
||
PulseDuration7 = RS_SETTINGS->readEntry("/MODE7");
|
||
|
||
Power8 = RS_SETTINGS->readEntry("/PP8");
|
||
Prepump8 = RS_SETTINGS->readEntry("/PG8");
|
||
PulseRepetition8 = RS_SETTINGS->readEntry("/AM8");
|
||
PulseDuration8 = RS_SETTINGS->readEntry("/MODE8");
|
||
RS_SETTINGS->endGroup();
|
||
|
||
|
||
Power1_set= Power1;
|
||
int tmp;
|
||
tmp = PulseDuration1.toInt() -1;
|
||
PulseDuration1 = QString::number(tmp);
|
||
QString str;
|
||
str = getValueFromList(DEV->deCodeString,"PW1");
|
||
dstPower1 = str.toDouble();
|
||
|
||
Power2_set= Power2;
|
||
|
||
tmp = PulseDuration2.toInt() -1;
|
||
PulseDuration2 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW2");
|
||
dstPower2 = str.toDouble();
|
||
|
||
tmp = PulseDuration3.toInt() -1;
|
||
PulseDuration3 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW3");
|
||
dstPower3 = str.toDouble();
|
||
|
||
tmp = PulseDuration4.toInt() -1;
|
||
PulseDuration4 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW4");
|
||
dstPower4 = str.toDouble();
|
||
|
||
tmp = PulseDuration5.toInt() -1;
|
||
PulseDuration5 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW5");
|
||
dstPower5 = str.toDouble();
|
||
|
||
tmp = PulseDuration6.toInt() -1;
|
||
PulseDuration6 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW6");
|
||
dstPower6 = str.toDouble();
|
||
|
||
tmp = PulseDuration7.toInt() -1;
|
||
PulseDuration7 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW7");
|
||
dstPower7 = str.toDouble();
|
||
|
||
tmp = PulseDuration8.toInt() -1;
|
||
PulseDuration8 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW8");
|
||
dstPower8 = str.toDouble();
|
||
|
||
|
||
return 0;
|
||
}
|
||
int IPGLaser::getIPGLaerPara(QString DevName)
|
||
{
|
||
QSettings *settings;//申明一个QSetting类函数
|
||
settings = new QSettings ("SerialDevSet.ini", QSettings::IniFormat);//构建函数
|
||
|
||
QString strKey;
|
||
strKey = "/"+DevName+"/com";
|
||
com = settings->value(strKey).toString();
|
||
if (com.length() > 4)
|
||
{
|
||
com = "\\\\.\\" + com ;
|
||
}
|
||
// strKey = "/"+DevName+"/baud";
|
||
// nBaudRate = settings->value(strKey).toInt();
|
||
// strKey = "/"+DevName+"/nParity";
|
||
// nParity = settings->value(strKey).toInt();
|
||
|
||
// strKey = "/"+DevName+"/nByteSize";
|
||
// nByteSize = settings->value(strKey).toInt();
|
||
// strKey = "/"+DevName+"/nStopBits";
|
||
// nStopBits = settings->value(strKey).toInt();
|
||
// if (nStopBits == 1)
|
||
// nStopBits = 0;
|
||
nBaudRate = 57600;
|
||
nParity = 0;
|
||
nByteSize = 8;
|
||
nStopBits = 0; //停止位1
|
||
|
||
//int ret = DEV->deCode_file(".\\Data\\laser_para1.txt");
|
||
// int ret = DEV->deCode_file(".\\Data\\data.txt");
|
||
// if (ret != 0)
|
||
// return -1;
|
||
// Mode 1
|
||
// AM 50
|
||
// PP 10
|
||
// PG 6500
|
||
//QStringList list = DEV->deCodeString.split("\n"); // 按","为分隔符分割字符串,list的值为["apple", "banana", "pear"]
|
||
|
||
RS_SETTINGS->beginGroup("device/LaserCmb");
|
||
|
||
PP_Enable = RS_SETTINGS->readEntry("/PPEnable");
|
||
|
||
Power1 = RS_SETTINGS->readEntry("/PP1");
|
||
Prepump1 = RS_SETTINGS->readEntry("/PG1");
|
||
PulseRepetition1 = RS_SETTINGS->readEntry("/AM1");
|
||
PulseDuration1 = RS_SETTINGS->readEntry("/MODE1");
|
||
|
||
Power2 = RS_SETTINGS->readEntry("/PP2");
|
||
Prepump2 = RS_SETTINGS->readEntry("/PG2");
|
||
PulseRepetition2 = RS_SETTINGS->readEntry("/AM2");
|
||
PulseDuration2 = RS_SETTINGS->readEntry("/MODE2");
|
||
|
||
Power3 = RS_SETTINGS->readEntry("/PP3");
|
||
Prepump3 = RS_SETTINGS->readEntry("/PG3");
|
||
PulseRepetition3 = RS_SETTINGS->readEntry("/AM3");
|
||
PulseDuration3 = RS_SETTINGS->readEntry("/MODE3");
|
||
|
||
Power4 = RS_SETTINGS->readEntry("/PP4");
|
||
Prepump4 = RS_SETTINGS->readEntry("/PG4");
|
||
PulseRepetition4 = RS_SETTINGS->readEntry("/AM4");
|
||
PulseDuration4 = RS_SETTINGS->readEntry("/MODE4");
|
||
|
||
Power5 = RS_SETTINGS->readEntry("/PP5");
|
||
Prepump5 = RS_SETTINGS->readEntry("/PG5");
|
||
PulseRepetition5 = RS_SETTINGS->readEntry("/AM5");
|
||
PulseDuration5 = RS_SETTINGS->readEntry("/MODE5");
|
||
|
||
Power6 = RS_SETTINGS->readEntry("/PP6");
|
||
Prepump6 = RS_SETTINGS->readEntry("/PG6");
|
||
PulseRepetition6 = RS_SETTINGS->readEntry("/AM6");
|
||
PulseDuration6 = RS_SETTINGS->readEntry("/MODE6");
|
||
|
||
Power7 = RS_SETTINGS->readEntry("/PP7");
|
||
Prepump7 = RS_SETTINGS->readEntry("/PG7");
|
||
PulseRepetition7 = RS_SETTINGS->readEntry("/AM7");
|
||
PulseDuration7 = RS_SETTINGS->readEntry("/MODE7");
|
||
|
||
Power8 = RS_SETTINGS->readEntry("/PP8");
|
||
Prepump8 = RS_SETTINGS->readEntry("/PG8");
|
||
PulseRepetition8 = RS_SETTINGS->readEntry("/AM8");
|
||
PulseDuration8 = RS_SETTINGS->readEntry("/MODE8");
|
||
RS_SETTINGS->endGroup();
|
||
|
||
///Power1 = getValueFromList(DEV->deCodeString,"PP1");//
|
||
Power1_set= Power1;
|
||
///Prepump1 = getValueFromList(DEV->deCodeString,"PG1");//
|
||
///PulseDuration1 = getValueFromList(DEV->deCodeString,"Mode1");//
|
||
int tmp;
|
||
tmp = PulseDuration1.toInt() -1;
|
||
PulseDuration1 = QString::number(tmp);
|
||
///PulseRepetition1 = getValueFromList(DEV->deCodeString,"AM1");//
|
||
QString str;
|
||
str = getValueFromList(DEV->deCodeString,"PW1");
|
||
dstPower1 = str.toDouble();
|
||
//PP_Enable = getValueFromList(DEV->deCodeString,"PP_Enable");
|
||
|
||
|
||
// ret = DEV->deCode_file(".\\Data\\laser_para2.txt");
|
||
// if (ret != 0)
|
||
// return -1;
|
||
//Power2 = getValueFromList(DEV->deCodeString,"PP2");
|
||
Power2_set= Power2;
|
||
//Prepump2 = getValueFromList(DEV->deCodeString,"PG2");
|
||
//PulseDuration2 = getValueFromList(DEV->deCodeString,"Mode2");
|
||
//PulseRepetition2 = getValueFromList(DEV->deCodeString,"AM2");
|
||
tmp = PulseDuration2.toInt() -1;
|
||
PulseDuration2 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW2");
|
||
dstPower2 = str.toDouble();
|
||
|
||
DEVICE_INFO->printDeviceSystemInfo("MODE1:"+PulseDuration1+1);
|
||
DEVICE_INFO->printDeviceSystemInfo("PP1:"+Power1);
|
||
DEVICE_INFO->printDeviceSystemInfo("PG1:"+Prepump1);
|
||
DEVICE_INFO->printDeviceSystemInfo("AM1:"+PulseRepetition1);
|
||
|
||
DEVICE_INFO->printDeviceSystemInfo("MODE2:"+PulseDuration2+1);
|
||
DEVICE_INFO->printDeviceSystemInfo("PP2:"+Power2);
|
||
DEVICE_INFO->printDeviceSystemInfo("PG2:"+Prepump2);
|
||
DEVICE_INFO->printDeviceSystemInfo("AM2:"+PulseRepetition2);
|
||
|
||
|
||
//Power3 = getValueFromList(DEV->deCodeString,"PP3");
|
||
//Prepump3 = getValueFromList(DEV->deCodeString,"PG3");
|
||
//PulseDuration3 = getValueFromList(DEV->deCodeString,"Mode3");
|
||
//PulseRepetition3 = getValueFromList(DEV->deCodeString,"AM3");
|
||
tmp = PulseDuration3.toInt() -1;
|
||
PulseDuration3 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW3");
|
||
dstPower3 = str.toDouble();
|
||
|
||
//Power4 = getValueFromList(DEV->deCodeString,"PP4");
|
||
//Prepump4 = getValueFromList(DEV->deCodeString,"PG4");
|
||
//PulseDuration4 = getValueFromList(DEV->deCodeString,"Mode4");
|
||
//PulseRepetition4 = getValueFromList(DEV->deCodeString,"AM4");
|
||
tmp = PulseDuration4.toInt() -1;
|
||
PulseDuration4 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW4");
|
||
dstPower4 = str.toDouble();
|
||
|
||
// Power5 = getValueFromList(DEV->deCodeString,"PP5");
|
||
// Prepump5 = getValueFromList(DEV->deCodeString,"PG5");
|
||
// PulseDuration5 = getValueFromList(DEV->deCodeString,"Mode5");
|
||
// PulseRepetition5 = getValueFromList(DEV->deCodeString,"AM5");
|
||
tmp = PulseDuration5.toInt() -1;
|
||
PulseDuration5 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW5");
|
||
dstPower5 = str.toDouble();
|
||
|
||
// Power6 = getValueFromList(DEV->deCodeString,"PP6");
|
||
// Prepump6 = getValueFromList(DEV->deCodeString,"PG6");
|
||
// PulseDuration6 = getValueFromList(DEV->deCodeString,"Mode6");
|
||
// PulseRepetition6 = getValueFromList(DEV->deCodeString,"AM6");
|
||
tmp = PulseDuration6.toInt() -1;
|
||
PulseDuration6 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW6");
|
||
dstPower6 = str.toDouble();
|
||
|
||
// Power7 = getValueFromList(DEV->deCodeString,"PP7");
|
||
// Prepump7 = getValueFromList(DEV->deCodeString,"PG7");
|
||
// PulseDuration7 = getValueFromList(DEV->deCodeString,"Mode7");
|
||
// PulseRepetition7 = getValueFromList(DEV->deCodeString,"AM7");
|
||
tmp = PulseDuration7.toInt() -1;
|
||
PulseDuration7 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW7");
|
||
dstPower7 = str.toDouble();
|
||
|
||
// Power8 = getValueFromList(DEV->deCodeString,"PP8");
|
||
// Prepump8 = getValueFromList(DEV->deCodeString,"PG8");
|
||
// PulseDuration8 = getValueFromList(DEV->deCodeString,"Mode8");
|
||
// PulseRepetition8 = getValueFromList(DEV->deCodeString,"AM8");
|
||
tmp = PulseDuration8.toInt() -1;
|
||
PulseDuration8 = QString::number(tmp);
|
||
str = getValueFromList(DEV->deCodeString,"PW8");
|
||
dstPower8 = str.toDouble();
|
||
|
||
// strKey = "/"+DevName+"/Power1";
|
||
// Power1 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/Prepump1";
|
||
// Prepump1 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/PulseDuration1";
|
||
// PulseDuration1 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/PulseRepetition1";
|
||
// PulseRepetition1 = settings->value(strKey).toString();
|
||
|
||
// strKey = "/"+DevName+"/Power2";
|
||
// Power2 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/Prepump2";
|
||
// Prepump2 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/PulseDuration2";
|
||
// PulseDuration2 = settings->value(strKey).toString();
|
||
// strKey = "/"+DevName+"/PulseRepetition2";
|
||
// PulseRepetition2 = settings->value(strKey).toString();
|
||
|
||
return 0;
|
||
}
|
||
QString IPGLaser::getValueFromList(QString strDecode,QString strName)
|
||
{
|
||
QStringList list = strDecode.split("\n"); // 按","为分隔符分割字符串,list的值为["apple", "banana", "pear"]
|
||
for (int i=0;i<list.count();i++)
|
||
{
|
||
if (list[i].indexOf(strName) >=0)
|
||
{
|
||
QStringList list_son = list[i].split("=");
|
||
return list_son[1];
|
||
}
|
||
}
|
||
return "";
|
||
}
|
||
|