void DDSWidget::loadQmaxPlugins() { QPluginLoader loader4("libQmaxPTInterface.so", this); ILineEdit = qobject_cast<IQmaxLineEdit*> (loader4.instance()); IPTLibrary = qobject_cast<IQmaxPTLibrary*> (loader4.instance()); INumberPanel = qobject_cast<IQmaxNumberPanel*> (loader4.instance()); QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); qDebug() << "Appcard" << IAppCard; IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); m_objAD5293Component = new AD5293(IAppCard); qDebug() << "Code ID:" << hex << IAppCard->readAppCardCodeId(); QPluginLoader loader2("libBackPlaneInterface.so", this); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); IBackPlane->InitializeBpObject(); // GPIO Envet QPluginLoader loader3("libGPIOEventInterface.so",this); IGPIOEvent = qobject_cast<PTGPIOEventInterface*>(loader3.instance()); IGPIOEvent->InvokeGPIOEvent(this, "/dev/input/event1", "gpioevent", &m_nKeyCode); // Enable Interrupt // IBackPlane->writeBackPlaneRegister(0x40,0x20); // IBackPlane->writeBackPlaneRegister(0x0FFF,0x1E); // IBackPlane->writeBackPlaneRegister(0x1,0x24); // // IGPIOEvent->setProbeFlag(-1); }
void Widget::initialiseHWLibraries() { QPluginLoader loader4("libQmaxPTInterface.so",this); ILineEdit = qobject_cast<IQmaxLineEdit*>(loader4.instance()); INumberPanel=qobject_cast<IQmaxNumberPanel*>(loader4.instance()); QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); qDebug() << "Appcard" << IAppCard; IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); IAppCard->setSPIAppendBit(0xC000); QPluginLoader loader2("libSPIMemoryInterface.so", this); ISPIMemory = qobject_cast<ISPIMemoryInterface*> (loader2.instance()); ISPIMemory->setHardwarwObject(IAppCard); m_objAD7190Component = new AD7190Component(IAppCard); m_objAD5318Component = new AD5318Components(IAppCard); resetDAC(); m_objAD7190Component->resetADC(1); m_objAD7190Component->resetADC(2); m_nFrequency=1000.0; m_nAVGSamples=1.0; ADCtimer = new QTimer(this); connect(ADCtimer, SIGNAL(timeout()), this, SLOT(readADC())); }
void ADHighAccuracy::InitialiseHWLibraries() { QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); qDebug() << "Appcard" << IAppCard; IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); IAppCard->setSPIAppendBit(0xC000); qDebug()<<"Code ID:"<<hex<<IAppCard->readAppCardCodeId(); m_objAD7190 = new AD7190Component(IAppCard); QPluginLoader testing("libAppBckPsoc.so", this); test = qobject_cast<IPTAppBckPsocInterface*> (testing.instance()); }
ADCHighSpeed::ADCHighSpeed(QWidget *parent) : QWidget(parent), ui(new Ui::ADCHighSpeed) { ui->setupUi(this); QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); IAppCard->setSPIAppendBit(0xC000); ui->appCardCodeID->setText(QString::number(IAppCard->readAppCardCodeId(),16)); objISLA118P50=new ISLA118P50Component(IAppCard); }
void DACCalibration::loadQmaxPlugins(){ QPluginLoader loader4("libQmaxPTInterface.so", this); ILineEdit = qobject_cast<IQmaxLineEdit*> (loader4.instance()); INumberPanel = qobject_cast<IQmaxNumberPanel*> (loader4.instance()); QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); m_objAD7190 = new AD7190Component(IAppCard); IAppCard->setSPIAppendBit(0xC000); m_objAD5318Component = new AD5318Components(IAppCard); AD5318_dataTemplate l_nAD5318DW; m_objAD5318Component->resetDAC5318(true); m_eSelect = DACF; m_objAD5318Component->configureADC5318CW(); l_nAD5318DW.m_eDACSelect = m_eSelect; l_nAD5318DW.m_bCtrlBit = 0; l_nAD5318DW.m_nVout = 0.0; l_nAD5318DW.m_nVRef = 2.5; l_nAD5318DW.m_bUniPolor = true; l_nAD5318DW.m_bUniPolor = false; m_objAD5318Component->configureADC5318Data(l_nAD5318DW); m_eSelect = DACG; m_objAD5318Component->configureADC5318CW(); l_nAD5318DW.m_eDACSelect = m_eSelect; m_objAD5318Component->configureADC5318Data(l_nAD5318DW); double l_dbDACVoltage; l_dbDACVoltage = 1600; IAppCard->setSPIAppendBit(0x8000); m_objAD5293Component = new AD5293(IAppCard); m_objAD5293Component->setAD5293Voltage(l_dbDACVoltage); m_objAD5293Component->writeAD5293(SPI1); IAppCard->setSPIAppendBit(0xC000); }
PortableTester::PortableTester(QWidget *parent) : QMainWindow(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint), ui(new Ui::PortableTester) { ui->setupUi(this); /* LoginDialog* loginDialog = new LoginDialog( this ); connect(loginDialog,SIGNAL(acceptLogin(QString&,QString&,int&)),this,SLOT(slotAcceptUserLogin(QString&,QString&))); do{ loginDialog->exec(); }while(!m_nPassword);*/ //qDebug() //<< "----------------------------PORTABLE TESTER STARTS----------------------------"; //Set home Directory as Current Directory QDir::setCurrent("/home"); //PT6 Application Interface Library QPluginLoader apploader1("libPTComponentsInterface.so", this); QObject *AppPlugin1 = apploader1.instance(); IPT = qobject_cast<IPTComponentsInterface*> (AppPlugin1); //Application Card Interface Library QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); //Backplane Interface Library QPluginLoader loader2("libBackPlaneInterface.so", this); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); IBackPlane->InitializeBpObject(); //PSOC Interface Library QPluginLoader loader3("libPTPsocInterface2.so", this); IPsoc = qobject_cast<IPSOCCOMMUNICATION*> (loader3.instance()); IPsoc->openSerial(); objTimer = new QTimer(this); connect(objTimer, SIGNAL(timeout()), this, SLOT(checkButton())); // idleTimer=new QTimer(this); // connect(idleTimer, SIGNAL(timeout()),this,SLOT(idleScreen())); // idleTimer->setInterval(23000); // idleTimer->start(); //QMax PT Interface Library QPluginLoader loader4("libQmaxPTInterface.so", this); IptLib = qobject_cast<IQmaxPTLibrary*> (loader4.instance()); //GPIO Event Interface Library QPluginLoader loader5("libGPIOEventInterface.so", this); IGPIOEvent = qobject_cast<PTGPIOEventInterface*> (loader5.instance()); //PT Keypad Interface Library QPluginLoader loader6("libPTKeyEventInterfaces.so", this); IPTKeyEvent = qobject_cast<PTEventInterface*> (loader6.instance()); //GPIO PIN Interface Library for toggle touch and kill QPluginLoader loader7("libPTGPIOPinInterface.so", this); IGPIOPin = qobject_cast<InterfaceGPIOPins*> (loader7.instance()); // //Hardware Identification Library // QPluginLoader loader8("libPTHWIDInterface.so", this); // IHWID = qobject_cast<IHWIDInterface*> (loader8.instance()); // // //Utility Panel Interface Library // QPluginLoader loader9("libUtilityPanel.so", this); // IUtility = qobject_cast<UtilityInterface*> (loader9.instance()); IBackPlane->writeBackPlaneRegister(0x03, 0x14); // Initialize LCD Control // IptLib->InitPTLibrary("./PTUI.xml", "MainWindow"); initialitation(); IPTKeyEvent->InvokeGPIOEvent(this, "/dev/input/event2", "pt_kpp",&m_nPTKeyCode); // IGPIOEvent->InvokeGPIOEvent(this, "/dev/input/event3", "gpioshutdown", &m_nPTShutDown);//do not uncomment VI will not work properly //qDebug() << "PT win Id" << this->winId(); isWindowOpen = false; msgBoxLive = false; /* QByteArray psocData; QMessageBox failure; IPsoc->writeSerial(0xff); IPsoc->writeSerial(0xff); psocData = IPsoc->readSerByte(); if (psocData.endsWith("*?") == true) { qDebug() << "PSOC RESET DONE on 1st try"; } else { IPsoc->writeSerial(0xff); psocData = IPsoc->readSerByte(); if (psocData.endsWith("*?") == true) { qDebug() << "PSOC RESET DONE on 2nd try"; } else { IPsoc->writeSerial(0xff); psocData = IPsoc->readSerByte(); if (psocData.endsWith("*?") == true) { qDebug() << "PSOC RESET DONE on 3rd try"; } else { failure.setText("PSOC RESET FAILURE"); failure.exec(); } } } qDebug() << "RESET DATA:" << psocData; */ QMessageBox testing; if (IAppCard->readAppCardCodeId() != 0x1982) { testing.setText("Check Appcard !!!"); testing.exec(); } if (IBackPlane->readBackPlaneCodeID() != 0x2704) { testing.setText("Check Backpanel !!!"); testing.exec(); } // IAppCard->resetADC(1); dmmPlugin = viPlugin = fgPlugin = slPlugin = icmPlugin = false; m_bTouchFlag = true; //~~~~~~~~~~~Transparent OM Symbol Splash~~~~~~~~~~~ /* QPixmap pixmap(":/images/Tamil_ohm2.png"); QSplashScreen splash(pixmap); splash.setMask(pixmap.mask()); splash.show(); splash.close();*/ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~Digital Clock~~~~~~~~~~~~~~~~~~~~~~~ clock=new QDigitalClock(this); clock->setGeometry(620,0,170,30); clock->m_TextColor=QColor(255,255,255,255); clock->setFont(QFont("DejaVu Sans",14,50,false)); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ myID=0; // qInstallMsgHandler(customMessageHandler); }
HY3131Calibration::HY3131Calibration(QWidget *parent) : QDialog(parent), ui(new Ui::HY3131Calibration) { ui->setupUi(this); setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); ADCTimer = new QTimer(this); connect(ADCTimer, SIGNAL(timeout()), this, SLOT(ADCRead())); QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); QPluginLoader loader4("libQmaxPTInterface.so", this); ILineEdit = qobject_cast<IQmaxLineEdit*> (loader4.instance()); INumberPanel = qobject_cast<IQmaxNumberPanel*> (loader4.instance()); QPluginLoader loader5("libHY3131DMMLib.so", this); hy3131dmm = qobject_cast<IHY3131DMMLibInterface*> (loader5.instance()); QPluginLoader loaderKeith("libKeithley2100Lib.so", this); KDmm = qobject_cast<IKeithley2100Interface*> (loaderKeith.instance()); ui->leOffsetValue->setVisible(false); objOffsetValue = ILineEdit->QmaxLineEdit(0, ui->CalibBox); objOffsetValue->setGeometry(92,154,205,31); objOffsetValue->setStyleSheet(ui->leOffsetValue->styleSheet()); connect(objOffsetValue, SIGNAL(focussed(bool)), this, SLOT(callOffsetEdit())); ui->leMaxValue->setVisible(false); objMaxValue = ILineEdit->QmaxLineEdit(1, ui->CalibBox); objMaxValue->setGeometry(81,265,216,29); objMaxValue->setStyleSheet(ui->leMaxValue->styleSheet()); connect(objMaxValue, SIGNAL(focussed(bool)), this, SLOT(callMaxEdit())); ui->cmbComponent->addItem("Select..."); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/R1.png")),"Resistance"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/dc.png")),"DC Voltage"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/ac.png")),"AC Volatge"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/dc.png")),"DC Current"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/ac.png")),"AC Current"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/D1.png")),"Diode"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/C1.png")),"Capacitor"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/sp.png")),"Beep"); ui->cmbComponent->addItem(QIcon(QPixmap(":/Images/freq.png")),"Frequency"); //Read Gain & Offset from file~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bool ok=true; int index=0; QFile file("/home/HY3131/GainOffset.dat"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { QByteArray line = file.readLine(); QList<QByteArray> data = line.split('\t'); if (data[0].endsWith('\n')) data[0].chop(1); if (data[1].endsWith('\n')) data[1].chop(1); if (data[2].endsWith('\n')) data[2].chop(1); m_strRange[index]=data[0]; m_nGain[index]=data[1].toDouble(&ok); m_nOffset[index]=data[2].toDouble(&ok); index++; } file.close(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Read Reference & Measured from file~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bool ok2=true; int index2=0; QFile file2("/home/HY3131/calib.dat"); if (!file2.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file2.atEnd()) { QByteArray line2 = file2.readLine(); QList<QByteArray> data2 = line2.split('\t'); if (data2[0].endsWith('\n')) data2[0].chop(1); if (data2[1].endsWith('\n')) data2[1].chop(1); if (data2[2].endsWith('\n')) data2[2].chop(1); if (data2[3].endsWith('\n')) data2[3].chop(1); if (data2[4].endsWith('\n')) data2[4].chop(1); m_strRange2[index2]=data2[0]; KRefMinData[index2]=data2[1].toDouble(&ok2); KRefMaxData[index2]=data2[2].toDouble(&ok2); HYMinRead[index2]=data2[3].toDouble(&ok2); HYMaxRead[index2]=data2[4].toDouble(&ok2); index2++; } file2.close(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //enableDisable(0,false); //enableDisable(1,false); //enableDisable(2,false); //enableDisable(3,false); //enableDisable(4,false); }
HY3131DMMLib::HY3131DMMLib(QObject *parent):QObject(parent){ QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); //BackPlaneInterfacePlugin QPluginLoader loader2("libBackPlaneInterface.so", this); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); IBackPlane->InitializeBpObject(); selAppCard=false; // if(selAppCard) // IAppCard->writeRegister(0x20, DMM_CLK_DIV);//DMM SPI Clock Settings 1MHz // else IBackPlane->writeBackPlaneRegister(0x20,DMM_CLK_DIV_BP); D32Bit=0; reg0 = reg1 = reg2 = 0; ADCDigital = 0; RMSData=0; ReadData = RawData=0; minus=false; buzState=false; busyState=false; //Read Gain & Offset from file~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bool ok=true; int index=0; //qDebug()<<"dp:26"; QFile file("/home/HY3131/GainOffset.dat"); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { QByteArray line = file.readLine(); QList<QByteArray> data = line.split('\t'); if (data[0].endsWith('\n')) data[0].chop(1); if (data[1].endsWith('\n')) data[1].chop(1); if (data[2].endsWith('\n')) data[2].chop(1); m_strRange[index]=data[0]; m_nGain[index]=data[1].toDouble(&ok); m_nOffset[index]=data[2].toDouble(&ok); index++; } file.close(); //qDebug()<<"dp:48"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Load No of Samples from File~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ m_nSampleCount=25; QStringList stringList; QFile textFile("/home/HY3131/Samples.dat"); if (textFile.open(QIODevice::ReadOnly)) { QTextStream textStream(&textFile); while (!textStream.atEnd()) { stringList.append(textStream.readLine()); } m_nSampleCount=stringList.value(0).toInt(&ok,10); } textFile.close(); //qDebug()<<"samples:"<<m_nSampleCount; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }
PTDMMLibInterface::PTDMMLibInterface(QObject *parent):QObject(parent) { // qDebug()<<"----------------------------PTDMM INTERFACE STARTS----------------------------"; //Library Initializations QPluginLoader loaderApp("libPTApplicationcardInterface.so", this); IAppCard = qobject_cast<IApplicationCardInterface*> (loaderApp.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); //qDebug()<<"App Card Code ID:"<<hex<<IAppCard->readAppCardCodeId(); IAppCard->setSPIAppendBit(0xC000); m_objAD5318Component = new AD5318Components(IAppCard); m_objAD7190 = new AD7190Component(IAppCard); QPluginLoader loader3("libPTPsocInterface2.so",this); IPsoc = qobject_cast<IPSOCCOMMUNICATION*>(loader3.instance()); IPsoc->openSerial(); QPluginLoader loader7("libCalibrationInterface.so",this); ICALIB = qobject_cast<InterfaceCalibrationLib*>(loader7.instance()); IAppCard->writeRegister(0x0000,0x0048);//offset relay //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Drive initializations m_objAD5318Component->resetDAC5318(true); //RESET DAC m_eSelect = DACF; m_objAD5318Component->configureADC5318CW(); m_nDACVoltage=0.0; ForceCurrent(0,m_nDACVoltage); m_eSelect = DACG; m_objAD5318Component->configureADC5318CW(); m_nDACVoltage=0.0; ForceCurrent(0,m_nDACVoltage); //Receive initializations m_nADC=1; m_objAD7190->resetADC(1); calib_value.flag=false; ADCRxVoltage=0.0; values.Data=0.0; values.ConvertedData=0.0; noOfSamples=1; for(int i=0;i<noOfSamples;i++) avgRetval[i]=0.0; avg=0; retval=0; //qDebug()<<"----------------------------PTDMM INTERFACE STARTS----------------------------"; }