diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index e7f30d8..7d91671 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -290,6 +290,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index e7f30d8..7d91671 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -290,6 +290,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index df9ff67..90a3172 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -266,7 +266,7 @@ - 2 + 0 diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index e7f30d8..7d91671 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -290,6 +290,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index df9ff67..90a3172 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -266,7 +266,7 @@ - 2 + 0 diff --git a/softwareDirectory/AutoVerScheme/formcommsetting.cpp b/softwareDirectory/AutoVerScheme/formcommsetting.cpp index f5c4f9d..f4a8773 100644 --- a/softwareDirectory/AutoVerScheme/formcommsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formcommsetting.cpp @@ -1,5 +1,6 @@ #include "formcommsetting.h" #include "ui_formcommsetting.h" +#include "visacommonengine.h" FormCommSetting::FormCommSetting(QWidget *parent,int type,QString id) : QWidget(parent), @@ -7,6 +8,14 @@ ui(new Ui::FormCommSetting) { ui->setupUi(this); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_9->addItems(visaAddrs); + visaAddrs.clear(); + QStringList serialAddrs = engine.getSerialAddrs(); + ui->comboBox->addItems(serialAddrs); + serialAddrs.clear(); if(deviceId!=""){ addrList = BaseCommonApi::getVerificationProgramConfigInterface(deviceId); if(addrList.length()>0){ diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index e7f30d8..7d91671 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -290,6 +290,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index df9ff67..90a3172 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -266,7 +266,7 @@ - 2 + 0 diff --git a/softwareDirectory/AutoVerScheme/formcommsetting.cpp b/softwareDirectory/AutoVerScheme/formcommsetting.cpp index f5c4f9d..f4a8773 100644 --- a/softwareDirectory/AutoVerScheme/formcommsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formcommsetting.cpp @@ -1,5 +1,6 @@ #include "formcommsetting.h" #include "ui_formcommsetting.h" +#include "visacommonengine.h" FormCommSetting::FormCommSetting(QWidget *parent,int type,QString id) : QWidget(parent), @@ -7,6 +8,14 @@ ui(new Ui::FormCommSetting) { ui->setupUi(this); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_9->addItems(visaAddrs); + visaAddrs.clear(); + QStringList serialAddrs = engine.getSerialAddrs(); + ui->comboBox->addItems(serialAddrs); + serialAddrs.clear(); if(deviceId!=""){ addrList = BaseCommonApi::getVerificationProgramConfigInterface(deviceId); if(addrList.length()>0){ diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.cpp b/softwareDirectory/AutoVerScheme/visacommonengine.cpp index 3c277fe..e0e16af 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.cpp +++ b/softwareDirectory/AutoVerScheme/visacommonengine.cpp @@ -11,6 +11,63 @@ { closeDevice(); }*/ +QStringList VisaCommonEngine::getVisaAddrs() +{ + QStringList addrList; + //addrList.append("TCPIP0::10.129.41.111::inst0::INSTR"); + //addrList.append("GPIB1::INSTR"); + char instrDescriptor[VI_FIND_BUFLEN]; + ViUInt32 numInstrs; + ViFindList findList; + + status = viOpenDefaultRM(&defaultRM); + if ( status < VI_SUCCESS ) { + qDebug() << "Could not open a session to the VISA Resource Manager!\n"; + return addrList; + } + + status = viFindRsrc( defaultRM, "?*INSTR", &findList, &numInstrs, instrDescriptor ); + if ( status < VI_SUCCESS ) { + qDebug() << "An error occurred while finding resources."; + return addrList; + } + + if ( numInstrs > 0 ) { + addrList.append(instrDescriptor); + } + + //status = viOpen( defaultRM, instrDescriptor, VI_NULL, VI_NULL, &instr ); + + while (--numInstrs ) { + status = viFindNext( findList, instrDescriptor ); + if ( status < VI_SUCCESS ) { + qDebug() <<"An error occurred finding the next resource."; + //return status; + }else{ + addrList.append(instrDescriptor); + } + //这个时候的instrDescriptor就是你电脑上找到的资源,并且可用,如果为空就说明你的连线有问题 + } + + //viClose(instr); + //viClose(findList); + viClose(defaultRM); + + return addrList; +} + +QStringList VisaCommonEngine::getSerialAddrs() +{ + QStringList addrList; + //addrList.append("COM1"); + //addrList.append("COM2"); + foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) + { + addrList.append(info.portName()); + } + return addrList; +} + bool VisaCommonEngine::getState() { return commState; diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp index 1b8bdc4..ce95fc7 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.cpp @@ -2,6 +2,7 @@ #include "ui_checkmethodmanage.h" #include "newcheckmethod.h" #include +#include "PageControl.h" CheckMethodManage::CheckMethodManage(QWidget *parent) : QWidget(parent), @@ -106,6 +107,9 @@ row++; } } + //PagedTableWidget *pagedTable = new PagedTableWidget(this, ui->HBoxPageLayout); + //data转换位QList> + //pagedTable->setData(PageData, 20,ui->tableWidget_2); // 每页10行 } void CheckMethodManage::updateTable(bool insert,VerificationProgramInfo program) diff --git a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui index e7f30d8..7d91671 100644 --- a/softwareDirectory/AutoVerScheme/checkmethodmanage.ui +++ b/softwareDirectory/AutoVerScheme/checkmethodmanage.ui @@ -290,6 +290,31 @@ + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/softwareDirectory/AutoVerScheme/checkwindow.ui b/softwareDirectory/AutoVerScheme/checkwindow.ui index df9ff67..90a3172 100644 --- a/softwareDirectory/AutoVerScheme/checkwindow.ui +++ b/softwareDirectory/AutoVerScheme/checkwindow.ui @@ -266,7 +266,7 @@ - 2 + 0 diff --git a/softwareDirectory/AutoVerScheme/formcommsetting.cpp b/softwareDirectory/AutoVerScheme/formcommsetting.cpp index f5c4f9d..f4a8773 100644 --- a/softwareDirectory/AutoVerScheme/formcommsetting.cpp +++ b/softwareDirectory/AutoVerScheme/formcommsetting.cpp @@ -1,5 +1,6 @@ #include "formcommsetting.h" #include "ui_formcommsetting.h" +#include "visacommonengine.h" FormCommSetting::FormCommSetting(QWidget *parent,int type,QString id) : QWidget(parent), @@ -7,6 +8,14 @@ ui(new Ui::FormCommSetting) { ui->setupUi(this); + + VisaCommonEngine engine; + QStringList visaAddrs = engine.getVisaAddrs(); + ui->comboBox_9->addItems(visaAddrs); + visaAddrs.clear(); + QStringList serialAddrs = engine.getSerialAddrs(); + ui->comboBox->addItems(serialAddrs); + serialAddrs.clear(); if(deviceId!=""){ addrList = BaseCommonApi::getVerificationProgramConfigInterface(deviceId); if(addrList.length()>0){ diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.cpp b/softwareDirectory/AutoVerScheme/visacommonengine.cpp index 3c277fe..e0e16af 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.cpp +++ b/softwareDirectory/AutoVerScheme/visacommonengine.cpp @@ -11,6 +11,63 @@ { closeDevice(); }*/ +QStringList VisaCommonEngine::getVisaAddrs() +{ + QStringList addrList; + //addrList.append("TCPIP0::10.129.41.111::inst0::INSTR"); + //addrList.append("GPIB1::INSTR"); + char instrDescriptor[VI_FIND_BUFLEN]; + ViUInt32 numInstrs; + ViFindList findList; + + status = viOpenDefaultRM(&defaultRM); + if ( status < VI_SUCCESS ) { + qDebug() << "Could not open a session to the VISA Resource Manager!\n"; + return addrList; + } + + status = viFindRsrc( defaultRM, "?*INSTR", &findList, &numInstrs, instrDescriptor ); + if ( status < VI_SUCCESS ) { + qDebug() << "An error occurred while finding resources."; + return addrList; + } + + if ( numInstrs > 0 ) { + addrList.append(instrDescriptor); + } + + //status = viOpen( defaultRM, instrDescriptor, VI_NULL, VI_NULL, &instr ); + + while (--numInstrs ) { + status = viFindNext( findList, instrDescriptor ); + if ( status < VI_SUCCESS ) { + qDebug() <<"An error occurred finding the next resource."; + //return status; + }else{ + addrList.append(instrDescriptor); + } + //这个时候的instrDescriptor就是你电脑上找到的资源,并且可用,如果为空就说明你的连线有问题 + } + + //viClose(instr); + //viClose(findList); + viClose(defaultRM); + + return addrList; +} + +QStringList VisaCommonEngine::getSerialAddrs() +{ + QStringList addrList; + //addrList.append("COM1"); + //addrList.append("COM2"); + foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) + { + addrList.append(info.portName()); + } + return addrList; +} + bool VisaCommonEngine::getState() { return commState; diff --git a/softwareDirectory/AutoVerScheme/visacommonengine.h b/softwareDirectory/AutoVerScheme/visacommonengine.h index 20871f8..af0d978 100644 --- a/softwareDirectory/AutoVerScheme/visacommonengine.h +++ b/softwareDirectory/AutoVerScheme/visacommonengine.h @@ -16,6 +16,8 @@ bool openDevice(QString sAddr,QString sType); void closeDevice(); bool getState(); + QStringList getVisaAddrs(); + QStringList getSerialAddrs(); private: //visa ViSession defaultRM;