diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index ec22a4c..e1acddc 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -837,16 +837,69 @@ } void CheckWindow::connectDevice(){ - if(connectList.length()>0&&connectList[0].type==0) - deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>0&&connectList[0].type==0){ + if(deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa")){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } + } if(connectList.length()>1&&connectList[1].type==1) { - if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")) + if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")){ ui->tableWidget_Standard->setItem(0,1,new QTableWidgetItem("ON")); + InstructionLib *instrcutLib = getCmdByCheckName(1,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } } } +void CheckWindow::closeDevice(){ + if(connectList.length()>0&&connectList[0].type==0){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + deviceEngine.closeDevice(); + } + if(connectList.length()>1&&connectList[1].type==1) + { + InstructionLib *instrcutLib = getCmdByCheckName(1,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + standardEngine.closeDevice(); + } +} + InstructionLib* CheckWindow::getCmdByCheckName(int idx,QString name) { if(idx>=0&&idx& dataRes){ diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index ec22a4c..e1acddc 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -837,16 +837,69 @@ } void CheckWindow::connectDevice(){ - if(connectList.length()>0&&connectList[0].type==0) - deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>0&&connectList[0].type==0){ + if(deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa")){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } + } if(connectList.length()>1&&connectList[1].type==1) { - if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")) + if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")){ ui->tableWidget_Standard->setItem(0,1,new QTableWidgetItem("ON")); + InstructionLib *instrcutLib = getCmdByCheckName(1,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } } } +void CheckWindow::closeDevice(){ + if(connectList.length()>0&&connectList[0].type==0){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + deviceEngine.closeDevice(); + } + if(connectList.length()>1&&connectList[1].type==1) + { + InstructionLib *instrcutLib = getCmdByCheckName(1,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + standardEngine.closeDevice(); + } +} + InstructionLib* CheckWindow::getCmdByCheckName(int idx,QString name) { if(idx>=0&&idx& dataRes){ diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 26aa297..eefc17c 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -89,6 +89,7 @@ QString TranDecimals(QString sLabel,QStringList data,double TestValue); void autoAdujstData(QString sLabel,int i,double dStdValue,QList& dataRes); QString TranTypeUnit(QString sUnit); + void closeDevice(); private: Ui::CheckWindow *ui; diff --git a/softwareDirectory/AutoVerScheme/checkwindow.cpp b/softwareDirectory/AutoVerScheme/checkwindow.cpp index ec22a4c..e1acddc 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.cpp +++ b/softwareDirectory/AutoVerScheme/checkwindow.cpp @@ -837,16 +837,69 @@ } void CheckWindow::connectDevice(){ - if(connectList.length()>0&&connectList[0].type==0) - deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa"); + if(connectList.length()>0&&connectList[0].type==0){ + if(deviceEngine.openDevice(connectList[0].programInterface.visa,"Visa")){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } + } if(connectList.length()>1&&connectList[1].type==1) { - if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")) + if(standardEngine.openDevice(connectList[1].programInterface.visa,"Visa")){ ui->tableWidget_Standard->setItem(0,1,new QTableWidgetItem("ON")); + InstructionLib *instrcutLib = getCmdByCheckName(1,"INIT"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + } } } +void CheckWindow::closeDevice(){ + if(connectList.length()>0&&connectList[0].type==0){ + InstructionLib *instrcutLib = getCmdByCheckName(0,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + deviceEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + deviceEngine.closeDevice(); + } + if(connectList.length()>1&&connectList[1].type==1) + { + InstructionLib *instrcutLib = getCmdByCheckName(1,"CLOSE"); + if(instrcutLib!=nullptr){ + QStringList sList = instrcutLib->instruct_config.split(";"); + if(sList.length()>0){ + for (QString& sCmd : sList){ + standardEngine.sendData(sCmd); + qDebug() << "standard cmds:" << sCmd; + } + } + } + standardEngine.closeDevice(); + } +} + InstructionLib* CheckWindow::getCmdByCheckName(int idx,QString name) { if(idx>=0&&idx& dataRes){ diff --git a/softwareDirectory/AutoVerScheme/checkwindow.h b/softwareDirectory/AutoVerScheme/checkwindow.h index 26aa297..eefc17c 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.h +++ b/softwareDirectory/AutoVerScheme/checkwindow.h @@ -89,6 +89,7 @@ QString TranDecimals(QString sLabel,QStringList data,double TestValue); void autoAdujstData(QString sLabel,int i,double dStdValue,QList& dataRes); QString TranTypeUnit(QString sUnit); + void closeDevice(); private: Ui::CheckWindow *ui; diff --git a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp index ce2e327..a820ec9 100644 --- a/softwareDirectory/AutoVerScheme/formaddrsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formaddrsetting.cpp @@ -61,6 +61,9 @@ } this->ui->comboBox->clear(); + this->ui->comboBox->addItem("INIT"); + this->ui->comboBox->addItem("RESET"); + this->ui->comboBox->addItem("CLOSE"); if(checkMode) { // QStringList headlist;