UpdatePTUDevCtrl/main.cpp

48 lines
1.1 KiB
C++

#include <QCoreApplication>
#include <QApplication>
#include <QDebug>
#include <QTimer>
#include "message_handler.h"
#include "load_dc_plugin.h"
#include "serial.h"
#include "commands_to_update_dc.h"
#include "plugins/interfaces.h"
#include <unistd.h>
#include <thread>
static void updateDC(hwinf const *hw) {
qDebug() << "ENTER";
//return;
for (int i=0; i< 1;++i) {
hw->dc_updateDC("dc2c4.bin", "115200", "ttyUSB0");
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
}
qDebug() << "LEAVE";
QCoreApplication::quit();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
atbInstallMessageHandler(atbDebugOutput);
setDebugLevel(QtMsgType::QtDebugMsg);
//setDebugLevel(QtMsgType::QtDebugMsg);
}
DCPlugin plugin;
hwinf const* hw = plugin.loadPlugin();
if (!hw) {
qCritical() << "Cannot load plugin";
}
std::thread t(updateDC, hw);
int ret = a.exec();
t.join();
return ret;
}