Compare commits
4 Commits
carun_remo
...
f6efb1ee9a
| Author | SHA1 | Date | |
|---|---|---|---|
| f6efb1ee9a | |||
| a1237749dc | |||
| f5613d5aad | |||
| 3564bac8d4 |
@@ -90,9 +90,7 @@ HEADERS += \
|
|||||||
$${PWD}/include/sendWRcmd.h \
|
$${PWD}/include/sendWRcmd.h \
|
||||||
$${PWD}/include/storeINdata.h \
|
$${PWD}/include/storeINdata.h \
|
||||||
$${PWD}/include/tslib.h \
|
$${PWD}/include/tslib.h \
|
||||||
$${PWD}/include/shared_mem_buffer.h \
|
$${PWD}/include/shared_mem_buffer.h
|
||||||
$${PWD}/include/reporting_thread.h \
|
|
||||||
$${PWD}/include/download_thread.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$${PWD}/src/datei.cpp \
|
$${PWD}/src/datei.cpp \
|
||||||
@@ -103,9 +101,7 @@ SOURCES += \
|
|||||||
$${PWD}/src/sendWRcmd.cpp \
|
$${PWD}/src/sendWRcmd.cpp \
|
||||||
$${PWD}/src/storeINdata.cpp \
|
$${PWD}/src/storeINdata.cpp \
|
||||||
$${PWD}/src/tslib.cpp \
|
$${PWD}/src/tslib.cpp \
|
||||||
$${PWD}/src/shared_mem_buffer.cpp \
|
$${PWD}/src/shared_mem_buffer.cpp
|
||||||
$${PWD}/src/reporting_thread.cpp \
|
|
||||||
$${PWD}/src/download_thread.cpp
|
|
||||||
|
|
||||||
|
|
||||||
# INTERFACE = DeviceController
|
# INTERFACE = DeviceController
|
||||||
|
|||||||
199
dCArun/CArun.cpp
199
dCArun/CArun.cpp
@@ -1,199 +0,0 @@
|
|||||||
#include "CArun.h"
|
|
||||||
|
|
||||||
#include "datei.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define UPDATE_PERIOD_MS 100
|
|
||||||
// period to call chain steps
|
|
||||||
|
|
||||||
#define VENDINGTIMEOUT_MS 30000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CArun::CArun(QObject *parent)
|
|
||||||
: QObject{parent}
|
|
||||||
{
|
|
||||||
loadPlugIn(1);
|
|
||||||
|
|
||||||
timerChainCtrl = new QTimer(this);
|
|
||||||
connect(timerChainCtrl, SIGNAL(timeout()), this, SLOT(chainControl()));
|
|
||||||
timerChainCtrl->setSingleShot(0);
|
|
||||||
timerChainCtrl->start(UPDATE_PERIOD_MS); // 1000: call every 1000ms
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char CArun::loadPlugIn(char lade1_entlade2)
|
|
||||||
{
|
|
||||||
plugInDir.cd("plugins");
|
|
||||||
QPluginLoader *pluginLoader = new QPluginLoader();
|
|
||||||
|
|
||||||
pluginLoader->setFileName("/usr/lib/libCAmaster.so"); // for ptu5
|
|
||||||
|
|
||||||
if (lade1_entlade2==2)
|
|
||||||
{
|
|
||||||
pluginLoader->unload();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pluginLoader->load())
|
|
||||||
{
|
|
||||||
qDebug()<<"cannot load plugin";
|
|
||||||
} else
|
|
||||||
qDebug() <<"loaded plugin: " << pluginLoader->fileName();
|
|
||||||
|
|
||||||
if (!pluginLoader->isLoaded())
|
|
||||||
{
|
|
||||||
qDebug()<<pluginLoader->errorString();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject *plugin = pluginLoader->instance();
|
|
||||||
if ( plugin == nullptr)
|
|
||||||
{
|
|
||||||
// make instance of the root component (which can hold more then one clases)
|
|
||||||
// also loads the lib if not yet done
|
|
||||||
qDebug()<<"cannot start instance";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
HWaccess= qobject_cast<hwinf *>(plugin);
|
|
||||||
// make instance to class "hwinf" in dll_HWapi.h over "interfaces.h"
|
|
||||||
|
|
||||||
qDebug()<<"loadPlugIn, HWAccess: " << HWaccess;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CArun::chainControl(void)
|
|
||||||
{
|
|
||||||
#define FILENAME_COMPORT "../comport.csv" // TODO: use absolute path
|
|
||||||
// use settings (ini-file)
|
|
||||||
|
|
||||||
QString bs, cn;
|
|
||||||
int br, ci;
|
|
||||||
|
|
||||||
|
|
||||||
// load and use last settings: --------------------
|
|
||||||
QByteArray myBA;
|
|
||||||
myBA=datei_readFromFile(FILENAME_COMPORT);
|
|
||||||
if (myBA.length()>0)
|
|
||||||
{
|
|
||||||
bs=csv_getEntryAsString(myBA,0); // read the 's' war 2!??
|
|
||||||
br=csv_getEntryAsInt(myBA,1); // z.B. 5 (5.Eintrag in der Baud-Liste)
|
|
||||||
bs=csv_getEntryAsString(myBA,2); // z.B 115200
|
|
||||||
cn=csv_getEntryAsString(myBA,3); // z.B. COM9
|
|
||||||
ci=csv_getEntryAsInt(myBA,4); // Eintragsnummer in COM-Fenster
|
|
||||||
HWaccess->dc_openSerial(br,bs,cn,1);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// vermutlich wird dies hier ausgeführt, weil eine csv-Datei wird nicht installiert
|
|
||||||
|
|
||||||
// open with default settings
|
|
||||||
qDebug()<<"CArunGui: open serial with default values";
|
|
||||||
|
|
||||||
bs="115200";
|
|
||||||
br=5;
|
|
||||||
//cn="COM14"; // Windows
|
|
||||||
cn="ttymxc2"; // PTU5
|
|
||||||
ci=2;
|
|
||||||
HWaccess->dc_openSerial(br,bs,cn,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TIMER myTO: hat keinen timeout-slot!
|
|
||||||
// wird nur verwendet, um isActive() abzufragen, d.h. ~x zu warten
|
|
||||||
|
|
||||||
// pruefen, of Port nach x s open:
|
|
||||||
if (HWaccess->dc_isPortOpen())
|
|
||||||
{
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// wenn nicht: step 6
|
|
||||||
}
|
|
||||||
myTO->start(100);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==2)
|
|
||||||
{
|
|
||||||
if (!myTO->isActive())
|
|
||||||
{
|
|
||||||
HWaccess->dc_requTestResponse();
|
|
||||||
myStep++;
|
|
||||||
myTO->start(100);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==3)
|
|
||||||
{
|
|
||||||
if (!myTO->isActive())
|
|
||||||
{
|
|
||||||
if (HWaccess->dc_readAnswTestResponse())
|
|
||||||
myStep++; // response was correct
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myStep=6; // 13.12.23: start Autoconnect cycle
|
|
||||||
qDebug()<<"CArunGui: got no answer from DC, retry..";
|
|
||||||
}
|
|
||||||
myTO->start(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==4)
|
|
||||||
{
|
|
||||||
HWaccess->dc_autoRequest(1);
|
|
||||||
AutSendButton->setChecked(true); // taste "druecken"
|
|
||||||
myStep++;
|
|
||||||
myTO->start(2000);
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==5)
|
|
||||||
{
|
|
||||||
if (!myTO->isActive())
|
|
||||||
{
|
|
||||||
if (HWaccess->sys_areDCdataValid())
|
|
||||||
{
|
|
||||||
qDebug()<<"CArunGui: DC is connected";
|
|
||||||
myStep=7; // OK, connection is up and running
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
qDebug()<<"CArunGui: auto request is not running, retry...";
|
|
||||||
myStep++;
|
|
||||||
myTO->start(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==6)
|
|
||||||
{
|
|
||||||
// restart autoconnect cycle
|
|
||||||
myTO->start(100); // restart
|
|
||||||
myStep=0;
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (myStep==7)
|
|
||||||
{
|
|
||||||
// stay here, DC connection is up and running
|
|
||||||
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myNextStep)
|
|
||||||
{
|
|
||||||
*nextScreen=myNextStep;
|
|
||||||
myNextStep=0;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#ifndef CARUN_H
|
|
||||||
#define CARUN_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#include <QPluginLoader>
|
|
||||||
#include <QDir>
|
|
||||||
#include "plugin.h"
|
|
||||||
#include "stepList.h"
|
|
||||||
//#include "stepList.h" // define all working chain steps here
|
|
||||||
|
|
||||||
|
|
||||||
class CArun : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CArun(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
QTimer *timerChainCtrl;
|
|
||||||
QTimer *timerVendingTimeout;
|
|
||||||
|
|
||||||
char loadPlugIn(char lade1_entlade2);
|
|
||||||
|
|
||||||
QDir plugInDir;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
hwinf *HWaccess=nullptr; // global pointer to plugin-class
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void chainControl();
|
|
||||||
void vendingTimeout();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CARUN_H
|
|
||||||
@@ -41,7 +41,6 @@ DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
|
|||||||
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
CArun.cpp \
|
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
tslib.cpp \
|
tslib.cpp \
|
||||||
@@ -49,7 +48,6 @@ SOURCES += \
|
|||||||
datei.cpp
|
datei.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CArun.h \
|
|
||||||
guidefs.h \
|
guidefs.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
stepList.h \
|
stepList.h \
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
#include "CArun.h"
|
#include "mainwindow.h"
|
||||||
//#include "message_handler.h"
|
//#include "message_handler.h"
|
||||||
#include <QCoreApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
int thisisglobal;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication myapp(argc, argv);
|
int ret;
|
||||||
|
QApplication myapp(argc, argv);
|
||||||
QCoreApplication::setOrganizationName("ATB");
|
QApplication::setApplicationName("CArunGui");
|
||||||
QCoreApplication::setApplicationName("CArun");
|
QApplication::setApplicationVersion(APP_VERSION);
|
||||||
QCoreApplication::setApplicationVersion(APP_VERSION);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
|
||||||
@@ -17,9 +18,16 @@ int main(int argc, char *argv[])
|
|||||||
//setDebugLevel(QtMsgType::QtDebugMsg);
|
//setDebugLevel(QtMsgType::QtDebugMsg);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
CArun carun;
|
MainWindow myMainWin;
|
||||||
|
QSize myMainSize={800, 480}; // breite, höhe, PTU: 800x440
|
||||||
|
myMainWin.setMinimumSize(myMainSize);
|
||||||
|
myMainWin.setMaximumSize(myMainSize);
|
||||||
|
myMainWin.setWindowTitle("CArun_V4.2 run cash agent master lib");
|
||||||
|
//myMainWin.show();
|
||||||
|
|
||||||
return myapp.exec();
|
ret=myapp.exec();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DownloadThread;
|
||||||
|
class hwinf;
|
||||||
class T_datif : public QObject
|
class T_datif : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -165,13 +166,14 @@ class T_datif : public QObject
|
|||||||
T_prot *myDCIF;
|
T_prot *myDCIF;
|
||||||
QTimer *datif_trigger;
|
QTimer *datif_trigger;
|
||||||
uint8_t selectedSlaveAddr;
|
uint8_t selectedSlaveAddr;
|
||||||
|
hwinf *m_hw = nullptr;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
char datif_cycleSend();
|
char datif_cycleSend();
|
||||||
void StoredRecData();
|
void StoredRecData();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
T_datif(QObject *parent = nullptr);
|
T_datif(hwinf *hw, QObject *parent = nullptr);
|
||||||
|
|
||||||
void resetChain(void);
|
void resetChain(void);
|
||||||
char isPortOpen(void);
|
char isPortOpen(void);
|
||||||
|
|||||||
@@ -93,14 +93,13 @@ private:
|
|||||||
void sub_storeSendingText(QByteArray *buf) const;
|
void sub_storeSendingText(QByteArray *buf) const;
|
||||||
QTimer *hwapi_TimerPayment;
|
QTimer *hwapi_TimerPayment;
|
||||||
QSharedMemory *m_sharedMem;
|
QSharedMemory *m_sharedMem;
|
||||||
ReportingThread *m_reportingThread;
|
ReportingThread *m_reportingThread = nullptr;
|
||||||
DownloadThread *m_downloadThread;
|
DownloadThread *m_downloadThread = nullptr;
|
||||||
//QTimer *hwapi_triggerBL;
|
//QTimer *hwapi_triggerBL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QWidget *parent = nullptr);
|
explicit hwapi(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
#ifdef THIS_IS_CA_MASTER
|
||||||
T_datif *myDatif;
|
T_datif *myDatif;
|
||||||
#endif
|
#endif
|
||||||
@@ -1384,7 +1383,9 @@ signals:
|
|||||||
void hwapi_doorCBinAndAllDoorsClosed(void) const override;
|
void hwapi_doorCBinAndAllDoorsClosed(void) const override;
|
||||||
void hwapi_doorAllDoorsClosed(void) const override;
|
void hwapi_doorAllDoorsClosed(void) const override;
|
||||||
|
|
||||||
void hwapi_coinAttached() const override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//void hwapi_slotPrintFinished_OK(void);
|
//void hwapi_slotPrintFinished_OK(void);
|
||||||
@@ -1412,7 +1413,8 @@ signals:
|
|||||||
void sub_slotCoin15(void);
|
void sub_slotCoin15(void);
|
||||||
void sub_slotCoin16(void);
|
void sub_slotCoin16(void);
|
||||||
|
|
||||||
void coinAttached();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2390,7 +2390,6 @@ signals:
|
|||||||
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
|
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
|
||||||
virtual void hwapi_doorAllDoorsClosed(void) const=0;
|
virtual void hwapi_doorAllDoorsClosed(void) const=0;
|
||||||
|
|
||||||
virtual void hwapi_coinAttached() const = 0;
|
|
||||||
|
|
||||||
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||||
/* GH Version, bringt Fehler
|
/* GH Version, bringt Fehler
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
// #include <functional>
|
||||||
|
|
||||||
class hwapi;
|
class hwapi;
|
||||||
class ReportingThread : public QThread {
|
class ReportingThread : public QThread {
|
||||||
@@ -12,6 +13,14 @@ public:
|
|||||||
ReportingThread(hwapi *hw);
|
ReportingThread(hwapi *hw);
|
||||||
~ReportingThread();
|
~ReportingThread();
|
||||||
|
|
||||||
|
//void setFunction(std::function<void(QString const&)> f) {
|
||||||
|
// m_f = f;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//std::function<void(QString const&)> function() {
|
||||||
|
// return m_f;
|
||||||
|
//}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// reporting thread does not have a running event queue, and therefore
|
// reporting thread does not have a running event queue, and therefore
|
||||||
// no slots. signals work the usual way.
|
// no slots. signals work the usual way.
|
||||||
@@ -20,6 +29,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
hwapi *m_hw;
|
hwapi *m_hw;
|
||||||
QString m_fileToDownload;
|
QString m_fileToDownload;
|
||||||
|
//std::function<void(QString const&)> m_f;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REPORTING_THREAD_H_INCLUDED
|
#endif // REPORTING_THREAD_H_INCLUDED
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "datIf.h"
|
#include "datIf.h"
|
||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
#include <atomic>
|
|
||||||
#include "sendWRcmd.h"
|
#include "sendWRcmd.h"
|
||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "storeINdata.h"
|
#include "storeINdata.h"
|
||||||
@@ -36,10 +35,6 @@ class T_runProc : public QObject
|
|||||||
|
|
||||||
void restoreDeviceParameter(struct T_devices *deviceSettings);
|
void restoreDeviceParameter(struct T_devices *deviceSettings);
|
||||||
|
|
||||||
#ifndef THIS_IS_CA_MASTER
|
|
||||||
std::atomic_bool m_coinAttached{false};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void runProc_slotProcess(void);
|
void runProc_slotProcess(void);
|
||||||
bool bl_performComplStart(void);
|
bool bl_performComplStart(void);
|
||||||
@@ -85,7 +80,6 @@ signals:
|
|||||||
void runProc_doorCBinAndAllDoorsClosed(void);
|
void runProc_doorCBinAndAllDoorsClosed(void);
|
||||||
void runProc_doorAllDoorsClosed(void);
|
void runProc_doorAllDoorsClosed(void);
|
||||||
|
|
||||||
void runProc_coinAttached();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ VERSION="1.0.1"
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
../include/com.h \
|
../include/com.h \
|
||||||
../include/datIf.h \
|
../include/datIf.h \
|
||||||
../include/prot.h
|
../include/prot.h \
|
||||||
|
../include/download_thread.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
../src/com.cpp \
|
../src/com.cpp \
|
||||||
../src/datIf.cpp \
|
../src/datIf.cpp \
|
||||||
../src/prot.cpp
|
../src/prot.cpp \
|
||||||
|
../src/download_thread.cpp
|
||||||
|
|
||||||
include(../DCLibraries.pri)
|
include(../DCLibraries.pri)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ TEMPLATE = lib
|
|||||||
TARGET = CAslave
|
TARGET = CAslave
|
||||||
VERSION="1.0.1"
|
VERSION="1.0.1"
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
../include/reporting_thread.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
../src/reporting_thread.cpp
|
||||||
|
|
||||||
include(../DCLibraries.pri)
|
include(../DCLibraries.pri)
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
|
|||||||
connect(runProcess, SIGNAL(runProc_doorCoinBoxInserted()), this, SLOT(sub_slotCoin14())); // hwapi_doorCoinBoxInserted()));
|
connect(runProcess, SIGNAL(runProc_doorCoinBoxInserted()), this, SLOT(sub_slotCoin14())); // hwapi_doorCoinBoxInserted()));
|
||||||
connect(runProcess, SIGNAL(runProc_doorCBinAndAllDoorsClosed()), this, SLOT(sub_slotCoin15())); // hwapi_doorCBinAndAllDoorsClosed()));
|
connect(runProcess, SIGNAL(runProc_doorCBinAndAllDoorsClosed()), this, SLOT(sub_slotCoin15())); // hwapi_doorCBinAndAllDoorsClosed()));
|
||||||
connect(runProcess, SIGNAL(runProc_doorAllDoorsClosed()), this, SLOT(sub_slotCoin16())); // hwapi_doorAllDoorsClosed()));
|
connect(runProcess, SIGNAL(runProc_doorAllDoorsClosed()), this, SLOT(sub_slotCoin16())); // hwapi_doorAllDoorsClosed()));
|
||||||
connect(runProcess, SIGNAL(runProc_coinAttached()), this, SLOT(coinAttached()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::hwapi_slotPayProc(void)
|
void hwapi::hwapi_slotPayProc(void)
|
||||||
@@ -226,9 +227,6 @@ void hwapi::sub_slotCoin16(void)
|
|||||||
emit hwapi_doorAllDoorsClosed();
|
emit hwapi_doorAllDoorsClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::coinAttached() {
|
|
||||||
emit hwapi_coinAttached();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3334,15 +3332,22 @@ void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const
|
|||||||
// attention: only applies if function "sys_sendDeviceParameter()" was used to send this settings before
|
// attention: only applies if function "sys_sendDeviceParameter()" was used to send this settings before
|
||||||
// cannot be used to see settings programmed by JsonFile
|
// cannot be used to see settings programmed by JsonFile
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
uint8_t LL;
|
uint8_t LL, nn;
|
||||||
tslib_strclr(buf,0,64);
|
tslib_strclr(buf,0,64);
|
||||||
|
uint8_t *start;
|
||||||
|
|
||||||
//runProcess->epi_restore64BdevParameter(&LL, buf); // wozu die???
|
//runProcess->epi_restore64BdevParameter(&LL, buf); // wozu die???
|
||||||
epi_restoreRbDeviceSettings(&LL, buf); // viel besser, stimmt immer
|
epi_restoreRbDeviceSettings(&LL, buf); // viel besser, stimmt immer
|
||||||
|
|
||||||
Q_STATIC_ASSERT(sizeof(*deviceSettings) <= sizeof(buf));
|
// Puffer in struct eintragen:
|
||||||
|
start = &deviceSettings->kindOfPrinter;
|
||||||
|
nn=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*start = buf[nn];
|
||||||
|
start++;
|
||||||
|
} while(++nn<LL);
|
||||||
|
|
||||||
memcpy(deviceSettings, buf, sizeof(*deviceSettings));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::sys_areDCdataValid(void) const
|
bool hwapi::sys_areDCdataValid(void) const
|
||||||
|
|||||||
@@ -4,10 +4,15 @@
|
|||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
ReportingThread::ReportingThread(hwapi *hw)
|
ReportingThread::ReportingThread(hwapi *hw)
|
||||||
: m_hw(hw)
|
: m_hw(hw)
|
||||||
, m_fileToDownload(m_hw->dcDownloadFileName()) {
|
, m_fileToDownload(m_hw->dcDownloadFileName()) {
|
||||||
|
// , m_f([](QString const&){}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportingThread::~ReportingThread() {
|
ReportingThread::~ReportingThread() {
|
||||||
@@ -17,7 +22,9 @@ ReportingThread::~ReportingThread() {
|
|||||||
// each component which has connects for the corresponding signals.
|
// each component which has connects for the corresponding signals.
|
||||||
void ReportingThread::run() {
|
void ReportingThread::run() {
|
||||||
|
|
||||||
qCritical() << QDateTime::currentDateTime() << "START DOWNLOAD THREAD";
|
qCritical()
|
||||||
|
<< QDateTime::currentDateTime() << "START REPORT THREAD"
|
||||||
|
<< "(PART OF APPLICATION" << QCoreApplication::applicationName() << ")";
|
||||||
|
|
||||||
static QString report("");
|
static QString report("");
|
||||||
|
|
||||||
@@ -96,28 +103,37 @@ void ReportingThread::run() {
|
|||||||
qCritical() << QDateTime::currentDateTime() << "TOTAL BLOCKS" << totalBlocks;
|
qCritical() << QDateTime::currentDateTime() << "TOTAL BLOCKS" << totalBlocks;
|
||||||
|
|
||||||
if (totalBlocks) {
|
if (totalBlocks) {
|
||||||
qint64 const start = QDateTime::currentMSecsSinceEpoch();
|
QDateTime const start = QDateTime::currentDateTime();
|
||||||
double durationMillis = 0;
|
|
||||||
uint16_t currentBlockNumber = 0;
|
uint16_t currentBlockNumber = 0;
|
||||||
|
uint16_t prevBlockNumber = ~0;
|
||||||
|
|
||||||
while (m_hw->dcDownloadGetRunning()) {
|
while (m_hw->dcDownloadGetRunning()) {
|
||||||
currentBlockNumber = m_hw->dcDownloadGetCurrentBlockNumber();
|
currentBlockNumber = m_hw->dcDownloadGetCurrentBlockNumber();
|
||||||
|
if (prevBlockNumber != currentBlockNumber) {
|
||||||
|
double durationSecs = start.secsTo(QDateTime::currentDateTime());
|
||||||
|
|
||||||
durationMillis += QDateTime::currentMSecsSinceEpoch() - start;
|
double const timeAveragePerBlock = (currentBlockNumber > 0) ? (durationSecs / currentBlockNumber) : durationSecs;
|
||||||
|
long estimatedSecondsLeft = lround((timeAveragePerBlock * (totalBlocks - currentBlockNumber)));
|
||||||
double const timeAveragePerBlock = (currentBlockNumber > 0) ? (durationMillis / currentBlockNumber) : durationMillis;
|
long estimatedMinutesLeft =
|
||||||
double const estimatedSecondsLeft = (timeAveragePerBlock * (totalBlocks - currentBlockNumber)) / 1000.0;
|
((estimatedSecondsLeft % 60) == 0) ?
|
||||||
|
(estimatedSecondsLeft / 60) :
|
||||||
|
((estimatedSecondsLeft + 60) / 60);
|
||||||
|
estimatedSecondsLeft = (estimatedSecondsLeft % 60);
|
||||||
|
|
||||||
double percent = ((double)currentBlockNumber / (double)totalBlocks) * 100.0;
|
double percent = ((double)currentBlockNumber / (double)totalBlocks) * 100.0;
|
||||||
report = QString(": total blocks %1, current block %2 [%3] (est. time left: %4s)")
|
report = QString(": total blocks %1, current block %2 [%3] (est. time left: %4min %5s)")
|
||||||
.arg(totalBlocks)
|
.arg(totalBlocks)
|
||||||
.arg(currentBlockNumber)
|
.arg(currentBlockNumber)
|
||||||
.arg(percent, 0, 'f', 2)
|
.arg(percent, 0, 'f', 2)
|
||||||
.arg(estimatedSecondsLeft, 0, 'f', 2);
|
.arg(estimatedMinutesLeft)
|
||||||
|
.arg(estimatedSecondsLeft, 2);
|
||||||
|
|
||||||
qCritical() << "RT report" << report;
|
qCritical() << m_hw << "RT report" << report;
|
||||||
|
|
||||||
emit m_hw->hwapi_reportDCDownloadStatus(report);
|
emit m_hw->hwapi_reportDCDownloadStatus(report);
|
||||||
|
|
||||||
|
prevBlockNumber = currentBlockNumber;
|
||||||
|
}
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,16 +48,6 @@ T_runProc::T_runProc()
|
|||||||
void T_runProc::runProc_slotProcess(void)
|
void T_runProc::runProc_slotProcess(void)
|
||||||
{
|
{
|
||||||
#ifndef THIS_IS_CA_MASTER
|
#ifndef THIS_IS_CA_MASTER
|
||||||
bool const coinAttached = epi_getDI_CoinAttach();
|
|
||||||
// exchange: (atomically) replaces the underlying value of m_coinAttached
|
|
||||||
// with the value of coinAttached, returns the value of m_coinAttached
|
|
||||||
// before the call
|
|
||||||
if (m_coinAttached.exchange(coinAttached) == false) {
|
|
||||||
if (coinAttached) {
|
|
||||||
// old value was false, and new value is true
|
|
||||||
emit runProc_coinAttached();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cash_paymentProcessing();
|
cash_paymentProcessing();
|
||||||
doors_supervise();
|
doors_supervise();
|
||||||
bl_performComplStart(); // neu 1.12.23
|
bl_performComplStart(); // neu 1.12.23
|
||||||
|
|||||||
Reference in New Issue
Block a user