Compare commits

..

No commits in common. "ec08e04f2c49b100c35ac0e58d13705c66357876" and "3069c3bd653b439c68e00fa15edba85ab8060812" have entirely different histories.

6 changed files with 16 additions and 50 deletions

@ -1,6 +1,7 @@
QT += core serialport QT += core gui
QT += widgets serialport network
TARGET = ATBUpdateDC TARGET = ATBDownloadDCFirmware
VERSION="0.1.0" VERSION="0.1.0"
win32 { win32 {
@ -76,23 +77,21 @@ contains( CONFIG, DesktopLinux ) {
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
mainwindow.cpp \
../common/src/message_handler.cpp \ ../common/src/message_handler.cpp \
../UpdatePTUDevCtrl/commandline_parser.cpp \ ../UpdatePTUDevCtrl/commandline_parser.cpp \
update.cpp \ update.cpp \
dc_download.cpp \ dc_download.cpp \
../common/src/System.cpp \ ../common/src/System.cpp
../common/src/utils_internal.cpp \
../common/src/command.cpp
HEADERS += \ HEADERS += \
mainwindow.h \
../common/include/message_handler.h \ ../common/include/message_handler.h \
../UpdatePTUDevCtrl/commandline_parser.h \ ../UpdatePTUDevCtrl/commandline_parser.h \
update.h \ update.h \
dc_download.h \ dc_download.h \
../common/include/System.h \ ../common/include/System.h
../common/include/utils_internal.h \
../common/include/command.h
OTHER_FILES += \ OTHER_FILES += \

@ -1,6 +1,7 @@
#include <QtGlobal> #include <QtGlobal>
#include <QCoreApplication> #include <QCoreApplication>
#include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QProcess> #include <QProcess>
@ -15,6 +16,7 @@
#include "commandline_parser.h" #include "commandline_parser.h"
#include "utils.h" #include "utils.h"
#include "update.h" #include "update.h"
#include "mainwindow.h"
#include "System.h" #include "System.h"
#include <DeviceController/interfaces.h> #include <DeviceController/interfaces.h>
@ -52,9 +54,9 @@ int main(int argc, char **argv) {
openlog("DC", LOG_PERROR | LOG_CONS, LOG_USER); openlog("DC", LOG_PERROR | LOG_CONS, LOG_USER);
QCoreApplication a(argc, argv); QApplication a(argc, argv);
QCoreApplication::setApplicationName("ATBDownloadDCFirmware"); QApplication::setApplicationName("ATBDownloadDCFirmware");
QCoreApplication::setApplicationVersion(APP_VERSION); QApplication::setApplicationVersion(APP_VERSION);
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
atbInstallMessageHandler(atbDebugOutput); atbInstallMessageHandler(atbDebugOutput);

@ -1,7 +1,10 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer> #include <QTimer>
#include <QStatusBar>
#include <QWidget>
#include <QSerialPort> #include <QSerialPort>
#include <QSerialPortInfo> #include <QSerialPortInfo>

@ -24,8 +24,6 @@
#include <QMap> #include <QMap>
#include <QStringList> #include <QStringList>
#include <QString> #include <QString>
#include <QSerialPort>
#include <QSerialPortInfo>
#define UPDATE_OPKG (1) #define UPDATE_OPKG (1)
#define UPDATE_DC (0) #define UPDATE_DC (0)
@ -149,35 +147,6 @@ Update::~Update() {
unloadDCPlugin(); unloadDCPlugin();
} }
bool Update::openSerialPort() {
// const SettingsDialog::Settings p = m_settings->settings();
m_serial->setPortName(SERIAL_PORT);
m_serial->setBaudRate(QSerialPort::Baud115200);
m_serial->setDataBits(QSerialPort::DataBits::Data8);
m_serial->setParity(QSerialPort::Parity::NoParity);
m_serial->setStopBits(QSerialPort::StopBits::OneStop);
m_serial->setFlowControl(QSerialPort::FlowControl::NoFlowControl);
if (m_serial->open(QIODevice::ReadWrite)) {
//showStatusMessage(tr("Connected to %1 : %2, %3, %4, %5, %6")
// .arg(p.name, p.stringBaudRate, p.stringDataBits,
// p.stringParity, p.stringStopBits, p.stringFlowControl));
return true;
} else {
//QMessageBox::critical(this, tr("Error"), m_serial->errorString());
//showStatusMessage(tr("Open error"));
}
return false;
}
bool Update::closeSerialPort() {
if (m_serial->isOpen()) {
m_serial->close();
return true;
}
return false;
//showStatusMessage(tr("Disconnected"));
}
Update::DownloadResult Update::sendStatus(int ret) const { Update::DownloadResult Update::sendStatus(int ret) const {
switch (ret) { // return values of dc are: switch (ret) { // return values of dc are:
case 0: // 0: no answer by now case 0: // 0: no answer by now

@ -21,7 +21,6 @@
#define SERIAL_PORT "ttyUSB0" #define SERIAL_PORT "ttyUSB0"
#endif #endif
class QSerialPort;
class Update : public QObject { class Update : public QObject {
Q_OBJECT Q_OBJECT
@ -47,12 +46,6 @@ class Update : public QObject {
return QStringLiteral("+%1s").arg(secs, 7, 'f', 2, QChar('0')); return QStringLiteral("+%1s").arg(secs, 7, 'f', 2, QChar('0'));
} }
bool openSerialPort();
bool closeSerialPort();
QSerialPort *m_serial;
public: public:
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP}; enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
enum class FileTypeJson {CONFIG=1, DEVICE=2, CASH=3, SERIAL=4, TIME=5, PRINTER=6}; enum class FileTypeJson {CONFIG=1, DEVICE=2, CASH=3, SERIAL=4, TIME=5, PRINTER=6};

@ -90,5 +90,5 @@ int main(int argc, char **argv) {
if (ret == 0) { if (ret == 0) {
ret = SyncCommand().exec("rsync", options << optInRepo << "/opt"); ret = SyncCommand().exec("rsync", options << optInRepo << "/opt");
} }
return (ret > 0) ? -ret : ret; return ret;
} }