Compare commits
8 Commits
pu/integra
...
proposal_s
Author | SHA1 | Date | |
---|---|---|---|
fbe53ea845 | |||
bab771cece | |||
de61de85f1
|
|||
4e58fbe4e1
|
|||
647dc9fe4b
|
|||
433af98de7
|
|||
492d30aaf0
|
|||
03d21c62b6
|
@@ -114,7 +114,7 @@ void CArun::chainControl(void)
|
|||||||
case SETUP_STEP::OPEN_SERIAL_PORT:
|
case SETUP_STEP::OPEN_SERIAL_PORT:
|
||||||
qCritical() << "CArun: SETUP_STEP::OPEN_SERIAL_PORT";
|
qCritical() << "CArun: SETUP_STEP::OPEN_SERIAL_PORT";
|
||||||
this->openSerialPort();
|
this->openSerialPort();
|
||||||
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
this->setupStep = SETUP_STEP::TEST_OPEN_PORT;
|
||||||
this->timerChainCtrl->start();
|
this->timerChainCtrl->start();
|
||||||
break;
|
break;
|
||||||
case SETUP_STEP::TEST_OPEN_PORT:
|
case SETUP_STEP::TEST_OPEN_PORT:
|
||||||
@@ -151,7 +151,7 @@ void CArun::chainControl(void)
|
|||||||
|
|
||||||
this->HWaccess->dc_autoRequest(1);
|
this->HWaccess->dc_autoRequest(1);
|
||||||
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
||||||
this->timerChainCtrl->start();
|
this->timerChainCtrl->start(2000);
|
||||||
break;
|
break;
|
||||||
case SETUP_STEP::CHECK_VALID_DATA:
|
case SETUP_STEP::CHECK_VALID_DATA:
|
||||||
qCritical() << "CArun: SETUP_STEP::CHECK_VALID_DATA";
|
qCritical() << "CArun: SETUP_STEP::CHECK_VALID_DATA";
|
||||||
|
@@ -161,6 +161,8 @@ class T_datif : public QObject
|
|||||||
// blockNr=transmitted in WRITEADDRESS low byte
|
// blockNr=transmitted in WRITEADDRESS low byte
|
||||||
|
|
||||||
int datif_noResponseCtr;
|
int datif_noResponseCtr;
|
||||||
|
int datif_nowNewDyns;
|
||||||
|
int datif_nowNewStats;
|
||||||
|
|
||||||
T_prot *myDCIF;
|
T_prot *myDCIF;
|
||||||
QTimer *datif_trigger;
|
QTimer *datif_trigger;
|
||||||
|
@@ -121,8 +121,13 @@ public:
|
|||||||
explicit hwapi(QObject *parent = nullptr);
|
explicit hwapi(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef THIS_IS_CA_MASTER
|
#ifdef THIS_IS_CA_MASTER
|
||||||
T_datif *myDatif;
|
T_datif *myDatif;
|
||||||
|
#else // THIS_IS_CA_SLAVE
|
||||||
|
QString getVersions();
|
||||||
|
void resetVersions();
|
||||||
|
bool m_resetVersions = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
T_runProc *runProcess;
|
T_runProc *runProcess;
|
||||||
@@ -1401,6 +1406,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void hwapi_restoredVersions();
|
||||||
|
|
||||||
void hwapi_reportDCDownloadStatus(QString const&) const override;
|
void hwapi_reportDCDownloadStatus(QString const&) const override;
|
||||||
void hwapi_reportDCDownloadSuccess(QString const&) const override;
|
void hwapi_reportDCDownloadSuccess(QString const&) const override;
|
||||||
void hwapi_reportDCDownloadFailure(QString const&) const override;
|
void hwapi_reportDCDownloadFailure(QString const&) const override;
|
||||||
|
@@ -91,6 +91,8 @@ T_datif::T_datif(QObject *parent) : QObject(parent)
|
|||||||
epi_resetDcDataValid(1); // data are not yet valid, no response from DC by now
|
epi_resetDcDataValid(1); // data are not yet valid, no response from DC by now
|
||||||
|
|
||||||
datif_noResponseCtr=0;
|
datif_noResponseCtr=0;
|
||||||
|
datif_nowNewDyns=0;
|
||||||
|
datif_nowNewStats=0;
|
||||||
|
|
||||||
datif_repeatCtr=0;
|
datif_repeatCtr=0;
|
||||||
datif_cmdWasPerformed=0; // 0: no response by now
|
datif_cmdWasPerformed=0; // 0: no response by now
|
||||||
@@ -151,13 +153,24 @@ char T_datif::datif_cycleSend()
|
|||||||
{
|
{
|
||||||
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
||||||
epi_resetDcDataValid(2); // DC data not valid
|
epi_resetDcDataValid(2); // DC data not valid
|
||||||
|
datif_nowNewDyns=0;
|
||||||
|
datif_nowNewStats=0;
|
||||||
|
|
||||||
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>50) // no life sign from device controller (DC) for about a sec
|
||||||
|
{
|
||||||
epi_resetDcDataValid(3); // DC data has not updated for >=5s -> no longer valid!
|
epi_resetDcDataValid(3); // DC data has not updated for >=5s -> no longer valid!
|
||||||
|
datif_nowNewDyns=0;
|
||||||
|
datif_nowNewStats=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
// 24.7.24 new, data are valid if dynamic machine conditions AND dyn machine states came in
|
||||||
|
if (datif_nowNewDyns && datif_nowNewStats && !epi_areDcDataValid() )
|
||||||
|
epi_setDcDataValid();
|
||||||
|
|
||||||
// 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())
|
||||||
@@ -360,6 +373,9 @@ char T_datif::datif_cycleSend()
|
|||||||
{
|
{
|
||||||
dif_scanStep=0; // always start from beginning
|
dif_scanStep=0; // always start from beginning
|
||||||
epi_resetDcDataValid(4);
|
epi_resetDcDataValid(4);
|
||||||
|
datif_nowNewDyns=0;
|
||||||
|
datif_nowNewStats=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
datif_cmdWasPerformed=0; // 0: no response by now
|
datif_cmdWasPerformed=0; // 0: no response by now
|
||||||
@@ -384,7 +400,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
||||||
|
|
||||||
// send quicker while transaction is ongoing:
|
// 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_vendRequCommandList[15]={102,107,108,110,112,115,116,30,31,32,40,41,42,23,0};
|
||||||
uint8_t datif_maxVendingCmds=13;
|
uint8_t datif_maxVendingCmds=13;
|
||||||
|
|
||||||
// special commands:
|
// special commands:
|
||||||
@@ -996,11 +1012,16 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
uit2=uchar2uint(receivedData[7],receivedData[6]); // value of last coin
|
uit2=uchar2uint(receivedData[7],receivedData[6]); // value of last coin
|
||||||
//if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern:
|
//if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern:
|
||||||
// beim Wechsler hat die kleinste Muenze immer coin type 0!
|
// beim Wechsler hat die kleinste Muenze immer coin type 0!
|
||||||
|
|
||||||
if (uitmp>10000 || uit2>10000)
|
if (uitmp>10000 || uit2>10000)
|
||||||
{
|
{
|
||||||
uitmp=0;
|
uitmp=0;
|
||||||
uit2=0;
|
uit2=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uit2==3 || uit2==5 || uit2==10 || uit2==20 || uit2==50 || uit2==100 || uit2==200 || uit2==500)
|
||||||
|
{
|
||||||
|
// valid coin
|
||||||
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
|
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
|
||||||
{
|
{
|
||||||
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||||
@@ -1009,6 +1030,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
lastInsertedAmount=newInsertedAmount;
|
lastInsertedAmount=newInsertedAmount;
|
||||||
//qCritical()<<"datif 112 store and emit new coin "<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
//qCritical()<<"datif 112 store and emit new coin "<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1035,6 +1057,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
if (RdDleng>28)
|
if (RdDleng>28)
|
||||||
{
|
{
|
||||||
gpi_storeDeviceConditions(RdDleng, receivedData);
|
gpi_storeDeviceConditions(RdDleng, receivedData);
|
||||||
|
datif_nowNewStats=1; // 24.7.24 new
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1043,9 +1066,9 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
|
|
||||||
if (RdDleng>60)
|
if (RdDleng>60)
|
||||||
{
|
{
|
||||||
epi_setDcDataValid(); // DC-Data are valid as DC responded.
|
//epi_setDcDataValid(); // 24.7.24 remove here
|
||||||
// Could be set to every response but this (31)
|
datif_nowNewDyns=1; // 24.7.24 new
|
||||||
// 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
|
gpi_storeDI_CoinAttach(receivedData[6]); // new, 14.2.24 needed for direct coin insertion
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "hwapi.h"
|
#include "hwapi.h"
|
||||||
#include "download_thread.h"
|
#include "download_thread.h"
|
||||||
#include "reporting_thread.h"
|
#include "reporting_thread.h"
|
||||||
|
#include "storeINdata.h" // epi_loadSWVer, epi_loadHWVer
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
@@ -25,6 +26,37 @@ static uint8_t hwapi_lastDoorState;
|
|||||||
static uint8_t bl_startupStep;
|
static uint8_t bl_startupStep;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef THIS_IS_CA_MASTER
|
||||||
|
#else // THIS_IS_CA_SLAVE
|
||||||
|
QString hwapi::getVersions() {
|
||||||
|
if (m_sharedMem != nullptr) {
|
||||||
|
// check if sw/hw-versions have been restored (see resetVersions()).
|
||||||
|
// emit a signal in such a case.
|
||||||
|
QString const &sw = epi_loadSWver(); // command 11
|
||||||
|
QString const &hw = epi_loadHWver(); // command 12
|
||||||
|
if (!sw.isEmpty() && !hw.isEmpty() && m_resetVersions) {
|
||||||
|
emit hwapi_restoredVersions();
|
||||||
|
return sw + " " + hw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void hwapi::resetVersions() {
|
||||||
|
if (m_sharedMem != nullptr) {
|
||||||
|
// command 11 and 12 are included in the requests sent automatically,
|
||||||
|
// first 11, then 12. The results are used to refresh corresponding
|
||||||
|
// shared memory locations.
|
||||||
|
// set these locations to the empty string in the opposite order as
|
||||||
|
// the commands are sent.
|
||||||
|
// purpose: only when both locations are not empty again, we can be
|
||||||
|
// sure that data are not obsolete.
|
||||||
|
gpi_storeHWver(""); // command 12
|
||||||
|
gpi_storeSWver(""); // command 11
|
||||||
|
m_resetVersions = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
hwapi::hwapi(QObject *parent) : QObject(parent)
|
hwapi::hwapi(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,11 @@
|
|||||||
#include "shared_mem_buffer.h"
|
#include "shared_mem_buffer.h"
|
||||||
#include "datei.h"
|
#include "datei.h"
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
|
static QMutex SWHD_mutex;
|
||||||
|
|
||||||
// gpi: grafical access to PI: access from external devices over device controller FOR GUI
|
// gpi: grafical access to PI: access from external devices over device controller FOR GUI
|
||||||
// epi: external access from GUI to PI: FOR external devices (DC)
|
// epi: external access from GUI to PI: FOR external devices (DC)
|
||||||
|
|
||||||
@@ -64,6 +69,7 @@ bool indat_isMdbOn()
|
|||||||
|
|
||||||
void gpi_storeHWver(QString text)
|
void gpi_storeHWver(QString text)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&SWHD_mutex);
|
||||||
// change Qstring to array of chars, because shared mem allowes no QString!
|
// change Qstring to array of chars, because shared mem allowes no QString!
|
||||||
int nn, LL = text.length();
|
int nn, LL = text.length();
|
||||||
if (LL >= versionBufferLen)
|
if (LL >= versionBufferLen)
|
||||||
@@ -79,6 +85,7 @@ void gpi_storeHWver(QString text)
|
|||||||
|
|
||||||
QString epi_loadHWver(void)
|
QString epi_loadHWver(void)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&SWHD_mutex);
|
||||||
// load array of chars from SM and change to QString
|
// load array of chars from SM and change to QString
|
||||||
int nn, LL = versionBufferLen;
|
int nn, LL = versionBufferLen;
|
||||||
char cc;
|
char cc;
|
||||||
@@ -96,6 +103,7 @@ QString epi_loadHWver(void)
|
|||||||
|
|
||||||
void gpi_storeSWver(QString text)
|
void gpi_storeSWver(QString text)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&SWHD_mutex);
|
||||||
int nn, LL = text.length();
|
int nn, LL = text.length();
|
||||||
if (LL >= versionBufferLen)
|
if (LL >= versionBufferLen)
|
||||||
LL=versionBufferLen-1; // leave place for termination
|
LL=versionBufferLen-1; // leave place for termination
|
||||||
@@ -111,6 +119,7 @@ void gpi_storeSWver(QString text)
|
|||||||
|
|
||||||
QString epi_loadSWver(void)
|
QString epi_loadSWver(void)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&SWHD_mutex);
|
||||||
int nn, LL = versionBufferLen;
|
int nn, LL = versionBufferLen;
|
||||||
char cc;
|
char cc;
|
||||||
QString myStr;
|
QString myStr;
|
||||||
|
Reference in New Issue
Block a user