2023-04-05 14:43:27 +02:00
|
|
|
#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) {
|
2023-04-11 14:03:54 +02:00
|
|
|
hw->dc_updateDC("dc2c4.bin", "115200", "ttymxc2");
|
2023-04-05 14:43:27 +02:00
|
|
|
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";
|
2023-04-11 14:03:54 +02:00
|
|
|
return -1;
|
2023-04-05 14:43:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::thread t(updateDC, hw);
|
|
|
|
|
|
|
|
int ret = a.exec();
|
|
|
|
t.join();
|
|
|
|
return ret;
|
|
|
|
}
|