12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include <QCoreApplication>
- #include <QObject>
- #include <signal.h>
- #include "canctrl.h"
- #include <unistd.h>
- #include <thread>
- #include <iostream>
- #include <xmlparam.h>
- #include "ivversion.h"
- //void func()
- //{
- // int i;
- // i = 0;
- // while(1)
- // {
- // std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- // i++;
- // qDebug("pid is ",getpid());
- // if(i == 10)break;
- // }
- // qDebug("pid is %d ",getpid());
- // kill(getpid(),SIGINT);
- //}
- int main(int argc, char *argv[])
- {
- showversion("driver_can_vci");
- QCoreApplication a(argc, argv);
- QString strpath = QCoreApplication::applicationDirPath();
- if(argc < 2)
- strpath = strpath + "/driver_can_vci.xml";
- else
- strpath = argv[1];
- std::cout<<strpath.toStdString()<<std::endl;
- iv::xmlparam::Xmlparam xp(strpath.toStdString());
- std::string strmemsend0 = xp.GetParam("cansend0_vci","cansend0");//31510000E80
- std::string strmemsend1 = xp.GetParam("cansend1_vci","cansend1");
- std::string strmemrecv0 = xp.GetParam("canrecv0_vci","canrecv0");
- std::string strmemrecv1 = xp.GetParam("canrecv1_vci","canrecv1");
- std::string strmemdevnum = xp.GetParam("devnum","0");
- std::string strmembaud0 = xp.GetParam("baud0","500k");
- std::string strmembaud1 = xp.GetParam("baud0","500k");
- canctrl * pcanctrl = new canctrl(strmemsend0.data(),strmemsend1.data(),strmemrecv0.data(),strmemrecv1.data(),strmemdevnum.data(),
- strmembaud0.data(),strmembaud1.data());
- pcanctrl->start();
- // std::thread b(func);
- return a.exec();
- }
|