Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
@ -1,8 +1,6 @@
|
||||||
#include "CArun.h"
|
#include "CArun.h"
|
||||||
#include "datei.h"
|
#include "datei.h"
|
||||||
|
|
||||||
#include "CCWakelineAbstraction.h"
|
|
||||||
|
|
||||||
|
|
||||||
CArun::CArun(QObject *parent)
|
CArun::CArun(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@ -19,8 +17,6 @@ CArun::CArun(QObject *parent)
|
||||||
qCritical() << "CArun: start setup...";
|
qCritical() << "CArun: start setup...";
|
||||||
|
|
||||||
this->timerChainCtrl->start();
|
this->timerChainCtrl->start();
|
||||||
|
|
||||||
this->ccWakelineAbstraction = new CCWakelineAbstraction(this->HWaccess, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ enum class SETUP_STEP {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CCWakelineAbstraction;
|
|
||||||
|
|
||||||
class CArun : public QObject
|
class CArun : public QObject
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,6 @@ private:
|
||||||
|
|
||||||
void openSerialPort();
|
void openSerialPort();
|
||||||
|
|
||||||
CCWakelineAbstraction* ccWakelineAbstraction;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
#include <QFileSystemWatcher>
|
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "CCWakelineAbstraction.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this is based on a solution from:
|
|
||||||
* https://embeddeduse.com/2018/09/18/monitoring-sys-files-qfilesystemwatcher/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
CCWakelineAbstraction::CCWakelineAbstraction(hwinf *dc, QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, dc(dc)
|
|
||||||
{
|
|
||||||
auto ccWakeMonitor = new QFileSystemWatcher(this);
|
|
||||||
|
|
||||||
ccWakeMonitor->addPath("/sys/class/leds/wakeupctrl_cc/brightness");
|
|
||||||
connect(ccWakeMonitor, &QFileSystemWatcher::fileChanged,
|
|
||||||
this, &CCWakelineAbstraction::ccWakeChanged);
|
|
||||||
|
|
||||||
qCritical() << "... init CCWakelineAbstraction";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CCWakelineAbstraction::ccWakeChanged(const QString &path)
|
|
||||||
{
|
|
||||||
QFile ccWakeFile(path);
|
|
||||||
if (!ccWakeFile.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning() << "ERROR: Could not open ccWakeFile file.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto ccWake = ccWakeFile.readAll();
|
|
||||||
if (!ccWake.isEmpty()) {
|
|
||||||
int state = ccWake.at(0);
|
|
||||||
//qCritical() << "INFO: ccWake = " << state;
|
|
||||||
switch (state) {
|
|
||||||
case 0x30: // '1'
|
|
||||||
qCritical() << "INFO: ccWake -> sleep";
|
|
||||||
this->dc->credit_switchWake(true); // switch 'sleep'
|
|
||||||
break;
|
|
||||||
case 0x31: // '0'
|
|
||||||
qCritical() << "INFO: ccWake -> wake";
|
|
||||||
this->dc->credit_switchWake(false); // switch 'wake'
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
#ifndef CCWAKELINEABSTRACTION_H
|
|
||||||
#define CCWAKELINEABSTRACTION_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class hwinf;
|
|
||||||
class QFileSystemWatcher;
|
|
||||||
|
|
||||||
|
|
||||||
class CCWakelineAbstraction : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CCWakelineAbstraction(hwinf *dc, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
hwinf *dc;
|
|
||||||
QFileSystemWatcher *ccWakeMonitor;
|
|
||||||
|
|
||||||
void ccWakeChanged(const QString &path);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CCWAKELINEABSTRACTION_H
|
|
|
@ -40,14 +40,12 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
CArun.cpp \
|
CArun.cpp \
|
||||||
CCWakelineAbstraction.cpp \
|
|
||||||
main.cpp \
|
main.cpp \
|
||||||
tslib.cpp \
|
tslib.cpp \
|
||||||
datei.cpp
|
datei.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CArun.h \
|
CArun.h \
|
||||||
CCWakelineAbstraction.h \
|
|
||||||
guidefs.h \
|
guidefs.h \
|
||||||
tslib.h \
|
tslib.h \
|
||||||
versionHistory.txt \
|
versionHistory.txt \
|
||||||
|
|
|
@ -990,24 +990,22 @@ char T_datif::loadRecDataFromFrame()
|
||||||
case 112: // get inserted amount in cent in sum
|
case 112: // get inserted amount in cent in sum
|
||||||
// byte 0..3: amount just paid 4,5:last coin type 6,7: last coin value
|
// byte 0..3: amount just paid 4,5:last coin type 6,7: last coin value
|
||||||
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||||
uitmp=uchar2uint(receivedData[5],receivedData[4]); // last coin type
|
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||||
uit2=uchar2uint(receivedData[7],receivedData[6]); // last coin value
|
uit2=uchar2uint(receivedData[7],receivedData[6]);
|
||||||
//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 (uit2>0)
|
||||||
if (uitmp>10000 || uit2>10000)
|
|
||||||
{
|
|
||||||
uitmp=0;
|
|
||||||
uit2=0;
|
|
||||||
}
|
|
||||||
if ((newInsertedAmount != lastInsertedAmount) || uit2>0) // 22.5.2024
|
|
||||||
{
|
{
|
||||||
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||||
emit datif_gotNewCoin(); // OR BILL if (uitmp & 0x8000)>0
|
//void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
|
||||||
//qDebug()<<"emit new coin";
|
if (newInsertedAmount != lastInsertedAmount)
|
||||||
lastInsertedAmount=newInsertedAmount;
|
{
|
||||||
//qCritical()<<"datif 112 store and emit new coin "<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
emit datif_gotNewCoin();
|
||||||
}
|
//qDebug()<<"emit new coin";
|
||||||
|
|
||||||
|
lastInsertedAmount=newInsertedAmount;
|
||||||
|
}
|
||||||
|
// qDebug()<<"datif store new coin"<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 113: // get wake source, 8byte
|
case 113: // get wake source, 8byte
|
||||||
|
|
|
@ -1773,25 +1773,15 @@ void epi_clearCurrentPayment(void)
|
||||||
|
|
||||||
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
|
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
|
||||||
{
|
{
|
||||||
uint8_t pLC;
|
uint8_t pLC=SharedMem::read()->p_lastCoin;
|
||||||
|
|
||||||
// 21.3.24 attention: if bit 15 in lastCoinType is set then we got a bill not a coin
|
|
||||||
SharedMem::write()->store_insertedAmount=insertedAmount;
|
SharedMem::write()->store_insertedAmount=insertedAmount;
|
||||||
if (lastCoinType & 0x8000)
|
SharedMem::write()->store_lastCoinType[pLC]=lastCoinType;
|
||||||
{
|
SharedMem::write()->store_lastCoinValue[pLC]=lastCoinValue;
|
||||||
// then it's a banknote
|
pLC++;
|
||||||
//qCritical()<<"gpi_storeCurrentPayment got banknote, total: "<<insertedAmount;
|
SharedMem::write()->p_lastCoin=pLC;
|
||||||
} else
|
SharedMem::write()->store_curPayNewCoin++;
|
||||||
{
|
|
||||||
//qCritical()<<"gpi_storeCurrentPayment "<<insertedAmount<<" " << lastCoinType<<" " << lastCoinValue;
|
|
||||||
pLC=SharedMem::read()->p_lastCoin;
|
|
||||||
SharedMem::write()->store_lastCoinType[pLC]=lastCoinType;
|
|
||||||
SharedMem::write()->store_lastCoinValue[pLC]=lastCoinValue;
|
|
||||||
pLC++;
|
|
||||||
SharedMem::write()->p_lastCoin=pLC;
|
|
||||||
SharedMem::write()->store_curPayNewCoin++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//qDebug()<<"gpi_storeCurrentPayment "<<insertedAmount<<" " << lastCoinType<<" " << lastCoinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t epi_CurrentPaymentGetAmount(void)
|
uint32_t epi_CurrentPaymentGetAmount(void)
|
||||||
|
@ -1829,13 +1819,6 @@ bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int nn;
|
|
||||||
for (nn=0; nn<8; nn++)
|
|
||||||
{
|
|
||||||
data[nn]=SharedMem::read()->store_bnaCollect[nn];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//uint64_t stor_wakSrc;
|
//uint64_t stor_wakSrc;
|
||||||
//uint8_t stor_reason;
|
//uint8_t stor_reason;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user