Compare commits
2 Commits
0a5816454e
...
c000971f14
Author | SHA1 | Date | |
---|---|---|---|
c000971f14 | |||
8cf2141916 |
@ -8,24 +8,41 @@ TARGET = up_dev_ctrl
|
||||
CONFIG += c++11
|
||||
# CONFIG -= app_bundle
|
||||
|
||||
# DEFINES+=LinuxDesktop
|
||||
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
contains( CONFIG, PTU5 ) {
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||
CONFIG += link_pkgconfig
|
||||
lessThan(QT_MAJOR_VERSION, 5): PKGCONFIG += qextserialport
|
||||
QMAKE_CXXFLAGS += -std=c++11 # for GCC >= 4.7
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
ARCH = PTU5
|
||||
DEFINES+=PTU5
|
||||
}
|
||||
contains( CONFIG, DesktopLinux ) {
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||
lessThan(QT_MAJOR_VERSION, 5): CONFIG += extserialport
|
||||
# QMAKE_CC = ccache $$QMAKE_CC
|
||||
# QMAKE_CXX = ccache $$QMAKE_CXX
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||
ARCH = DesktopLinux
|
||||
DEFINES+=DesktopLinux
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
message_handler.cpp \
|
||||
load_dc_plugin.cpp \
|
||||
commands_to_update_dc.cpp \
|
||||
serial.cpp
|
||||
message_handler.cpp
|
||||
|
||||
HEADERS += \
|
||||
message_handler.h \
|
||||
load_dc_plugin.h \
|
||||
commands_to_update_dc.h \
|
||||
serial.h \
|
||||
plugins/interfaces.h
|
||||
|
||||
# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
|
||||
|
33
main.cpp
33
main.cpp
@ -9,22 +9,25 @@
|
||||
#include "commands_to_update_dc.h"
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
#include "DCPlugin/include/hwapi.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
static void updateDC(hwinf const *hw) {
|
||||
qDebug() << "ENTER";
|
||||
//return;
|
||||
for (int i=0; i< 1;++i) {
|
||||
hw->dc_updateDC("dc2c4.bin", "115200", "ttymxc2");
|
||||
//static void updateDC(hwinf const *hw) {
|
||||
static void updateDC(std::unique_ptr<hwinf> hw,
|
||||
char const *fileToSendToDC,
|
||||
char const *baudrate,
|
||||
char const *serialInterface) {
|
||||
for (int i=0; i < 1;++i) {
|
||||
hw->dc_updateDC(fileToSendToDC, baudrate, serialInterface);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||
}
|
||||
qDebug() << "LEAVE";
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
|
||||
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
||||
@ -33,15 +36,17 @@ int main(int argc, char *argv[])
|
||||
//setDebugLevel(QtMsgType::QtDebugMsg);
|
||||
}
|
||||
|
||||
DCPlugin plugin;
|
||||
hwinf const* hw = plugin.loadPlugin();
|
||||
if (!hw) {
|
||||
qCritical() << "Cannot load plugin";
|
||||
if (argc > 2) {
|
||||
qCritical() << "Usage: " << argv[0] << "<file to send to dc>";
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::thread t(updateDC, hw);
|
||||
|
||||
std::unique_ptr<hwinf> hw(new hwapi());
|
||||
#ifdef PTU5
|
||||
std::thread t(updateDC, std::move(hw), argv[1], "115200", "ttymxc2");
|
||||
#else
|
||||
std::thread t(updateDC, std::move(hw), "dc2c4.bin", "115200", "ttyUSB0");
|
||||
#endif
|
||||
int ret = a.exec();
|
||||
t.join();
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user