void VIHWClass::initializeHWLibraries() { //ApplicationInterfacePlugin QPluginLoader loader1("libPTApplicationcardInterface.so"); IAppCard = qobject_cast<IApplicationCardInterface*>(loader1.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); qDebug() << "APPCard Code ID:" <<IAppCard->readAppCardCodeId(); m_nInterruptValue = IAppCard->readScratchPad(); qDebug()<<"Scratch:"<<m_nInterruptValue; //BackPanel Interface Plugin QPluginLoader loader2("libBackPlaneInterface.so"); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); IBackPlane->InitializeBpObject(); qDebug() << "BACKPlane Code ID:" <<IBackPlane->readBackPlaneCodeID(); IBackPlane->writeBackPlaneRegister(0x01, 0x48); //PSOC Interface Plugin QPluginLoader loader3("libPTPsocInterface2.so"); IPsoc = qobject_cast<IPSOCCOMMUNICATION*>(loader3.instance()); IPsoc->openSerial(); QPluginLoader loaderSPIMemory("libSPIMemoryInterface.so"); ISPIMemory = qobject_cast<ISPIMemoryInterface*> (loaderSPIMemory.instance()); ISPIMemory->setHardwarwObject(IAppCard); ISPIMemory->accessSPIMemory(BACKPLANE); m_objAD5318Component = new AD5318Components(IAppCard); m_objAD5293Component = new AD5293(IAppCard); resetDAC(); //IPsoc->closeSerial(); //IPsoc->changeBaudRate(1); //IPsoc->writeSerial(0x50); //IPsoc->writeSerial(0x01); peformDriveConfiguration(); }
void test_lda() { printf("[test lda]\n"); double feats[3*10] = {1,2,3,4,5,6,7,8,9,3,5,7,5,3,7, 11,12,13,14,15,16,17,18,19, 13,15,17,15,13,17}; int lbls[10] = {-1, -1, 1, 1, -1, 1, 1, 1, -1, 1}; //HFMatrix<double> features(feats, 3, 10); Loader loader("data/hello_matrix"); HFMatrix<double> features(loader); //HFVector<int> labels(lbls, 10); Loader loader2("data/hello_label"); HFVector<int> labels(loader2); //Saver saver("data/hello_label"); //labels.save(saver); //Saver saver("data/hello_matrix"); //features.save(saver); LDA lda; lda.train(&features, &labels); }
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())); }
GPIOEvent::GPIOEvent(QWidget *parent,int *pKeyCode):QWidget(parent){ //qDebug()<<"----------------------------GPIO LIBRARY STARTS----------------------------"; m_TW = parent; m_nKey = pKeyCode; //Backpanel Interface Plugin QPluginLoader loader2("libBackPlaneInterface.so",this); IBackPlane = qobject_cast<IntefaceBackPlane*>(loader2.instance()); IBackPlane->InitializeBpObject(); QPluginLoader loader1("libPTApplicationcardInterface.so"); IAppCard = qobject_cast<IApplicationCardInterface*>(loader1.instance()); IAppCard->setDeviceName(SLOT0); IAppCard->enumerateAPPCard(); m_nInterruptValue = IAppCard->readScratchPad(); QPluginLoader loaderSPIMemory("libSPIMemoryInterface.so"); ISPIMemory = qobject_cast<ISPIMemoryInterface*> (loaderSPIMemory.instance()); IAppCard->setSPIAppendBit(0xC000); QPluginLoader loader3("libPTPsocInterface2.so"); IPsoc = qobject_cast<IPSOCCOMMUNICATION*>(loader3.instance()); IPsoc->openSerial(); m_nReceiveData = new unsigned short int[300]; m_stopFlag = false; m_strReceiveName =".\ActualData.bin"; //m_objEvent = new QEvent(APPCARDDRIVEEVENT); }
void simple_loading_example(int argc, char **argv) { std::string LIBRARY_1="libplugin_animals.so"; std::string LIBRARY_2="libplugin_fantasy.so"; try { envire::core::Environment envire1; class_loader::ClassLoader loader1(LIBRARY_1, false); std::vector<std::string> classes = loader1.getAvailableClasses<Base>(); for(unsigned int c = 0; c < classes.size(); ++c) { envire::core::Item<Base> item; item->value = loader1.createInstance<Base>(classes[c]); item->value->saySomething(); envire1.insert(boost::uuids::random_generator(), new envire::core::Environment()); } } catch(class_loader::ClassLoaderException& e) { std::cout << "ClassLoaderException: " << e.what() << "\n"; } catch (class_loader::CreateClassException& e) { std::cout <<"CreateClassException: "<< e.what() << "\n"; } try { class_loader::ClassLoader loader2(LIBRARY_2, false); std::vector<std::string> classes = loader2.getAvailableClasses<Base>(); for(unsigned int c = 0; c < classes.size(); ++c) { boost::shared_ptr<Base> plugin = loader2.createInstance<Base>(classes[c]); plugin->saySomething(); } } catch(class_loader::ClassLoaderException& e) { std::cout << "ClassLoaderException: " << e.what() << "\n"; } catch (class_loader::CreateClassException& e) { std::cout <<"CreateClassException: "<< e.what() << "\n"; } }
void PTPSoCTestJigInterface2::LoadPlugins(){ QPluginLoader loader3("libPTPsocInterface2.so",this); IPsoc = qobject_cast<IPSOCCOMMUNICATION*>(loader3.instance()); QPluginLoader loader2("libBackPlaneInterface.so", this); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); QPluginLoader loader4("libQmaxPTInterface.so", this); ILineEdit = qobject_cast<IQmaxLineEdit*> (loader4.instance()); INumberPanel = qobject_cast<IQmaxNumberPanel*> (loader4.instance()); QPluginLoader loader5("libGPIOEventInterface.so",this); IGPIOEvent = qobject_cast<PTGPIOEventInterface*>(loader5.instance()); }
ShortLocater::ShortLocater(QWidget *parent) : QWidget(parent) { ui.setupUi(this); qDebug()<<"----------------------------SHORT LOCATER START----------------------------"; //DISPLAY dis=new DISPLAY(ui.displayPanel); dis->selectGeometry(150,30); ui.units->setFont(QFont("DejaVu Sans", 85, 50, false)); QPluginLoader loader2("libBackPlaneInterface.so",this); IBackPlane = qobject_cast<IntefaceBackPlane*>(loader2.instance()); IBackPlane->InitializeBpObject(); QPluginLoader loader3("libPTPsocInterface2.so",this); IPsoc = qobject_cast<IPSOCCOMMUNICATION*>(loader3.instance()); IPsoc->openSerial(); QPluginLoader loader4("libPTDMMLibInterface2.so",this); IDMMLib = qobject_cast<IDMMLibInterface*>(loader4.instance()); QPluginLoader loader5("libGPIOEventInterface.so",this); IGPIOEvent = qobject_cast<PTGPIOEventInterface*>(loader5.instance()); QPluginLoader loader6("libPTKeyEventInterfaces.so",this); IPTKeyEvent = qobject_cast<PTEventInterface*>(loader6.instance()); QPluginLoader loader8("libPTGPIOPinInterface.so",this); IGPIOPin = qobject_cast<InterfaceGPIOPins*>(loader8.instance()); QPluginLoader testing("libAppBckPsoc.so",this); test = qobject_cast<IPTAppBckPsocInterface*>(testing.instance()); QPluginLoader loaderhaadc("libADCHighAccuracy.so", this); HAADC = qobject_cast<IHACADCTestJigInterface*> (loaderhaadc.instance()); HAADC->setHACADC(ui.HAADC_WIDGET); ui.HAADC_WIDGET->setWindowFlags(Qt::Dialog); HAADC->showWidget(); // // toolboxFlag=false; // ToolBox(toolboxFlag); Initializations(); connect(m_nADCtimer,SIGNAL(timeout()),this,SLOT(Measure())); }
PtKeyKnob::PtKeyKnob(QWidget *parent) : QWidget(parent) { ui.setupUi(this); QPluginLoader loader2("libBackPlaneInterface.so", this); IBackPlane = qobject_cast<IntefaceBackPlane*> (loader2.instance()); IBackPlane->InitializeBpObject(); QPluginLoader loader5("libGPIOEventInterface.so",this); IGPIOEvent = qobject_cast<PTGPIOEventInterface*>(loader5.instance()); QPluginLoader loader6("libPTKeyEventInterfaces.so",this); IPTKeyEvent = qobject_cast<PTEventInterface*>(loader6.instance()); //~~~~~~~~~~~~Magnetic Rotary Knob~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ IBackPlane->writeOtpLsb(0x00);//to initialize read angle to 0 REG-0x18 IBackPlane->setTimer(0xf9); //to set timer interval -> (249*.001)+.001=.01Sec REG-0x1C ui.lineEdit_32->setText("250ms"); IBackPlane->setKnobCommandRegsiter(0x03);//to start drive in loop.for single drive 0x01 REG-0x16 ui.lineEdit_33->setText("loop"); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ IGPIOEvent->InvokeGPIOEvent(this, "/dev/input/event1", "gpioevent", &m_nGPIOCode); IPTKeyEvent->InvokeGPIOEvent(this, "/dev/input/event2", "pt_kpp", &m_nPTKeyCode); QLabel *dummy = new QLabel(); IndicateKeyPressed(dummy); //interrupt initialization IBackPlane->writeBackPlaneRegister(0x0FFF, 0x001E); //clear all interrupts IBackPlane->writeBackPlaneRegister(0x0000, 0x0020); //disable all interrupts IBackPlane->writeBackPlaneRegister(0x0000, 0x0024); //disable global interrupt IBackPlane->writeBackPlaneRegister(0x0001, 0x0024); //disable global interrupt delay=2; enableRichGUI(); }
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); }
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; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }
void LoadBox() { //load a wavefront *.obj file #ifdef _WIN32 gloost::ObjLoader loader2("../../../data/objects/box.obj"); #else gloost::ObjLoader loader2("box.obj"); #endif mesh2 = loader2.getMesh(); //IMPORTANT: use this to increase the reference counter //gloost::meshes have a garbage collector which throws //the mesh away otherwise mesh2->takeReference(); mesh2->generateNormals(); //normalizes the mesh mesh2->scaleToSize(1.0); //puts the meshdata in one array mesh2->interleave(); mesh2->printMeshInfo(); //bind VertexArray - Scope begins glBindVertexArray(BufferIds[1]); ////Create two VertexBufferObject and bind the first one to set its data glGenBuffers(2, &BufferIds[4]); glBindBuffer(GL_ARRAY_BUFFER, BufferIds[4]); //set the vertex data for the actual buffer; the second parameter is the size in bytes of all Vertices together //the third parameter is a pointer to the vertexdata glBufferData(GL_ARRAY_BUFFER, sizeof(float) * mesh2->getInterleavedAttributes().size(), &mesh2->getInterleavedAttributes().front(), GL_STATIC_DRAW); //enables a VertexAttributeArray glEnableVertexAttribArray(0); //specifies where in the GL_ARRAY_BUFFER our data(the vertex position) is exactly glVertexAttribPointer(0, GLOOST_MESH_NUM_COMPONENTS_VERTEX, GL_FLOAT, GL_FALSE, mesh2->getInterleavedInfo().interleavedPackageStride,//mesh->getInterleavedInfo().interleavedVertexStride, (GLvoid*)(mesh2->getInterleavedInfo().interleavedVertexStride)); //enables a VertexAttributeArray glEnableVertexAttribArray(1); //specifies where in the GL_ARRAY_BUFFER our data(the vertex position) is exactly glVertexAttribPointer(1, GLOOST_MESH_NUM_COMPONENTS_NORMAL, GL_FLOAT, GL_FALSE, mesh2->getInterleavedInfo().interleavedPackageStride, (GLvoid*)(mesh2->getInterleavedInfo().interleavedNormalStride)); // the seceond VertexBufferObject ist bound glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, BufferIds[5]); // its data are the indices of the vertices glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(gloost::TriangleFace) * mesh2->getTriangles().size(), &mesh2->getTriangles().front(), GL_STATIC_DRAW); //enables a vertexAttibuteArray glEnableVertexAttribArray(2); //specifies the position in the buffer glVertexAttribPointer( 2, GLOOST_MESH_NUM_COMPONENTS_TEXCOORD, GL_FLOAT, GL_FALSE, mesh2->getInterleavedInfo().interleavedPackageStride, (GLvoid*)(mesh2->getInterleavedInfo().interleavedTexcoordStride) ); //the next BufferObject is bound glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, BufferIds[5]); //data are texture coordinates glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(gloost::TriangleFace) * mesh2->getTriangles().size(), &mesh2->getTriangles().front(), GL_STATIC_DRAW); // unbind the VertexArray - scope ends glBindVertexArray(0); }