Compare commits
No commits in common. "652ad9b43d24bddbc3c2636c4ff4b5d74e081e46" and "86311de486609f232f495b1417a6a2ca568efdfc" have entirely different histories.
652ad9b43d
...
86311de486
@ -330,11 +330,6 @@ signals:
|
||||
//the requested data are stored in peripheral image
|
||||
// can be loaded with epi
|
||||
|
||||
void datif_templatePrintFinished_OK();
|
||||
void datif_templatePrintFinished_Err();
|
||||
|
||||
void datif_gotNewCoin();
|
||||
|
||||
};
|
||||
|
||||
#endif // CI_H
|
||||
|
@ -100,8 +100,6 @@ class hwapi : public QObject,
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
|
||||
Q_INTERFACES(hwinf)
|
||||
private:
|
||||
void sub_storeSendingText(QByteArray *buf) const;
|
||||
|
||||
DownloadResult sendNextAddress(int bNum) const;
|
||||
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
||||
@ -994,6 +992,19 @@ public:
|
||||
// uint16_t borough, uint16_t zone,
|
||||
// uint16_t alias, char *location) const override;
|
||||
|
||||
/*
|
||||
uint8_t emp_getInsertedCoinSignal(void) const override;
|
||||
// can be called one time after each coin
|
||||
// emp_chkIfCoinInserted() must be called before!
|
||||
|
||||
uint16_t emp_getInsertedCoinValue(void) const override;
|
||||
// can be called one time after each coin
|
||||
// emp_chkIfCoinInserted() must be called before!
|
||||
|
||||
uint8_t emp_getCoinError(void) const override;
|
||||
// can be called one time after each coin
|
||||
// emp_chkIfCoinInserted() must be called before!
|
||||
*/
|
||||
|
||||
bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const override;
|
||||
// return true if successful. could fail if more the 8 commands are waiting
|
||||
@ -1045,8 +1056,7 @@ public:
|
||||
bool prn_printTestTicket(void) const override;
|
||||
// return true if sending to DC OK, false if cmd-stack is full
|
||||
|
||||
bool cash_startPayment(uint32_t amount) const override;
|
||||
// 17.4.23TS: extended to 32bit
|
||||
bool cash_startPayment(uint16_t amount) const override;
|
||||
|
||||
bool cash_cancelPayment(void) const override;
|
||||
// and return coins
|
||||
@ -1081,6 +1091,7 @@ public:
|
||||
uint64_t sys_getWakeSource(void) const override;
|
||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||
|
||||
//void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
|
||||
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
|
||||
|
||||
void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
|
||||
@ -1093,28 +1104,16 @@ public:
|
||||
|
||||
uint16_t cash_getNrCoinsInVault(void) const override;
|
||||
|
||||
uint8_t prn_getPrintResult() const override;
|
||||
|
||||
uint8_t prn_getCurrentPrinterState() const override;
|
||||
// 0: printer OK
|
||||
// bit0: near paper end bit1: no paper
|
||||
// bit2: temperature error bit3: error head open
|
||||
// bit4: paper jam in cutter
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
|
||||
|
||||
signals:
|
||||
void hwapi_templatePrintFinished_OK(void) const override;
|
||||
void hwapi_templatePrintFinished_Err(void) const override;
|
||||
void hwapi_gotNewCoin(void) const override;
|
||||
void hwapi_vendStopByMax(void) const override;
|
||||
void hwapi_vendStopByPushbutton(void) const override;
|
||||
|
||||
private slots:
|
||||
void hwapi_slotPrintFinished_OK(void);
|
||||
void hwapi_slotPrintFinished_Err(void);
|
||||
void hwapi_slotGotCoin(void);
|
||||
private:
|
||||
void sub_storeSendingText(QByteArray *buf) const;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -241,19 +241,7 @@ struct T_dynamicCondition
|
||||
char jsonValid_serial;
|
||||
char jsonValid_time;
|
||||
char lastFileType;
|
||||
// 44
|
||||
uint8_t MifCardHolder[8];
|
||||
uint8_t resultOfLastTemplPrint;
|
||||
// 0: unknown or printing in progress
|
||||
// 1: OK, doc was printed 2: error, doc was not printed
|
||||
uint8_t lastPrinterStatus;
|
||||
// 0: printer OK
|
||||
// bit0: near paper end bit1: no paper
|
||||
// bit2: temperature error bit3: error head open
|
||||
// bit4: paper jam in cutter
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
//54
|
||||
|
||||
};
|
||||
|
||||
struct T_extTime
|
||||
@ -1444,8 +1432,7 @@ public:
|
||||
virtual bool prn_printTestTicket(void) const=0;
|
||||
// return true if sending to DC OK, false if cmd-stack is full
|
||||
|
||||
virtual bool cash_startPayment(uint32_t amount) const=0;
|
||||
// 17.4.23TS: extended to 32bit
|
||||
virtual bool cash_startPayment(uint16_t amount) const=0;
|
||||
|
||||
virtual uint32_t getInsertedAmount(void) const=0;
|
||||
|
||||
@ -1476,6 +1463,7 @@ public:
|
||||
virtual uint64_t sys_getWakeSource(void) const =0;
|
||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||
|
||||
//virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
|
||||
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||
/*
|
||||
|
||||
@ -1513,6 +1501,7 @@ public:
|
||||
*/
|
||||
|
||||
virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
|
||||
//virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
|
||||
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||
/*
|
||||
|
||||
@ -1586,23 +1575,6 @@ public:
|
||||
virtual uint16_t cash_getNrCoinsInVault(void) const=0;
|
||||
|
||||
|
||||
virtual uint8_t prn_getPrintResult() const=0;
|
||||
|
||||
// in case of print-error get detailed error:
|
||||
virtual uint8_t prn_getCurrentPrinterState() const=0;
|
||||
// 0: printer OK
|
||||
// bit0: near paper end bit1: no paper
|
||||
// bit2: temperature error bit3: error head open
|
||||
// bit4: paper jam in cutter
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
|
||||
signals:
|
||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||
virtual void hwapi_gotNewCoin(void) const=0;
|
||||
virtual void hwapi_vendStopByMax(void) const=0;
|
||||
virtual void hwapi_vendStopByPushbutton(void) const=0;
|
||||
|
||||
};
|
||||
|
||||
@ -1627,8 +1599,7 @@ signals:
|
||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
|
||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
|
||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.5"
|
||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
|
||||
|
||||
|
||||
|
||||
|
@ -13,9 +13,6 @@ uint32_t uchar2ulong(uint8_t Highbyte, uint8_t MHbyte, uint8_t MLbyte, uint8_t L
|
||||
|
||||
uint8_t uint2uchar(uint16_t uival, bool getHighB);
|
||||
|
||||
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr);
|
||||
// getBytNr: 0=LSB 3=MSB
|
||||
|
||||
|
||||
void delay(uint16_t MilliSec);
|
||||
|
||||
|
@ -864,10 +864,6 @@ char T_datif::loadRecDataFromFrame()
|
||||
bool ret;
|
||||
uint8_t uctmp; // maxai
|
||||
char ctmp;
|
||||
static uint8_t lastResult;
|
||||
uint8_t prnResult;
|
||||
static uint32_t lastInsertedAmount;
|
||||
uint32_t newInsertedAmount;
|
||||
|
||||
ret=myDCIF->getReceivedInData(&SlaveAdr, &readSource, &readAddress, &RdDleng, receivedData);
|
||||
// retval: data valid, only one time true, true if CommandState OK and readState OK
|
||||
@ -1358,16 +1354,10 @@ char T_datif::loadRecDataFromFrame()
|
||||
|
||||
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
|
||||
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||
ultmp=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||
uit2=uchar2uint(receivedData[7],receivedData[6]);
|
||||
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||
if (newInsertedAmount != lastInsertedAmount)
|
||||
{
|
||||
emit datif_gotNewCoin();
|
||||
lastInsertedAmount=newInsertedAmount;
|
||||
}
|
||||
|
||||
gpi_storeCurrentPayment(ultmp, uitmp, uit2);
|
||||
break;
|
||||
|
||||
case 113: // get wake source, 8byte
|
||||
@ -1479,23 +1469,6 @@ char T_datif::loadRecDataFromFrame()
|
||||
*/
|
||||
|
||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
||||
|
||||
prnResult=receivedData[52];
|
||||
if (prnResult != lastResult)
|
||||
{
|
||||
// new result
|
||||
if (prnResult==1)
|
||||
{
|
||||
emit datif_templatePrintFinished_OK();
|
||||
} else
|
||||
if (prnResult==2)
|
||||
{
|
||||
emit datif_templatePrintFinished_Err();
|
||||
}
|
||||
|
||||
lastResult=prnResult;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 32: // Get current cash level (in vault)
|
||||
|
115
src/hwapi.cpp
115
src/hwapi.cpp
@ -27,7 +27,6 @@
|
||||
|
||||
#include "interfaces.h"
|
||||
|
||||
static uint32_t hwapi_lastStartAmount;
|
||||
|
||||
static const QMap<QString, int> baudrateMap = {
|
||||
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
||||
@ -48,10 +47,6 @@ hwapi::hwapi(QWidget *parent) : QObject(parent) {
|
||||
}
|
||||
sendWRcmd_INI();
|
||||
myDatif = new T_datif();
|
||||
|
||||
connect(myDatif, SIGNAL(datif_templatePrintFinished_OK()), this, SLOT(hwapi_slotPrintFinished_OK()));
|
||||
connect(myDatif, SIGNAL(datif_templatePrintFinished_Err()), this, SLOT(hwapi_slotPrintFinished_Err()));
|
||||
connect(myDatif, SIGNAL(datif_gotNewCoin()), this, SLOT(hwapi_slotGotCoin()));
|
||||
}
|
||||
|
||||
hwapi::~hwapi() {
|
||||
@ -60,25 +55,6 @@ hwapi::~hwapi() {
|
||||
}
|
||||
}
|
||||
|
||||
void hwapi::hwapi_slotPrintFinished_OK(void) {
|
||||
emit hwapi_templatePrintFinished_OK();
|
||||
}
|
||||
|
||||
void hwapi::hwapi_slotPrintFinished_Err(void) {
|
||||
emit hwapi_templatePrintFinished_Err();
|
||||
}
|
||||
|
||||
void hwapi::hwapi_slotGotCoin(void) {
|
||||
// new coin was inserted while transaction and new amount reported:
|
||||
emit hwapi_gotNewCoin();
|
||||
|
||||
uint32_t newSum=epi_CurrentPaymentGetAmount();
|
||||
|
||||
if (newSum>=hwapi_lastStartAmount)
|
||||
emit hwapi_vendStopByMax();
|
||||
|
||||
}
|
||||
|
||||
void hwapi::sub_storeSendingText(QByteArray *buf) const {
|
||||
|
||||
char local[70], copie[1350]; // 64byte more then max buffer size!
|
||||
@ -3591,19 +3567,14 @@ bool hwapi::prn_printTestTicket(void) const
|
||||
|
||||
}
|
||||
|
||||
bool hwapi::cash_startPayment(uint32_t amount) const
|
||||
bool hwapi::cash_startPayment(uint16_t amount) const
|
||||
{
|
||||
// 17.4.23TS: extended to 32bit
|
||||
uint8_t dat1, dat2, dat3, dat4;
|
||||
uint8_t dat1, dat2;
|
||||
|
||||
hwapi_lastStartAmount=amount;
|
||||
epi_clearCurrentPayment();
|
||||
dat1=ulong2uchar(amount, 0);
|
||||
dat2=ulong2uchar(amount, 1);
|
||||
dat3=ulong2uchar(amount, 2);
|
||||
dat4=ulong2uchar(amount, 3);
|
||||
|
||||
return sendFDcmd_set(155, 0,0, dat1,dat2,dat3,dat4);
|
||||
dat1=uint2uchar(amount, LOWBYTE);
|
||||
dat2=uint2uchar(amount, HIGHBYTE);
|
||||
return sendFDcmd_set(155, 0,0, dat1,dat2,0,0);
|
||||
|
||||
}
|
||||
|
||||
@ -3637,7 +3608,6 @@ bool hwapi::cash_stopPayment(void) const
|
||||
{
|
||||
// DB1: 1=encash 2=cancel & return coins
|
||||
// 3=stop and keep coins in escrow
|
||||
emit hwapi_vendStopByPushbutton();
|
||||
return sendFDcmd_set(156, 0,0, 3,0,0,0);
|
||||
|
||||
}
|
||||
@ -3680,21 +3650,18 @@ uint8_t hwapi::mif_getCardType(QString *cardholder) const
|
||||
return type;
|
||||
}
|
||||
|
||||
uint64_t hwapi::sys_getWakeSource(void) const
|
||||
{
|
||||
uint64_t hwapi::sys_getWakeSource(void) const {
|
||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||
return epi_getWakeSources();
|
||||
}
|
||||
|
||||
|
||||
void hwapi::sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const
|
||||
{
|
||||
void hwapi::sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const {
|
||||
//uint8_t leng, data[66];
|
||||
epi_restoreDeviceConditions(leng, data);
|
||||
}
|
||||
|
||||
void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
||||
{
|
||||
void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const {
|
||||
uint16_t LL, nn;
|
||||
uint8_t *start;
|
||||
uint8_t buf[70], leng;
|
||||
@ -3754,70 +3721,4 @@ uint16_t hwapi::cash_getNrCoinsInVault(void) const
|
||||
|
||||
|
||||
|
||||
uint8_t hwapi::prn_getPrintResult() const
|
||||
{
|
||||
// return: 0: unknown
|
||||
// 1: OK - last template was printed succesful
|
||||
// 2: error - last template was not printed
|
||||
|
||||
struct T_dynamicCondition dynMachCon;
|
||||
//uint8_t buf[70], leng,
|
||||
uint8_t res;
|
||||
static uint8_t lastState;
|
||||
//uint32_t aa;
|
||||
|
||||
// aa=&dynMachCon;
|
||||
sys_getDynMachineConditions(&dynMachCon);
|
||||
res= dynMachCon.resultOfLastTemplPrint;
|
||||
// 0: unknown or printing in progress
|
||||
// 1: OK, doc was printed 2: error, doc was not printed
|
||||
|
||||
if (res==0)
|
||||
{
|
||||
if (lastState>0)
|
||||
{
|
||||
// print was started
|
||||
lastState=res;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (lastState==0)
|
||||
{
|
||||
// result hat sich auf 1 oder 2 geändert, d.h. Druck ist fertig
|
||||
if (res==1)
|
||||
{
|
||||
|
||||
//emit hwapi_templatePrintFinished_OK();
|
||||
} else
|
||||
if (res==2)
|
||||
{
|
||||
|
||||
//emit hwapi_templatePrintFinished_Err();
|
||||
}
|
||||
lastState=res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
uint8_t hwapi::prn_getCurrentPrinterState() const
|
||||
{
|
||||
// 0: printer OK
|
||||
// bit0: near paper end bit1: no paper
|
||||
// bit2: temperature error bit3: error head open
|
||||
// bit4: paper jam in cutter
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
|
||||
|
||||
uint8_t lastPrinterStatus;
|
||||
uint8_t buf[70], leng;
|
||||
|
||||
// 2nd way to get dyn.conditions:
|
||||
epi_restoreDynMachineConditions(&leng, buf);
|
||||
lastPrinterStatus=buf[53];
|
||||
|
||||
return lastPrinterStatus;
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,23 +76,6 @@ uint8_t uint2uchar(uint16_t uival, bool getHighB)
|
||||
}
|
||||
|
||||
|
||||
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr)
|
||||
{
|
||||
// getBytNr: 0=LSB 3=MSB
|
||||
uint32_t ultmp=ulval;
|
||||
if (getBytNr==0)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
if (getBytNr==1)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
if (getBytNr==2)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
return uint8_t(ultmp);
|
||||
|
||||
}
|
||||
|
||||
void delay(uint16_t MilliSec)
|
||||
{
|
||||
QThread::msleep(uint32_t(MilliSec));
|
||||
|
Loading…
x
Reference in New Issue
Block a user