Compare commits
10 Commits
f6efb1ee9a
...
1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
8f8947482a
|
|||
|
42c817ddce
|
|||
|
2c799e1cd2
|
|||
| 9cac6a6461 | |||
| aa10d3b275 | |||
| 790c2fd031 | |||
| 7130d052e7 | |||
| ad84464bf4 | |||
|
69d0420e7d
|
|||
|
9b2433c2cd
|
@@ -90,7 +90,9 @@ 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 \
|
||||||
@@ -101,7 +103,9 @@ 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
|
||||||
|
|||||||
@@ -134,8 +134,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DownloadThread;
|
|
||||||
class hwinf;
|
|
||||||
class T_datif : public QObject
|
class T_datif : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -166,14 +165,13 @@ 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(hwinf *hw, QObject *parent = nullptr);
|
T_datif(QObject *parent = nullptr);
|
||||||
|
|
||||||
void resetChain(void);
|
void resetChain(void);
|
||||||
char isPortOpen(void);
|
char isPortOpen(void);
|
||||||
|
|||||||
@@ -93,13 +93,14 @@ 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 = nullptr;
|
ReportingThread *m_reportingThread;
|
||||||
DownloadThread *m_downloadThread = nullptr;
|
DownloadThread *m_downloadThread;
|
||||||
//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
|
||||||
@@ -1383,9 +1384,7 @@ 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);
|
||||||
@@ -1413,8 +1412,7 @@ signals:
|
|||||||
void sub_slotCoin15(void);
|
void sub_slotCoin15(void);
|
||||||
void sub_slotCoin16(void);
|
void sub_slotCoin16(void);
|
||||||
|
|
||||||
|
void coinAttached();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2390,6 +2390,7 @@ 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,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
// #include <functional>
|
|
||||||
|
|
||||||
class hwapi;
|
class hwapi;
|
||||||
class ReportingThread : public QThread {
|
class ReportingThread : public QThread {
|
||||||
@@ -13,14 +12,6 @@ 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.
|
||||||
@@ -29,7 +20,6 @@ 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,6 +15,7 @@
|
|||||||
#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"
|
||||||
@@ -35,6 +36,10 @@ 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);
|
||||||
@@ -80,6 +85,7 @@ signals:
|
|||||||
void runProc_doorCBinAndAllDoorsClosed(void);
|
void runProc_doorCBinAndAllDoorsClosed(void);
|
||||||
void runProc_doorAllDoorsClosed(void);
|
void runProc_doorAllDoorsClosed(void);
|
||||||
|
|
||||||
|
void runProc_coinAttached();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ 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,12 +2,6 @@ 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,8 +128,7 @@ 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)
|
||||||
@@ -227,6 +226,9 @@ void hwapi::sub_slotCoin16(void)
|
|||||||
emit hwapi_doorAllDoorsClosed();
|
emit hwapi_doorAllDoorsClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hwapi::coinAttached() {
|
||||||
|
emit hwapi_coinAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3332,22 +3334,15 @@ 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, nn;
|
uint8_t LL;
|
||||||
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
|
||||||
|
|
||||||
// Puffer in struct eintragen:
|
Q_STATIC_ASSERT(sizeof(*deviceSettings) <= sizeof(buf));
|
||||||
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,15 +4,10 @@
|
|||||||
|
|
||||||
#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() {
|
||||||
@@ -22,9 +17,7 @@ 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()
|
qCritical() << QDateTime::currentDateTime() << "START DOWNLOAD THREAD";
|
||||||
<< QDateTime::currentDateTime() << "START REPORT THREAD"
|
|
||||||
<< "(PART OF APPLICATION" << QCoreApplication::applicationName() << ")";
|
|
||||||
|
|
||||||
static QString report("");
|
static QString report("");
|
||||||
|
|
||||||
@@ -103,37 +96,28 @@ void ReportingThread::run() {
|
|||||||
qCritical() << QDateTime::currentDateTime() << "TOTAL BLOCKS" << totalBlocks;
|
qCritical() << QDateTime::currentDateTime() << "TOTAL BLOCKS" << totalBlocks;
|
||||||
|
|
||||||
if (totalBlocks) {
|
if (totalBlocks) {
|
||||||
QDateTime const start = QDateTime::currentDateTime();
|
qint64 const start = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
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());
|
|
||||||
|
|
||||||
double const timeAveragePerBlock = (currentBlockNumber > 0) ? (durationSecs / currentBlockNumber) : durationSecs;
|
durationMillis += QDateTime::currentMSecsSinceEpoch() - start;
|
||||||
long estimatedSecondsLeft = lround((timeAveragePerBlock * (totalBlocks - currentBlockNumber)));
|
|
||||||
long estimatedMinutesLeft =
|
double const timeAveragePerBlock = (currentBlockNumber > 0) ? (durationMillis / currentBlockNumber) : durationMillis;
|
||||||
((estimatedSecondsLeft % 60) == 0) ?
|
double const estimatedSecondsLeft = (timeAveragePerBlock * (totalBlocks - currentBlockNumber)) / 1000.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: %4min %5s)")
|
report = QString(": total blocks %1, current block %2 [%3] (est. time left: %4s)")
|
||||||
.arg(totalBlocks)
|
.arg(totalBlocks)
|
||||||
.arg(currentBlockNumber)
|
.arg(currentBlockNumber)
|
||||||
.arg(percent, 0, 'f', 2)
|
.arg(percent, 0, 'f', 2)
|
||||||
.arg(estimatedMinutesLeft)
|
.arg(estimatedSecondsLeft, 0, 'f', 2);
|
||||||
.arg(estimatedSecondsLeft, 2);
|
|
||||||
|
|
||||||
qCritical() << m_hw << "RT report" << report;
|
qCritical() << "RT report" << report;
|
||||||
|
|
||||||
emit m_hw->hwapi_reportDCDownloadStatus(report);
|
emit m_hw->hwapi_reportDCDownloadStatus(report);
|
||||||
|
|
||||||
prevBlockNumber = currentBlockNumber;
|
|
||||||
}
|
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,16 @@ 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