Compare commits
No commits in common. "c000971f14bd9af724ab3d6695f110d0076b9f54" and "0a5816454e5f00f49fc0aaea93d5551402c7251f" have entirely different histories.
c000971f14
...
0a5816454e
@ -8,41 +8,24 @@ TARGET = up_dev_ctrl
|
|||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
# CONFIG -= app_bundle
|
# CONFIG -= app_bundle
|
||||||
|
|
||||||
# DEFINES+=LinuxDesktop
|
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
# In order to do so, uncomment the following line.
|
# 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
|
#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 += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
message_handler.cpp
|
message_handler.cpp \
|
||||||
|
load_dc_plugin.cpp \
|
||||||
|
commands_to_update_dc.cpp \
|
||||||
|
serial.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
message_handler.h \
|
message_handler.h \
|
||||||
|
load_dc_plugin.h \
|
||||||
|
commands_to_update_dc.h \
|
||||||
|
serial.h \
|
||||||
plugins/interfaces.h
|
plugins/interfaces.h
|
||||||
|
|
||||||
# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
|
# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
|
||||||
|
33
main.cpp
33
main.cpp
@ -9,25 +9,22 @@
|
|||||||
#include "commands_to_update_dc.h"
|
#include "commands_to_update_dc.h"
|
||||||
#include "plugins/interfaces.h"
|
#include "plugins/interfaces.h"
|
||||||
|
|
||||||
#include "DCPlugin/include/hwapi.h"
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
//static void updateDC(hwinf const *hw) {
|
static void updateDC(hwinf const *hw) {
|
||||||
static void updateDC(std::unique_ptr<hwinf> hw,
|
qDebug() << "ENTER";
|
||||||
char const *fileToSendToDC,
|
//return;
|
||||||
char const *baudrate,
|
for (int i=0; i< 1;++i) {
|
||||||
char const *serialInterface) {
|
hw->dc_updateDC("dc2c4.bin", "115200", "ttymxc2");
|
||||||
for (int i=0; i < 1;++i) {
|
|
||||||
hw->dc_updateDC(fileToSendToDC, baudrate, serialInterface);
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||||
}
|
}
|
||||||
|
qDebug() << "LEAVE";
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
||||||
@ -36,17 +33,15 @@ int main(int argc, char *argv[]) {
|
|||||||
//setDebugLevel(QtMsgType::QtDebugMsg);
|
//setDebugLevel(QtMsgType::QtDebugMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 2) {
|
DCPlugin plugin;
|
||||||
qCritical() << "Usage: " << argv[0] << "<file to send to dc>";
|
hwinf const* hw = plugin.loadPlugin();
|
||||||
|
if (!hw) {
|
||||||
|
qCritical() << "Cannot load plugin";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<hwinf> hw(new hwapi());
|
std::thread t(updateDC, hw);
|
||||||
#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();
|
int ret = a.exec();
|
||||||
t.join();
|
t.join();
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user