remove obsolete files
This commit is contained in:
parent
c000971f14
commit
750e7a13f7
@ -1,84 +0,0 @@
|
||||
#include "commands_to_update_dc.h"
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QThread>
|
||||
#include <QCoreApplication>
|
||||
|
||||
Command::Command(hwinf const *hw)
|
||||
: m_hw(hw)
|
||||
, m_serial(hw, 115200, "115200", "ttyUSB0") {
|
||||
qDebug() << "opening serial...";
|
||||
m_serial.openSerial();
|
||||
}
|
||||
|
||||
Command::~Command() {
|
||||
qDebug() << "close serial...";
|
||||
m_serial.closeSerial();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
bool Command::startCmdSequence() {
|
||||
QThread::sleep(3);
|
||||
qDebug() << "updating dc-fw...";
|
||||
if (!resetDeviceController()) {
|
||||
qCritical() << "resetDeviceController failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
QThread::sleep(10);
|
||||
return true;
|
||||
|
||||
if (!enterBootloader()) {
|
||||
// after max. 3 seconds start boot loader
|
||||
qCritical() << "enterBootloader failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isBootloaderRunning()) {
|
||||
qCritical() << "isBootloaderRunning failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
//if (!loadBinary()) {
|
||||
//
|
||||
// }
|
||||
|
||||
// if (!sendBinary()) {
|
||||
//
|
||||
// }
|
||||
|
||||
if (!exitBootloader()) {
|
||||
qCritical() << "exitBootloader failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
qDebug() << "updating dc-fw...done";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Command::resetDeviceController() {
|
||||
qDebug() << __func__;
|
||||
m_hw->dc_OrderToReset();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Command::enterBootloader() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Command::isBootloaderRunning() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Command::loadBinary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Command::sendBinary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Command::exitBootloader() {
|
||||
return false;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#ifndef COMMANDS_TO_UPDATE_DC_H_INCLUDED
|
||||
#define COMMANDS_TO_UPDATE_DC_H_INCLUDED
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
class hwinf;
|
||||
class Command {
|
||||
hwinf const *m_hw;
|
||||
Serial m_serial;
|
||||
public:
|
||||
Command(hwinf const *hw);
|
||||
~Command();
|
||||
|
||||
bool startCmdSequence();
|
||||
|
||||
bool resetDeviceController();
|
||||
bool enterBootloader();
|
||||
bool isBootloaderRunning();
|
||||
bool loadBinary();
|
||||
bool sendBinary();
|
||||
bool exitBootloader();
|
||||
};
|
||||
|
||||
#endif // COMMANDS_TO_UPDATE_DC_H_INCLUDED
|
@ -1,40 +0,0 @@
|
||||
#include "load_dc_plugin.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QPluginLoader>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
DCPlugin::DCPlugin()
|
||||
: m_hw_interface(0) {
|
||||
}
|
||||
|
||||
DCPlugin::~DCPlugin() {
|
||||
}
|
||||
|
||||
hwinf const *DCPlugin::loadPlugin() {
|
||||
QString pluginPath = QCoreApplication::applicationDirPath() + "/plugins/";
|
||||
QString pluginFileName = pluginPath + "libCashAgentLib.so";
|
||||
|
||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFileName);
|
||||
|
||||
if (!pluginLoader->load()) {
|
||||
qFatal(pluginLoader->errorString().toStdString().c_str());
|
||||
}
|
||||
|
||||
qDebug() <<"loaded plugin: " << pluginLoader->fileName();
|
||||
|
||||
QObject *plugin = pluginLoader->instance();
|
||||
if (!plugin) {
|
||||
qFatal("cannot load root component of plugin (hwinf ctor failing?");
|
||||
}
|
||||
|
||||
// the plugin stays in memory until unloaded by the application
|
||||
if ((m_hw_interface = qobject_cast<hwinf *>(plugin)) == nullptr) {
|
||||
qFatal("cannot create root component");
|
||||
}
|
||||
|
||||
return m_hw_interface;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef LOAD_DC_PLUGIN_H_INCLUDED
|
||||
#define LOAD_DC_PLUGIN_H_INCLUDED
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class hwinf;
|
||||
class DCPlugin : public QObject {
|
||||
Q_OBJECT
|
||||
hwinf *m_hw_interface;
|
||||
public:
|
||||
DCPlugin();
|
||||
~DCPlugin();
|
||||
|
||||
hwinf const *loadPlugin();
|
||||
};
|
||||
|
||||
#endif // LOAD_DC_PLUGIN_H_INCLUDED
|
33
serial.cpp
33
serial.cpp
@ -1,33 +0,0 @@
|
||||
#include "serial.h"
|
||||
#include "plugins/interfaces.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Serial::Serial(hwinf const *hwinf, uint32_t baudrate, QString baudrateStr,
|
||||
QString comPort)
|
||||
: m_hwinf(hwinf)
|
||||
, m_baudrate(baudrate)
|
||||
, m_baudrateStr(baudrateStr)
|
||||
, m_comPort(comPort) {
|
||||
|
||||
}
|
||||
|
||||
bool Serial::testConnection() {
|
||||
m_hwinf->dc_requTestResponse();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Serial::openSerial() { // 1: connect
|
||||
// sollte einen bool zureuckgeben
|
||||
m_baudrate = 5;
|
||||
m_comPort = "ttyUSB0";
|
||||
qDebug() << "winComPort opening serial with: " << m_baudrate << " " << m_baudrateStr << " " << m_comPort;
|
||||
m_hwinf->dc_openSerial(5, m_baudrateStr, m_comPort, 1);
|
||||
//m_hwinf->dc_openSerial(m_baudrate, m_baudrateStr, m_comPort, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Serial::closeSerial() {
|
||||
m_hwinf->dc_closeSerial();
|
||||
return true;
|
||||
}
|
22
serial.h
22
serial.h
@ -1,22 +0,0 @@
|
||||
#ifndef SERIAL_H_INCLUDED
|
||||
#define SERIAL_H_INCLUDED
|
||||
|
||||
#include <cinttypes>
|
||||
#include <QString>
|
||||
|
||||
class hwinf;
|
||||
class Serial {
|
||||
hwinf const *m_hwinf;
|
||||
uint32_t m_baudrate;
|
||||
QString m_baudrateStr;
|
||||
QString m_comPort;
|
||||
public:
|
||||
Serial(hwinf const *hwinf, uint32_t baudrate, QString baudrateStr,
|
||||
QString comPort);
|
||||
|
||||
bool openSerial();
|
||||
bool testConnection();
|
||||
bool closeSerial();
|
||||
};
|
||||
|
||||
#endif // SERIAL_H_INCLUDED
|
Loading…
Reference in New Issue
Block a user