Compare commits
27 Commits
1.99.1
...
gerhard-en
Author | SHA1 | Date | |
---|---|---|---|
4cc964e8c2 | |||
f910b7d057 | |||
5dd90e9597 | |||
47f09067ea | |||
65163354bd | |||
5f88c8f856 | |||
4efbbcbb5a | |||
1155b83ca9 | |||
631550b55e | |||
9e5c379e8a | |||
6b9e795206 | |||
b7ff6dcdbe | |||
2025a75d56 | |||
6176285b89 | |||
0344150950 | |||
68813a49c5 | |||
8e287e3163 | |||
fd58f41c87 | |||
ece75887e2 | |||
cee4caf77d | |||
6b2830ee83 | |||
cd4bddd169 | |||
8a380c9845 | |||
23619543b2 | |||
be16fe4981 | |||
cf621c02bd | |||
ee26eef50f |
@@ -21,15 +21,14 @@ INCLUDEPATH += ../include
|
|||||||
win32 {
|
win32 {
|
||||||
BUILD_DATE=$$system("date /t")
|
BUILD_DATE=$$system("date /t")
|
||||||
BUILD_TIME=$$system("time /t")
|
BUILD_TIME=$$system("time /t")
|
||||||
GIT_COMMIT=""
|
|
||||||
EXTENDED_VERSION=""
|
|
||||||
} else {
|
} else {
|
||||||
BUILD_DATE=$$system("date +%d-%m-%y")
|
BUILD_DATE=$$system("date +%d-%m-%y")
|
||||||
BUILD_TIME=$$system("date +%H:%M:%S")
|
BUILD_TIME=$$system("date +%H:%M:%S")
|
||||||
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
|
||||||
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||||
|
|
||||||
|
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||||
|
|
||||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
||||||
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
||||||
|
@@ -375,9 +375,6 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
// bit0,1: enable/disable button "next"
|
// bit0,1: enable/disable button "next"
|
||||||
// bit2,3: enable/disable button "home"
|
// bit2,3: enable/disable button "home"
|
||||||
// bit4,5: enable/disable button "back"
|
// bit4,5: enable/disable button "back"
|
||||||
QString bs, cn;
|
|
||||||
int br, ci;
|
|
||||||
|
|
||||||
|
|
||||||
this->updateGui();
|
this->updateGui();
|
||||||
*nextScreen=0; // 0=no change
|
*nextScreen=0; // 0=no change
|
||||||
@@ -388,29 +385,22 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
// load and use last settings: --------------------
|
// load and use last settings: --------------------
|
||||||
QByteArray myBA;
|
QByteArray myBA;
|
||||||
myBA=datei_readFromFile(FILENAME_COMPORT);
|
myBA=datei_readFromFile(FILENAME_COMPORT);
|
||||||
if (myBA.length()>0)
|
|
||||||
{
|
//uint32_t len= datei_nrOfEntriesInFile(myBA);
|
||||||
bs=csv_getEntryAsString(myBA,0); // read the 's' war 2!??
|
//uint64_t ulltmp=csv_getEntryAs2Ulong(myBA,0);
|
||||||
br=csv_getEntryAsInt(myBA,1); // z.B. 5 (5.Eintrag in der Baud-Liste)
|
//qDebug()<<"win_startup load long numer: "<<ulltmp;
|
||||||
|
|
||||||
|
QString bs=csv_getEntryAsString(myBA,0); // read the 's' war 2!??
|
||||||
|
int br=csv_getEntryAsInt(myBA,1); // z.B. 5 (5.Eintrag in der Baud-Liste)
|
||||||
bs=csv_getEntryAsString(myBA,2); // z.B 115200
|
bs=csv_getEntryAsString(myBA,2); // z.B 115200
|
||||||
cn=csv_getEntryAsString(myBA,3); // z.B. COM9
|
QString cn=csv_getEntryAsString(myBA,3); // z.B. COM9
|
||||||
ci=csv_getEntryAsInt(myBA,4); // Eintragsnummer in COM-Fenster
|
int ci=csv_getEntryAsInt(myBA,4); // Eintragsnummer in COM-Fenster
|
||||||
|
//qDebug()<<"win_startup loaded com settings: "<<br<<" "<<bs<<" "<<cn;
|
||||||
HWaccess->dc_openSerial(br,bs,cn,1);
|
HWaccess->dc_openSerial(br,bs,cn,1);
|
||||||
|
//CB_baudSel->setCurrentIndex(br); // im BR auswahlfenster diese Baud vorgeben
|
||||||
CB_portSel->setCurrentIndex(ci); // den Port aus der Datei hier vorgeben
|
CB_portSel->setCurrentIndex(ci); // den Port aus der Datei hier vorgeben
|
||||||
connectButton->setChecked(true); // connect Taste "druecken"
|
connectButton->setChecked(true); // connect Taste "druecken"
|
||||||
} else
|
|
||||||
{
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
}
|
|
||||||
myTO->start(100); // restart
|
myTO->start(100); // restart
|
||||||
myStep++;
|
myStep++;
|
||||||
} else
|
} else
|
||||||
@@ -420,13 +410,9 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
if (!myTO->isActive())
|
if (!myTO->isActive())
|
||||||
{
|
{
|
||||||
if (HWaccess->dc_isPortOpen())
|
if (HWaccess->dc_isPortOpen())
|
||||||
{
|
|
||||||
myStep++;
|
myStep++;
|
||||||
} else
|
else
|
||||||
{
|
myStep=99; // stop automatic connection and wait for manual start
|
||||||
myStep=6; // 13.12.23: start Autoconnect cycle
|
|
||||||
qDebug()<<"CArunGui: port is still closed, restarting..";
|
|
||||||
}
|
|
||||||
myTO->start(100);
|
myTO->start(100);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -448,10 +434,7 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
if (HWaccess->dc_readAnswTestResponse())
|
if (HWaccess->dc_readAnswTestResponse())
|
||||||
myStep++; // response was correct
|
myStep++; // response was correct
|
||||||
else
|
else
|
||||||
{
|
myStep=99; // stop automatic connection and wait for manual start
|
||||||
myStep=6; // 13.12.23: start Autoconnect cycle
|
|
||||||
qDebug()<<"CArunGui: got no answer from DC, retry..";
|
|
||||||
}
|
|
||||||
myTO->start(100);
|
myTO->start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,38 +445,23 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
HWaccess->dc_autoRequest(1);
|
HWaccess->dc_autoRequest(1);
|
||||||
AutSendButton->setChecked(true); // taste "druecken"
|
AutSendButton->setChecked(true); // taste "druecken"
|
||||||
myStep++;
|
myStep++;
|
||||||
myTO->start(2000);
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (myStep==5)
|
if (myStep==5)
|
||||||
{
|
{
|
||||||
if (!myTO->isActive())
|
// got next screen:
|
||||||
{
|
//myNextStep=2; // nicht bei CArun
|
||||||
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++;
|
myStep++;
|
||||||
myTO->start(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (myStep==6)
|
if (myStep==6)
|
||||||
{
|
{
|
||||||
// restart autoconnect cycle
|
// stop here, everything done
|
||||||
myTO->start(100); // restart
|
|
||||||
myStep=0;
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (myStep==7)
|
if (myStep==7)
|
||||||
{
|
{
|
||||||
// stay here, DC connection is up and running
|
|
||||||
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -502,6 +470,7 @@ bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
|||||||
|
|
||||||
if (myNextStep)
|
if (myNextStep)
|
||||||
{
|
{
|
||||||
|
//qDebug()<<"fenster1 working: "<< myNextStep;
|
||||||
*nextScreen=myNextStep;
|
*nextScreen=myNextStep;
|
||||||
myNextStep=0;
|
myNextStep=0;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
QT -= gui
|
QT -= gui
|
||||||
QT += serialport
|
QT += widgets serialport
|
||||||
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
@@ -81,31 +81,37 @@ contains( CONFIG, PTU5_YOCTO ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
$${PWD}/include/com.h \
|
||||||
$${PWD}/include/datei.h \
|
$${PWD}/include/datei.h \
|
||||||
$${PWD}/include/runProc.h \
|
$${PWD}/include/runProc.h \
|
||||||
$${PWD}/include/controlBus.h \
|
$${PWD}/include/controlBus.h \
|
||||||
|
$${PWD}/include/datIf.h \
|
||||||
$${PWD}/include/dcBL.h \
|
$${PWD}/include/dcBL.h \
|
||||||
$${PWD}/include/hwapi.h \
|
$${PWD}/include/hwapi.h \
|
||||||
$${PWD}/include/interfaces.h \
|
$${PWD}/include/interfaces.h \
|
||||||
|
$${PWD}/include/prot.h \
|
||||||
$${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 \
|
||||||
$${PWD}/include/download_thread.h
|
$${PWD}/include/reporting_thread.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
$${PWD}/src/com.cpp \
|
||||||
$${PWD}/src/datei.cpp \
|
$${PWD}/src/datei.cpp \
|
||||||
$${PWD}/src/runProc.cpp \
|
$${PWD}/src/runProc.cpp \
|
||||||
$${PWD}/src/controlBus.cpp \
|
$${PWD}/src/controlBus.cpp \
|
||||||
|
$${PWD}/src/datIf.cpp \
|
||||||
$${PWD}/src/dcBL.cpp \
|
$${PWD}/src/dcBL.cpp \
|
||||||
$${PWD}/src/hwapi.cpp \
|
$${PWD}/src/hwapi.cpp \
|
||||||
|
$${PWD}/src/prot.cpp \
|
||||||
$${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 \
|
||||||
$${PWD}/src/download_thread.cpp
|
$${PWD}/src/reporting_thread.cpp
|
||||||
|
|
||||||
|
|
||||||
# INTERFACE = DeviceController
|
# INTERFACE = DeviceController
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
|
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
SUBDIRS = lib_ca_master lib_ca_slave CArunGUI dCArun
|
SUBDIRS = lib_ca_master lib_ca_slave CArunGUI dCArun
|
||||||
|
|
||||||
|
170
dCArun/CArun.cpp
170
dCArun/CArun.cpp
@@ -1,170 +0,0 @@
|
|||||||
#include "CArun.h"
|
|
||||||
#include "datei.h"
|
|
||||||
|
|
||||||
|
|
||||||
CArun::CArun(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, setupStep(SETUP_STEP::INIT)
|
|
||||||
{
|
|
||||||
this->timerChainCtrl = new QTimer(this);
|
|
||||||
this->connect(timerChainCtrl, SIGNAL(timeout()), this, SLOT(chainControl()));
|
|
||||||
this->timerChainCtrl->setSingleShot(true);
|
|
||||||
this->timerChainCtrl->setInterval(100);
|
|
||||||
|
|
||||||
loadPlugIn(1);
|
|
||||||
|
|
||||||
// Start setup-steps:
|
|
||||||
qCritical() << "CArun: start setup...";
|
|
||||||
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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())
|
|
||||||
{
|
|
||||||
qCritical() << "CArun: cannot load plugin";
|
|
||||||
} else
|
|
||||||
qCritical() << "CArun: plugin loaded: " << pluginLoader->fileName();
|
|
||||||
|
|
||||||
if (!pluginLoader->isLoaded())
|
|
||||||
{
|
|
||||||
qCritical() << "CArun: ERROR loading plugin: " << 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
|
|
||||||
qCritical() << "CArun: ERROR cannot start instance";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->HWaccess = qobject_cast<hwinf *>(plugin);
|
|
||||||
// make instance to class "hwinf" in dll_HWapi.h over "interfaces.h"
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CArun::openSerialPort()
|
|
||||||
{
|
|
||||||
#define FILENAME_COMPORT "../comport.csv" // TODO: use absolute path
|
|
||||||
// use settings (ini-file)
|
|
||||||
// comport.csv wird mit installiert in: /opt/app/
|
|
||||||
// k.A., ob "../comport.csv" gefunden wird.
|
|
||||||
|
|
||||||
qCritical() << "CArun: open serial port...";
|
|
||||||
|
|
||||||
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
|
|
||||||
this->HWaccess->dc_openSerial(br,bs,cn,1);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// vermutlich wird dies hier ausgeführt?
|
|
||||||
|
|
||||||
// open with default settings
|
|
||||||
qCritical() << "CArun: open serial with default values";
|
|
||||||
|
|
||||||
bs="115200";
|
|
||||||
br=5;
|
|
||||||
//cn="COM14"; // Windows
|
|
||||||
cn="ttymxc2"; // PTU5
|
|
||||||
ci=2;
|
|
||||||
HWaccess->dc_openSerial(br,bs,cn,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CArun::chainControl(void)
|
|
||||||
{
|
|
||||||
switch (this->setupStep) {
|
|
||||||
case SETUP_STEP::INIT:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::INIT";
|
|
||||||
this->setupStep = SETUP_STEP::OPEN_SERIAL_PORT;
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::OPEN_SERIAL_PORT:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::OPEN_SERIAL_PORT";
|
|
||||||
this->openSerialPort();
|
|
||||||
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::TEST_OPEN_PORT:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::TEST_OPEN_PORT";
|
|
||||||
if (this->HWaccess->dc_isPortOpen()) {
|
|
||||||
this->setupStep = SETUP_STEP::TEST_RESPONSE_REQUEST;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qCritical() << "CArun: port is still closed, restarting..";
|
|
||||||
this->setupStep = SETUP_STEP::INIT;
|
|
||||||
}
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::TEST_RESPONSE_REQUEST:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::TEST_RESPONSE_REQUEST";
|
|
||||||
this->HWaccess->dc_requTestResponse();
|
|
||||||
this->setupStep = SETUP_STEP::TEST_RESPONSE_CHECK;
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::TEST_RESPONSE_CHECK:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::TEST_RESPONSE_CHECK";
|
|
||||||
if (this->HWaccess->dc_readAnswTestResponse()) {
|
|
||||||
// response was correct
|
|
||||||
this->setupStep = SETUP_STEP::SETUP_AUTOREQEUST;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qCritical() << "CArun: got no answer from DC, retry..";
|
|
||||||
this->setupStep = SETUP_STEP::INIT;
|
|
||||||
}
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::SETUP_AUTOREQEUST:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::SETUP_AUTOREQEUST";
|
|
||||||
|
|
||||||
this->HWaccess->dc_autoRequest(1);
|
|
||||||
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
break;
|
|
||||||
case SETUP_STEP::CHECK_VALID_DATA:
|
|
||||||
qCritical() << "CArun: SETUP_STEP::CHECK_VALID_DATA";
|
|
||||||
if (this->HWaccess->sys_areDCdataValid()) {
|
|
||||||
qCritical() << "CArun: DC is connected";
|
|
||||||
// do not start timer again
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qCritical() << "CArun: auto request is not running, retry...";
|
|
||||||
this->setupStep = SETUP_STEP::INIT;
|
|
||||||
this->timerChainCtrl->start();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qCritical() << "CArun: invalid setup step";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@@ -1,56 +0,0 @@
|
|||||||
#ifndef CARUN_H
|
|
||||||
#define CARUN_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#include <QPluginLoader>
|
|
||||||
#include <QDir>
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
|
|
||||||
enum class SETUP_STEP {
|
|
||||||
INIT,
|
|
||||||
OPEN_SERIAL_PORT,
|
|
||||||
TEST_OPEN_PORT,
|
|
||||||
TEST_RESPONSE_REQUEST,
|
|
||||||
TEST_RESPONSE_CHECK,
|
|
||||||
SETUP_AUTOREQEUST,
|
|
||||||
CHECK_VALID_DATA
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CArun : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CArun(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
QTimer *timerChainCtrl;
|
|
||||||
|
|
||||||
char loadPlugIn(char lade1_entlade2);
|
|
||||||
|
|
||||||
QDir plugInDir;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
hwinf *HWaccess=nullptr; // global pointer to plugin-class
|
|
||||||
|
|
||||||
SETUP_STEP setupStep;
|
|
||||||
|
|
||||||
void openSerialPort();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void chainControl();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CARUN_H
|
|
@@ -1,5 +1,5 @@
|
|||||||
QT += core
|
QT += core gui
|
||||||
QT += serialport
|
QT +=widgets serialport
|
||||||
QT +=network
|
QT +=network
|
||||||
# for TCP-IP
|
# for TCP-IP
|
||||||
|
|
||||||
@@ -11,6 +11,8 @@ VERSION = "1.0.0"
|
|||||||
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
||||||
|
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
CONFIG += PTU5
|
CONFIG += PTU5
|
||||||
|
|
||||||
@@ -23,15 +25,14 @@ INCLUDEPATH += ../include
|
|||||||
win32 {
|
win32 {
|
||||||
BUILD_DATE=$$system("date /t")
|
BUILD_DATE=$$system("date /t")
|
||||||
BUILD_TIME=$$system("time /t")
|
BUILD_TIME=$$system("time /t")
|
||||||
GIT_COMMIT=""
|
|
||||||
EXTENDED_VERSION=""
|
|
||||||
} else {
|
} else {
|
||||||
BUILD_DATE=$$system("date +%d-%m-%y")
|
BUILD_DATE=$$system("date +%d-%m-%y")
|
||||||
BUILD_TIME=$$system("date +%H:%M:%S")
|
BUILD_TIME=$$system("date +%H:%M:%S")
|
||||||
|
}
|
||||||
|
|
||||||
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
GIT_COMMIT=$$system("git log -1 --format=oneline | cut -d' ' -f1")
|
||||||
|
|
||||||
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||||
}
|
|
||||||
|
|
||||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
||||||
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
||||||
@@ -39,15 +40,18 @@ 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 \
|
||||||
tslib.cpp \
|
tslib.cpp \
|
||||||
|
win01_com.cpp \
|
||||||
datei.cpp
|
datei.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CArun.h \
|
|
||||||
guidefs.h \
|
guidefs.h \
|
||||||
|
mainwindow.h \
|
||||||
|
stepList.h \
|
||||||
tslib.h \
|
tslib.h \
|
||||||
versionHistory.txt \
|
versionHistory.txt \
|
||||||
|
win01_com.h \
|
||||||
datei.h \
|
datei.h \
|
||||||
plugin.h
|
plugin.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
439
dCArun/mainwindow.cpp
Executable file
439
dCArun/mainwindow.cpp
Executable file
@@ -0,0 +1,439 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
char MainWindow::loadPlugIn(char lade1_entlade2)
|
||||||
|
{
|
||||||
|
plugInDir.cd("plugins");
|
||||||
|
QPluginLoader *pluginLoader = new QPluginLoader();
|
||||||
|
|
||||||
|
// select system:
|
||||||
|
//pluginLoader->setFileName("../MasterPlug/libCAmaster.so"); // for suse
|
||||||
|
//pluginLoader->setFileName("../SlavePlug/libCAslave.so"); // for ptu5
|
||||||
|
//pluginLoader->setFileName("../../MasterPlug/CAmaster.dll"); // for windows
|
||||||
|
//pluginLoader->setFileName("CAmaster.dll"); // for windows
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//int rr=hwapi->giveVal(2); funktioniert :))
|
||||||
|
//qDebug()<<"got value from plugin"<<rr; funktioniert :))
|
||||||
|
// aber besser globaler pointer:
|
||||||
|
// im h-file
|
||||||
|
// hwinf *hwapi=nullptr; // pointer to plugin-class
|
||||||
|
|
||||||
|
HWaccess= qobject_cast<hwinf *>(plugin);
|
||||||
|
// make instance to class "hwinf" in dll_HWapi.h over "interfaces.h"
|
||||||
|
|
||||||
|
qDebug()<<"loadPlugIn, HWAccess: " << HWaccess;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define WINCTRMIN 0
|
||||||
|
// 0 is always the home screen
|
||||||
|
|
||||||
|
#define WINCTRMAX 30
|
||||||
|
// number of needed application screens, up to 255
|
||||||
|
// All screens must be defined below in mainwindow-class first before increasing the nr
|
||||||
|
// numbers must be consecutively from 0 always, 0 is the home screen always
|
||||||
|
|
||||||
|
#define FORMWIDTH 725
|
||||||
|
//#define FORMWIDTH 690
|
||||||
|
// this width is the same for ALL windows
|
||||||
|
|
||||||
|
#define FORMHEIGHT 440
|
||||||
|
// this height is the same for ALL windows
|
||||||
|
|
||||||
|
#define NAVIBUTTONHEIGHT 70
|
||||||
|
#define NAVIBUTTONWIDHT 50
|
||||||
|
|
||||||
|
#define HOMEPAGE_BACKGROUND_COLOR "background-color: lightgrey"
|
||||||
|
|
||||||
|
#define BUTTON_COLOR "background-color: rgb(160,250,190)"
|
||||||
|
|
||||||
|
#define ACTIVE_NAVI_COLOR "background-color: rgb(160,250,190)"
|
||||||
|
#define DISABL_NAVI_COLOR "background-color: grey"
|
||||||
|
|
||||||
|
#define APPPAGE_BACKGROUND_COLOR "background-color: lightgrey"
|
||||||
|
|
||||||
|
#define UPDATE_PERIOD_MS 100
|
||||||
|
// period to call chain steps
|
||||||
|
|
||||||
|
#define VENDINGTIMEOUT_MS 30000
|
||||||
|
// after this time without any operation the program returns to idle state
|
||||||
|
// time in ms, that means 30.000 gives 30seconds
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||||
|
{
|
||||||
|
loadPlugIn(1);
|
||||||
|
|
||||||
|
// define all working moduls (besides gui) here, call ini and working in chainControl() (~Line 1000)
|
||||||
|
//mifCard = new T_Mifare(HWaccess); // ganz wichtig: HWaccess an sub-Konstruktor übergeben
|
||||||
|
// sonst crash bei HW-Zugriff!!!!
|
||||||
|
//diary = new T_lib_diary(); absturz!!!!!!
|
||||||
|
//conf = new T_lib_config(HWaccess);
|
||||||
|
|
||||||
|
timerChainCtrl = new QTimer(this);
|
||||||
|
connect(timerChainCtrl, SIGNAL(timeout()), this, SLOT(chainControl()));
|
||||||
|
timerChainCtrl->setSingleShot(0);
|
||||||
|
timerChainCtrl->start(UPDATE_PERIOD_MS); // 1000: call every 1000ms
|
||||||
|
|
||||||
|
timerVendingTimeout = new QTimer(this);
|
||||||
|
connect(timerVendingTimeout, SIGNAL(timeout()), this, SLOT(vendingTimeout()));
|
||||||
|
timerVendingTimeout->setSingleShot(true);
|
||||||
|
timerVendingTimeout->start(VENDINGTIMEOUT_MS); // in ms
|
||||||
|
|
||||||
|
// ##########################################################################################
|
||||||
|
// für jedes anzuzeigende Fenster eine eigene Groupbox mit eigenem Grid anlegen:
|
||||||
|
|
||||||
|
frame01 = new QGroupBox;
|
||||||
|
frame01->setStyleSheet(APPPAGE_BACKGROUND_COLOR);
|
||||||
|
frame01->setMinimumSize(FORMWIDTH,FORMHEIGHT);
|
||||||
|
QVBoxLayout *smallLay01 = new QVBoxLayout;
|
||||||
|
frame01->setLayout(smallLay01);
|
||||||
|
// Fensterinhalt aus externer Klasse einfügen:
|
||||||
|
myFenster01 = new T_winComPort(HWaccess); // HWaccess damit auf das HW-Plugin zugegriffen werden kann, sonst crash
|
||||||
|
smallLay01->addWidget(myFenster01);
|
||||||
|
|
||||||
|
// ##########################################################################################
|
||||||
|
// draw Mainwindow:
|
||||||
|
bigGroupbox = new QGroupBox;
|
||||||
|
bigGroupbox->setStyleSheet("background-color: grey");
|
||||||
|
bigGroupbox->setMinimumSize(800,480);
|
||||||
|
// bigLayout = new QVBoxLayout; // navi buttons on bottom side
|
||||||
|
bigLayout = new QHBoxLayout; // navi buttons right hand
|
||||||
|
|
||||||
|
// ##########################################################################################
|
||||||
|
// add all windows (but display only one)
|
||||||
|
// display only one: then all windows are shown at the same place
|
||||||
|
// display more then one: the windows are listed in vertical order
|
||||||
|
|
||||||
|
bigLayout->addWidget(frame01);
|
||||||
|
|
||||||
|
bigGroupbox->setLayout(bigLayout);
|
||||||
|
switchScreen(1);
|
||||||
|
//HideAllWindows();
|
||||||
|
|
||||||
|
// ##########################################################################################
|
||||||
|
// Steuer Leiste
|
||||||
|
|
||||||
|
//QHBoxLayout *ButtonLayout = new QHBoxLayout();
|
||||||
|
QVBoxLayout *ButtonLayout = new QVBoxLayout();
|
||||||
|
QFont myTabFont;
|
||||||
|
myTabFont.setPixelSize(26);
|
||||||
|
|
||||||
|
pBback = new QPushButton("<"); //b\na\nc\nk");
|
||||||
|
pBback->setFont(myTabFont);
|
||||||
|
pBback->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
pBback->setMinimumHeight(NAVIBUTTONHEIGHT);
|
||||||
|
pBback->setMaximumWidth(NAVIBUTTONWIDHT);
|
||||||
|
connect(pBback, SIGNAL( clicked() ), myFenster01, SLOT( Nav_back()));
|
||||||
|
|
||||||
|
myTabFont.setPixelSize(22);
|
||||||
|
pBhome = new QPushButton("<<"); //h\no\nm\ne");
|
||||||
|
pBhome->setFont(myTabFont);
|
||||||
|
pBhome->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
pBhome->setMinimumHeight(NAVIBUTTONHEIGHT);
|
||||||
|
pBhome->setMaximumWidth(NAVIBUTTONWIDHT);
|
||||||
|
connect(pBhome, SIGNAL( clicked() ), myFenster01, SLOT( Nav_home()));
|
||||||
|
|
||||||
|
myTabFont.setPixelSize(26);
|
||||||
|
pBforward = new QPushButton(">"); //n\ne\nx\nt");
|
||||||
|
pBforward->setFont(myTabFont);
|
||||||
|
pBforward->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
pBforward->setMinimumHeight(NAVIBUTTONHEIGHT);
|
||||||
|
pBforward->setMaximumWidth(NAVIBUTTONWIDHT);
|
||||||
|
connect(pBforward, SIGNAL( clicked() ), myFenster01, SLOT( Nav_next()));
|
||||||
|
|
||||||
|
QLabel *buttonSpace = new QLabel(" ");
|
||||||
|
ButtonLayout->addWidget(pBback);
|
||||||
|
ButtonLayout->addWidget(buttonSpace);
|
||||||
|
//ButtonLayout->addWidget(buttonSpace);
|
||||||
|
ButtonLayout->addWidget(pBhome);
|
||||||
|
ButtonLayout->addWidget(buttonSpace);
|
||||||
|
//ButtonLayout->addWidget(buttonSpace);
|
||||||
|
ButtonLayout->addWidget(pBforward);
|
||||||
|
QLabel *bottomSpace = new QLabel(" ");
|
||||||
|
ButtonLayout->addWidget(bottomSpace);
|
||||||
|
|
||||||
|
bigLayout->addLayout(ButtonLayout);
|
||||||
|
|
||||||
|
setCentralWidget(bigGroupbox);
|
||||||
|
|
||||||
|
// AUTOSTART serial transmission
|
||||||
|
//HWaccess->dc_openSerial(5,"115200","ttyS0",1); // my suse computer
|
||||||
|
//HWaccess->dc_openSerial(1,"9600","COM5",1); // my suse computer
|
||||||
|
//HWaccess->dc_openSerial(5,"115200","ttymxc2",1); // ptu5
|
||||||
|
//HWaccess->dc_autoRequest(true);
|
||||||
|
//myFenster01->setButtons4autoStart();
|
||||||
|
//HWaccess->alarm_switchSiren(0); // test
|
||||||
|
|
||||||
|
enableNaviButtons(BACKBUTTON,true);
|
||||||
|
enableNaviButtons(HOMEBUTTON,true);
|
||||||
|
enableNaviButtons(FORWBUTTON,true);
|
||||||
|
this->chainIni();
|
||||||
|
|
||||||
|
//connect(myFenster02, SIGNAL(quitMyApp()), this, SLOT(close()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
loadPlugIn(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::HideAllWindows()
|
||||||
|
{
|
||||||
|
// vorsicht: Fenster muss oben definiert sein sonst Programmabsturz ohne Kommentar
|
||||||
|
|
||||||
|
frame01->setEnabled(false);
|
||||||
|
frame01->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
// Call Windows
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void MainWindow::switchScreen(uint16_t winNr) // 0...30
|
||||||
|
{
|
||||||
|
|
||||||
|
HideAllWindows();
|
||||||
|
//qDebug()<<"switch screen to " << winNr;
|
||||||
|
|
||||||
|
switch (winNr)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
frame01->setEnabled(true);
|
||||||
|
frame01->setVisible(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
// Navigation buttons
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void MainWindow::enableNaviButtons(uint8_t switchBitwise)
|
||||||
|
{
|
||||||
|
// switchBitwise=0: no change
|
||||||
|
// bit0,1: enable/disable button "next"
|
||||||
|
// bit2,3: enable/disable button "home"
|
||||||
|
// bit4,5: enable/disable button "back"
|
||||||
|
|
||||||
|
if (switchBitwise &1)
|
||||||
|
{
|
||||||
|
pBforward->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBforward->setText("next");
|
||||||
|
pBforward->setEnabled(true);
|
||||||
|
} else
|
||||||
|
if (switchBitwise &2)
|
||||||
|
{
|
||||||
|
pBforward->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBforward->setText(" ");
|
||||||
|
pBforward->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switchBitwise &4)
|
||||||
|
{
|
||||||
|
pBhome->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBhome->setText("home");
|
||||||
|
pBhome->setEnabled(true);
|
||||||
|
} else
|
||||||
|
if (switchBitwise &8)
|
||||||
|
{
|
||||||
|
pBhome->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBhome->setText(" ");
|
||||||
|
pBhome->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switchBitwise &16)
|
||||||
|
{
|
||||||
|
pBback->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBback->setText("back");
|
||||||
|
pBback->setEnabled(true);
|
||||||
|
} else
|
||||||
|
if (switchBitwise &32)
|
||||||
|
{
|
||||||
|
pBback->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBback->setText(" ");
|
||||||
|
pBback->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::enableNaviButtons(uint8_t buttonNr, bool enabled)
|
||||||
|
{
|
||||||
|
if (buttonNr==1)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
pBback->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBback->setText("back");
|
||||||
|
pBback->setEnabled(true);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
pBback->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBback->setText(" ");
|
||||||
|
pBback->setEnabled(false);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (buttonNr==2)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
pBhome->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBhome->setText("home");
|
||||||
|
pBhome->setEnabled(true);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
pBhome->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBhome->setText(" ");
|
||||||
|
pBhome->setEnabled(false);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (buttonNr==3)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
pBforward->setStyleSheet(ACTIVE_NAVI_COLOR);
|
||||||
|
//pBforward->setText("next");
|
||||||
|
pBforward->setEnabled(true);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
pBforward->setStyleSheet(DISABL_NAVI_COLOR);
|
||||||
|
//pBforward->setText(" ");
|
||||||
|
pBforward->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
// control work flow by Finite state machine
|
||||||
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
static uint16_t chainCurrentStep, chainNextStep;
|
||||||
|
static bool chain_stepIni;
|
||||||
|
|
||||||
|
void MainWindow::chainIni(void)
|
||||||
|
{
|
||||||
|
// called once after power-up by constructor
|
||||||
|
chainCurrentStep=WCS_STARTSCREEN; // start screen
|
||||||
|
chainNextStep=chainCurrentStep;
|
||||||
|
switchScreen(chainCurrentStep);
|
||||||
|
chain_stepIni=true;
|
||||||
|
//qDebug()<<"chain ini, call step "<<WCS_STARTUP << " " << chainCurrentStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::chainControl(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint16_t nextScreen=0;
|
||||||
|
uint8_t useNavi=0;
|
||||||
|
bool busy=false;
|
||||||
|
// working step chain:
|
||||||
|
if (chainCurrentStep != chainNextStep)
|
||||||
|
{
|
||||||
|
if (chainNextStep!=WCS_STARTSCREEN)
|
||||||
|
{
|
||||||
|
timerVendingTimeout->stop();
|
||||||
|
timerVendingTimeout->start(VENDINGTIMEOUT_MS);
|
||||||
|
}
|
||||||
|
//qDebug()<<"found new sreen";
|
||||||
|
chainCurrentStep=chainNextStep;
|
||||||
|
switchScreen(chainCurrentStep);
|
||||||
|
chain_stepIni=true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chainCurrentStep==1)
|
||||||
|
{
|
||||||
|
if (chain_stepIni)
|
||||||
|
busy=myFenster01->work_ini(&nextScreen, &useNavi);
|
||||||
|
else
|
||||||
|
busy=myFenster01->working(&nextScreen, &useNavi);
|
||||||
|
} else
|
||||||
|
|
||||||
|
{
|
||||||
|
// error undefined step
|
||||||
|
qDebug()<<"error main chain control, wrong step ("<<chainCurrentStep<<") selected";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chain_stepIni)
|
||||||
|
{
|
||||||
|
chain_stepIni=false;
|
||||||
|
switchScreen(chainCurrentStep); // the mainWindow frame has always the same number as the working step
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextScreen>0)
|
||||||
|
{
|
||||||
|
// call next chain step
|
||||||
|
//qDebug()<<"chain control: new step selected: "<< nextScreen;
|
||||||
|
|
||||||
|
chainNextStep=nextScreen;
|
||||||
|
}
|
||||||
|
if (useNavi>0)
|
||||||
|
{
|
||||||
|
//qDebug()<<"chain control: navi buttons "<< useNavi;
|
||||||
|
enableNaviButtons(useNavi);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (busy>0)
|
||||||
|
{
|
||||||
|
// reset time-out
|
||||||
|
timerVendingTimeout->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::vendingTimeout(void)
|
||||||
|
{
|
||||||
|
// there was no user operation for 30s so return to start screen
|
||||||
|
// uint16_t nextScreen=WCS_STARTSCREEN;
|
||||||
|
// chainNextStep=nextScreen; erstmal stilllegen, stört bei IBN
|
||||||
|
//qDebug()<<"chain control: vending TO";
|
||||||
|
timerVendingTimeout->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
72
dCArun/mainwindow.h
Executable file
72
dCArun/mainwindow.h
Executable file
@@ -0,0 +1,72 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QStyle>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QDate>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
#include <QPluginLoader>
|
||||||
|
#include <QDir>
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "stepList.h"
|
||||||
|
//#include "stepList.h" // define all working chain steps here
|
||||||
|
#include "win01_com.h"
|
||||||
|
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QPushButton *pBback;
|
||||||
|
QPushButton *pBhome;
|
||||||
|
QPushButton *pBforward;
|
||||||
|
QGroupBox *bigGroupbox;
|
||||||
|
QHBoxLayout *bigLayout;
|
||||||
|
QTimer *timerChainCtrl;
|
||||||
|
QTimer *timerVendingTimeout;
|
||||||
|
|
||||||
|
QGroupBox *frame01;
|
||||||
|
T_winComPort *myFenster01;
|
||||||
|
|
||||||
|
void HideAllWindows();
|
||||||
|
void switchScreen(uint16_t winNr);
|
||||||
|
char loadPlugIn(char lade1_entlade2);
|
||||||
|
QDir plugInDir;
|
||||||
|
void chainIni(void);
|
||||||
|
|
||||||
|
public:
|
||||||
|
hwinf *HWaccess=nullptr; // global pointer to plugin-class
|
||||||
|
|
||||||
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
#define BACKBUTTON 1
|
||||||
|
#define HOMEBUTTON 2
|
||||||
|
#define FORWBUTTON 3
|
||||||
|
void enableNaviButtons(uint8_t buttonNr, bool enabled);
|
||||||
|
void enableNaviButtons(uint8_t switchBitwise);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void chainControl();
|
||||||
|
void vendingTimeout();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
210
dCArun/stepList.h
Executable file
210
dCArun/stepList.h
Executable file
@@ -0,0 +1,210 @@
|
|||||||
|
#ifndef STEPLIST_H
|
||||||
|
#define STEPLIST_H
|
||||||
|
|
||||||
|
|
||||||
|
// define all working chain steps
|
||||||
|
// every FSM-Step get's a frame in MainWindow with the same number and a self-designed GUI
|
||||||
|
// labels are used for switchScreen( label=nr );
|
||||||
|
// numbers are important: e.g. number 3 calls frame3 and frame3 includes subClass "T_fenster03"
|
||||||
|
// so best solution: label = same name like class (in example: Fenster03). Label is fixed bound to number, never change!
|
||||||
|
|
||||||
|
// numbers are fixed assosiated with the function (e.g. ComPort), can't be changed.
|
||||||
|
// but screen order can be called in step chain randomly
|
||||||
|
|
||||||
|
|
||||||
|
// Windownumbers for certain function, never change
|
||||||
|
#define PAGE_COMPORT 1
|
||||||
|
#define PAGE_SERVICEMAIN 2
|
||||||
|
#define PAGE_TIMEDATEVERSION 3
|
||||||
|
#define PAGE_MACHINESTATUS 4
|
||||||
|
#define PAGE_CHECKDOORS 5
|
||||||
|
#define PAGE_PRINTER 6
|
||||||
|
#define PAGE_COINMECHANIC 7
|
||||||
|
#define PAGE_MIFARE 8
|
||||||
|
#define PAGE_MODEM 9
|
||||||
|
#define PAGE_COINPAYMENT 10
|
||||||
|
#define PAGE_VAULTRECORD 11
|
||||||
|
#define PAGE_BOOTLOADER 12
|
||||||
|
#define PAGE_PROG_JSON 13
|
||||||
|
#define PAGE_COINCHANGER 14
|
||||||
|
#define PAGE_BILLREADER 15
|
||||||
|
#define PAGE_NEXT16 16
|
||||||
|
#define PAGE_NEXT17 17
|
||||||
|
#define PAGE_NEXT18 18
|
||||||
|
#define PAGE_NEXT19 19
|
||||||
|
#define PAGE_NEXT20 20
|
||||||
|
|
||||||
|
// fix: customize:
|
||||||
|
#define WCS_STARTSCREEN PAGE_COMPORT
|
||||||
|
|
||||||
|
// PAGE_COMPORT:
|
||||||
|
#define WCS_WIN01BAK PAGE_COMPORT
|
||||||
|
#define WCS_WIN01MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN01FWD PAGE_SERVICEMAIN
|
||||||
|
|
||||||
|
// PAGE_SERVICEMAIN:
|
||||||
|
#define WCS_WIN02BAK PAGE_COMPORT
|
||||||
|
#define WCS_WIN02MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN02FWD PAGE_TIMEDATEVERSION
|
||||||
|
|
||||||
|
// PAGE_TIMEDATEVERSION:
|
||||||
|
#define WCS_WIN03BAK PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN03MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN03FWD PAGE_MACHINESTATUS
|
||||||
|
|
||||||
|
// PAGE_MACHINESTATUS:
|
||||||
|
#define WCS_WIN04BAK PAGE_TIMEDATEVERSION
|
||||||
|
#define WCS_WIN04MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN04FWD PAGE_CHECKDOORS
|
||||||
|
|
||||||
|
|
||||||
|
// PAGE_CHECKDOORS:
|
||||||
|
#define WCS_WIN05BAK PAGE_MACHINESTATUS
|
||||||
|
#define WCS_WIN05MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN05FWD PAGE_COINMECHANIC
|
||||||
|
|
||||||
|
// PAGE_COINMECHANIC:
|
||||||
|
#define WCS_WIN07BAK PAGE_CHECKDOORS
|
||||||
|
#define WCS_WIN07MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN07FWD PAGE_COINPAYMENT
|
||||||
|
|
||||||
|
// PAGE_COINPAYMENT:
|
||||||
|
#define WCS_WIN10BAK PAGE_COINMECHANIC
|
||||||
|
#define WCS_WIN10MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN10FWD PAGE_COINCHANGER
|
||||||
|
|
||||||
|
// PAGE_COINCHANGER:
|
||||||
|
#define WCS_WIN14BAK PAGE_COINPAYMENT
|
||||||
|
#define WCS_WIN14MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN14FWD PAGE_BILLREADER
|
||||||
|
|
||||||
|
|
||||||
|
// PAGE_BILLREADER:
|
||||||
|
#define WCS_WIN15BAK PAGE_COINCHANGER
|
||||||
|
#define WCS_WIN15MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN15FWD PAGE_PRINTER
|
||||||
|
|
||||||
|
// PAGE_PRINTER:
|
||||||
|
#define WCS_WIN06BAK PAGE_BILLREADER
|
||||||
|
#define WCS_WIN06MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN06FWD PAGE_MIFARE
|
||||||
|
|
||||||
|
// PAGE_MIFARE:
|
||||||
|
#define WCS_WIN08BAK PAGE_PRINTER
|
||||||
|
#define WCS_WIN08MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN08FWD PAGE_MODEM
|
||||||
|
|
||||||
|
// PAGE_MODEM:
|
||||||
|
#define WCS_WIN09BAK PAGE_MIFARE
|
||||||
|
#define WCS_WIN09MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN09FWD PAGE_VAULTRECORD
|
||||||
|
|
||||||
|
|
||||||
|
// PAGE_VAULTRECORD:
|
||||||
|
#define WCS_WIN11BAK PAGE_MODEM
|
||||||
|
#define WCS_WIN11MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN11FWD PAGE_PROG_JSON
|
||||||
|
|
||||||
|
// PAGE_PROG_JSON:
|
||||||
|
#define WCS_WIN13BAK PAGE_VAULTRECORD
|
||||||
|
#define WCS_WIN13MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN13FWD PAGE_BOOTLOADER
|
||||||
|
|
||||||
|
// PAGE_BOOTLOADER:
|
||||||
|
#define WCS_WIN12BAK PAGE_PROG_JSON
|
||||||
|
#define WCS_WIN12MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN12FWD PAGE_NEXT16
|
||||||
|
|
||||||
|
|
||||||
|
// PAGE_NEXT16
|
||||||
|
#define WCS_WIN16BAK PAGE_BOOTLOADER
|
||||||
|
#define WCS_WIN16MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN16FWD PAGE_NEXT17
|
||||||
|
|
||||||
|
// PAGE_NEXT17
|
||||||
|
#define WCS_WIN17BAK PAGE_NEXT16
|
||||||
|
#define WCS_WIN17MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN17FWD PAGE_NEXT18
|
||||||
|
|
||||||
|
// PAGE_NEXT18
|
||||||
|
#define WCS_WIN18BAK PAGE_NEXT17
|
||||||
|
#define WCS_WIN18MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN18FWD PAGE_NEXT19
|
||||||
|
|
||||||
|
// PAGE_NEXT19
|
||||||
|
#define WCS_WIN19BAK PAGE_NEXT18
|
||||||
|
#define WCS_WIN19MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN19FWD PAGE_NEXT20
|
||||||
|
|
||||||
|
// PAGE_NEXT20
|
||||||
|
#define WCS_WIN20BAK PAGE_NEXT19
|
||||||
|
#define WCS_WIN20MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN20FWD PAGE_SERVICEMAIN
|
||||||
|
|
||||||
|
// just for Template
|
||||||
|
#define WCS_WIN99BAK PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN99MID PAGE_SERVICEMAIN
|
||||||
|
#define WCS_WIN99FWD PAGE_SERVICEMAIN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define WIN02_LABEL_SHORT01 " Status"
|
||||||
|
#define WCS_WIN02SHORT01 PAGE_MACHINESTATUS
|
||||||
|
#define WIN02_LABEL_SHORT02 " Doors "
|
||||||
|
#define WCS_WIN02SHORT02 PAGE_CHECKDOORS
|
||||||
|
#define WIN02_LABEL_SHORT03 "Coin mech"
|
||||||
|
#define WCS_WIN02SHORT03 PAGE_COINMECHANIC
|
||||||
|
#define WIN02_LABEL_SHORT04 "Payment"
|
||||||
|
#define WCS_WIN02SHORT04 PAGE_COINPAYMENT
|
||||||
|
|
||||||
|
#define WIN02_LABEL_SHORT05 "Changer"
|
||||||
|
#define WCS_WIN02SHORT05 PAGE_COINCHANGER
|
||||||
|
#define WIN02_LABEL_SHORT06 " Bill "
|
||||||
|
#define WCS_WIN02SHORT06 PAGE_BILLREADER
|
||||||
|
#define WIN02_LABEL_SHORT07 "Printer"
|
||||||
|
#define WCS_WIN02SHORT07 PAGE_PRINTER
|
||||||
|
|
||||||
|
#define WIN02_LABEL_SHORT08 "Program"
|
||||||
|
#define WCS_WIN02SHORT08 PAGE_VAULTRECORD
|
||||||
|
#define WIN02_LABEL_SHORT09 " "
|
||||||
|
#define WCS_WIN02SHORT09 PAGE_SERVICEMAIN
|
||||||
|
#define WIN02_LABEL_SHORT10 " "
|
||||||
|
#define WCS_WIN02SHORT10 PAGE_SERVICEMAIN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// set needed navigation buttons, use | to combine more then one:
|
||||||
|
#define SWITCH_NEXT_ON 1
|
||||||
|
#define SWITCH_NEXT_OFF 2
|
||||||
|
#define SWITCH_HOME_ON 4
|
||||||
|
#define SWITCH_HOME_OFF 8
|
||||||
|
#define SWITCH_BACK_ON 16
|
||||||
|
#define SWITCH_BACK_OFF 32
|
||||||
|
// example: *useNavi=SWITCH_BACK_ON; // change only this one, or set all:
|
||||||
|
// *useNavi=SWITCH_BACK_OFF | SWITCH_HOME_OFF | SWITCH_NEXT_ON;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// some defines for Widget design:
|
||||||
|
|
||||||
|
#define TS_VALUEBOX_FRAMESTYLE 0x0032
|
||||||
|
#define TS_VALUEBOX_LINEWIDTH 3
|
||||||
|
|
||||||
|
//genDatPort->setFrameStyle(QFrame::Panel | QFrame::Sunken ); funktioniert aber gibt unverständliche Warnung
|
||||||
|
// QFrame::Panel = 0x0002 QFrame::Sunken=0x0030
|
||||||
|
//genDatPort->setFrameStyle(0x0032); // funktioniert und gibt keine Warnung
|
||||||
|
//genDatPort->setFrameStyle(TS_VALUEBOX_FRAMESTYLE); // funktioniert und gibt keine Warnung
|
||||||
|
|
||||||
|
#define TS_LED_FRAMESTYLE 0x0031
|
||||||
|
// QFrame::Box | QFrame::Sunken
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // STEPLIST_H
|
578
dCArun/win01_com.cpp
Executable file
578
dCArun/win01_com.cpp
Executable file
@@ -0,0 +1,578 @@
|
|||||||
|
#include "win01_com.h"
|
||||||
|
#include "stepList.h" // define all working chain steps here
|
||||||
|
#include "datei.h"
|
||||||
|
//#include "globVars.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// %%%%%%%%%%%%%%%%%%%% TabComPort
|
||||||
|
|
||||||
|
Console::Console(QWidget *parent) : QPlainTextEdit(parent)
|
||||||
|
{
|
||||||
|
document()->setMaximumBlockCount(100);
|
||||||
|
QPalette p = palette();
|
||||||
|
p.setColor(QPalette::Base, Qt::black); //geht nicht weil untergrund schon farbig
|
||||||
|
p.setColor(QPalette::Text, Qt::blue);
|
||||||
|
setPalette(p);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::putData(const QByteArray &data)
|
||||||
|
{
|
||||||
|
insertPlainText(data);
|
||||||
|
insertPlainText("\n");
|
||||||
|
QScrollBar *bar = verticalScrollBar();
|
||||||
|
bar->setValue(bar->maximum());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::putText(QString text)
|
||||||
|
{
|
||||||
|
insertPlainText(text);
|
||||||
|
insertPlainText("\n");
|
||||||
|
QScrollBar *bar = verticalScrollBar();
|
||||||
|
bar->setValue(bar->maximum());
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::subPortInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Port Info Anzeige Feld, 2. Zeile links
|
||||||
|
QStringList myStringList;
|
||||||
|
QStringList comboPortList;
|
||||||
|
|
||||||
|
const auto infos = QSerialPortInfo::availablePorts();
|
||||||
|
for (const QSerialPortInfo &info : infos)
|
||||||
|
{
|
||||||
|
myStringList.append(QObject::tr(" \n Port: ") + info.portName() );
|
||||||
|
myStringList.append(QObject::tr("Location: ") + info.systemLocation()); // + "\n");
|
||||||
|
myStringList.append(QObject::tr("Description: ") + info.description() );
|
||||||
|
myStringList.append(QObject::tr("Manufacturer: ") + info.manufacturer());
|
||||||
|
myStringList.append(QObject::tr("Serial number: ") + info.serialNumber());
|
||||||
|
myStringList.append (QObject::tr("Vendor Id: ") + QString::number(info.vendorIdentifier(), 16));
|
||||||
|
myStringList.append(QObject::tr("Product Id: ") +QString::number(info.productIdentifier(), 16));
|
||||||
|
//myStringList.append(QObject::tr("Busy: ") + (info.isBusy() ? QObject::tr("Yes") : QObject::tr("No")));
|
||||||
|
comboPortList.append(info.portName()); // wenn Comport im System vorhanden dann in die Liste eintragen
|
||||||
|
}
|
||||||
|
QListWidget *myListWidget = new QListWidget;
|
||||||
|
myListWidget->insertItems(0, myStringList);
|
||||||
|
myListWidget->setMaximumWidth(250);
|
||||||
|
myTabComLayout->addWidget(myListWidget,1,0);
|
||||||
|
|
||||||
|
|
||||||
|
// ComboBox Comport Nr:
|
||||||
|
CB_portSel = new QComboBox();
|
||||||
|
CB_portSel->addItems(comboPortList); // string Liste mit addItems (s am Schluss) !
|
||||||
|
CB_portSel->setMinimumHeight(30);
|
||||||
|
CB_portSel->setMaximumWidth(150);
|
||||||
|
QFont myCBfont;
|
||||||
|
//myCBfont.setBold(true);
|
||||||
|
myCBfont.setPixelSize(15);
|
||||||
|
CB_portSel->setFont(myCBfont);
|
||||||
|
CB_portSel->setCurrentIndex(2); // default 3. Comport in der Liste = ttymxc2 in PTU5
|
||||||
|
myTabComLayout->addWidget(CB_portSel, 4,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::callOpenSerial()
|
||||||
|
{
|
||||||
|
// Taste Connect wurde gedrückt, eine Klasse/einen Slot aus einer übergeordneten Klasse:
|
||||||
|
// openSerialPort();
|
||||||
|
// kann man nicht aufrufen. deshalb: speichere ComPort, Baudrate und Startbefehl global.
|
||||||
|
// Von dort wird mit einem zyklischen Timer ausgelesen
|
||||||
|
|
||||||
|
int br, ci;
|
||||||
|
QString bs, cn;
|
||||||
|
//br=CB_baudSel->currentIndex();
|
||||||
|
//bs=CB_baudSel->currentText();
|
||||||
|
br=5;
|
||||||
|
bs="115200";
|
||||||
|
cn=CB_portSel->currentText();
|
||||||
|
ci=CB_portSel->currentIndex();
|
||||||
|
|
||||||
|
// aktuell: br=5 bs=115200 cn=0 (=Com5)
|
||||||
|
//epi_setSerial(5,"115200","COM5",1);
|
||||||
|
// epi_setSerial(br, bs, cn, 1);
|
||||||
|
|
||||||
|
// new: save values for next time
|
||||||
|
QByteArray myBA, tmpBA;
|
||||||
|
myBA.clear(); tmpBA.clear();
|
||||||
|
myBA.append('s'); // start sign, not used
|
||||||
|
myBA.append(FILESEPERATOR);
|
||||||
|
tmpBA.setNum(br,10);
|
||||||
|
myBA.append(tmpBA);
|
||||||
|
myBA.append(FILESEPERATOR);
|
||||||
|
myBA.append(bs.toLatin1());
|
||||||
|
myBA.append(FILESEPERATOR);
|
||||||
|
myBA.append(cn.toLatin1());
|
||||||
|
myBA.append(FILESEPERATOR);
|
||||||
|
tmpBA.clear();
|
||||||
|
tmpBA.setNum(ci,10);
|
||||||
|
myBA.append(tmpBA);
|
||||||
|
myBA.append(FILESEPERATOR);
|
||||||
|
|
||||||
|
datei_clearFile(FILENAME_COMPORT);
|
||||||
|
datei_writeToFile(FILENAME_COMPORT, myBA);
|
||||||
|
qDebug() << "winComPort opening serial with: " << br << " " << bs << " " << cn;
|
||||||
|
HWaccess->dc_openSerial(br, bs, cn, 1);// same function with hwapi
|
||||||
|
// void dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect)
|
||||||
|
// BaudNr: 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
|
||||||
|
// BaudStr: for exapmle "19200"
|
||||||
|
// ComName: for example "COM48"
|
||||||
|
// connect: 0, 1
|
||||||
|
|
||||||
|
emit connectButtonPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::callCloseSerial()
|
||||||
|
{
|
||||||
|
HWaccess->dc_closeSerial();
|
||||||
|
// epi_closeSerial(); // same function without hwapi
|
||||||
|
emit closeButtonPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::callAutoSend()
|
||||||
|
{
|
||||||
|
if (AutSendButton->isChecked())
|
||||||
|
{
|
||||||
|
HWaccess->dc_autoRequest(1);
|
||||||
|
emit autoSendButtonIsOn();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
HWaccess->dc_autoRequest(0);
|
||||||
|
|
||||||
|
emit autoSendButtonIsOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::callRefresh(void)
|
||||||
|
{
|
||||||
|
subPortInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::callConnectToggle()
|
||||||
|
{
|
||||||
|
if (connectButton->isChecked())
|
||||||
|
{
|
||||||
|
//qDebug() << "down";
|
||||||
|
|
||||||
|
callOpenSerial();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//qDebug() << "released";
|
||||||
|
callCloseSerial();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::getDcTestRS232()
|
||||||
|
{
|
||||||
|
//qDebug() << "request test response...";
|
||||||
|
HWaccess->dc_requTestResponse();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void T_winComPort::newBaud(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
qDebug() << "new baud selected...";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::setButtons4autoStart()
|
||||||
|
{
|
||||||
|
connectButton->setEnabled(true);
|
||||||
|
connectButton->setDown(true);
|
||||||
|
connectButton->setChecked(true);
|
||||||
|
|
||||||
|
AutSendButton->setEnabled(true);
|
||||||
|
AutSendButton->setDown(true);
|
||||||
|
AutSendButton->setChecked(true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
T_winComPort::T_winComPort(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
this->HWaccess = HWaccess;
|
||||||
|
|
||||||
|
myTabComLayout = new QGridLayout;
|
||||||
|
//QGridLayout *myGridLayout = new QGridLayout();
|
||||||
|
|
||||||
|
// Überschrift linke Spalte
|
||||||
|
QLabel *portListLabel2 = new QLabel(tr("in System available Ports:"));
|
||||||
|
myTabComLayout->addWidget(portListLabel2, 0,0);
|
||||||
|
|
||||||
|
// Überschrift rechte Spalte
|
||||||
|
QLabel *lab_headlineR = new QLabel(tr("Serial traffic:"));
|
||||||
|
myTabComLayout->addWidget(lab_headlineR, 0, 1);
|
||||||
|
|
||||||
|
subPortInfo();
|
||||||
|
// sende-empfangs-Rohdaten-Fenster, 2. Zeile rechts
|
||||||
|
myDiagWindow = new Console();
|
||||||
|
myDiagWindow->setReadOnly(true);
|
||||||
|
myDiagWindow->setEnabled(true);
|
||||||
|
//myDiagWindow->setLocalEchoEnabled(p.localEchoEnabled);
|
||||||
|
//myDiagWindow->setMinimumWidth(300);
|
||||||
|
//myDiagWindow->putData("ongoing serial traffic: ");
|
||||||
|
myTabComLayout->addWidget(myDiagWindow, 1,1);
|
||||||
|
|
||||||
|
// links:
|
||||||
|
// refresh button:
|
||||||
|
refreshButton = new QPushButton(tr("&refresh"));
|
||||||
|
refreshButton->setCheckable(false); // true = toggle button
|
||||||
|
refreshButton->setAutoDefault(false); // beim start aus
|
||||||
|
//refreshButton->setMaximumWidth(90);
|
||||||
|
myTabComLayout->addWidget(refreshButton, 2,0);
|
||||||
|
//connect(refreshButton, &QAbstractButton::clicked, this, &T_fenster01::callRefresh);
|
||||||
|
connect(refreshButton, SIGNAL(clicked()), this, SLOT(callRefresh()));
|
||||||
|
|
||||||
|
|
||||||
|
QLabel *Label3 = new QLabel(tr("Port:"));
|
||||||
|
myTabComLayout->addWidget(Label3, 3,0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QLabel *Label4 = new QLabel(tr("Baud:"));
|
||||||
|
myTabComLayout->addWidget(Label4, 5,0);
|
||||||
|
|
||||||
|
// ComboBox Baudrate:
|
||||||
|
QFont my2CBfont;
|
||||||
|
//my2CBfont.setBold(true);
|
||||||
|
my2CBfont.setPixelSize(15);
|
||||||
|
/*
|
||||||
|
CB_baudSel = new QComboBox();
|
||||||
|
CB_baudSel->addItem(tr("1200"));
|
||||||
|
CB_baudSel->addItem(tr("9600"));
|
||||||
|
CB_baudSel->addItem(tr("19200"));
|
||||||
|
CB_baudSel->addItem(tr("38400"));
|
||||||
|
CB_baudSel->addItem(tr("57600"));
|
||||||
|
CB_baudSel->addItem(tr("115200"));
|
||||||
|
CB_baudSel->setMinimumHeight(30);
|
||||||
|
CB_baudSel->setMaximumWidth(150);
|
||||||
|
CB_baudSel->setFont(my2CBfont);
|
||||||
|
CB_baudSel->setCurrentIndex(5); // default 115k baud
|
||||||
|
//CB_baudSel->setCurrentIndex(1); // default 9600 baud
|
||||||
|
myTabComLayout->addWidget(CB_baudSel, 6,0);
|
||||||
|
//connect(CB_baudSel, SIGNAL(currentIndexChanged(int)), this, SLOT(newBaud()));
|
||||||
|
connect(CB_baudSel, SIGNAL(currentIndexChanged(int)), this, SLOT(newBaud()));
|
||||||
|
*/
|
||||||
|
// Statuszeile COM Port (serial Port)
|
||||||
|
LabelComState = new QLabel(tr("not connected"));
|
||||||
|
myTabComLayout->addWidget(LabelComState, 7,0);
|
||||||
|
|
||||||
|
// Connect button:
|
||||||
|
connectButton = new QPushButton(tr("&Connect"));
|
||||||
|
connectButton->setCheckable(true); // true = toggle button
|
||||||
|
connectButton->setAutoDefault(true); // beim start ein
|
||||||
|
connectButton->setMaximumWidth(90);
|
||||||
|
connectButton->setMinimumHeight(50);
|
||||||
|
myTabComLayout->addWidget(connectButton, 8,0);
|
||||||
|
//connect(connectButton, &QAbstractButton::clicked, this, &T_fenster01::callConnectToggle);
|
||||||
|
connect(connectButton, SIGNAL(clicked()), this, SLOT(callConnectToggle()));
|
||||||
|
|
||||||
|
|
||||||
|
// rechts:
|
||||||
|
|
||||||
|
// test serial line:
|
||||||
|
TestButton = new QPushButton(tr("test Connection"));
|
||||||
|
TestButton->setMaximumWidth(150);
|
||||||
|
myTabComLayout->addWidget(TestButton,2,1);
|
||||||
|
TestButton->setCheckable(false); // true = toggle button
|
||||||
|
TestButton->setAutoDefault(false); // beim start aus
|
||||||
|
// connect(TestButton, &QAbstractButton::clicked, this, &T_fenster01::getDcTestRS232);
|
||||||
|
connect(TestButton, SIGNAL(clicked()), this, SLOT(getDcTestRS232()));
|
||||||
|
|
||||||
|
// I Statuszeile Handshakes (serial Control) flow.cpp
|
||||||
|
// geht überhaupt was raus? kommt überhaupt was zurück?
|
||||||
|
//LabelHandshakes = new QLabel(tr("control line"));
|
||||||
|
LabelHandshakes = new QLabel("HS"); // not used
|
||||||
|
myTabComLayout->addWidget(LabelHandshakes, 3,1);
|
||||||
|
|
||||||
|
// II Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
||||||
|
LabelRecieveFrame = new QLabel(tr("slave receive"));
|
||||||
|
myTabComLayout->addWidget(LabelRecieveFrame, 4,1);
|
||||||
|
|
||||||
|
// III Anzeige der Slave-Results (Datif)
|
||||||
|
LabelResults = new QLabel(tr("results line"));
|
||||||
|
myTabComLayout->addWidget(LabelResults, 5,1);
|
||||||
|
|
||||||
|
// IV Statuszeile Sende- und Empfangsdaten brauchbar? (Datif)
|
||||||
|
LabelDataState = new QLabel(tr("datif line"));
|
||||||
|
myTabComLayout->addWidget(LabelDataState, 6,1);
|
||||||
|
|
||||||
|
// V
|
||||||
|
LabelDatif = new QLabel(tr("datif line"));
|
||||||
|
myTabComLayout->addWidget(LabelDatif, 7,1);
|
||||||
|
|
||||||
|
// Autosend:
|
||||||
|
AutSendButton = new QPushButton(tr("&Automatic reading")); // &A --> also keycode Alt-A possible
|
||||||
|
//AutSendButton->setMaximumWidth(90);
|
||||||
|
myTabComLayout->addWidget(AutSendButton,8,1);
|
||||||
|
AutSendButton->setCheckable(true); // true = toggle button
|
||||||
|
AutSendButton->setAutoDefault(true); // beim start aus
|
||||||
|
AutSendButton->setMinimumHeight(50);
|
||||||
|
// connect(AutSendButton, &QAbstractButton::clicked, this, &T_fenster01::callAutoSend);
|
||||||
|
connect(AutSendButton, SIGNAL(clicked()), this, SLOT(callAutoSend()));
|
||||||
|
|
||||||
|
setLayout(myTabComLayout);
|
||||||
|
myNextStep=0;
|
||||||
|
myStep=0;
|
||||||
|
callConnectToggle();
|
||||||
|
callAutoSend();
|
||||||
|
|
||||||
|
myTO = new QTimer();
|
||||||
|
myTO->setSingleShot(true);
|
||||||
|
myTO->start(2000);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// not needed:
|
||||||
|
T_winComPort::~T_winComPort()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_winComPort::Nav_back(void)
|
||||||
|
{
|
||||||
|
myNextStep=WCS_WIN01BAK;
|
||||||
|
}
|
||||||
|
void T_winComPort::Nav_home(void)
|
||||||
|
{
|
||||||
|
myNextStep=WCS_WIN01MID;
|
||||||
|
}
|
||||||
|
void T_winComPort::Nav_next(void)
|
||||||
|
{
|
||||||
|
myNextStep=WCS_WIN01FWD;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool T_winComPort::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
|
||||||
|
{
|
||||||
|
// one state of the vending/operating FSM
|
||||||
|
// called ONE time after selecting this state (initialization)
|
||||||
|
// useNavi=0: no change
|
||||||
|
// bit0,1: enable/disable button "next"
|
||||||
|
// bit2,3: enable/disable button "home"
|
||||||
|
// bit4,5: enable/disable button "back"
|
||||||
|
|
||||||
|
*nextScreen=0; // needed 0=no change
|
||||||
|
// *useNavi=SWITCH_BACK_OFF | SWITCH_HOME_OFF | SWITCH_NEXT_ON;
|
||||||
|
*useNavi=SWITCH_BACK_OFF | SWITCH_HOME_OFF | SWITCH_NEXT_OFF; // bei CArun alle aus
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool T_winComPort::working(uint16_t *nextScreen, uint8_t *useNavi)
|
||||||
|
{
|
||||||
|
// one state of the vending/operating FSM
|
||||||
|
// called cyclic until this state changes intentionally to another state
|
||||||
|
// display informations for human operator, react on operators inputs or wait for payment media
|
||||||
|
|
||||||
|
// useNavi=0: no change
|
||||||
|
// bit0,1: enable/disable button "next"
|
||||||
|
// bit2,3: enable/disable button "home"
|
||||||
|
// bit4,5: enable/disable button "back"
|
||||||
|
|
||||||
|
this->updateGui();
|
||||||
|
*nextScreen=0; // 0=no change
|
||||||
|
*useNavi=0;
|
||||||
|
|
||||||
|
if (myStep==0)
|
||||||
|
{
|
||||||
|
// load and use last settings: --------------------
|
||||||
|
QByteArray myBA;
|
||||||
|
myBA=datei_readFromFile(FILENAME_COMPORT);
|
||||||
|
|
||||||
|
//uint32_t len= datei_nrOfEntriesInFile(myBA);
|
||||||
|
//uint64_t ulltmp=csv_getEntryAs2Ulong(myBA,0);
|
||||||
|
//qDebug()<<"win_startup load long numer: "<<ulltmp;
|
||||||
|
|
||||||
|
QString bs=csv_getEntryAsString(myBA,0); // read the 's' war 2!??
|
||||||
|
int br=csv_getEntryAsInt(myBA,1); // z.B. 5 (5.Eintrag in der Baud-Liste)
|
||||||
|
bs=csv_getEntryAsString(myBA,2); // z.B 115200
|
||||||
|
QString cn=csv_getEntryAsString(myBA,3); // z.B. COM9
|
||||||
|
int ci=csv_getEntryAsInt(myBA,4); // Eintragsnummer in COM-Fenster
|
||||||
|
//qDebug()<<"win_startup loaded com settings: "<<br<<" "<<bs<<" "<<cn;
|
||||||
|
HWaccess->dc_openSerial(br,bs,cn,1);
|
||||||
|
//CB_baudSel->setCurrentIndex(br); // im BR auswahlfenster diese Baud vorgeben
|
||||||
|
CB_portSel->setCurrentIndex(ci); // den Port aus der Datei hier vorgeben
|
||||||
|
connectButton->setChecked(true); // connect Taste "druecken"
|
||||||
|
|
||||||
|
myTO->start(100); // restart
|
||||||
|
myStep++;
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (myStep==1)
|
||||||
|
{
|
||||||
|
if (!myTO->isActive())
|
||||||
|
{
|
||||||
|
if (HWaccess->dc_isPortOpen())
|
||||||
|
myStep++;
|
||||||
|
else
|
||||||
|
myStep=99; // stop automatic connection and wait for manual start
|
||||||
|
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=99; // stop automatic connection and wait for manual start
|
||||||
|
myTO->start(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (myStep==4)
|
||||||
|
{
|
||||||
|
HWaccess->dc_autoRequest(1);
|
||||||
|
AutSendButton->setChecked(true); // taste "druecken"
|
||||||
|
myStep++;
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (myStep==5)
|
||||||
|
{
|
||||||
|
// got next screen:
|
||||||
|
//myNextStep=2; // nicht bei CArun
|
||||||
|
myStep++;
|
||||||
|
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (myStep==6)
|
||||||
|
{
|
||||||
|
// stop here, everything done
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (myStep==7)
|
||||||
|
{
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myNextStep)
|
||||||
|
{
|
||||||
|
//qDebug()<<"fenster1 working: "<< myNextStep;
|
||||||
|
*nextScreen=myNextStep;
|
||||||
|
myNextStep=0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void T_winComPort::updateGui(void)
|
||||||
|
{
|
||||||
|
QByteArray myBA;
|
||||||
|
QString ms;
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getTxt4RsDiagWin();
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
myDiagWindow->putText(ms);
|
||||||
|
HWaccess->dc_clrTxt4RsDiagWin();
|
||||||
|
}
|
||||||
|
|
||||||
|
ms=HWaccess->dc_get2ndTxt4RsDiagWin();
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
myDiagWindow->putText(ms);
|
||||||
|
HWaccess->dc_clr2ndTxt4RsDiagWin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// state of the COM Port (open, closed)
|
||||||
|
ms=HWaccess->dc_getSerialState();
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelComState->setText(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
// I Statuszeile Handshakes (serial Control)
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getTxt4HsStateLine();
|
||||||
|
if (!connectButton->isChecked())
|
||||||
|
ms="";
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelHandshakes->setText(ms);
|
||||||
|
HWaccess->dc_clrTxt4HsStateLine();
|
||||||
|
// clear to avoid multiple displaying
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// II Master receive state (empfangenes Telgramm OK? crc? length? )
|
||||||
|
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getTxt4masterStateLine();
|
||||||
|
if (!connectButton->isChecked())
|
||||||
|
ms="---";
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelRecieveFrame->setText(ms);
|
||||||
|
HWaccess->dc_clrTxt4masterStateLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
||||||
|
// entweder Empfangsfehler anzeigen (crc? length?) oder result OUT-OK, OUT_ERR, IN_OK, IN_ERR
|
||||||
|
// Hintergrund: wenn der Slave Fehler im Master-Telegramm gefunden hat, dann kann er es auch
|
||||||
|
// nicht verwenden und nichts ausgeben oder einlesen
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getTxt4resultStateLine();
|
||||||
|
if (!connectButton->isChecked())
|
||||||
|
ms="---";
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelResults->setText(ms);
|
||||||
|
HWaccess->dc_clrTxt4resultStateLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// IV Statuszeile Empfangsdaten
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getdataStateLine();
|
||||||
|
if (!connectButton->isChecked())
|
||||||
|
ms="---";
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelDataState->setText(ms);
|
||||||
|
HWaccess->dc_clrTxt4dataStateLine();
|
||||||
|
// clear to avoid multiple displaying
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 5. Zeile: Datif Ergebnis, Daten brauchbar?
|
||||||
|
|
||||||
|
ms=HWaccess->dc_getdatifLine();
|
||||||
|
if (!connectButton->isChecked())
|
||||||
|
ms="---";
|
||||||
|
if (ms.length()>1) // sonst ständig scrolling
|
||||||
|
{
|
||||||
|
LabelDatif->setText(ms);
|
||||||
|
HWaccess->dc_clrTxt4datifLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
107
dCArun/win01_com.h
Executable file
107
dCArun/win01_com.h
Executable file
@@ -0,0 +1,107 @@
|
|||||||
|
#ifndef WINCOMPORT_H
|
||||||
|
#define WINCOMPORT_H
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QSerialPortInfo>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QRadioButton>
|
||||||
|
//#include "tslib.h"
|
||||||
|
//#include "stepList.h" // define all working chain steps here
|
||||||
|
//#include "datei.h"
|
||||||
|
#include "plugin.h"
|
||||||
|
//#include "globVars.h"
|
||||||
|
|
||||||
|
class Console : public QPlainTextEdit
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Console(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
void putData(const QByteArray &data);
|
||||||
|
void putText(QString text);
|
||||||
|
};
|
||||||
|
|
||||||
|
class T_winComPort : public QWidget // former TabComport
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Console *myDiagWindow; // Ausgabefenster
|
||||||
|
QComboBox *CB_portSel;
|
||||||
|
//QComboBox *CB_baudSel;
|
||||||
|
QPushButton *connectButton;
|
||||||
|
QPushButton *AutSendButton;
|
||||||
|
QPushButton *TestButton;
|
||||||
|
QPushButton *refreshButton;
|
||||||
|
|
||||||
|
QLabel *LabelComState; // Statusanzeige
|
||||||
|
QLabel *LabelPort;
|
||||||
|
QLabel *LabelHandshakes;
|
||||||
|
QLabel *LabelRecieveFrame;
|
||||||
|
QLabel *LabelResults;
|
||||||
|
QLabel *LabelDataState;
|
||||||
|
QLabel *LabelDatif;
|
||||||
|
|
||||||
|
QGridLayout *myTabComLayout;
|
||||||
|
void subPortInfo();
|
||||||
|
hwinf *HWaccess;
|
||||||
|
void updateGui(void);
|
||||||
|
uint16_t myNextStep;
|
||||||
|
uint8_t myStep;
|
||||||
|
QTimer *myTO;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void callOpenSerial();
|
||||||
|
void callCloseSerial();
|
||||||
|
void callAutoSend();
|
||||||
|
//void tabComTime100ms();
|
||||||
|
void callConnectToggle();
|
||||||
|
void getDcTestRS232();
|
||||||
|
void callRefresh(void);
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit T_winComPort(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
|
||||||
|
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
|
||||||
|
// useNavi=0: no change
|
||||||
|
// bit0,1: enable/disable button "next"
|
||||||
|
// bit2,3: enable/disable button "home"
|
||||||
|
// bit4,5: enable/disable button "back"
|
||||||
|
bool working (uint16_t *nextScreen, uint8_t *useNavi);
|
||||||
|
~T_winComPort();
|
||||||
|
|
||||||
|
void writeRSdiagBytes(const QByteArray &bytarray);
|
||||||
|
void writeRSdiagText(QString text);
|
||||||
|
void writeComState(const QString text);
|
||||||
|
void writeDataState(const QString text);
|
||||||
|
void setButtons4autoStart();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void connectButtonPressed();
|
||||||
|
void closeButtonPressed();
|
||||||
|
void autoSendButtonIsOn();
|
||||||
|
void autoSendButtonIsOff();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void newBaud(void); // just for test
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void Nav_back(void);
|
||||||
|
void Nav_home(void);
|
||||||
|
void Nav_next(void);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -3,7 +3,7 @@
|
|||||||
#ifndef SER_H
|
#ifndef SER_H
|
||||||
#define SER_H
|
#define SER_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QObject>
|
#include <QMainWindow>
|
||||||
//#include <QString>
|
//#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
|
@@ -133,8 +133,8 @@
|
|||||||
#define SENDCOMBINED 0
|
#define SENDCOMBINED 0
|
||||||
|
|
||||||
|
|
||||||
|
class hwinf;
|
||||||
|
class DownloadThread;
|
||||||
class T_datif : public QObject
|
class T_datif : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -165,13 +165,15 @@ class T_datif : public QObject
|
|||||||
T_prot *myDCIF;
|
T_prot *myDCIF;
|
||||||
QTimer *datif_trigger;
|
QTimer *datif_trigger;
|
||||||
uint8_t selectedSlaveAddr;
|
uint8_t selectedSlaveAddr;
|
||||||
|
DownloadThread *m_downloadThread;
|
||||||
|
hwinf *m_hw;
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#ifndef DATEI_H
|
#ifndef DATEI_H
|
||||||
#define DATEI_H
|
#define DATEI_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@@ -26,7 +26,6 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
#ifndef hwapi_H
|
#ifndef hwapi_H
|
||||||
#define hwapi_H
|
#define hwapi_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -38,11 +37,11 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "storeINdata.h"
|
#include "storeINdata.h"
|
||||||
#include "dcBL.h"
|
#include "dcBL.h"
|
||||||
//#include <../plugins/interfaces.h>
|
#include "interfaces.h"
|
||||||
#include "shared_mem_buffer.h"
|
#include "shared_mem_buffer.h"
|
||||||
#include "runProc.h"
|
#include "runProc.h"
|
||||||
#include "interfaces.h"
|
#include "download_thread.h"
|
||||||
|
#include "reporting_thread.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* select Plugin Type here
|
* select Plugin Type here
|
||||||
@@ -74,13 +73,10 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
|||||||
//#undef THIS_IS_CA_MASTER
|
//#undef THIS_IS_CA_MASTER
|
||||||
|
|
||||||
//for CAmaster:
|
//for CAmaster:
|
||||||
//#define THIS_IS_CA_MASTER
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QSharedMemory;
|
class QSharedMemory;
|
||||||
class DownloadThread;
|
|
||||||
class ReportingThread;
|
class ReportingThread;
|
||||||
|
class DownloadThread;
|
||||||
class hwapi : public QObject,
|
class hwapi : public QObject,
|
||||||
public hwinf
|
public hwinf
|
||||||
{
|
{
|
||||||
@@ -94,10 +90,9 @@ private:
|
|||||||
QSharedMemory *m_sharedMem;
|
QSharedMemory *m_sharedMem;
|
||||||
ReportingThread *m_reportingThread;
|
ReportingThread *m_reportingThread;
|
||||||
DownloadThread *m_downloadThread;
|
DownloadThread *m_downloadThread;
|
||||||
//QTimer *hwapi_triggerBL;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QObject *parent = nullptr);
|
explicit hwapi(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
#ifdef THIS_IS_CA_MASTER
|
||||||
@@ -1301,15 +1296,8 @@ public:
|
|||||||
|
|
||||||
uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const override;
|
uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const override;
|
||||||
// returns number of collected bank notes since start-command (current transaction)
|
// returns number of collected bank notes since start-command (current transaction)
|
||||||
// return value: numbers of bills or 99 in case of error
|
// latestBill: last accepted bank note, value in cent
|
||||||
// latestBill: not used
|
// currentNotes an array with up to 16 (further) notes collected
|
||||||
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
|
|
||||||
// in normal case:
|
|
||||||
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
|
|
||||||
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
|
|
||||||
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
|
|
||||||
// currentNotes[2]: total sum of bills in cent, low word (16bit)
|
|
||||||
// currentNotes[3]: total sum of bills in cent, high word (16bit)
|
|
||||||
|
|
||||||
void bna_requestStackerLevel(void) const override;
|
void bna_requestStackerLevel(void) const override;
|
||||||
|
|
||||||
@@ -1318,9 +1306,6 @@ public:
|
|||||||
// countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker
|
// countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker
|
||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
bool cash_isCollectionStarted(void) const override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// download device controller
|
// download device controller
|
||||||
bool dcDownloadRequest(QString const &fileToDownload) const override;
|
bool dcDownloadRequest(QString const &fileToDownload) const override;
|
||||||
@@ -1334,6 +1319,7 @@ public:
|
|||||||
bool dcDownloadReportRunning() const override;
|
bool dcDownloadReportRunning() const override;
|
||||||
bool dcDownloadReportFinished() override;
|
bool dcDownloadReportFinished() override;
|
||||||
|
|
||||||
|
|
||||||
bool dcDownloadThreadStart() override;
|
bool dcDownloadThreadStart() override;
|
||||||
bool dcDownloadThreadRunning() const override;
|
bool dcDownloadThreadRunning() const override;
|
||||||
void dcDownloadThreadFinalize(DownloadThread *) override;
|
void dcDownloadThreadFinalize(DownloadThread *) override;
|
||||||
@@ -1358,36 +1344,34 @@ public:
|
|||||||
|
|
||||||
virtual QObject const *getAPI() override;
|
virtual QObject const *getAPI() override;
|
||||||
|
|
||||||
signals:
|
signals: // for download
|
||||||
void hwapi_reportDCDownloadStatus(QString const&) const override;
|
void hwapi_reportDCDownloadStatus(QString const&) const;
|
||||||
void hwapi_reportDCDownloadSuccess(QString const&) const override;
|
void hwapi_reportDCDownloadSuccess(QString const&) const;
|
||||||
void hwapi_reportDCDownloadFailure(QString const&) const override;
|
void hwapi_reportDCDownloadFailure(QString const&) const;
|
||||||
|
// already declared in interfaces.h
|
||||||
|
void hwapi_templatePrintFinished_OK(void) const;
|
||||||
|
void hwapi_templatePrintFinished_Err(void) const;
|
||||||
|
|
||||||
void hwapi_templatePrintFinished_OK(void) const override;
|
void hwapi_coinCollectionJustStarted(void) const;
|
||||||
void hwapi_templatePrintFinished_Err(void) const override;
|
void hwapi_coinCollectionAborted(void) const;
|
||||||
|
|
||||||
void hwapi_coinCollectionJustStarted(void) const override;
|
void hwapi_gotNewCoin(void) const;
|
||||||
void hwapi_coinCollectionAborted(void) const override;
|
void hwapi_payStopByMax(void) const;
|
||||||
|
void hwapi_payStopByPushbutton(void) const;
|
||||||
|
|
||||||
void hwapi_gotNewCoin(void) const override;
|
void hwapi_payStopByEscrow(void) const;
|
||||||
void hwapi_payStopByMax(void) const override;
|
void hwapi_payStopByError(void) const;
|
||||||
void hwapi_payStopByPushbutton(void) const override;
|
void hwapi_payStopByTimeout(void) const;
|
||||||
|
void hwapi_payCancelled(void) const;
|
||||||
void hwapi_payStopByEscrow(void) const override;
|
void hwapi_coinProcessJustStopped(void) const;
|
||||||
void hwapi_payStopByError(void) const override;
|
|
||||||
void hwapi_payStopByTimeout(void) const override;
|
|
||||||
void hwapi_payCancelled(void) const override;
|
|
||||||
void hwapi_coinProcessJustStopped(void) const override;
|
|
||||||
|
|
||||||
// new from 2023.06.12
|
// new from 2023.06.12
|
||||||
void hwapi_doorServiceDoorOpened(void) const override;
|
void hwapi_doorServiceDoorOpened(void) const;
|
||||||
void hwapi_doorVaultDoorOpened(void) const override;
|
void hwapi_doorVaultDoorOpened(void) const;
|
||||||
void hwapi_doorCoinBoxRemoved(void) const override;
|
void hwapi_doorCoinBoxRemoved(void) const;
|
||||||
void hwapi_doorCoinBoxInserted(void) const override;
|
void hwapi_doorCoinBoxInserted(void) const;
|
||||||
void hwapi_doorCBinAndAllDoorsClosed(void) const override;
|
void hwapi_doorCBinAndAllDoorsClosed(void) const;
|
||||||
void hwapi_doorAllDoorsClosed(void) const override;
|
void hwapi_doorAllDoorsClosed(void) const;
|
||||||
|
|
||||||
void hwapi_coinAttached() const override;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//void hwapi_slotPrintFinished_OK(void);
|
//void hwapi_slotPrintFinished_OK(void);
|
||||||
@@ -1415,7 +1399,8 @@ signals:
|
|||||||
void sub_slotCoin15(void);
|
void sub_slotCoin15(void);
|
||||||
void sub_slotCoin16(void);
|
void sub_slotCoin16(void);
|
||||||
|
|
||||||
void coinAttached();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +25,6 @@ struct T_emp
|
|||||||
|
|
||||||
// dynamic:
|
// dynamic:
|
||||||
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
||||||
/*
|
|
||||||
// 0=start command
|
// 0=start command
|
||||||
// 1=powered, do emp ini, send reset
|
// 1=powered, do emp ini, send reset
|
||||||
// 2=delay
|
// 2=delay
|
||||||
@@ -40,7 +40,7 @@ struct T_emp
|
|||||||
// 90: stop all, 1s delay
|
// 90: stop all, 1s delay
|
||||||
// 99: off, all stopped
|
// 99: off, all stopped
|
||||||
|
|
||||||
*/
|
|
||||||
uint8_t pollingRunning;
|
uint8_t pollingRunning;
|
||||||
uint8_t paymentRunning;
|
uint8_t paymentRunning;
|
||||||
|
|
||||||
@@ -170,7 +170,6 @@ struct T_vaultRecord
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ATTENTION: struct length must be 64 exactly!!!
|
|
||||||
struct T_moduleCondition
|
struct T_moduleCondition
|
||||||
{
|
{
|
||||||
// store conditon of all system components, hold in RAM
|
// store conditon of all system components, hold in RAM
|
||||||
@@ -183,53 +182,44 @@ struct T_moduleCondition
|
|||||||
uint8_t ram;
|
uint8_t ram;
|
||||||
uint8_t intEe;
|
uint8_t intEe;
|
||||||
uint8_t extEe;
|
uint8_t extEe;
|
||||||
|
|
||||||
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
||||||
uint8_t boardHw;
|
uint8_t boardHw;
|
||||||
uint8_t printer;
|
uint8_t printer;
|
||||||
uint8_t modem;
|
uint8_t modem;
|
||||||
|
|
||||||
uint8_t signal; // 1...99
|
uint8_t signal; // 1...99
|
||||||
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
||||||
uint8_t mdbBus;
|
uint8_t mdbBus;
|
||||||
// 10
|
|
||||||
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
||||||
|
|
||||||
uint8_t coinEscrow;
|
uint8_t coinEscrow;
|
||||||
uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
|
uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
|
||||||
uint8_t creditTerm;
|
uint8_t creditTerm;
|
||||||
uint8_t coinReject;
|
uint8_t coinReject;
|
||||||
|
|
||||||
uint8_t coinSafe;
|
uint8_t coinSafe;
|
||||||
uint8_t billSafe;
|
uint8_t billSafe;
|
||||||
uint8_t voltage; // 1:11..14V
|
uint8_t voltage; // 1:11..14V
|
||||||
uint8_t temper;
|
uint8_t temper;
|
||||||
|
|
||||||
uint8_t poweronTest;
|
uint8_t poweronTest;
|
||||||
// 20
|
|
||||||
uint8_t doorState; // 1: alles zu 200: tuer offen + bit1(S) +bit2(CB) + bit3(CB)
|
uint8_t doorState; // 1: alles zu 200: tuer offen + bit1(S) +bit2(CB) + bit3(CB)
|
||||||
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
||||||
uint8_t changer; // can only be tested by usage
|
uint8_t changer; // can only be tested by usage
|
||||||
|
|
||||||
uint8_t coinBlocker; // can only be tested by usage
|
uint8_t coinBlocker; // can only be tested by usage
|
||||||
uint8_t billReader; // can only be tested by usage
|
uint8_t billReader; // can only be tested by usage
|
||||||
uint8_t ResetReason;
|
uint8_t ResetReason;
|
||||||
uint8_t allModulesChecked;
|
uint8_t allModulesChecked;
|
||||||
|
|
||||||
uint8_t alarmState;
|
uint8_t alarmState;
|
||||||
uint8_t res11;
|
uint8_t res11;
|
||||||
uint8_t res12;
|
uint8_t res12;
|
||||||
// 30
|
|
||||||
uint8_t res13;
|
uint8_t res13;
|
||||||
uint8_t padd01;
|
// 31
|
||||||
uint8_t padd02;
|
|
||||||
uint8_t padd03;
|
|
||||||
uint32_t padd04;
|
|
||||||
uint32_t padd05;
|
|
||||||
uint32_t padd06;
|
|
||||||
uint32_t padd07;
|
|
||||||
// 50
|
|
||||||
uint32_t padd08;
|
|
||||||
uint32_t padd09;
|
|
||||||
uint32_t padd10;
|
|
||||||
uint16_t padd11;
|
|
||||||
// 64
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ATTENTION: struct length must be 64 exactly!!!
|
|
||||||
struct T_dynamicCondition
|
struct T_dynamicCondition
|
||||||
{
|
{
|
||||||
char allDoorsDebounced;
|
char allDoorsDebounced;
|
||||||
@@ -238,11 +228,10 @@ struct T_dynamicCondition
|
|||||||
char upperDoor; // 99: undefined 0:closed 1:open
|
char upperDoor; // 99: undefined 0:closed 1:open
|
||||||
char middleDoor; // 99: undefined 0:closed 1:open
|
char middleDoor; // 99: undefined 0:closed 1:open
|
||||||
char lowerDoor; // 99: undefined 0:closed 1:open
|
char lowerDoor; // 99: undefined 0:closed 1:open
|
||||||
char coinAttached;
|
char reserve;
|
||||||
char billBox;
|
char billBox;
|
||||||
char modeAbrech;
|
char modeAbrech;
|
||||||
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
||||||
// 10
|
|
||||||
char nowCardTest;
|
char nowCardTest;
|
||||||
char nowPayment; // not used, always 0
|
char nowPayment; // not used, always 0
|
||||||
char lastMifCardType;
|
char lastMifCardType;
|
||||||
@@ -250,7 +239,6 @@ struct T_dynamicCondition
|
|||||||
uint8_t lastVDoorState;
|
uint8_t lastVDoorState;
|
||||||
uint8_t lastCBstate;
|
uint8_t lastCBstate;
|
||||||
char paymentInProgress;
|
char paymentInProgress;
|
||||||
// Version Szeged: aug2023
|
|
||||||
// 0: stopped by timeout
|
// 0: stopped by timeout
|
||||||
// 1: running 2: wait4lastCoin
|
// 1: running 2: wait4lastCoin
|
||||||
// 3: payment stopped manually, coins in Escrow
|
// 3: payment stopped manually, coins in Escrow
|
||||||
@@ -259,25 +247,9 @@ struct T_dynamicCondition
|
|||||||
// 6: coins encashed 7:coins returned
|
// 6: coins encashed 7:coins returned
|
||||||
// 8: CoinChecker or MDB on Error
|
// 8: CoinChecker or MDB on Error
|
||||||
|
|
||||||
// since Schoenau with bill and changer, nov2023
|
|
||||||
//0 = no payment
|
|
||||||
//will be set to 1 by cash_startCollection()
|
|
||||||
//neu 1: wait for devices getting ready for payment
|
|
||||||
//2 = payment,
|
|
||||||
//3 = wait for last coin/bill
|
|
||||||
//4 = Bezahlvorgang manuell beendet
|
|
||||||
//5 = payment stopped autom, amount collected, coins in Escrow
|
|
||||||
//6 = Bezahlvorgang beendet weil ZK voll
|
|
||||||
//4,5,6: payment done, keep on polling, wait for cash or return command
|
|
||||||
//7 = encash collected money from coin escrow into cash box
|
|
||||||
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
|
|
||||||
//9 = wait for changer result
|
|
||||||
//10= print refund receipt with "amountToReturn"
|
|
||||||
|
|
||||||
|
|
||||||
char res1;
|
char res1;
|
||||||
uint16_t U_Batt;
|
uint16_t U_Batt;
|
||||||
// 20
|
|
||||||
uint16_t Temperatur;
|
uint16_t Temperatur;
|
||||||
uint16_t nrCoinsInBox;
|
uint16_t nrCoinsInBox;
|
||||||
uint32_t amountInBox;
|
uint32_t amountInBox;
|
||||||
@@ -287,10 +259,10 @@ struct T_dynamicCondition
|
|||||||
char jsonValid_device;
|
char jsonValid_device;
|
||||||
char jsonValid_cash;
|
char jsonValid_cash;
|
||||||
char jsonValid_print;
|
char jsonValid_print;
|
||||||
// 40
|
|
||||||
char jsonValid_serial;
|
char jsonValid_serial;
|
||||||
char jsonValid_time;
|
char jsonValid_time;
|
||||||
char lastFileType;
|
char lastFileType;
|
||||||
|
// 44
|
||||||
uint8_t MifCardHolder[8];
|
uint8_t MifCardHolder[8];
|
||||||
uint8_t resultOfLastTemplPrint;
|
uint8_t resultOfLastTemplPrint;
|
||||||
// 0: unknown or printing in progress
|
// 0: unknown or printing in progress
|
||||||
@@ -304,15 +276,7 @@ struct T_dynamicCondition
|
|||||||
// bit5: printer not ready
|
// bit5: printer not ready
|
||||||
uint8_t startupTestIsRunning;
|
uint8_t startupTestIsRunning;
|
||||||
|
|
||||||
uint8_t padd01;
|
//54
|
||||||
uint8_t padd02;
|
|
||||||
uint8_t padd03;
|
|
||||||
//50
|
|
||||||
uint32_t padd04;
|
|
||||||
uint32_t padd05;
|
|
||||||
uint32_t padd06;
|
|
||||||
uint16_t padd07;
|
|
||||||
// 64
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_extTime
|
struct T_extTime
|
||||||
@@ -349,7 +313,6 @@ struct T_extTime
|
|||||||
typedef uint8_t UCHAR;
|
typedef uint8_t UCHAR;
|
||||||
typedef uint16_t UINT;
|
typedef uint16_t UINT;
|
||||||
|
|
||||||
// ATTENTION: struct length must be 64 exactly!!!
|
|
||||||
struct T_devices
|
struct T_devices
|
||||||
{
|
{
|
||||||
// set by master, used(1) or notused (0) or type 2....20
|
// set by master, used(1) or notused (0) or type 2....20
|
||||||
@@ -358,33 +321,27 @@ struct T_devices
|
|||||||
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW)
|
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW)
|
||||||
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
||||||
UCHAR solarPower; // 1:sleep allowed 0: no sleep
|
UCHAR solarPower; // 1:sleep allowed 0: no sleep
|
||||||
|
//UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
|
||||||
|
|
||||||
UCHAR kindOfModem; // 0:off 1:Sunlink
|
UCHAR kindOfModem; // 0:off 1:Sunlink
|
||||||
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
||||||
UCHAR CoinEscrow;
|
UCHAR CoinEscrow;
|
||||||
UCHAR CoinRejectUnit;
|
UCHAR CoinRejectUnit;
|
||||||
|
|
||||||
UCHAR CoinShutter;
|
UCHAR CoinShutter;
|
||||||
UCHAR BillAcceptor;
|
UCHAR BillAcceptor;
|
||||||
// 10
|
|
||||||
UCHAR usevaultLock;
|
UCHAR usevaultLock;
|
||||||
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
||||||
|
|
||||||
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
||||||
UCHAR printAccReceipt; // 0/1
|
UCHAR printAccReceipt; // 0/1
|
||||||
UCHAR printDoorReceipt;
|
UCHAR printDoorReceipt;
|
||||||
UCHAR printTokenTicket;
|
UCHAR printTokenTicket;
|
||||||
|
|
||||||
UINT VaultFullWarnLevel;
|
UINT VaultFullWarnLevel;
|
||||||
UINT VaultFullErrorLevel;
|
UINT VaultFullErrorLevel;
|
||||||
// 30
|
|
||||||
UINT BattEmptyWarnLevel;
|
UINT BattEmptyWarnLevel;
|
||||||
UINT BattEmptyErrorLevel;
|
UINT BattEmptyErrorLevel;
|
||||||
uint32_t padd01;
|
|
||||||
uint32_t padd02;
|
|
||||||
uint32_t padd03;
|
|
||||||
uint32_t padd04;
|
|
||||||
uint32_t padd05;
|
|
||||||
uint32_t padd06;
|
|
||||||
uint32_t padd07;
|
|
||||||
uint16_t padd08;
|
|
||||||
// 64
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -441,6 +398,7 @@ struct T_bna
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class hwapi;
|
||||||
class DownloadThread;
|
class DownloadThread;
|
||||||
class hwinf
|
class hwinf
|
||||||
{
|
{
|
||||||
@@ -2297,23 +2255,14 @@ public:
|
|||||||
virtual void bna_requestCurrentNotes() const {}
|
virtual void bna_requestCurrentNotes() const {}
|
||||||
// send command to DC in order to get transaction data
|
// send command to DC in order to get transaction data
|
||||||
|
|
||||||
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const
|
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const {
|
||||||
{
|
|
||||||
Q_UNUSED(latestBill);
|
Q_UNUSED(latestBill);
|
||||||
Q_UNUSED(currentNotes);
|
Q_UNUSED(currentNotes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// returns number of collected bank notes since start-command (current transaction)
|
// returns number of collected bank notes since start-command (current transaction)
|
||||||
// return value: numbers of bills or 99 in case of error
|
// latestBill: last accepted bank note, value in cent
|
||||||
// latestBill: not used
|
// currentNotes an array with up to 16 (further) notes collected
|
||||||
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
|
|
||||||
// in normal case:
|
|
||||||
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
|
|
||||||
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
|
|
||||||
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
|
|
||||||
// currentNotes[2]: total sum of bills in cent, low word (16bit)
|
|
||||||
// currentNotes[3]: total sum of bills in cent, high word (16bit)
|
|
||||||
|
|
||||||
|
|
||||||
virtual void bna_requestStackerLevel() const {}
|
virtual void bna_requestStackerLevel() const {}
|
||||||
|
|
||||||
@@ -2326,9 +2275,6 @@ public:
|
|||||||
// countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker
|
// countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker
|
||||||
// countOfBills[1] for 10€ and so on
|
// countOfBills[1] for 10€ and so on
|
||||||
|
|
||||||
virtual bool cash_isCollectionStarted(void) const {return false;}
|
|
||||||
// return true is coin collection in DC is running
|
|
||||||
|
|
||||||
|
|
||||||
// download device controller
|
// download device controller
|
||||||
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
|
||||||
@@ -2380,50 +2326,12 @@ public:
|
|||||||
|
|
||||||
virtual QObject const *getAPI() { return nullptr; }
|
virtual QObject const *getAPI() { return nullptr; }
|
||||||
|
|
||||||
|
signals: // for download
|
||||||
signals:
|
void hwapi_reportDCDownloadStatus(QString const&) const;
|
||||||
/*
|
void hwapi_reportDCDownloadSuccess(QString const&) const;
|
||||||
NOTE: the difference between a virtual Qt signal and a normal Qt signal:
|
void hwapi_reportDCDownloadFailure(QString const&) const;
|
||||||
A Qt virtual signal is a connection that is established using a pointer
|
|
||||||
or reference and is not connected to an object or data. It is therefore
|
|
||||||
not bound to a particular object, but to a specific class (object type).
|
|
||||||
Qt virtual signals are useful because they allow you to create
|
|
||||||
connections without worrying about whether an object or a specific data
|
|
||||||
element has been destroyed.
|
|
||||||
https://www.youtube.com/watch?v=HTH3VFfqsXw
|
|
||||||
|
|
||||||
*/
|
|
||||||
virtual void hwapi_reportDCDownloadStatus(QString const&) const {}
|
|
||||||
virtual void hwapi_reportDCDownloadSuccess(QString const&) const {}
|
|
||||||
virtual void hwapi_reportDCDownloadFailure(QString const&) const {}
|
|
||||||
|
|
||||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
|
||||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
|
||||||
|
|
||||||
virtual void hwapi_coinCollectionJustStarted(void) const=0;
|
|
||||||
virtual void hwapi_coinCollectionAborted(void) const=0;
|
|
||||||
|
|
||||||
virtual void hwapi_gotNewCoin(void) const=0;
|
|
||||||
virtual void hwapi_payStopByMax(void) const=0;
|
|
||||||
virtual void hwapi_payStopByPushbutton(void) const=0;
|
|
||||||
|
|
||||||
virtual void hwapi_payStopByEscrow(void) const=0;
|
|
||||||
virtual void hwapi_payStopByError(void) const=0;
|
|
||||||
virtual void hwapi_payStopByTimeout(void) const=0;
|
|
||||||
virtual void hwapi_payCancelled(void) const=0;
|
|
||||||
virtual void hwapi_coinProcessJustStopped(void) const=0;
|
|
||||||
|
|
||||||
virtual void hwapi_doorServiceDoorOpened(void) const=0;
|
|
||||||
virtual void hwapi_doorVaultDoorOpened(void) const=0;
|
|
||||||
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
|
|
||||||
virtual void hwapi_doorCoinBoxInserted(void) const=0;
|
|
||||||
virtual void hwapi_doorCBinAndAllDoorsClosed(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
|
|
||||||
void hwapi_templatePrintFinished_OK() const;
|
void hwapi_templatePrintFinished_OK() const;
|
||||||
void hwapi_templatePrintFinished_Err() const;
|
void hwapi_templatePrintFinished_Err() const;
|
||||||
|
|
||||||
@@ -2446,7 +2354,6 @@ signals:
|
|||||||
void hwapi_doorCoinBoxInserted() const;
|
void hwapi_doorCoinBoxInserted() const;
|
||||||
void hwapi_doorCBinAndAllDoorsClosed() const;
|
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||||
void hwapi_doorAllDoorsClosed() const;
|
void hwapi_doorAllDoorsClosed() const;
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -2509,12 +2416,10 @@ signals:
|
|||||||
|
|
||||||
// hier dazwischen: Umstellung ALLER Prototypen
|
// hier dazwischen: Umstellung ALLER Prototypen
|
||||||
// hier von =0 auf {} durch Gerhard
|
// hier von =0 auf {} durch Gerhard
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2"
|
|
||||||
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2"
|
||||||
// 7.11.2023: bna functions activated
|
// 7.11.2023: bna functions activated
|
||||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.3"
|
|
||||||
// 14.3.24:new function bool hwapi::cash_isCollectionStarted(void) const
|
|
||||||
// padding three struct to 64 byte to avoid stack overflow when using
|
|
||||||
// signal coin attached is much faster now
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#ifndef SERIAL_FRAME_H
|
#ifndef SERIAL_FRAME_H
|
||||||
#define SERIAL_FRAME_H
|
#define SERIAL_FRAME_H
|
||||||
#include <QObject>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "tslib.h"
|
#include "tslib.h"
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
#define STARTSIGN_RECEIVE_LONG 0x5D
|
#define STARTSIGN_RECEIVE_LONG 0x5D
|
||||||
|
|
||||||
|
|
||||||
class T_prot : public QObject
|
class T_prot : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -2,8 +2,7 @@
|
|||||||
#ifndef RUN_PROCESS_H
|
#ifndef RUN_PROCESS_H
|
||||||
#define RUN_PROCESS_H
|
#define RUN_PROCESS_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <QMainWindow>
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "tslib.h"
|
#include "tslib.h"
|
||||||
@@ -15,7 +14,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"
|
||||||
@@ -27,7 +25,7 @@
|
|||||||
class T_runProc : public QObject
|
class T_runProc : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QTimer *hwapi_TimerPayment, *hwapi_triggerBL, *myTO;
|
QTimer *hwapi_TimerPayment, *hwapi_triggerBL;
|
||||||
|
|
||||||
void sub_emp_getAllParameters(struct T_emp *emp);
|
void sub_emp_getAllParameters(struct T_emp *emp);
|
||||||
void changer_getAllParameters(struct T_changer *mw);
|
void changer_getAllParameters(struct T_changer *mw);
|
||||||
@@ -36,10 +34,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 +79,6 @@ signals:
|
|||||||
void runProc_doorCBinAndAllDoorsClosed(void);
|
void runProc_doorCBinAndAllDoorsClosed(void);
|
||||||
void runProc_doorAllDoorsClosed(void);
|
void runProc_doorAllDoorsClosed(void);
|
||||||
|
|
||||||
void runProc_coinAttached();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -300,6 +300,7 @@ struct SharedMem
|
|||||||
|
|
||||||
uint8_t p_nextFDcmdsInQueue;
|
uint8_t p_nextFDcmdsInQueue;
|
||||||
|
|
||||||
|
|
||||||
// download of device controller and json files
|
// download of device controller and json files
|
||||||
struct DCDownload {
|
struct DCDownload {
|
||||||
enum class FILE_INDEX {
|
enum class FILE_INDEX {
|
||||||
@@ -321,7 +322,6 @@ struct SharedMem
|
|||||||
std::atomic_bool m_finished{false};
|
std::atomic_bool m_finished{false};
|
||||||
} m_downLoadDC;
|
} m_downLoadDC;
|
||||||
|
|
||||||
|
|
||||||
static QSharedMemory *getShm(std::size_t s = 0);
|
static QSharedMemory *getShm(std::size_t s = 0);
|
||||||
|
|
||||||
static SharedMem *getData()
|
static SharedMem *getData()
|
||||||
|
@@ -527,9 +527,6 @@ void gpi_storeDcDataValid(bool isVal);
|
|||||||
|
|
||||||
bool epi_areDcDataValid();
|
bool epi_areDcDataValid();
|
||||||
|
|
||||||
void epi_setDcDataValid(void);
|
|
||||||
|
|
||||||
void epi_resetDcDataValid(void);
|
|
||||||
|
|
||||||
|
|
||||||
void epi_clearDynData(void);
|
void epi_clearDynData(void);
|
||||||
|
@@ -1,40 +1,11 @@
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
TARGET = CAmaster
|
TARGET = CAmaster
|
||||||
VERSION="1.0.1"
|
VERSION="1.0.0"
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
../include/com.h \
|
|
||||||
../include/datIf.h \
|
|
||||||
../include/prot.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
../src/com.cpp \
|
|
||||||
../src/datIf.cpp \
|
|
||||||
../src/prot.cpp
|
|
||||||
|
|
||||||
include(../DCLibraries.pri)
|
include(../DCLibraries.pri)
|
||||||
|
|
||||||
win32 {
|
|
||||||
BUILD_DATE=$$system("date /t")
|
|
||||||
BUILD_TIME=$$system("time /t")
|
|
||||||
GIT_COMMIT=""
|
|
||||||
EXTENDED_VERSION=""
|
|
||||||
EXTENDED_VERSION_LIB=""
|
|
||||||
} else {
|
|
||||||
BUILD_DATE=$$system("date +%d-%m-%y")
|
|
||||||
BUILD_TIME=$$system("date +%H:%M:%S")
|
|
||||||
|
|
||||||
GIT_COMMIT=$$system("git log -1 --format=oneline . | cut -d' ' -f1")
|
|
||||||
EXTENDED_VERSION_LIB="libCAmaster-$${VERSION}-$${GIT_COMMIT}"
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
|
||||||
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
|
||||||
DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
|
|
||||||
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
|
||||||
DEFINES+=APP_EXTENDED_VERSION_LIB=\\\"$$EXTENDED_VERSION_LIB\\\"
|
|
||||||
|
|
||||||
DEFINES+=THIS_IS_CA_MASTER
|
DEFINES+=THIS_IS_CA_MASTER
|
||||||
|
DEFINES-=THIS_IS_CA_SLAVE
|
||||||
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
|
@@ -1,30 +1,12 @@
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
TARGET = CAslave
|
TARGET = CAslave
|
||||||
VERSION="1.0.1"
|
VERSION="1.0.0"
|
||||||
|
|
||||||
include(../DCLibraries.pri)
|
include(../DCLibraries.pri)
|
||||||
|
|
||||||
win32 {
|
|
||||||
BUILD_DATE=$$system("date /t")
|
|
||||||
BUILD_TIME=$$system("time /t")
|
|
||||||
GIT_COMMIT=""
|
|
||||||
EXTENDED_VERSION=""
|
|
||||||
EXTENDED_VERSION_LIB=""
|
|
||||||
} else {
|
|
||||||
BUILD_DATE=$$system("date +%d-%m-%y")
|
|
||||||
BUILD_TIME=$$system("date +%H:%M:%S")
|
|
||||||
|
|
||||||
GIT_COMMIT=$$system("git log -1 --format=oneline . | cut -d' ' -f1")
|
|
||||||
EXTENDED_VERSION_LIB_="libCAslave-$${VERSION}-$${GIT_COMMIT}"
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINES+=APP_VERSION=\\\"$$VERSION\\\"
|
|
||||||
DEFINES+=APP_BUILD_DATE=\\\"$$BUILD_DATE\\\"
|
|
||||||
DEFINES+=APP_BUILD_TIME=\\\"$$BUILD_TIME\\\"
|
|
||||||
DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
|
||||||
DEFINES+=APP_EXTENDED_VERSION_LIB=\\\"$$EXTENDED_VERSION_LIB\\\"
|
|
||||||
|
|
||||||
DEFINES+=THIS_IS_CA_SLAVE
|
DEFINES+=THIS_IS_CA_SLAVE
|
||||||
|
DEFINES-=THIS_IS_CA_MASTER
|
||||||
|
|
||||||
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
|
108
src/datIf.cpp
108
src/datIf.cpp
@@ -1,14 +1,10 @@
|
|||||||
/*
|
|
||||||
History:
|
|
||||||
06.12.2023: weitere IN-requests in Autorequest übernommen
|
|
||||||
Umschaltung mit/ohne Verkauf, während VK nur 12 wichtige, sonst alle 36
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include "datIf.h"
|
#include "datIf.h"
|
||||||
#include "sendWRcmd.h"
|
#include "sendWRcmd.h"
|
||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "storeINdata.h"
|
#include "storeINdata.h"
|
||||||
|
#include "download_thread.h"
|
||||||
|
#include "hwapi.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <datei.h>
|
#include <datei.h>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -54,8 +50,10 @@ static uint8_t datif_pNextCmd, datif_sendSlowCmd;
|
|||||||
//#define DATIF_CTR_GOTRESPVAL 100
|
//#define DATIF_CTR_GOTRESPVAL 100
|
||||||
|
|
||||||
|
|
||||||
T_datif::T_datif(QObject *parent) : QObject(parent)
|
T_datif::T_datif(hwinf *hw, QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
m_hw = hw;
|
||||||
|
|
||||||
QByteArray myBA;
|
QByteArray myBA;
|
||||||
QDir myDir("../dmd");
|
QDir myDir("../dmd");
|
||||||
|
|
||||||
@@ -88,8 +86,7 @@ T_datif::T_datif(QObject *parent) : QObject(parent)
|
|||||||
dif_scanStep=0;
|
dif_scanStep=0;
|
||||||
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
epi_resetDcDataValid(); // data are not yet valid, no response from DC by now
|
gpi_storeDcDataValid(0); // data are not yet valid, no response from DC by now
|
||||||
|
|
||||||
datif_noResponseCtr=0;
|
datif_noResponseCtr=0;
|
||||||
|
|
||||||
datif_repeatCtr=0;
|
datif_repeatCtr=0;
|
||||||
@@ -145,14 +142,14 @@ char T_datif::datif_cycleSend()
|
|||||||
if ( !myDCIF->isPortOpen())
|
if ( !myDCIF->isPortOpen())
|
||||||
{
|
{
|
||||||
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
||||||
epi_resetDcDataValid(); // DC data not valid
|
gpi_storeDcDataValid(0); // DC data not valid
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// supervise if DC data are valid
|
// supervise if DC data are valid
|
||||||
datif_noResponseCtr++; // inc every 20ms
|
datif_noResponseCtr++; // inc every 20ms
|
||||||
if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s
|
if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s
|
||||||
epi_resetDcDataValid(); // DC data has not updated for >=5s -> no longer valid!
|
gpi_storeDcDataValid(0); // DC data has not updated for >=5s -> no longer valid!
|
||||||
|
|
||||||
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
|
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
|
||||||
if (gpi_wantToResetSupervision())
|
if (gpi_wantToResetSupervision())
|
||||||
@@ -206,8 +203,21 @@ char T_datif::datif_cycleSend()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_hw->dcDownloadRequested()) { // only happens in ca-master
|
||||||
|
m_hw->dcDownloadResetRequest();
|
||||||
|
|
||||||
|
// start download-thread.
|
||||||
|
m_downloadThread = new DownloadThread(m_hw);
|
||||||
|
m_downloadThread->start();
|
||||||
|
|
||||||
|
int cnt = 10;
|
||||||
|
while (--cnt > 0 && !m_downloadThread->isRunning()) {
|
||||||
|
QThread::msleep(100);
|
||||||
|
}
|
||||||
|
if (cnt <= 0) {
|
||||||
|
qCritical() << "DOWNLOAD-THREAD NOT RUNNING WITHIN 1000ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 17.7.2023: repeat commands if result was !=OK -------------------------------------------------------------------
|
// 17.7.2023: repeat commands if result was !=OK -------------------------------------------------------------------
|
||||||
if (datif_cmdWasPerformed==2 && doRepeat) // Cmd was not or false performed und Wiederholen erwuenscht
|
if (datif_cmdWasPerformed==2 && doRepeat) // Cmd was not or false performed und Wiederholen erwuenscht
|
||||||
@@ -345,7 +355,7 @@ char T_datif::datif_cycleSend()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dif_scanStep=0; // always start from beginning
|
dif_scanStep=0; // always start from beginning
|
||||||
epi_resetDcDataValid();
|
gpi_storeDcDataValid(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
datif_cmdWasPerformed=0; // 0: no response by now
|
datif_cmdWasPerformed=0; // 0: no response by now
|
||||||
@@ -358,20 +368,9 @@ char T_datif::datif_cycleSend()
|
|||||||
char T_datif::sendINrequestsAutomatic(void)
|
char T_datif::sendINrequestsAutomatic(void)
|
||||||
{
|
{
|
||||||
//qDebug() << "send IN request " << dif_scanStep;
|
//qDebug() << "send IN request " << dif_scanStep;
|
||||||
//uint8_t datif_autoRequCommandList[30]={11, 12, 14, 17, 18, 19, 22, 23, 27, 30,
|
// uint8_t datif_autoRequCommandList[50]={11, 12, 18, 104, 106, 103, 14, 27, 109, 17, 19, 23, 30, 31, 32, 33, 114, 35};
|
||||||
// 31, 32, 33, 35, 102, 103, 104, 106, 107, 109,
|
uint8_t datif_autoRequCommandList[30]={11, 12, 14, 17, 18, 19, 22, 23, 27, 30, 31, 32, 33, 35, 102, 103, 104, 106, 107, 109, 114,0,0,0,0,0,0,0,0,0};
|
||||||
// 114,0,0,0,0,0,0,0,0,0};
|
uint8_t datif_maxNrCommands=21, datif_sendNow;
|
||||||
|
|
||||||
// extension 6.12.23, complete list:
|
|
||||||
uint8_t datif_autoRequCommandList[40]={11, 12, 13, 14, 17, 18, 19, 21, 22, 23,
|
|
||||||
24, 25, 27, 30, 31, 32, 33, 35, 39, 40,
|
|
||||||
41, 42, 102,103,104,106,107,108,109,110,
|
|
||||||
112,113,114,115,116,0, 0, 0, 0, 0};
|
|
||||||
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
|
||||||
|
|
||||||
// send quicker while transaction is ongoing:
|
|
||||||
uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,23,0,0};
|
|
||||||
uint8_t datif_maxVendingCmds=13;
|
|
||||||
|
|
||||||
// special commands:
|
// special commands:
|
||||||
// 102: get IOs run constantly!!!
|
// 102: get IOs run constantly!!!
|
||||||
@@ -381,44 +380,40 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
// 107, 22: MDB: poll if needed
|
// 107, 22: MDB: poll if needed
|
||||||
|
|
||||||
doRepeat=true; // 20.9.23 15uhr (after release)
|
doRepeat=true; // 20.9.23 15uhr (after release)
|
||||||
|
if (datif_sendSlowCmd>0)
|
||||||
if (gpi_getNowCoinPay())
|
|
||||||
{
|
|
||||||
// send only important commands while transaction in progress
|
|
||||||
if (datif_pNextCmd>=datif_maxVendingCmds ) datif_pNextCmd=0;
|
|
||||||
datif_sendNow=datif_vendRequCommandList[datif_pNextCmd++];
|
|
||||||
if (datif_sendNow>0) // never send Command 0
|
|
||||||
{
|
|
||||||
datif_sendIOrequest(0, datif_sendNow, 0);
|
|
||||||
//qDebug() << "datif, VEND-request: " << datif_sendNow;
|
|
||||||
} else
|
|
||||||
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// no transaction, request all but request DI's more frequently
|
|
||||||
if (datif_sendSlowCmd>0) // send slow and fast commands alternating
|
|
||||||
{
|
{
|
||||||
// send special command, slowly
|
// send special command, slowly
|
||||||
if (datif_pNextCmd>=datif_maxNrCommands ) datif_pNextCmd=0;
|
|
||||||
datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++];
|
datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++];
|
||||||
|
if (datif_pNextCmd >= datif_maxNrCommands)
|
||||||
|
datif_pNextCmd=0;
|
||||||
if (datif_sendNow>0) // never send Command 0
|
if (datif_sendNow>0) // never send Command 0
|
||||||
{
|
|
||||||
datif_sendIOrequest(0, datif_sendNow, 0);
|
datif_sendIOrequest(0, datif_sendNow, 0);
|
||||||
// qDebug() << "datif, auto-requ: " << datif_sendNow;
|
else
|
||||||
} else
|
|
||||||
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
||||||
|
|
||||||
|
//qDebug()<< "datif send request " << datif_sendNow;
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (gpi_getNowCoinPay())
|
||||||
|
{
|
||||||
|
// request coin input, high priority
|
||||||
|
datif_sendIOrequest(0, 112, 0);
|
||||||
|
//qDebug()<< "datif send request 112 get coins";
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// request inputs, high priority
|
// request inputs, high priority
|
||||||
datif_sendIOrequest(0, 31, 0); // 102
|
datif_sendIOrequest(0, 31, 0); // 102
|
||||||
// while coin collection DIs are polled slower
|
// while coin collection DIs are polled slowly with datif_autoRequCommandList[]
|
||||||
//qDebug()<< "datif send requ.31 get DIs";
|
|
||||||
|
//qDebug()<< "datif send request 102 get DIs";
|
||||||
}
|
}
|
||||||
if (++datif_sendSlowCmd>1) datif_sendSlowCmd=0; // 0,1,0,1,0,1,0....
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (++datif_sendSlowCmd>1) datif_sendSlowCmd=0; // 0,1,0,1,0,1,0....
|
||||||
|
|
||||||
return 0; // 25.9.2023, wichtig sonst bleibt die komplette PTU stehen!!!!
|
return 0; // 25.9.2023, wichtig sonst bleibt die komplette PTU stehen!!!!
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -462,7 +457,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
uint32_t ultmp;
|
uint32_t ultmp;
|
||||||
//int portNr;
|
//int portNr;
|
||||||
bool ret;
|
bool ret;
|
||||||
uint8_t uctmp; //, nn; //, res; // maxai
|
uint8_t uctmp; //, res; // maxai
|
||||||
char ctmp;
|
char ctmp;
|
||||||
//static uint8_t lastResult;
|
//static uint8_t lastResult;
|
||||||
//uint8_t prnResult;
|
//uint8_t prnResult;
|
||||||
@@ -1037,13 +1032,10 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
||||||
if (RdDleng>50)
|
if (RdDleng>50)
|
||||||
{
|
{
|
||||||
epi_setDcDataValid(); // DC-Data are valid as DC responded.
|
gpi_storeDcDataValid(1); // DC-Data are valid as DC responded.
|
||||||
// Could be set to every response but this (31)
|
// Could be set to every response but this (31)
|
||||||
// is a very common and very important request
|
// is a very common and very important request
|
||||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
||||||
|
|
||||||
gpi_storeDI_CoinAttach(receivedData[6]); // new, 14.2.24 needed for direct coin insertion
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* funktioniert, ist aber nicht nötig. Signal wird nach dem shared memory erzeugt
|
/* funktioniert, ist aber nicht nötig. Signal wird nach dem shared memory erzeugt
|
||||||
prnResult=receivedData[52];
|
prnResult=receivedData[52];
|
||||||
@@ -1131,7 +1123,9 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 42: // get BNA box content and value of types
|
case 42: // get BNA box content and value of types
|
||||||
//qDebug()<< "CAslave datif_got 42";
|
// qDebug()<< "CAmaster datif_got 42 ";
|
||||||
|
// for (uctmp=0; uctmp<64; uctmp++)
|
||||||
|
// qDebug()<<receivedData[uctmp]<<" ";
|
||||||
|
|
||||||
if (RdDleng>60)
|
if (RdDleng>60)
|
||||||
{
|
{
|
||||||
|
@@ -17,19 +17,15 @@
|
|||||||
und hier in hwapi die entprellten Werte fuer Tueren und Kasse verwenden.
|
und hier in hwapi die entprellten Werte fuer Tueren und Kasse verwenden.
|
||||||
Problem war: Signal "Kasse entnommen" war zu langsam -> manchmal abr nicht gesendet
|
Problem war: Signal "Kasse entnommen" war zu langsam -> manchmal abr nicht gesendet
|
||||||
|
|
||||||
14.3.24 new function bool hwapi::cash_isCollectionStarted(void) const
|
|
||||||
padding three struct to 64 byte to avoid stack overflow when using
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hwapi.h"
|
#include "hwapi.h"
|
||||||
#include "download_thread.h"
|
|
||||||
#include "reporting_thread.h"
|
#include "reporting_thread.h"
|
||||||
|
#include "download_thread.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <QThread>
|
#include <atomic>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
|
|
||||||
static uint32_t hwapi_lastStartAmount;
|
static uint32_t hwapi_lastStartAmount;
|
||||||
static uint32_t hwapi_lastTotalAmount;
|
static uint32_t hwapi_lastTotalAmount;
|
||||||
@@ -40,15 +36,9 @@ static uint8_t bl_startupStep;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
hwapi::hwapi(QObject *parent) : QObject(parent)
|
hwapi::hwapi(QWidget *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
// constructor
|
// constructor
|
||||||
qCritical() << " hwapi::hwapi() APP_VERSION:" << APP_VERSION;
|
|
||||||
qCritical() << " hwapi::hwapi() APP_BUILD_DATE:" << APP_BUILD_DATE;
|
|
||||||
qCritical() << " hwapi::hwapi() APP_BUILD_TIME:" << APP_BUILD_TIME;
|
|
||||||
qCritical() << " hwapi::hwapi() APP_EXTENDED_VERSION:" << APP_EXTENDED_VERSION;
|
|
||||||
qCritical() << "hwapi::hwapi() APP_EXTENDED_VERSION_LIB:" << APP_EXTENDED_VERSION_LIB;
|
|
||||||
|
|
||||||
|
|
||||||
// create or attach shared memory segment
|
// create or attach shared memory segment
|
||||||
m_sharedMem = SharedMem::getShm(sizeof(SharedMem));
|
m_sharedMem = SharedMem::getShm(sizeof(SharedMem));
|
||||||
@@ -65,21 +55,9 @@ hwapi::hwapi(QObject *parent) : QObject(parent)
|
|||||||
// {
|
// {
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
#ifdef THIS_IS_CA_MASTER
|
||||||
|
myDatif = new T_datif(this); // für die CAslave-Lib auskommentieren!
|
||||||
#ifdef THIS_IS_CA_SLAVE
|
#else
|
||||||
#error "SLAVE LIB COMPILED INTO MASTER"
|
qCritical()<<"hwapi: error CAslave cannot include T_datif";
|
||||||
#endif
|
|
||||||
|
|
||||||
myDatif = new T_datif(); // für die CAslave-Lib auskommentieren!
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_SLAVE
|
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
|
||||||
#error "MASTER LIB COMPILED INTO MASTER"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// }
|
// }
|
||||||
@@ -131,11 +109,16 @@ hwapi::hwapi(QObject *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)
|
||||||
{
|
{
|
||||||
|
//cash_paymentProcessing();
|
||||||
|
//doors_supervise();
|
||||||
|
//dcBL_cycle();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,9 +212,6 @@ void hwapi::sub_slotCoin16(void)
|
|||||||
emit hwapi_doorAllDoorsClosed();
|
emit hwapi_doorAllDoorsClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::coinAttached() {
|
|
||||||
emit hwapi_coinAttached();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1812,8 +1792,6 @@ void hwapi::prn_sendText(QByteArray *buf) const
|
|||||||
uint16_t nn, pp, mm, leng_byt, leng_blk, llb, freeStak;
|
uint16_t nn, pp, mm, leng_byt, leng_blk, llb, freeStak;
|
||||||
uint8_t tmp66[66];
|
uint8_t tmp66[66];
|
||||||
|
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
|
|
||||||
@@ -2918,8 +2896,6 @@ bool hwapi::prn_printTemplate(uint8_t nrOftemplate) const
|
|||||||
{
|
{
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
|
|
||||||
@@ -3024,8 +3000,6 @@ bool hwapi::log_getVaultRecord(struct T_vaultRecord *retVR) const
|
|||||||
|
|
||||||
bool hwapi::prn_printAccountReceipt(void) const
|
bool hwapi::prn_printAccountReceipt(void) const
|
||||||
{
|
{
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
return sendFDcmd_set(154, 0,0, 0,0,0,0);
|
return sendFDcmd_set(154, 0,0, 0,0,0,0);
|
||||||
@@ -3033,8 +3007,6 @@ bool hwapi::prn_printAccountReceipt(void) const
|
|||||||
|
|
||||||
bool hwapi::prn_printTestTicket(void) const
|
bool hwapi::prn_printTestTicket(void) const
|
||||||
{
|
{
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
// return true if sending to DC OK, false if cmd-stack is full
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
@@ -3090,9 +3062,7 @@ bool hwapi::cash_cancelPayment(void) const
|
|||||||
{
|
{
|
||||||
// DB1: 1=encash 2=cancel & return coins
|
// DB1: 1=encash 2=cancel & return coins
|
||||||
// 3=stop and keep coins in escrow
|
// 3=stop and keep coins in escrow
|
||||||
//epi_setNowCoinPay(false); // new since 20.9.23
|
epi_setNowCoinPay(false); // new since 20.9.23
|
||||||
// am 6.12.23 wieder raus, waehrend Druck und wechseln auch schnell abfragen
|
|
||||||
|
|
||||||
//qCritical() << "cash cancel payment and return coins";
|
//qCritical() << "cash cancel payment and return coins";
|
||||||
return sendFDcmd_set(156, 0,0, 2,0,0,0);
|
return sendFDcmd_set(156, 0,0, 2,0,0,0);
|
||||||
}
|
}
|
||||||
@@ -3102,8 +3072,7 @@ bool hwapi::cash_stopPayment(void) const
|
|||||||
{
|
{
|
||||||
// DB1: 1=encash 2=cancel & return coins
|
// DB1: 1=encash 2=cancel & return coins
|
||||||
// 3=stop and keep coins in escrow
|
// 3=stop and keep coins in escrow
|
||||||
//epi_setNowCoinPay(false); // new since 20.9.23
|
epi_setNowCoinPay(false); // new since 20.9.23
|
||||||
// am 6.12.23 wieder raus, waehrend Druck und wechseln auch schnell abfragen
|
|
||||||
//qCritical() << "cash stop payment and keep coins in escrow";
|
//qCritical() << "cash stop payment and keep coins in escrow";
|
||||||
// qCritical() << "emitting signal StopByPushbutton 2";
|
// qCritical() << "emitting signal StopByPushbutton 2";
|
||||||
emit hwapi_payStopByPushbutton();
|
emit hwapi_payStopByPushbutton();
|
||||||
@@ -3337,15 +3306,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
|
||||||
@@ -3457,8 +3433,6 @@ bool hwapi::prn_printKombiticket(uint8_t nrOfKombi) const
|
|||||||
if ((nrOfKombi<1) || (nrOfKombi>8))
|
if ((nrOfKombi<1) || (nrOfKombi>8))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
|
|
||||||
@@ -3589,8 +3563,6 @@ bool hwapi::log_getVaultData(uint8_t *data) const
|
|||||||
// new from 1.8.23
|
// new from 1.8.23
|
||||||
bool hwapi::prn_printOneAccountReceipt(uint16_t accountNr) const
|
bool hwapi::prn_printOneAccountReceipt(uint16_t accountNr) const
|
||||||
{
|
{
|
||||||
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
|
||||||
|
|
||||||
// print one out of eight stored last accounting receipts
|
// print one out of eight stored last accounting receipts
|
||||||
// function log_getHoldAccountNumbers() gives a list of acc-Nr. of the stored receipts
|
// function log_getHoldAccountNumbers() gives a list of acc-Nr. of the stored receipts
|
||||||
epi_clearDynMachineConditions(); // 24.6.23
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
@@ -4405,17 +4377,6 @@ uint16_t hwapi::bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOf
|
|||||||
return anzahl;
|
return anzahl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// new, 14.3.24TS
|
|
||||||
bool hwapi::cash_isCollectionStarted(void) const
|
|
||||||
{
|
|
||||||
struct T_dynamicCondition myDynMachCond;
|
|
||||||
sys_getDynMachineConditions(&myDynMachCond);
|
|
||||||
if (myDynMachCond.paymentInProgress >=2)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject const *hwapi::getAPI() {
|
QObject const *hwapi::getAPI() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
23
src/main.cpp
23
src/main.cpp
@@ -1,16 +1,5 @@
|
|||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#ifndef WIN32
|
||||||
#include "tslib.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QCoreApplication a(argc, argv);
|
|
||||||
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#undef _FORTIFY_SOURCE
|
#undef _FORTIFY_SOURCE
|
||||||
|
|
||||||
@@ -18,11 +7,11 @@ int main(int argc, char *argv[])
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// Must define the interpreter to be the dynamic linker
|
// Must define the interpreter to be the dynamic linker
|
||||||
//#ifdef __LP64__
|
#ifdef __LP64__
|
||||||
//#error "__LP64__ not defined for PTU5"
|
#error "__LP64__ not defined for PTU5"
|
||||||
//#else
|
#else
|
||||||
//const char service_interp[] __attribute__((section(".interp"))) = "/lib/ld-linux-armhf.so.3";
|
const char service_interp[] __attribute__((section(".interp"))) = "/lib/ld-linux-armhf.so.3";
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
144
src/runProc.cpp
144
src/runProc.cpp
@@ -2,6 +2,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "dcBL.h"
|
#include "dcBL.h"
|
||||||
|
#include "interfaces.h"
|
||||||
|
|
||||||
static uint32_t hwapi_lastStartAmount;
|
static uint32_t hwapi_lastStartAmount;
|
||||||
static uint32_t hwapi_lastTotalAmount;
|
static uint32_t hwapi_lastTotalAmount;
|
||||||
@@ -28,41 +29,25 @@ T_runProc::T_runProc()
|
|||||||
QTimer *runProc_callProcesses = new QTimer();
|
QTimer *runProc_callProcesses = new QTimer();
|
||||||
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
|
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
|
||||||
runProc_callProcesses->setSingleShot(false);
|
runProc_callProcesses->setSingleShot(false);
|
||||||
runProc_callProcesses->start(10); // in ms
|
runProc_callProcesses->start(100); // in ms
|
||||||
|
|
||||||
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
|
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
|
||||||
// bit0: upper door 1:middle 2:lower 3=cash-box out
|
// bit0: upper door 1:middle 2:lower 3=cash-box out
|
||||||
|
|
||||||
// hwapi_triggerBL = new QTimer();
|
hwapi_triggerBL = new QTimer();
|
||||||
// connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
||||||
// hwapi_triggerBL->setSingleShot(false);
|
hwapi_triggerBL->setSingleShot(false);
|
||||||
// hwapi_triggerBL->stop();
|
hwapi_triggerBL->stop();
|
||||||
|
|
||||||
myTO = new QTimer();
|
|
||||||
myTO->setSingleShot(true);
|
|
||||||
myTO->start(200);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void T_runProc::runProc_slotProcess(void)
|
void T_runProc::runProc_slotProcess(void)
|
||||||
{
|
{
|
||||||
#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
|
|
||||||
dcBL_cycle();
|
dcBL_cycle();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool T_runProc::cash_startPayment(uint32_t amount)
|
bool T_runProc::cash_startPayment(uint32_t amount)
|
||||||
@@ -175,7 +160,6 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
|
|
||||||
sub_getDynMachineConditions(&myDynMachCond);
|
sub_getDynMachineConditions(&myDynMachCond);
|
||||||
payInProg= myDynMachCond.paymentInProgress;
|
payInProg= myDynMachCond.paymentInProgress;
|
||||||
// Version Szeged: aug2023
|
|
||||||
// 0: stopped by timeout
|
// 0: stopped by timeout
|
||||||
// 1: running 2: wait4lastCoin
|
// 1: running 2: wait4lastCoin
|
||||||
// 3: payment stopped manually, coins in Escrow
|
// 3: payment stopped manually, coins in Escrow
|
||||||
@@ -185,26 +169,9 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
// 7: coins returned 2 cases: due to cancel-button or printer-error
|
// 7: coins returned 2 cases: due to cancel-button or printer-error
|
||||||
// 8: CoinChecker or MDB on Error
|
// 8: CoinChecker or MDB on Error
|
||||||
|
|
||||||
// since Schoenau with bill and changer, nov2023
|
|
||||||
//0 = no payment
|
|
||||||
//will be set to 1 by cash_startCollection()
|
|
||||||
//neu 1: wait for devices getting ready for payment
|
|
||||||
//2 = payment,
|
|
||||||
//3 = wait for last coin/bill
|
|
||||||
//4 = Bezahlvorgang manuell beendet
|
|
||||||
//5 = payment stopped autom, amount collected, coins in Escrow
|
|
||||||
//6 = Bezahlvorgang beendet weil ZK voll
|
|
||||||
//4,5,6: payment done, keep on polling, wait for cash or return command
|
|
||||||
//7 = encash collected money from coin escrow into cash box
|
|
||||||
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
|
|
||||||
//9 = wait for changer result
|
|
||||||
//10= print refund receipt with "amountToReturn"
|
|
||||||
|
|
||||||
|
|
||||||
// qCritical() << "emitting signal payCancelled";
|
// qCritical() << "emitting signal payCancelled";
|
||||||
// emit runProc_payCancelled();
|
// emit runProc_payCancelled();
|
||||||
/*
|
|
||||||
// gabs bei Szeged, jetzt nicht mehr:
|
|
||||||
if (payInProg==8)
|
if (payInProg==8)
|
||||||
{
|
{
|
||||||
// coin checker faulty, cannot start
|
// coin checker faulty, cannot start
|
||||||
@@ -215,11 +182,11 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
emit runProc_coinCollectionAborted();
|
emit runProc_coinCollectionAborted();
|
||||||
//sendFDcmd_set(156, 0,0, 2,0,0,0); // cancel payment
|
//sendFDcmd_set(156, 0,0, 2,0,0,0); // cancel payment
|
||||||
}
|
}
|
||||||
return 10; // error cannot start
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// if (empState>=10 && empState<=12 && (payInProg==1 || payInProg==2) ) // Szeged
|
return 10; // error cannot start
|
||||||
if ( payInProg==2 ) //8.12.23
|
}
|
||||||
|
|
||||||
|
if (empState>=10 && empState<=12 && (payInProg==1 || payInProg==2) )
|
||||||
{
|
{
|
||||||
// coin acceptance is active now:
|
// coin acceptance is active now:
|
||||||
if (hwapi_paymentStarted==1) // && (( payInProg==0) || ( payInProg>5))) //16.6.23
|
if (hwapi_paymentStarted==1) // && (( payInProg==0) || ( payInProg>5))) //16.6.23
|
||||||
@@ -252,8 +219,7 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
//if (payInProg==3) // user pressed "Next/Continue", keep coin
|
if (payInProg==3) // user pressed "Next/Continue", keep coin
|
||||||
if (payInProg==4) // user pressed "Next/Continue", keep coin since nov2023
|
|
||||||
{
|
{
|
||||||
hwapi_paymentStarted++;
|
hwapi_paymentStarted++;
|
||||||
collActiv=3;
|
collActiv=3;
|
||||||
@@ -261,8 +227,7 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
emit runProc_payStopByPushbutton();
|
emit runProc_payStopByPushbutton();
|
||||||
} else
|
} else
|
||||||
|
|
||||||
//if (payInProg==4) // max achieved, keep coins
|
if (payInProg==4) // max achieved, keep coins
|
||||||
if (payInProg==5) // max achieved, keep coins since nov2023
|
|
||||||
{
|
{
|
||||||
hwapi_paymentStarted++;
|
hwapi_paymentStarted++;
|
||||||
collActiv=4;
|
collActiv=4;
|
||||||
@@ -270,8 +235,7 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
emit runProc_payStopByMax();
|
emit runProc_payStopByMax();
|
||||||
} else
|
} else
|
||||||
|
|
||||||
//if (payInProg==5) // escrow full, keep coins
|
if (payInProg==5) // escrow full, keep coins
|
||||||
if (payInProg==6) // escrow full, keep coins since nov2023
|
|
||||||
{
|
{
|
||||||
hwapi_paymentStarted++;
|
hwapi_paymentStarted++;
|
||||||
collActiv=5;
|
collActiv=5;
|
||||||
@@ -279,14 +243,14 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
emit runProc_payStopByEscrow();
|
emit runProc_payStopByEscrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5.10.23 raus, geht auf 99 wenn Betrag erreicht, ist aber kein fehler
|
/* 5.10.23 raus, geht auf 99 wenn Betrag erreicht, ist aber kein fehler
|
||||||
if ( (empState<10) || (empState>12)) // error
|
if ( (empState<10) || (empState>12)) // error
|
||||||
{
|
{
|
||||||
//collActiv=13;
|
collActiv=13;
|
||||||
//hwapi_paymentStarted=90;
|
hwapi_paymentStarted=90;
|
||||||
//qCritical() << "emitting signal payStopByError" << empState;
|
qCritical() << "emitting signal payStopByError" << empState;
|
||||||
//emit runProc_payStopByError();
|
emit runProc_payStopByError();
|
||||||
}
|
} */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,8 +258,7 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
{
|
{
|
||||||
// coin collection finished, but coins kept until printing done
|
// coin collection finished, but coins kept until printing done
|
||||||
collActiv=2;
|
collActiv=2;
|
||||||
//if (payInProg==6) // coins encashed
|
if (payInProg==6) // coins encashed
|
||||||
if (payInProg==7) // coins encashed since nov2023
|
|
||||||
{
|
{
|
||||||
collActiv=6;
|
collActiv=6;
|
||||||
hwapi_paymentStarted++;
|
hwapi_paymentStarted++;
|
||||||
@@ -303,8 +266,7 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
|||||||
emit runProc_coinProcessJustStopped();
|
emit runProc_coinProcessJustStopped();
|
||||||
} else
|
} else
|
||||||
|
|
||||||
//if (payInProg==7) // coins returned, printing failed
|
if (payInProg==7) // coins returned, printing failed
|
||||||
if (payInProg==0) // coins returned, printing failed since nov2023
|
|
||||||
{
|
{
|
||||||
collActiv=7;
|
collActiv=7;
|
||||||
hwapi_paymentStarted++;
|
hwapi_paymentStarted++;
|
||||||
@@ -692,7 +654,7 @@ bool T_runProc::bl_isUp(void)
|
|||||||
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
|
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
|
||||||
{
|
{
|
||||||
qDebug() << "got BL response to readFWversion";
|
qDebug() << "got BL response to readFWversion";
|
||||||
//epi_clrRawReceivedString();
|
epi_clrRawReceivedString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// response to "start BL"
|
// response to "start BL"
|
||||||
@@ -700,7 +662,7 @@ bool T_runProc::bl_isUp(void)
|
|||||||
receivedData[3]==223 && receivedData[4] ==131 )
|
receivedData[3]==223 && receivedData[4] ==131 )
|
||||||
{
|
{
|
||||||
qDebug() << "hwapi_bl_isUp: got BL response to start";
|
qDebug() << "hwapi_bl_isUp: got BL response to start";
|
||||||
//epi_clrRawReceivedString();
|
epi_clrRawReceivedString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -715,8 +677,7 @@ void T_runProc::bl_completeStart(void)
|
|||||||
|
|
||||||
bool T_runProc::bl_performComplStart(void)
|
bool T_runProc::bl_performComplStart(void)
|
||||||
{
|
{
|
||||||
bool result;
|
// must be called cyclic by timer
|
||||||
|
|
||||||
static uint8_t retryCtr;
|
static uint8_t retryCtr;
|
||||||
|
|
||||||
if ((bl_startupStep<1) || (bl_startupStep>10))
|
if ((bl_startupStep<1) || (bl_startupStep>10))
|
||||||
@@ -730,69 +691,58 @@ bool T_runProc::bl_performComplStart(void)
|
|||||||
|
|
||||||
if (bl_startupStep==2)
|
if (bl_startupStep==2)
|
||||||
{
|
{
|
||||||
qDebug()<<"rebooting";
|
|
||||||
bl_rebootDC();
|
bl_rebootDC();
|
||||||
myTO->stop();
|
hwapi_triggerBL->stop();
|
||||||
myTO->start(500);
|
hwapi_triggerBL->start(1000); // call next step in 1s
|
||||||
retryCtr=0;
|
retryCtr=0;
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==3)
|
if (bl_startupStep==3)
|
||||||
{
|
{
|
||||||
if (!myTO->isActive())
|
//qDebug()<<"starting BL";
|
||||||
{
|
|
||||||
qDebug()<<"starting BL";
|
|
||||||
bl_startBL();
|
bl_startBL();
|
||||||
myTO->stop();
|
hwapi_triggerBL->stop();
|
||||||
myTO->start(500);
|
hwapi_triggerBL->start(100);
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==4)
|
if (bl_startupStep==4)
|
||||||
{
|
{
|
||||||
if (!myTO->isActive())
|
//if (!myTO->isActive())
|
||||||
{
|
//{
|
||||||
qDebug()<<"checking BL";
|
|
||||||
bl_checkBL();
|
bl_checkBL();
|
||||||
myTO->stop();
|
hwapi_triggerBL->stop();
|
||||||
myTO->start(200);
|
hwapi_triggerBL->start(100);
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
}
|
|
||||||
|
//}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==5)
|
if (bl_startupStep==5)
|
||||||
{
|
{
|
||||||
if (!myTO->isActive())
|
hwapi_triggerBL->stop();
|
||||||
{
|
if (bl_isUp())
|
||||||
qDebug()<<"step 5";
|
|
||||||
result = bl_isUp();
|
|
||||||
qDebug()<<"BL result: "<< result;
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
bl_startupStep=99;
|
bl_startupStep=99;
|
||||||
qDebug()<<"BL is working now...";
|
|
||||||
// BL is up and running
|
// BL is up and running
|
||||||
return true;
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
retryCtr++; // start again
|
retryCtr++; // start again
|
||||||
if (retryCtr>=10)
|
if (retryCtr>=15)
|
||||||
{
|
{
|
||||||
bl_startupStep=99;
|
bl_startupStep=99;
|
||||||
qDebug()<<"BL error!!!";
|
//qDebug()<<"BL error!!!";
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
bl_startupStep=3;
|
bl_startupStep=3;
|
||||||
myTO->stop();
|
//qDebug()<<"BL retry...";
|
||||||
myTO->start(200);
|
|
||||||
qDebug()<<"BL retry...";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// store power on/off condition of the devices to control the data request
|
// store power on/off condition of the devices to control the data request
|
||||||
|
|
||||||
//static bool indat_savePrnPwr;
|
//static bool indat_savePrnPwr;
|
||||||
@@ -1985,7 +1984,7 @@ void epi_iniVRstorage(void)
|
|||||||
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data )
|
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data )
|
||||||
{
|
{
|
||||||
uint16_t start=blkNr, ii;
|
uint16_t start=blkNr, ii;
|
||||||
qDebug()<<"storing vault data "<<blkNr;
|
//qDebug()<<"storing vault data "<<blkNr;
|
||||||
SharedMem::write()->store_gotNrBlocksOfVaultRec |= (1<<start); // setze pro Block ein bit, wir brauchen block 0...5
|
SharedMem::write()->store_gotNrBlocksOfVaultRec |= (1<<start); // setze pro Block ein bit, wir brauchen block 0...5
|
||||||
// also muss store_gotNrBlocksOfVaultRec auf 0x1F stehen
|
// also muss store_gotNrBlocksOfVaultRec auf 0x1F stehen
|
||||||
start<<=6; // *64
|
start<<=6; // *64
|
||||||
@@ -2054,51 +2053,14 @@ uint16_t epi_getNrOfCoinsInCashBox(void)
|
|||||||
//static bool store_DcDataAreValid;
|
//static bool store_DcDataAreValid;
|
||||||
|
|
||||||
void gpi_storeDcDataValid(bool isVal)
|
void gpi_storeDcDataValid(bool isVal)
|
||||||
{
|
|
||||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
|
||||||
if (isVal != now)
|
|
||||||
{
|
{
|
||||||
SharedMem::write()->store_DcDataAreValid = isVal;
|
SharedMem::write()->store_DcDataAreValid = isVal;
|
||||||
#ifdef THIS_IS_CA_MASTER
|
|
||||||
qDebug()<<"master lib sets DcDataValid to "<<isVal;
|
|
||||||
#else
|
|
||||||
qDebug()<<"slave lib sets DcDataValid to "<<isVal;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_setDcDataValid(void)
|
|
||||||
{
|
|
||||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
|
||||||
if (now==false)
|
|
||||||
{
|
|
||||||
SharedMem::write()->store_DcDataAreValid = true;
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
|
||||||
qDebug()<<"master lib SET DcDataValid";
|
|
||||||
#else
|
|
||||||
qDebug()<<"slave lib SET DcDataValid";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void epi_resetDcDataValid(void)
|
|
||||||
{
|
|
||||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
|
||||||
if (now==true)
|
|
||||||
{
|
|
||||||
SharedMem::write()->store_DcDataAreValid = false;
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
|
||||||
qDebug()<<"master lib RESET DcDataValid";
|
|
||||||
#else
|
|
||||||
qDebug()<<"slave lib RESET DcDataValid";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool epi_areDcDataValid()
|
bool epi_areDcDataValid()
|
||||||
{
|
{
|
||||||
return SharedMem::read()->store_DcDataAreValid;
|
return SharedMem::read()->store_DcDataAreValid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ....................................................................................
|
// ....................................................................................
|
||||||
|
Reference in New Issue
Block a user