Merge branch 'master' into pu/integration
This commit is contained in:
commit
09a80498e4
@ -10,7 +10,8 @@ HEADERS += $${PWD}/include/com.h \
|
|||||||
$${PWD}/include/prot.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
|
||||||
|
|
||||||
SOURCES += $${PWD}/src/com.cpp \
|
SOURCES += $${PWD}/src/com.cpp \
|
||||||
$${PWD}/src/controlBus.cpp \
|
$${PWD}/src/controlBus.cpp \
|
||||||
@ -20,4 +21,5 @@ SOURCES += $${PWD}/src/com.cpp \
|
|||||||
$${PWD}/src/prot.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
|
||||||
|
@ -170,7 +170,7 @@ uint8_t epi_getResultOfLastRequest();
|
|||||||
// retval: 0: in progress 1: OK 2: error
|
// retval: 0: in progress 1: OK 2: error
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData);
|
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t const *receivedData);
|
||||||
// stored by Datif
|
// stored by Datif
|
||||||
|
|
||||||
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);
|
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);
|
||||||
|
@ -330,6 +330,11 @@ signals:
|
|||||||
//the requested data are stored in peripheral image
|
//the requested data are stored in peripheral image
|
||||||
// can be loaded with epi
|
// can be loaded with epi
|
||||||
|
|
||||||
|
void datif_templatePrintFinished_OK();
|
||||||
|
void datif_templatePrintFinished_Err();
|
||||||
|
|
||||||
|
void datif_gotNewCoin();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CI_H
|
#endif // CI_H
|
||||||
|
@ -93,13 +93,14 @@ Level 3): send command: "start payment process"
|
|||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "datIf.h"
|
#include "datIf.h"
|
||||||
|
|
||||||
|
class QSharedMemory;
|
||||||
|
|
||||||
class hwapi : public QObject,
|
class hwapi : public QObject,
|
||||||
public hwinf
|
public hwinf
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(hwinf)
|
Q_INTERFACES(hwinf)
|
||||||
|
private:
|
||||||
|
void sub_storeSendingText(QByteArray *buf) const;
|
||||||
|
|
||||||
DownloadResult sendNextAddress(int bNum) const;
|
DownloadResult sendNextAddress(int bNum) const;
|
||||||
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
||||||
@ -113,12 +114,17 @@ class hwapi : public QObject,
|
|||||||
bool resetDeviceController() const;
|
bool resetDeviceController() const;
|
||||||
QByteArray loadBinaryDCFile(QString filename) const;
|
QByteArray loadBinaryDCFile(QString filename) const;
|
||||||
bool downloadBinaryToDC(QString const &bFile) const;
|
bool downloadBinaryToDC(QString const &bFile) const;
|
||||||
|
|
||||||
|
QSharedMemory *m_sharedMem;
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QWidget *parent = nullptr);
|
explicit hwapi(QWidget *parent = nullptr);
|
||||||
|
virtual ~hwapi();
|
||||||
|
|
||||||
T_datif *myDatif;
|
T_datif *myDatif;
|
||||||
|
|
||||||
|
|
||||||
|
virtual QStringList dc_getStatus() const;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Level 0 commands, interface
|
// Level 0 commands, interface
|
||||||
// open, close, change serial interface
|
// open, close, change serial interface
|
||||||
@ -989,24 +995,12 @@ public:
|
|||||||
// uint16_t borough, uint16_t zone,
|
// uint16_t borough, uint16_t zone,
|
||||||
// uint16_t alias, char *location) const override;
|
// 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;
|
bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const override;
|
||||||
// return true if successful. could fail if more the 8 commands are waiting
|
// return true if successful. could fail if more the 8 commands are waiting
|
||||||
|
|
||||||
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
|
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
bool rtc_getExtendedTime(struct T_extTime *exTime) const override;
|
||||||
|
|
||||||
bool sys_runCompleteTest(void) const override;
|
bool sys_runCompleteTest(void) const override;
|
||||||
// warning: lasts 20s in one pace
|
// warning: lasts 20s in one pace
|
||||||
@ -1031,15 +1025,18 @@ public:
|
|||||||
// nr = 1..32
|
// nr = 1..32
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
void log_getHoldAccountNumbers(uint32_t *accNr ) const override;
|
void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const override;
|
||||||
// returns all acc nrs of the backuped vault records
|
// returns all acc nrs of the backuped vault records
|
||||||
// use: uint32_t backupedAccNumbers[8]
|
// use: uint16_t backupedAccNumbers[8]
|
||||||
|
|
||||||
bool log_selectVaultRecord(uint16_t accountNr ) const override;
|
bool log_selectVaultRecord(uint16_t accountNr ) const override;
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
|
// and trigger transfer
|
||||||
|
|
||||||
//request, isAvailable
|
bool log_chkIfVaultRecordAvailable(void) const override;
|
||||||
void log_getVaultRecord(struct T_vaultRecord *retVR) const override;
|
// return true if completly received
|
||||||
|
|
||||||
|
bool log_getVaultRecord(struct T_vaultRecord *retVR) const override;
|
||||||
// which was selected by: log_selectVaultRecord()
|
// which was selected by: log_selectVaultRecord()
|
||||||
// to be forwarded to Ismas
|
// to be forwarded to Ismas
|
||||||
|
|
||||||
@ -1049,7 +1046,8 @@ public:
|
|||||||
bool prn_printTestTicket(void) const override;
|
bool prn_printTestTicket(void) const override;
|
||||||
// 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
|
||||||
|
|
||||||
bool cash_startPayment(uint16_t amount) const override;
|
bool cash_startPayment(uint32_t amount) const override;
|
||||||
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
bool cash_cancelPayment(void) const override;
|
bool cash_cancelPayment(void) const override;
|
||||||
// and return coins
|
// and return coins
|
||||||
@ -1077,30 +1075,47 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t mif_getCardType(QString cardholder) const override;
|
uint8_t mif_getCardType(QString *cardholder) const override;
|
||||||
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
||||||
// cardholder: 7byte Name-String
|
// cardholder: 7byte Name-String
|
||||||
|
|
||||||
uint64_t sys_getWakeSource(void) const override;
|
uint64_t sys_getWakeSource(void) const override;
|
||||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
// 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(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
|
||||||
//void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
|
||||||
|
|
||||||
void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
|
void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t cash_getAmountInVault(void) const override;
|
||||||
|
|
||||||
|
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:
|
private slots:
|
||||||
void sub_storeSendingText(QByteArray *buf) const;
|
void hwapi_slotPrintFinished_OK(void);
|
||||||
|
void hwapi_slotPrintFinished_Err(void);
|
||||||
|
void hwapi_slotGotCoin(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
struct T_emp {
|
||||||
|
|
||||||
struct T_emp
|
|
||||||
{
|
|
||||||
|
|
||||||
// Fixdata from EMP:
|
// Fixdata from EMP:
|
||||||
uint8_t shaft; // = changer level
|
uint8_t shaft; // = changer level
|
||||||
uint16_t countryCode;
|
uint16_t countryCode;
|
||||||
@ -34,11 +31,9 @@ struct T_emp
|
|||||||
|
|
||||||
uint8_t pollingRunning;
|
uint8_t pollingRunning;
|
||||||
uint8_t paymentRunning;
|
uint8_t paymentRunning;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Trtc_DateTime
|
struct Trtc_DateTime {
|
||||||
{
|
|
||||||
uint8_t rtc_hour;
|
uint8_t rtc_hour;
|
||||||
uint8_t rtc_min;
|
uint8_t rtc_min;
|
||||||
uint8_t rtc_sec;
|
uint8_t rtc_sec;
|
||||||
@ -48,8 +43,7 @@ struct Trtc_DateTime
|
|||||||
uint8_t rtc_dayOfWeek;
|
uint8_t rtc_dayOfWeek;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tprn_hw_state
|
struct Tprn_hw_state {
|
||||||
{
|
|
||||||
// hardware (IO's)
|
// hardware (IO's)
|
||||||
bool powerRdBk; // prn pwr is on
|
bool powerRdBk; // prn pwr is on
|
||||||
bool rsSwOk; // serial switch (printer or modem) is set to printer
|
bool rsSwOk; // serial switch (printer or modem) is set to printer
|
||||||
@ -66,8 +60,7 @@ struct Tprn_hw_state
|
|||||||
bool badResponse;
|
bool badResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tprn_currentSettings
|
struct Tprn_currentSettings {
|
||||||
{
|
|
||||||
uint8_t currFont;
|
uint8_t currFont;
|
||||||
uint8_t currSize;
|
uint8_t currSize;
|
||||||
uint8_t currHeigth;
|
uint8_t currHeigth;
|
||||||
@ -80,8 +73,7 @@ struct Tprn_hw_state
|
|||||||
bool nowAligned;
|
bool nowAligned;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_dynDat
|
struct T_dynDat {
|
||||||
{
|
|
||||||
uint8_t licensePlate[8];
|
uint8_t licensePlate[8];
|
||||||
uint8_t vendingPrice[8];
|
uint8_t vendingPrice[8];
|
||||||
uint8_t parkingEnd[8];
|
uint8_t parkingEnd[8];
|
||||||
@ -92,10 +84,7 @@ struct Tprn_hw_state
|
|||||||
uint8_t dynDat7[8];
|
uint8_t dynDat7[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct T_vaultRecord {
|
||||||
struct T_vaultRecord
|
|
||||||
{
|
|
||||||
|
|
||||||
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
|
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
|
||||||
char startbuffer[4]; // Psa> // never move or change this 1st entry
|
char startbuffer[4]; // Psa> // never move or change this 1st entry
|
||||||
uint16_t AccountingNumber;
|
uint16_t AccountingNumber;
|
||||||
@ -126,7 +115,6 @@ struct T_vaultRecord
|
|||||||
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
//88
|
//88
|
||||||
|
|
||||||
// Service, Tür offen:
|
// Service, Tür offen:
|
||||||
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
@ -136,12 +124,10 @@ struct T_vaultRecord
|
|||||||
uint16_t resint5;
|
uint16_t resint5;
|
||||||
uint16_t resint6;
|
uint16_t resint6;
|
||||||
// 56
|
// 56
|
||||||
|
|
||||||
char label4buffer[4]; // box>
|
char label4buffer[4]; // box>
|
||||||
uint16_t coinsInVault[16];
|
uint16_t coinsInVault[16];
|
||||||
uint16_t billsInStacker[8];
|
uint16_t billsInStacker[8];
|
||||||
// 48
|
// 48
|
||||||
|
|
||||||
char label5buffer[4]; // val>
|
char label5buffer[4]; // val>
|
||||||
// actually constant unless exchange rate is changed
|
// actually constant unless exchange rate is changed
|
||||||
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
|
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
|
||||||
@ -149,17 +135,12 @@ struct T_vaultRecord
|
|||||||
uint16_t tubeDenom[6];
|
uint16_t tubeDenom[6];
|
||||||
uint16_t exchangeRate;
|
uint16_t exchangeRate;
|
||||||
uint16_t resint9;
|
uint16_t resint9;
|
||||||
|
|
||||||
// 64
|
// 64
|
||||||
|
|
||||||
char endofblock[4]; // end>
|
char endofblock[4]; // end>
|
||||||
|
|
||||||
// 316 byte Block im Speicher
|
// 316 byte Block im Speicher
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_moduleCondition
|
struct T_moduleCondition {
|
||||||
{
|
|
||||||
// store conditon of all system components, hold in RAM
|
// store conditon of all system components, hold in RAM
|
||||||
// 0 means unknown, not yet tested/used
|
// 0 means unknown, not yet tested/used
|
||||||
// 1 means OK
|
// 1 means OK
|
||||||
@ -167,30 +148,29 @@ struct T_moduleCondition
|
|||||||
// 100..150 = WARNING
|
// 100..150 = WARNING
|
||||||
// 200..250 = ERROR
|
// 200..250 = ERROR
|
||||||
|
|
||||||
uint8_t structStart; // always first!!!
|
uint8_t ram;
|
||||||
uint8_t ram; // v
|
uint8_t intEe;
|
||||||
uint8_t intEe; // v
|
uint8_t extEe;
|
||||||
uint8_t extEe; // v
|
|
||||||
|
|
||||||
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; // v
|
uint8_t boardHw;
|
||||||
uint8_t printer; // v
|
uint8_t printer;
|
||||||
uint8_t modem; // v
|
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;
|
||||||
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
||||||
|
|
||||||
uint8_t coinEscrow; // v
|
uint8_t coinEscrow;
|
||||||
uint8_t mifareReader; // v
|
uint8_t mifareReader;
|
||||||
uint8_t creditTerm; // not available
|
uint8_t creditTerm;
|
||||||
uint8_t coinReject; // v
|
uint8_t coinReject;
|
||||||
|
|
||||||
uint8_t coinSafe; // v
|
uint8_t coinSafe;
|
||||||
uint8_t billSafe; // v
|
uint8_t billSafe;
|
||||||
uint8_t voltage; // v // 1:11..14V
|
uint8_t voltage; // 1:11..14V
|
||||||
uint8_t temper; // v
|
uint8_t temper;
|
||||||
|
|
||||||
uint8_t poweronTest;
|
uint8_t poweronTest;
|
||||||
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
|
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
|
||||||
@ -206,70 +186,91 @@ struct T_moduleCondition
|
|||||||
uint8_t res11;
|
uint8_t res11;
|
||||||
uint8_t res12;
|
uint8_t res12;
|
||||||
uint8_t res13;
|
uint8_t res13;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_dynamicCondition
|
struct T_dynamicCondition {
|
||||||
{
|
char allDoorsDebounced;
|
||||||
// dynamic conditions, change rapidly and frequently
|
char openedAuthorized;
|
||||||
// these are values for the Heartbeat
|
uint8_t CBinDebounced;
|
||||||
|
|
||||||
// T?rschalter entprellt:
|
|
||||||
char upperDoor; // 0:fehlt 1:drin
|
char upperDoor; // 0:fehlt 1:drin
|
||||||
char middleDoor;
|
char middleDoor;
|
||||||
char lowerDoor;
|
char lowerDoor;
|
||||||
char coinBox;
|
char coinBox;
|
||||||
|
|
||||||
char billBox;
|
char billBox;
|
||||||
char modeAbrech;
|
char modeAbrech;
|
||||||
char onAlarm;
|
char onAlarm;
|
||||||
char nowCardTest;
|
char nowCardTest;
|
||||||
|
|
||||||
char nowPayment;
|
char nowPayment;
|
||||||
char lastMifCardType;
|
char lastMifCardType;
|
||||||
char openedAuthorized;
|
|
||||||
char allDoorsDebounced;
|
|
||||||
|
|
||||||
uint8_t lastSDoorState;
|
uint8_t lastSDoorState;
|
||||||
uint8_t lastVDoorState;
|
uint8_t lastVDoorState;
|
||||||
uint8_t CBinDebounced;
|
|
||||||
uint8_t lastCBstate;
|
uint8_t lastCBstate;
|
||||||
|
|
||||||
char paymentInProgress;
|
char paymentInProgress;
|
||||||
char res1;
|
char res1;
|
||||||
char res2;
|
|
||||||
char res3;
|
|
||||||
|
|
||||||
uint16_t U_Batt;
|
uint16_t U_Batt;
|
||||||
uint16_t Temperatur;
|
uint16_t Temperatur;
|
||||||
|
|
||||||
uint16_t cash_storedaccNumbers[8]; // List all stored accounting numbers in ext. eeprom
|
|
||||||
|
|
||||||
uint16_t nrCoinsInBox;
|
uint16_t nrCoinsInBox;
|
||||||
uint16_t resui1;
|
|
||||||
|
|
||||||
uint32_t amountInBox;
|
uint32_t amountInBox;
|
||||||
uint32_t amountJustPaid;
|
|
||||||
|
|
||||||
uint16_t lastInsCoinType; // wahrscheinlich uchar
|
|
||||||
uint16_t resui2;
|
|
||||||
|
|
||||||
uint32_t totalTransVolume;
|
uint32_t totalTransVolume;
|
||||||
uint32_t totalNrOfVends;
|
uint32_t totalNrOfVends;
|
||||||
|
char jsonValid_config;
|
||||||
|
char jsonValid_device;
|
||||||
|
char jsonValid_cash;
|
||||||
|
char jsonValid_print;
|
||||||
|
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 {
|
||||||
|
uint8_t Hours;
|
||||||
|
uint8_t Min;
|
||||||
|
uint8_t Sec;
|
||||||
|
uint8_t Year;
|
||||||
|
uint8_t Month;
|
||||||
|
uint8_t Day;
|
||||||
|
uint8_t DOW;
|
||||||
|
uint8_t res1;
|
||||||
|
uint16_t MinOfDay;
|
||||||
|
uint16_t res2;
|
||||||
|
uint32_t SecOfDay;
|
||||||
|
uint8_t isLeapYear;
|
||||||
|
uint8_t nxtLeapYear;
|
||||||
|
uint8_t lastLeapYear;
|
||||||
|
uint8_t hoursOfThisWeek;
|
||||||
|
uint16_t minutesOfThisWeek;
|
||||||
|
uint16_t hoursOfThisMonth;
|
||||||
|
uint16_t daysOfThisYear;
|
||||||
|
uint16_t GetHoursOfYear;
|
||||||
|
uint16_t res3;
|
||||||
|
uint32_t GetMinutesOfYear;
|
||||||
|
uint8_t getWakeIntvSec;
|
||||||
|
uint8_t res4;
|
||||||
|
uint16_t res5;
|
||||||
|
uint32_t MinutesOfMillenium;
|
||||||
|
};
|
||||||
|
|
||||||
class hwinf
|
class hwinf {
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||||
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER};
|
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER};
|
||||||
|
|
||||||
virtual ~hwinf() {}
|
virtual ~hwinf() {}
|
||||||
|
|
||||||
|
virtual QStringList dc_getStatus() const = 0;
|
||||||
|
|
||||||
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||||
// Use serial interface and protocol stack in Cashagent-Library
|
// Use serial interface and protocol stack in Cashagent-Library
|
||||||
@ -1371,6 +1372,8 @@ public:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const=0;
|
||||||
|
|
||||||
virtual bool sys_runCompleteTest(void) const=0;
|
virtual bool sys_runCompleteTest(void) const=0;
|
||||||
// warning: lasts 20s in one pace
|
// warning: lasts 20s in one pace
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
@ -1395,15 +1398,18 @@ public:
|
|||||||
// nr = 1..32
|
// nr = 1..32
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
virtual void log_getHoldAccountNumbers(uint32_t *accNr ) const=0;
|
virtual void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const=0;
|
||||||
// returns all acc nrs of the backuped vault records
|
// returns all acc nrs of the backuped vault records
|
||||||
// use: uint32_t backupedAccNumbers[8]
|
// use: uint16_t backupedAccNumbers[8]
|
||||||
|
|
||||||
virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
|
virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
|
// and trigger transfer
|
||||||
|
|
||||||
//request, isAvailable
|
virtual bool log_chkIfVaultRecordAvailable(void) const=0;
|
||||||
virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
// return true if completly received
|
||||||
|
|
||||||
|
virtual bool log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
||||||
// which was selected by: log_selectVaultRecord()
|
// which was selected by: log_selectVaultRecord()
|
||||||
// to be forwarded to Ismas
|
// to be forwarded to Ismas
|
||||||
|
|
||||||
@ -1413,7 +1419,8 @@ virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
|||||||
virtual bool prn_printTestTicket(void) const=0;
|
virtual bool prn_printTestTicket(void) const=0;
|
||||||
// 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
|
||||||
|
|
||||||
virtual bool cash_startPayment(uint16_t amount) const=0;
|
virtual bool cash_startPayment(uint32_t amount) const=0;
|
||||||
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
virtual uint32_t getInsertedAmount(void) const=0;
|
virtual uint32_t getInsertedAmount(void) const=0;
|
||||||
|
|
||||||
@ -1437,18 +1444,13 @@ virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
|||||||
// conclude payment process and return all inserted coins
|
// conclude payment process and return all inserted coins
|
||||||
|
|
||||||
|
|
||||||
|
virtual uint8_t mif_getCardType(QString *cardholder) const=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint8_t mif_getCardType(QString cardholder) const=0;
|
|
||||||
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
||||||
// cardholder: 7byte Name-String
|
// cardholder: 7byte Name-String
|
||||||
|
|
||||||
virtual uint64_t sys_getWakeSource(void) const =0;
|
virtual uint64_t sys_getWakeSource(void) const =0;
|
||||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
// 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;
|
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -1485,8 +1487,7 @@ virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
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;
|
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -1552,6 +1553,31 @@ virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
|
||||||
|
|
||||||
|
// content of Cashbox
|
||||||
|
virtual uint32_t cash_getAmountInVault(void) const=0;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1569,10 +1595,15 @@ virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
|||||||
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
|
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
|
||||||
// V3.2 Bootloader improvement
|
// V3.2 Bootloader improvement
|
||||||
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
||||||
|
// 14.04.2023: V3.4 new features extended: sys_getDynMachineConditions, sys_getDeviceConditions and
|
||||||
|
// rtc_getExtendedTime return struct in addition. New function to select and get VaultRecord
|
||||||
|
//
|
||||||
|
|
||||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
//#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.1"
|
||||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
//#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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,7 +218,10 @@ bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
|
|||||||
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
|
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
|
||||||
|
|
||||||
uint8_t check4FDshortCmd(void);
|
uint8_t check4FDshortCmd(void);
|
||||||
// returns number of waiting command
|
// returns number of waiting command, maxFDCMD_STACKDEPTH
|
||||||
|
|
||||||
|
uint8_t check4freeFDshortCmd(void);
|
||||||
|
// returns number of free places in short-command stack
|
||||||
|
|
||||||
#define FDLONG_STACKDEPTH 16
|
#define FDLONG_STACKDEPTH 16
|
||||||
void longFDcmd_clrStack(void);
|
void longFDcmd_clrStack(void);
|
||||||
@ -230,6 +233,9 @@ bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
|
|||||||
uint8_t check4FDlongCmd(void);
|
uint8_t check4FDlongCmd(void);
|
||||||
// returns number of waiting command
|
// returns number of waiting command
|
||||||
|
|
||||||
|
uint8_t check4freeFDlongCmd(void);
|
||||||
|
// returns number of free places in long-command stack
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
293
include/shared_mem_buffer.h
Normal file
293
include/shared_mem_buffer.h
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
#ifndef SHARED_MEM_BUFFER_INCLUDED_H
|
||||||
|
#define SHARED_MEM_BUFFER_INCLUDED_H
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
#include <QSharedMemory>
|
||||||
|
|
||||||
|
struct SharedMemBuffer {
|
||||||
|
struct rs {
|
||||||
|
char comportName[16]; // z.B. "COM48"
|
||||||
|
char baudStr[16]; // z.B. "19200"
|
||||||
|
int baudNr; // 0...5 oder -1
|
||||||
|
uint8_t connect; // 0,1
|
||||||
|
bool portIsOpen;
|
||||||
|
} rs;
|
||||||
|
|
||||||
|
char AutoEmissionOn; // 1: zyklisch Anfragen zum Slave senden
|
||||||
|
|
||||||
|
struct datif {
|
||||||
|
uint16_t sendingPeriod;
|
||||||
|
bool sendingPer_changed;
|
||||||
|
} datif;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// controlBus.cpp
|
||||||
|
char txt4comStateLine[32];
|
||||||
|
char txt4HsStateLine[32];
|
||||||
|
char txt4masterStateLine[32];
|
||||||
|
char txt4resultStateLine[32];
|
||||||
|
char txt4dataLine[32];
|
||||||
|
char txt4datifReceive[32];
|
||||||
|
char txt4diagWindow[32];
|
||||||
|
char sndTxt4diagWindow[32];
|
||||||
|
bool Sdata_serialTestResult[32];
|
||||||
|
uint8_t Sdata_pProtResultOk[32];
|
||||||
|
uint16_t Sdata_receivedDataLength[32];
|
||||||
|
uint8_t Sdata_receivedDataBlock[64];
|
||||||
|
|
||||||
|
// datif.cpp
|
||||||
|
uint8_t dif_dataStep;
|
||||||
|
uint8_t dif_scanStep;
|
||||||
|
uint8_t RDBLKNR;
|
||||||
|
uint8_t datif_OutCmdpara1;
|
||||||
|
uint8_t datif_OutCmdpara2;
|
||||||
|
uint8_t datif_OutCmdpara3;
|
||||||
|
uint8_t datif_OutCmdpara4;
|
||||||
|
|
||||||
|
uint16_t datif_OutCmdpara5;
|
||||||
|
uint32_t datif_OutCmdpara6;
|
||||||
|
uint8_t cycl_running;
|
||||||
|
|
||||||
|
// dcBL.cpp
|
||||||
|
uint8_t dcBL_LastBLcmd; // stored the last sent cmd in order to analys response
|
||||||
|
uint8_t dcBL_AtbBinFile[300000];
|
||||||
|
uint32_t dcBL_fileSize;
|
||||||
|
uint16_t dcBL_nrOfBlocks;
|
||||||
|
uint16_t dcBL_fileCrc;
|
||||||
|
uint8_t dcBL_myBuf[300000]; // same content like "dcBL_AtbBinFile" but bytewise
|
||||||
|
|
||||||
|
char BlResp[50][32];
|
||||||
|
uint8_t dcBL_step;
|
||||||
|
uint8_t dcBL_state;
|
||||||
|
uint16_t dcBL_BlkCtr;
|
||||||
|
uint16_t dcBL_cyclCtr;
|
||||||
|
uint16_t repeatCtr;
|
||||||
|
uint8_t Sdata_rawData[150];
|
||||||
|
uint8_t Sdata_LengthRawData;
|
||||||
|
|
||||||
|
// hwapi.cpp
|
||||||
|
uint16_t hwapi_shutterTime;
|
||||||
|
char ticketTemplate[1024];
|
||||||
|
|
||||||
|
// sendWRcmd.cpp
|
||||||
|
uint16_t nextAsynchsendCmd0[16];
|
||||||
|
uint8_t nrOfCmdsInQueue;
|
||||||
|
uint16_t nextAsynchsendCmd4[8];
|
||||||
|
uint8_t nextCmd4para1[8];
|
||||||
|
uint8_t nextCmd4para2[8];
|
||||||
|
uint8_t nextCmd4para3[8];
|
||||||
|
uint8_t nextCmd4para4[8];
|
||||||
|
uint8_t nrOfCmds4InQueue;
|
||||||
|
uint16_t nextAsynchsendCmd8[4];
|
||||||
|
uint8_t nextCmd8para1[4];
|
||||||
|
uint8_t nextCmd8para2[4];
|
||||||
|
uint16_t nextCmd8para3[4];
|
||||||
|
uint32_t nextCmd8para4[4];
|
||||||
|
uint8_t nrOfCmds8InQueue;
|
||||||
|
uint8_t sendAsynchDataBuf[160]; // no stack, only ONE buffer
|
||||||
|
uint8_t sendAsyDatLen;
|
||||||
|
uint8_t Sdata_mdbSendBuffer[64];
|
||||||
|
uint8_t Sdata_mdbSendLen;
|
||||||
|
uint8_t prnDataParameters[4];
|
||||||
|
uint8_t prnDataBufferUser;
|
||||||
|
char Sdata_PRN_TEXT[20][64];
|
||||||
|
uint8_t pPrnDataBuff; // points to next PRINTER_BLOCK
|
||||||
|
uint8_t nextFDwrCmd[16];
|
||||||
|
uint8_t nextFDrdCmd[16];
|
||||||
|
uint8_t nextFDblkNr[16];
|
||||||
|
|
||||||
|
uint8_t nextFDpara1[16];
|
||||||
|
uint8_t nextFDpara2[16];
|
||||||
|
uint8_t nextFDpara3[16];
|
||||||
|
uint8_t nextFDpara4[16];
|
||||||
|
uint8_t p_nextFDcmdsInQueue;
|
||||||
|
uint8_t longFDwrCmd[16];
|
||||||
|
uint8_t longFDrdCmd[16];
|
||||||
|
uint8_t longFDblkNr[16];
|
||||||
|
uint8_t longFDlength[16];
|
||||||
|
|
||||||
|
uint8_t longFDpara[16][64];
|
||||||
|
uint8_t p_longFDcmdsInQueue;
|
||||||
|
|
||||||
|
// storeInData.cpp
|
||||||
|
bool indat_savePrnPwr;
|
||||||
|
bool indat_saveMifPwr;
|
||||||
|
bool indat_MdbIsOn;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t ndbs;
|
||||||
|
uint8_t pari;
|
||||||
|
uint8_t nsb;
|
||||||
|
uint8_t br;
|
||||||
|
|
||||||
|
#define MAXNROF_GENSTR 16
|
||||||
|
char genStrings[MAXNROF_GENSTR][64];
|
||||||
|
|
||||||
|
#define MAXNROF_AI 4
|
||||||
|
uint16_t AI_val[MAXNROF_AI];
|
||||||
|
|
||||||
|
struct DigitalInputs {
|
||||||
|
uint8_t doorSwitch;
|
||||||
|
uint8_t vaultSwitch;
|
||||||
|
uint8_t lockSwitch;
|
||||||
|
uint8_t opto;
|
||||||
|
uint8_t aux;
|
||||||
|
bool wakeFromPtu;
|
||||||
|
bool wakeFromMdb;
|
||||||
|
bool wakeFromModem;
|
||||||
|
bool PrnReady;
|
||||||
|
bool CoinAttach;
|
||||||
|
bool CoinEscrowOpen;
|
||||||
|
bool mifCardTap;
|
||||||
|
bool contactPwrOn;
|
||||||
|
bool mifarePwrOn;
|
||||||
|
bool rdbk_mdbTxd;
|
||||||
|
bool AuxPwrOn;
|
||||||
|
bool gsmPwrOn;
|
||||||
|
bool creditPwrOn;
|
||||||
|
bool printerPwrOn;
|
||||||
|
bool mdbPwrOn;
|
||||||
|
bool rejMot_home;
|
||||||
|
uint8_t npe_sensor;
|
||||||
|
} din;
|
||||||
|
|
||||||
|
struct DigitalOutputs {
|
||||||
|
uint8_t mbdRxTst;
|
||||||
|
uint8_t motorBits;
|
||||||
|
uint8_t serialSwitch; // serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
uint8_t ledsAndFan;
|
||||||
|
uint8_t laermUndRelay;
|
||||||
|
uint8_t ptuWake;
|
||||||
|
uint8_t auxPower;
|
||||||
|
uint8_t coinShutter;
|
||||||
|
uint8_t coinEscrow;
|
||||||
|
uint8_t printerPower;
|
||||||
|
} dout;
|
||||||
|
|
||||||
|
struct Sdata {
|
||||||
|
#define NROFMIFSTATEBYTES 40
|
||||||
|
#define PRN_STATE_ARRAY_SIZE 20
|
||||||
|
#define PRN_STATE_FONT_SIZE 20
|
||||||
|
uint8_t MIF_STATE[NROFMIFSTATEBYTES];
|
||||||
|
uint8_t MIF_DATA[12][64];
|
||||||
|
uint8_t PRN_STATE[PRN_STATE_ARRAY_SIZE];
|
||||||
|
uint8_t PRN_FONTS[PRN_STATE_FONT_SIZE];
|
||||||
|
bool mdb_busRdy;
|
||||||
|
bool mdb_V12on;
|
||||||
|
bool mdb_V5on;
|
||||||
|
uint8_t mdbNrOfRecData;
|
||||||
|
uint8_t RecBuff[40];
|
||||||
|
uint8_t empNrOfsettings;
|
||||||
|
uint8_t emp_settingsBuff[66];
|
||||||
|
uint8_t NrOfDeviceSetting;
|
||||||
|
uint8_t DeviceSettingBuff[66];
|
||||||
|
uint8_t NrOfMachineIDSetting;
|
||||||
|
uint8_t NrOfMachineIDBuff[66];
|
||||||
|
uint64_t slaveUID;
|
||||||
|
uint8_t UIDstr[8];
|
||||||
|
#define MAXNROF_MEASURE 4
|
||||||
|
uint32_t measurement[MAXNROF_MEASURE];
|
||||||
|
bool serialTestResult;
|
||||||
|
uint8_t pProtResultOk;
|
||||||
|
uint16_t receivedDataLength;
|
||||||
|
uint8_t receivedDataBlock[64];
|
||||||
|
} Sdata;
|
||||||
|
|
||||||
|
uint8_t mif_cardType;
|
||||||
|
uint8_t mif_cardHolder[8];
|
||||||
|
|
||||||
|
#define MEMDEPTH_GOTCOINS (16)
|
||||||
|
struct T_coin {
|
||||||
|
uint8_t valid;
|
||||||
|
uint8_t signal;
|
||||||
|
uint8_t error;
|
||||||
|
uint8_t pad;
|
||||||
|
uint16_t value;
|
||||||
|
} gotCoin[MEMDEPTH_GOTCOINS];
|
||||||
|
uint8_t ctr_gotCoin;
|
||||||
|
|
||||||
|
struct store {
|
||||||
|
uint32_t insertedAmount;
|
||||||
|
uint16_t lastCoinType[64];
|
||||||
|
uint16_t lastCoinValue[64];
|
||||||
|
uint64_t wakeSrc;
|
||||||
|
uint8_t rbDevParamLen;
|
||||||
|
uint8_t rbDevParams[66];
|
||||||
|
uint8_t deviceCondLen;
|
||||||
|
uint8_t deviceCond[66];
|
||||||
|
uint8_t machCondLen;
|
||||||
|
uint8_t machCond[66];
|
||||||
|
uint8_t DcBackupNrOfAccNr;
|
||||||
|
uint16_t DcBackupAccNr[16]; // z.Z. nur 8
|
||||||
|
uint8_t gotNrBlocksOfVaultRec;
|
||||||
|
uint8_t vaultrecord[360];
|
||||||
|
uint32_t amount;
|
||||||
|
uint16_t nrOfCoins;
|
||||||
|
} store;
|
||||||
|
|
||||||
|
struct T_globTime {
|
||||||
|
// Reihenfolge nicht vertauschen!!!!!
|
||||||
|
uint8_t hour;
|
||||||
|
uint8_t minute;
|
||||||
|
uint8_t second;
|
||||||
|
uint8_t Year;
|
||||||
|
uint8_t Month;
|
||||||
|
uint8_t DayOfMonth;
|
||||||
|
uint8_t DayOfWeek; // 1=monday...7
|
||||||
|
uint8_t reserve1;
|
||||||
|
|
||||||
|
uint16_t MinutesOfToday;
|
||||||
|
uint16_t reserve2;
|
||||||
|
|
||||||
|
uint32_t SecondsOfToday;
|
||||||
|
|
||||||
|
uint8_t IsLeapyear;
|
||||||
|
uint8_t nextLeap;
|
||||||
|
uint8_t lastLeap;
|
||||||
|
uint8_t hoursOfWeek;
|
||||||
|
|
||||||
|
uint16_t minOfWeek;
|
||||||
|
uint16_t hoursOfMonth;
|
||||||
|
uint16_t minOfMonth;
|
||||||
|
uint16_t dayOfYear;
|
||||||
|
uint16_t hoursOfYear;
|
||||||
|
uint16_t reserve3;
|
||||||
|
|
||||||
|
uint32_t minOfYear;
|
||||||
|
|
||||||
|
uint8_t squareOutMode;
|
||||||
|
uint8_t free1;
|
||||||
|
uint16_t reserve4;
|
||||||
|
uint32_t minOfMillenium;
|
||||||
|
// bis hierher 44byts
|
||||||
|
uint32_t free2;
|
||||||
|
uint32_t free3;
|
||||||
|
uint32_t free4;
|
||||||
|
} getGlobalTime;
|
||||||
|
|
||||||
|
static QSharedMemory *getShm(std::size_t s = 0);
|
||||||
|
static SharedMemBuffer *getData() {
|
||||||
|
return (SharedMemBuffer *)getShm()->data();
|
||||||
|
}
|
||||||
|
static SharedMemBuffer const *getDataConst() {
|
||||||
|
return (SharedMemBuffer const *)getShm()->data();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static std::atomic<bool> __sharedMemLocked;
|
||||||
|
|
||||||
|
static bool sharedMemLocked() {
|
||||||
|
return __sharedMemLocked;
|
||||||
|
}
|
||||||
|
static void setSharedMemLocked() {
|
||||||
|
__sharedMemLocked = true;
|
||||||
|
}
|
||||||
|
static void setSharedMemUnlocked() {
|
||||||
|
__sharedMemLocked = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARED_MEM_BUFFER_INCLUDED_H
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define MAXNROF_AO 3
|
#define MAXNROF_AO 3
|
||||||
#define MAXNROF_GENSTR 16
|
//#define MAXNROF_GENSTR 16
|
||||||
#define MAXNROF_CONTR_PORTS 11
|
#define MAXNROF_CONTR_PORTS 11
|
||||||
#define MAXNROF_DIports 2
|
#define MAXNROF_DIports 2
|
||||||
#define MAXNROF_DOports 2
|
#define MAXNROF_DOports 2
|
||||||
@ -32,9 +32,6 @@ bool indat_isMifareOn();
|
|||||||
void indat_storeMDBisOn(bool isOn);
|
void indat_storeMDBisOn(bool isOn);
|
||||||
bool indat_isMdbOn();
|
bool indat_isMdbOn();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
||||||
uint8_t parity, uint8_t NrStopBits);
|
uint8_t parity, uint8_t NrStopBits);
|
||||||
|
|
||||||
@ -43,23 +40,16 @@ void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|||||||
|
|
||||||
QString epi_getSlaveParamSTR();
|
QString epi_getSlaveParamSTR();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeGenerals(uint8_t genNr, QString text);
|
void gpi_storeGenerals(uint8_t genNr, QString text);
|
||||||
// 0=HW 1=SW 2=State
|
// 0=HW 1=SW 2=State
|
||||||
|
|
||||||
QString epi_loadGenerals(uint8_t genNr);
|
QString epi_loadGenerals(uint8_t genNr);
|
||||||
// genNr=0=HW 1=SW 2=State
|
// genNr=0=HW 1=SW 2=State
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeUID(uint8_t *buf8byteUid);
|
void gpi_storeUID(uint8_t const *buf8byteUid);
|
||||||
// buffer size: 8 byte
|
// buffer size: 8 byte
|
||||||
|
|
||||||
void epi_getUIDdec(uint8_t *buf8byteUid);
|
void epi_getUIDdec(uint8_t *buf8byteUid);
|
||||||
// buffer size: 8 byte
|
// buffer size: 8 byte
|
||||||
|
|
||||||
QString epi_getUIDstr();
|
QString epi_getUIDstr();
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +79,7 @@ void epi_getSpecialYearTimeDate(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint
|
|||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#define MAXNROF_AI 4
|
// #define MAXNROF_AI 4
|
||||||
|
|
||||||
void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata
|
void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata
|
||||||
|
|
||||||
@ -138,185 +128,119 @@ void gpi_storeDI_optos(uint8_t indatOpto);
|
|||||||
uint8_t epi_getDI_optos(void);
|
uint8_t epi_getDI_optos(void);
|
||||||
// bit0: opto in 1 1: opto in 2
|
// bit0: opto in 1 1: opto in 2
|
||||||
|
|
||||||
void gpi_storeDI_auxIn(uint8_t indatAuxIn);
|
uint8_t gpi_storeDI_auxIn(uint8_t indatAuxIn); // Aux0...5
|
||||||
// Aux0...5
|
uint8_t epi_getDI_auxIn(void); // bit0: auxin 1 ... 5: auxin 6
|
||||||
|
|
||||||
uint8_t epi_getDI_auxIn(void);
|
|
||||||
// bit0: auxin 1 ... 5: auxin 6
|
|
||||||
|
|
||||||
void gpi_storeDI_ptuWake(uint8_t indat);
|
|
||||||
|
|
||||||
|
bool gpi_storeDI_ptuWake(bool w);
|
||||||
bool epi_getDI_ptuWake(void);
|
bool epi_getDI_ptuWake(void);
|
||||||
|
|
||||||
void gpi_storeDI_mbdWake(uint8_t indat);
|
bool gpi_storeDI_mbdWake(bool w);
|
||||||
|
|
||||||
bool epi_getDI_mdbWake(void);
|
bool epi_getDI_mdbWake(void);
|
||||||
|
|
||||||
void gpi_storeDI_prnReady(uint8_t indat);
|
bool gpi_storeDI_prnReady(bool ready);
|
||||||
|
|
||||||
bool epi_getDI_prnReady(void);
|
bool epi_getDI_prnReady(void);
|
||||||
|
|
||||||
void gpi_storeDI_CoinAttach(uint8_t indat);
|
bool gpi_storeDI_CoinAttach(bool attach);
|
||||||
|
|
||||||
bool epi_getDI_CoinAttach(void);
|
bool epi_getDI_CoinAttach(void);
|
||||||
|
|
||||||
void gpi_storeDI_CoinEscrow(uint8_t indat);
|
bool gpi_storeDI_CoinEscrow(bool ce);
|
||||||
|
|
||||||
bool epi_getDI_CoinEscrow(void);
|
bool epi_getDI_CoinEscrow(void);
|
||||||
|
|
||||||
void gpi_storeDI_mifareCardTapped(uint8_t indat);
|
bool gpi_storeDI_mifareCardTapped(bool tapped);
|
||||||
|
|
||||||
bool epi_getDI_mifareCardTapped(void);
|
bool epi_getDI_mifareCardTapped(void);
|
||||||
|
|
||||||
void gpi_storeDI_modemWake(uint8_t indat);
|
bool gpi_storeDI_modemWake(bool w);
|
||||||
|
|
||||||
bool epi_getDI_modemWake(void);
|
bool epi_getDI_modemWake(void);
|
||||||
|
|
||||||
|
bool gpi_storeDI_contactPowerIsOn(bool on);
|
||||||
void gpi_storeDI_contactPowerIsOn(bool di_contact_PwrOn);
|
|
||||||
|
|
||||||
bool epi_getDI_contactPwr(void);
|
bool epi_getDI_contactPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_MifarePowerIsOn(bool di_mifare_PwrOn);
|
bool gpi_storeDI_MifarePowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_mifarePwr(void);
|
bool epi_getDI_mifarePwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_readbackMdbTxD(bool di_rdbkMdbTxd);
|
bool gpi_storeDI_readbackMdbTxD(bool rdbkMdbTxd);
|
||||||
|
|
||||||
bool epi_getDI_mdbTxd(void);
|
bool epi_getDI_mdbTxd(void);
|
||||||
|
|
||||||
void gpi_storeDI_AuxPowerIsOn(bool di_Aux_PwrOn);
|
bool gpi_storeDI_AuxPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_auxPwr(void);
|
bool epi_getDI_auxPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn);
|
bool gpi_storeDI_GsmPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_gsmPwr(void);
|
bool epi_getDI_gsmPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_CreditPowerIsOn(bool di_credit_PwrOn);
|
bool gpi_storeDI_CreditPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_creditPwr(void);
|
bool epi_getDI_creditPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_PrinterPowerIsOn(bool di_printer_PwrOn);
|
bool gpi_storeDI_PrinterPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_printerPwr(void);
|
bool epi_getDI_printerPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_MdbPowerIsOn(bool di_mdb_PwrOn);
|
bool gpi_storeDI_MdbPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_mdbPwr(void);
|
bool epi_getDI_mdbPwr(void);
|
||||||
|
|
||||||
|
bool gpi_storeDI_rejMot_home(bool reject);
|
||||||
void gpi_storeDI_rejMot_home(bool di);
|
|
||||||
|
|
||||||
bool epi_getDI_rejectMotor_homepos(void);
|
bool epi_getDI_rejectMotor_homepos(void);
|
||||||
|
|
||||||
void gpi_storeDI_paperLow(uint8_t di);
|
uint8_t gpi_storeDI_paperLow(uint8_t di);
|
||||||
|
|
||||||
uint8_t epi_getDI_npe_sensor(void);
|
uint8_t epi_getDI_npe_sensor(void);
|
||||||
// 0: Sensor sees paper 1: no paper 99: off
|
// 0: Sensor sees paper 1: no paper 99: off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// readback digital outputs
|
// readback digital outputs
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
|
uint8_t gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
|
||||||
|
|
||||||
bool epi_getDO_mdbRxTestOut(void);
|
bool epi_getDO_mdbRxTestOut(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_motorOutputs(uint8_t Pwr);
|
||||||
void gpi_storeDO_motorOutputs(uint8_t Pwr);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_motorOuts(void);
|
uint8_t epi_getDO_motorOuts(void);
|
||||||
// bit0: upper lock forward bit 1 backward
|
// bit0: upper lock forward bit 1 backward
|
||||||
// bit2: lower lock forward bit 3 backward
|
// bit2: lower lock forward bit 3 backward
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_serialSwitch(uint8_t state);
|
||||||
void gpi_storeDO_serialSwitch(uint8_t state);
|
|
||||||
// serial drv on/off, Serial mux1, Serial mux2
|
// serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
|
||||||
uint8_t epi_getDO_serialSwitch(void);
|
uint8_t epi_getDO_serialSwitch(void);
|
||||||
// serial drv on/off, Serial mux1, Serial mux2
|
// serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
|
||||||
bool epi_getDO_serialDriverIsOn(void);
|
bool epi_getDO_serialDriverIsOn(void);
|
||||||
|
|
||||||
bool epi_getDO_serialMux1isSetToPrinter(void);
|
bool epi_getDO_serialMux1isSetToPrinter(void);
|
||||||
// mux1 off: serial is switched to printer
|
// mux1 off: serial is switched to printer
|
||||||
|
|
||||||
bool epi_getDO_serialMux1isSetToModem(void);
|
bool epi_getDO_serialMux1isSetToModem(void);
|
||||||
// mux1 on: serial is switched to modem
|
// mux1 on: serial is switched to modem
|
||||||
|
|
||||||
bool epi_getDO_serialMux2isSetToCredit(void);
|
bool epi_getDO_serialMux2isSetToCredit(void);
|
||||||
// mux2 off: serial is switched to credit card terminal
|
// mux2 off: serial is switched to credit card terminal
|
||||||
|
|
||||||
bool epi_getDO_serialMux2isSetToMifare(void);
|
bool epi_getDO_serialMux2isSetToMifare(void);
|
||||||
// mux2 on: serial is switched to mifare reader
|
// mux2 on: serial is switched to mifare reader
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_ledsAndFan(uint8_t ledState);
|
||||||
void gpi_storeDO_ledsAndFan(uint8_t ledState);
|
|
||||||
|
|
||||||
bool epi_getDO_led_coin(void);
|
bool epi_getDO_led_coin(void);
|
||||||
|
|
||||||
bool epi_getDO_led_front(void);
|
bool epi_getDO_led_front(void);
|
||||||
|
|
||||||
bool epi_getDO_led_ticket(void);
|
bool epi_getDO_led_ticket(void);
|
||||||
|
|
||||||
bool epi_getDO_led_pin(void);
|
bool epi_getDO_led_pin(void);
|
||||||
|
|
||||||
bool epi_getDO_led_start(void);
|
bool epi_getDO_led_start(void);
|
||||||
|
|
||||||
bool epi_getDO_led_inside(void);
|
bool epi_getDO_led_inside(void);
|
||||||
|
|
||||||
bool epi_getDO_fan(void);
|
bool epi_getDO_fan(void);
|
||||||
|
|
||||||
void gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
|
uint8_t gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
|
||||||
|
|
||||||
bool epi_getDO_sirene(void);
|
bool epi_getDO_sirene(void);
|
||||||
|
|
||||||
bool epi_getDO_relay(void);
|
bool epi_getDO_relay(void);
|
||||||
|
|
||||||
void gpi_storeDO_ptuWake(uint8_t state);
|
uint8_t gpi_storeDO_ptuWake(uint8_t state);
|
||||||
|
|
||||||
bool epi_getDO_ptuWake(void);
|
bool epi_getDO_ptuWake(void);
|
||||||
|
|
||||||
void gpi_storeDO_auxPower(uint8_t pwr);
|
uint8_t gpi_storeDO_auxPower(uint8_t pwr);
|
||||||
|
|
||||||
bool epi_getDO_auxPower(void);
|
bool epi_getDO_auxPower(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_coinShutter(uint8_t state);
|
||||||
void gpi_storeDO_coinShutter(uint8_t state);
|
|
||||||
|
|
||||||
bool epi_getDO_coinShutterOpen(void);
|
bool epi_getDO_coinShutterOpen(void);
|
||||||
|
|
||||||
bool epi_getDO_coinShutterTest(void);
|
bool epi_getDO_coinShutterTest(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_coinEscrow(uint8_t state);
|
||||||
void gpi_storeDO_coinEscrow(uint8_t state);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_coinEscrow(void);
|
uint8_t epi_getDO_coinEscrow(void);
|
||||||
// retval: 1:return flap is open 2:take flap is open 0:closed
|
// retval: 1:return flap is open 2:take flap is open 0:closed
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_printerPwrOn(uint8_t state);
|
||||||
void gpi_storeDO_printerPwrOn(uint8_t state);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_printerPwr(void);
|
uint8_t epi_getDO_printerPwr(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------
|
||||||
// counterchecks, make sure that DC-outputs are correct
|
// counterchecks, make sure that DC-outputs are correct
|
||||||
|
|
||||||
@ -363,21 +287,14 @@ bool epi_cntchk_Mot2Fon(void);
|
|||||||
|
|
||||||
uint8_t gpi_storeMdbRecData(uint8_t length, uint8_t *buf);
|
uint8_t gpi_storeMdbRecData(uint8_t length, uint8_t *buf);
|
||||||
// datif store received mdb data
|
// datif store received mdb data
|
||||||
|
|
||||||
uint8_t epi_getMdbResponse(void);
|
uint8_t epi_getMdbResponse(void);
|
||||||
// 0=no response 1=ACK 2=NAK 3=ACK with data
|
// 0=no response 1=ACK 2=NAK 3=ACK with data
|
||||||
|
|
||||||
uint8_t epi_getMdbRecLength(void);
|
uint8_t epi_getMdbRecLength(void);
|
||||||
// 0...31
|
// 0...31
|
||||||
|
|
||||||
uint8_t epi_restoreMdbRecData(uint8_t *buf);
|
uint8_t epi_restoreMdbRecData(uint8_t *buf);
|
||||||
// hwapi reads received mdb data from PI
|
// hwapi reads received mdb data from PI
|
||||||
|
|
||||||
|
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t const *buf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t *buf);
|
|
||||||
|
|
||||||
/* data description:
|
/* data description:
|
||||||
byte 0: current read state: 0=power off 1=reader-fault 2=ready
|
byte 0: current read state: 0=power off 1=reader-fault 2=ready
|
||||||
@ -401,41 +318,24 @@ byte 32: result, always 0
|
|||||||
|
|
||||||
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize);
|
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize);
|
||||||
// retval 0=OK 1=error host buffer too small
|
// retval 0=OK 1=error host buffer too small
|
||||||
|
bool gpi_storeMifCardData(uint8_t blkNr, uint8_t const *receivedData);
|
||||||
void gpi_storeMifCardData(uint8_t blkNr, uint8_t *receivedData);
|
|
||||||
// blkNr=0...11 receivedData[64]
|
// blkNr=0...11 receivedData[64]
|
||||||
|
|
||||||
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
|
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
|
||||||
// blkNr=0...11 return buf[64]
|
// blkNr=0...11 return buf[64]
|
||||||
// retval: 1=error 0=OK
|
// retval: 1=error 0=OK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define pi_prnStateArraySize 20
|
|
||||||
#define pi_prnFontArraySize 20
|
|
||||||
|
|
||||||
void epi_restorePrinterState(uint8_t *buf);
|
void epi_restorePrinterState(uint8_t *buf);
|
||||||
|
void gpi_storePrinterState(uint8_t const *buf);
|
||||||
void gpi_storePrinterState(uint8_t *buf);
|
|
||||||
|
|
||||||
void epi_restorePrinterFonts(uint8_t *buf);
|
void epi_restorePrinterFonts(uint8_t *buf);
|
||||||
|
void gpi_storePrinterFonts(uint8_t const *buf);
|
||||||
|
|
||||||
void gpi_storePrinterFonts(uint8_t *buf);
|
bool gpi_storeMdbState(bool busReady, bool V12on, bool V5on);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeMdbState(uint8_t busReady, uint8_t V12on, uint8_t V5on );
|
|
||||||
|
|
||||||
bool epi_restoreMdbBusReady(void);
|
bool epi_restoreMdbBusReady(void);
|
||||||
|
|
||||||
bool epi_restoreMdbV12Ready(void);
|
bool epi_restoreMdbV12Ready(void);
|
||||||
|
|
||||||
bool epi_restoreMdbV5Ready(void);
|
bool epi_restoreMdbV5Ready(void);
|
||||||
|
|
||||||
|
void gpi_storeMdbResponse(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeMdbResponse(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
||||||
// last received mdb answer (from mdb device)
|
// last received mdb answer (from mdb device)
|
||||||
// only needed if a special command was sent directly
|
// only needed if a special command was sent directly
|
||||||
@ -444,12 +344,9 @@ void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
|||||||
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
|
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
|
||||||
// DB3...DB38: rec.data (payload)
|
// DB3...DB38: rec.data (payload)
|
||||||
|
|
||||||
|
void gpi_storeEmpSettings(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeEmpSettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
||||||
|
|
||||||
@ -463,67 +360,60 @@ void epi_restoreEmpCoinSignal(uint8_t *leng, uint8_t *data);
|
|||||||
void epi_clearEmpCoinSignal();
|
void epi_clearEmpCoinSignal();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MEMDEPTH_GOTCOINS 16
|
|
||||||
|
|
||||||
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
uint8_t epi_isNewCoinLeft(void);
|
uint8_t epi_isNewCoinLeft(void);
|
||||||
// retval: 0...16 coins left in FIFO
|
// retval: 0...16 coins left in FIFO
|
||||||
|
|
||||||
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value);
|
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value);
|
||||||
|
|
||||||
|
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void epi_clearCurrentPayment(void);
|
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);
|
||||||
|
|
||||||
uint32_t epi_CurrentPaymentGetAmount(void);
|
uint32_t epi_CurrentPaymentGetAmount(void);
|
||||||
|
|
||||||
uint16_t epi_CurrentPaymentGetLastCoin(void);
|
uint16_t epi_CurrentPaymentGetLastCoin(void);
|
||||||
|
|
||||||
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
||||||
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
||||||
|
|
||||||
|
void gpi_storeWakeSources(uint8_t const *receivedData);
|
||||||
void gpi_storeWakeSources(uint8_t *receivedData);
|
|
||||||
|
|
||||||
uint64_t epi_getWakeSources(void);
|
uint64_t epi_getWakeSources(void);
|
||||||
|
|
||||||
|
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDeviceConditions(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t const *data);
|
||||||
|
void epi_restoreDCbackupAccNr(uint8_t *leng, uint16_t *accNrs);
|
||||||
|
// return accNrs[0..7]
|
||||||
|
|
||||||
|
void epi_iniVRstorage(void);
|
||||||
|
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t const *data);
|
||||||
|
bool epi_checkIfVaultRecordAvailable(void);
|
||||||
|
bool epi_restoreVaultRecord(uint16_t *length, uint8_t *buf);
|
||||||
|
// true if completly received
|
||||||
|
|
||||||
|
void gpi_storeCBlevel(uint32_t amount, uint16_t nrOfCoins);
|
||||||
|
|
||||||
|
uint32_t epi_getCashBoxContent(void);
|
||||||
|
uint16_t epi_getNrOfCoinsInCashBox(void);
|
||||||
|
|
||||||
|
void gpi_storeNewMifareCard(uint8_t typ, uint8_t const *holder);
|
||||||
|
|
||||||
|
uint8_t epi_mifGetCardType(uint8_t const *holder);
|
||||||
|
//holder[8] = name of card holder
|
||||||
|
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ 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 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);
|
void delay(uint16_t MilliSec);
|
||||||
|
|
||||||
|
@ -1,141 +1,110 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "tslib.h"
|
#include "tslib.h"
|
||||||
//#include "controlBus.h"
|
#include "shared_mem_buffer.h"
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// control serial interface gui <--> serial
|
// control serial interface gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void epi_setSerial(int BaudNr,
|
||||||
|
QString BaudStr,
|
||||||
|
QString ComName,
|
||||||
|
uint8_t connect) {
|
||||||
|
memset(&SharedMemBuffer::getData()->rs.comportName[0], 0x00,
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.comportName));
|
||||||
|
strncpy(SharedMemBuffer::getData()->rs.comportName,
|
||||||
|
ComName.toStdString().c_str(),
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.comportName)-1);
|
||||||
|
|
||||||
static QString rs_comportName; // z.B. "COM48"
|
memset(&SharedMemBuffer::getData()->rs.baudStr[0], 0x00,
|
||||||
static QString rs_baudStr; // z.B. "19200"
|
sizeof(SharedMemBuffer::getData()->rs.baudStr));
|
||||||
static int rs_baudNr; //0...5 oder -1
|
strncpy(SharedMemBuffer::getData()->rs.baudStr,
|
||||||
static uint8_t rs_connect; // 0,1
|
BaudStr.toStdString().c_str(),
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.baudStr)-1);
|
||||||
|
|
||||||
void epi_setSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect)
|
SharedMemBuffer::getData()->rs.baudNr = BaudNr;
|
||||||
{
|
SharedMemBuffer::getData()->rs.connect = connect;
|
||||||
// qDebug() << "ENTER" << BaudNr << BaudStr << ComName << connect;
|
|
||||||
|
|
||||||
rs_comportName = ComName;
|
|
||||||
rs_baudStr = BaudStr;
|
|
||||||
rs_baudNr = BaudNr; // 0=1200 1=9600 2=19200 3=38400 4=57600 5=115200 oder -1
|
|
||||||
rs_connect = connect; // 0/1
|
|
||||||
|
|
||||||
// qDebug() << "LEAVE" << rs_baudNr << rs_baudStr << rs_comportName << rs_connect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_closeSerial(void)
|
void epi_closeSerial(void) {
|
||||||
{
|
SharedMemBuffer::getData()->rs.connect = 0;
|
||||||
rs_connect=0;
|
|
||||||
// qDebug() << "ENTER/LEAVE rc_connect=0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpi_serialChanged(void) {
|
||||||
void gpi_serialChanged(void)
|
|
||||||
{
|
|
||||||
// serial confirms that port was closed or opened
|
// serial confirms that port was closed or opened
|
||||||
rs_connect=2; // Flanke, nur 1x öffnen/schließen
|
// rs_connect=2; // Flanke, nur 1x öffnen/schließen
|
||||||
//qDebug() << "ENTER/LEAVE rc_connect=2";
|
SharedMemBuffer::getData()->rs.connect = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t gpi_getSerialConn(void)
|
uint8_t gpi_getSerialConn(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->rs.connect;
|
||||||
return rs_connect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gpi_getBaudNr(void) {
|
||||||
int gpi_getBaudNr(void)
|
return SharedMemBuffer::getDataConst()->rs.baudNr;
|
||||||
{
|
|
||||||
return rs_baudNr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gpi_getComPortName(void)
|
QString gpi_getComPortName(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->rs.comportName;
|
||||||
return rs_comportName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rs_portIsOpen;
|
void gpi_serialIsOpen(bool offen) {
|
||||||
|
SharedMemBuffer::getData()->rs.portIsOpen = offen;
|
||||||
void gpi_serialIsOpen(bool offen)
|
|
||||||
{
|
|
||||||
//qDebug() << "ENTER/LEAVE offen=" << offen;
|
|
||||||
rs_portIsOpen=offen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool epi_isSerialPortOpen()
|
bool epi_isSerialPortOpen() {
|
||||||
{
|
|
||||||
// true: port is open false: port is closed
|
// true: port is open false: port is closed
|
||||||
//qDebug() << "ENTER/LEAVE offen=" << rs_portIsOpen;
|
return SharedMemBuffer::getDataConst()->rs.portIsOpen;
|
||||||
return rs_portIsOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Control transfer gui <--> serial
|
// Control transfer gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void epi_startEmmision(char start) {
|
||||||
static char AutoEmissionOn; // 1: zyklisch Anfragen zum Slave senden
|
SharedMemBuffer::getData()->AutoEmissionOn = start;
|
||||||
|
|
||||||
void epi_startEmmision(char start)
|
|
||||||
{
|
|
||||||
AutoEmissionOn=start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gpi_isEmmisionOn(void)
|
bool gpi_isEmmisionOn(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->AutoEmissionOn;
|
||||||
return AutoEmissionOn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
uint16_t gpi_getPeriodicSendTimeVal() {
|
||||||
|
SharedMemBuffer::getData()->datif.sendingPer_changed = 0;
|
||||||
static uint16_t datif_sendingPeriod;
|
if ((SharedMemBuffer::getDataConst()->datif.sendingPeriod < 3) ||
|
||||||
static bool datif_sendingPer_changed;
|
(SharedMemBuffer::getDataConst()->datif.sendingPeriod > 10000)) {
|
||||||
|
|
||||||
uint16_t gpi_getPeriodicSendTimeVal()
|
|
||||||
{
|
|
||||||
datif_sendingPer_changed=0;
|
|
||||||
if (datif_sendingPeriod<3 || datif_sendingPeriod>10000)
|
|
||||||
return 130; // ms, default
|
return 130; // ms, default
|
||||||
else
|
}
|
||||||
return datif_sendingPeriod;
|
return SharedMemBuffer::getDataConst()->datif.sendingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_setPeriodicSendTimeVal(uint16_t val)
|
void epi_setPeriodicSendTimeVal(uint16_t val) {
|
||||||
{
|
if (val>=3 && val<10000) {
|
||||||
if (val>=3 && val<10000)
|
SharedMemBuffer::getData()->datif.sendingPer_changed = 1;
|
||||||
{
|
SharedMemBuffer::getData()->datif.sendingPeriod = val;
|
||||||
datif_sendingPer_changed=1;
|
|
||||||
datif_sendingPeriod=val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gpi_PeriodicSendTimeHasChanged()
|
bool gpi_PeriodicSendTimeHasChanged() {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->datif.sendingPer_changed;
|
||||||
return datif_sendingPer_changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Status Display gui <--> serial
|
// Status Display gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// linke Spalte, über Connect Button
|
// linke Spalte, über Connect Button
|
||||||
static QString txt4comStateLine;
|
static QString txt4comStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4comStateLine(void)
|
QString epi_getTxt4comStateLine(void) {
|
||||||
{
|
|
||||||
// GUI: get Text for serial Comport-State Line
|
// GUI: get Text for serial Comport-State Line
|
||||||
return txt4comStateLine;
|
return txt4comStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4comStateLine(QString txtline) // gpi
|
void gpi_setTxt4comStateLine(QString txtline) {
|
||||||
{
|
|
||||||
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
||||||
txt4comStateLine.clear();
|
txt4comStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
@ -144,26 +113,20 @@ void gpi_setTxt4comStateLine(QString txtline) // gpi
|
|||||||
txt4comStateLine=txtline;
|
txt4comStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4comStateLine()
|
void epi_clrTxt4comStateLine() {
|
||||||
{
|
|
||||||
txt4comStateLine.clear();
|
txt4comStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// rechte Spalte, oberste Statuszeile
|
// rechte Spalte, oberste Statuszeile
|
||||||
// I) "Handshakes" (serial Control) flow.cpp
|
// I) "Handshakes" (serial Control) flow.cpp
|
||||||
// geht überhaupt was raus? kommt überhaupt was zurück?
|
// geht überhaupt was raus? kommt überhaupt was zurück?
|
||||||
static QString txt4HsStateLine;
|
static QString txt4HsStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4HsStateLine(void)
|
QString epi_getTxt4HsStateLine(void) {
|
||||||
{
|
|
||||||
return txt4HsStateLine;
|
return txt4HsStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4HsStateLine(QString txtline)
|
void gpi_setTxt4HsStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
@ -171,26 +134,19 @@ void gpi_setTxt4HsStateLine(QString txtline)
|
|||||||
txt4HsStateLine=txtline;
|
txt4HsStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4HsStateLine()
|
void epi_clrTxt4HsStateLine() {
|
||||||
{
|
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// II) Master receive state (empfangenes Telgramm OK? crc? length? )
|
// II) Master receive state (empfangenes Telgramm OK? crc? length? )
|
||||||
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
||||||
static QString txt4masterStateLine;
|
static QString txt4masterStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4masterStateLine(void)
|
QString epi_getTxt4masterStateLine(void) {
|
||||||
{
|
|
||||||
return txt4masterStateLine;
|
return txt4masterStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4masterStateLine(QString txtline)
|
void gpi_setTxt4masterStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
@ -198,13 +154,10 @@ void gpi_setTxt4masterStateLine(QString txtline)
|
|||||||
txt4masterStateLine=txtline;
|
txt4masterStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4masterStateLine()
|
void epi_clrTxt4masterStateLine() {
|
||||||
{
|
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
||||||
@ -214,13 +167,11 @@ void epi_clrTxt4masterStateLine()
|
|||||||
|
|
||||||
static QString txt4resultStateLine;
|
static QString txt4resultStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4resultStateLine(void)
|
QString epi_getTxt4resultStateLine(void) {
|
||||||
{
|
|
||||||
return txt4resultStateLine;
|
return txt4resultStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4resultStateLine(QString txtline)
|
void gpi_setTxt4resultStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
@ -228,26 +179,22 @@ void gpi_setTxt4resultStateLine(QString txtline)
|
|||||||
txt4resultStateLine=txtline;
|
txt4resultStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4resultStateLine()
|
void epi_clrTxt4resultStateLine() {
|
||||||
{
|
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// IV Statuszeile Empfangsdaten
|
// IV Statuszeile Empfangsdaten
|
||||||
static QString txt4dataLine;
|
static QString txt4dataLine;
|
||||||
|
|
||||||
QString epi_getTxt4dataStateLine(void)
|
QString epi_getTxt4dataStateLine(void) {
|
||||||
{
|
|
||||||
// GUI: get Text for serial Comport-State Line
|
// GUI: get Text for serial Comport-State Line
|
||||||
return txt4dataLine;
|
return txt4dataLine;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4dataStateLine(QString txtline)
|
void gpi_setTxt4dataStateLine(QString txtline) {
|
||||||
{
|
|
||||||
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
||||||
txt4dataLine.clear();
|
txt4dataLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
@ -256,8 +203,7 @@ void gpi_setTxt4dataStateLine(QString txtline)
|
|||||||
txt4dataLine=txtline;
|
txt4dataLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4dataStateLine()
|
void epi_clrTxt4dataStateLine() {
|
||||||
{
|
|
||||||
txt4dataLine.clear();
|
txt4dataLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,16 +213,11 @@ void epi_clrTxt4dataStateLine()
|
|||||||
|
|
||||||
static QString txt4datifReceive;
|
static QString txt4datifReceive;
|
||||||
|
|
||||||
QString epi_getTxt4datifLine(void)
|
QString epi_getTxt4datifLine(void) {
|
||||||
{
|
|
||||||
|
|
||||||
return txt4datifReceive;
|
return txt4datifReceive;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4datifLine(QString txtline)
|
void gpi_setTxt4datifLine(QString txtline) {
|
||||||
{
|
|
||||||
|
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
@ -284,8 +225,7 @@ void gpi_setTxt4datifLine(QString txtline)
|
|||||||
txt4datifReceive=txtline;
|
txt4datifReceive=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4datifLine()
|
void epi_clrTxt4datifLine() {
|
||||||
{
|
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,14 +234,11 @@ void epi_clrTxt4datifLine()
|
|||||||
|
|
||||||
static QString txt4diagWindow;
|
static QString txt4diagWindow;
|
||||||
|
|
||||||
QString epi_getTxt4RsDiagWin(void)
|
QString epi_getTxt4RsDiagWin(void) {
|
||||||
{
|
|
||||||
return txt4diagWindow;
|
return txt4diagWindow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4RsDiagWin(QString txtline)
|
void gpi_setTxt4RsDiagWin(QString txtline) {
|
||||||
{
|
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
@ -309,8 +246,7 @@ void gpi_setTxt4RsDiagWin(QString txtline)
|
|||||||
txt4diagWindow=txtline;
|
txt4diagWindow=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4RsDiagWin()
|
void epi_clrTxt4RsDiagWin() {
|
||||||
{
|
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,14 +254,11 @@ void epi_clrTxt4RsDiagWin()
|
|||||||
|
|
||||||
static QString sndTxt4diagWindow;
|
static QString sndTxt4diagWindow;
|
||||||
|
|
||||||
QString epi_get2ndTxt4RsDiagWin(void)
|
QString epi_get2ndTxt4RsDiagWin(void) {
|
||||||
{
|
|
||||||
return sndTxt4diagWindow;
|
return sndTxt4diagWindow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_set2ndTxt4RsDiagWin(QString txtline)
|
void gpi_set2ndTxt4RsDiagWin(QString txtline) {
|
||||||
{
|
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
@ -333,90 +266,61 @@ void gpi_set2ndTxt4RsDiagWin(QString txtline)
|
|||||||
sndTxt4diagWindow=txtline;
|
sndTxt4diagWindow=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clr2ndTxt4RsDiagWin()
|
void epi_clr2ndTxt4RsDiagWin() {
|
||||||
{
|
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Memory for Slave responses, common data
|
// Memory for Slave responses, common data
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void gpi_storeResult_serialTestOK(bool wasOk) {
|
||||||
|
SharedMemBuffer::getData()->Sdata.serialTestResult = wasOk;
|
||||||
static bool Sdata_serialTestResult;
|
|
||||||
|
|
||||||
void gpi_storeResult_serialTestOK(bool wasOk)
|
|
||||||
{
|
|
||||||
Sdata_serialTestResult=wasOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool epi_getResult_serialTestOK()
|
bool epi_getResult_serialTestOK() {
|
||||||
{
|
|
||||||
// retval: true: test was successful, got right response
|
// retval: true: test was successful, got right response
|
||||||
return Sdata_serialTestResult;
|
return SharedMemBuffer::getDataConst()->Sdata.serialTestResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Store received data for hwapi
|
// Store received data for hwapi
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void gpi_startNewRequest() {
|
||||||
|
SharedMemBuffer::getData()->Sdata.pProtResultOk = 0;
|
||||||
|
|
||||||
static uint8_t Sdata_pProtResultOk;
|
|
||||||
|
|
||||||
void gpi_startNewRequest()
|
|
||||||
{
|
|
||||||
Sdata_pProtResultOk=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_storeResultOfLastRequest(bool answisok)
|
void gpi_storeResultOfLastRequest(bool answisok) {
|
||||||
{
|
SharedMemBuffer::getData()->Sdata.pProtResultOk = answisok ? 1 : 2;
|
||||||
if (answisok)
|
|
||||||
Sdata_pProtResultOk=1;
|
|
||||||
else
|
|
||||||
Sdata_pProtResultOk=2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t epi_getResultOfLastRequest()
|
uint8_t epi_getResultOfLastRequest() {
|
||||||
{
|
|
||||||
// retval: 0: in progress 1: OK 2: error
|
// retval: 0: in progress 1: OK 2: error
|
||||||
return Sdata_pProtResultOk;
|
return SharedMemBuffer::getDataConst()->Sdata.pProtResultOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t const *receivedData) {
|
||||||
|
SharedMemBuffer::getData()->Sdata.receivedDataLength
|
||||||
|
= std::min(RdDlen, (uint8_t)(64));
|
||||||
static uint16_t Sdata_receivedDataLength;
|
memset((char *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
static uint8_t Sdata_receivedDataBlock[64];
|
0x00, sizeof(SharedMemBuffer::getData()->Sdata.receivedDataBlock));
|
||||||
|
strncpy((char *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData)
|
(char const *)receivedData,
|
||||||
{
|
sizeof(SharedMemBuffer::getData()->Sdata.receivedDataBlock)-1);
|
||||||
Sdata_receivedDataLength=uint16_t(RdDlen);
|
|
||||||
if (Sdata_receivedDataLength>64)
|
|
||||||
Sdata_receivedDataLength=64;
|
|
||||||
tslib_strclr(Sdata_receivedDataBlock,0,64);
|
|
||||||
tslib_strcpy(receivedData, Sdata_receivedDataBlock, Sdata_receivedDataLength);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad)
|
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad) {
|
||||||
{
|
|
||||||
// get data back in *pl, max 64 byte
|
// get data back in *pl, max 64 byte
|
||||||
// retval = nr of bytes received. If host buffer too small then
|
// retval = nr of bytes received. If host buffer too small then
|
||||||
// only plBufSíz bytes are copied to pl
|
// only plBufSíz bytes are copied to pl
|
||||||
// plBufSíz=size of host buffer
|
// plBufSíz=size of host buffer
|
||||||
|
|
||||||
uint16_t ml=plBufSiz;
|
uint16_t ml = std::min(plBufSiz, (uint16_t)(64));
|
||||||
if (ml>64) ml=64;
|
if (SharedMemBuffer::getDataConst()->Sdata.receivedDataLength < ml) {
|
||||||
if (Sdata_receivedDataLength<ml)
|
ml = SharedMemBuffer::getDataConst()->Sdata.receivedDataLength;
|
||||||
ml=Sdata_receivedDataLength;
|
}
|
||||||
tslib_strcpy(Sdata_receivedDataBlock, payLoad, ml);
|
strncpy((char *)payLoad,
|
||||||
return Sdata_receivedDataLength;
|
(char const *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
|
ml);
|
||||||
|
|
||||||
|
return SharedMemBuffer::getDataConst()->Sdata.receivedDataLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -863,6 +863,11 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
//int portNr;
|
//int portNr;
|
||||||
bool ret;
|
bool ret;
|
||||||
uint8_t uctmp; // maxai
|
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);
|
ret=myDCIF->getReceivedInData(&SlaveAdr, &readSource, &readAddress, &RdDleng, receivedData);
|
||||||
// retval: data valid, only one time true, true if CommandState OK and readState OK
|
// retval: data valid, only one time true, true if CommandState OK and readState OK
|
||||||
@ -902,7 +907,8 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
|
|
||||||
for (int ii=0; ii<RdDleng; ii++)
|
for (int ii=0; ii<RdDleng; ii++)
|
||||||
{
|
{
|
||||||
localStr.append(receivedData[ii]);
|
ctmp=receivedData[ii];
|
||||||
|
localStr.append(ctmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << "got HW version: " << localStr;
|
//qDebug() << "got HW version: " << localStr;
|
||||||
@ -936,7 +942,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
|
|
||||||
case CMD2DC_RdBkDCstate: //101
|
case CMD2DC_RdBkDCstate: //101
|
||||||
//qDebug() << "got DC state " << localStr;
|
//qDebug() << "got DC state " << localStr;
|
||||||
localStr[8]=0;
|
//localStr[8]=0;
|
||||||
gpi_storeGenerals(2, localStr);
|
gpi_storeGenerals(2, localStr);
|
||||||
// 0=HW 1=SW 2=State
|
// 0=HW 1=SW 2=State
|
||||||
break;
|
break;
|
||||||
@ -1112,7 +1118,9 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
case CMD2DC_RdBk_MifState: //109
|
case CMD2DC_RdBk_MifState: //109
|
||||||
// get reader status and card type
|
// get reader status and card type
|
||||||
|
|
||||||
gpi_storeMifReaderStateAndCardType(receivedData);
|
//gpi_storeMifReaderStateAndCardType(receivedData);
|
||||||
|
gpi_storeNewMifareCard(receivedData[0], &receivedData[1]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBk_MifData: //24
|
case CMD2DC_RdBk_MifData: //24
|
||||||
@ -1216,7 +1224,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ab hier neu: XXX
|
// ab hier neu: 12.4.23
|
||||||
|
|
||||||
case CMD2DC_RDBK_DEV_PARA: //14
|
case CMD2DC_RDBK_DEV_PARA: //14
|
||||||
/*
|
/*
|
||||||
@ -1350,10 +1358,16 @@ 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
|
||||||
ultmp=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]);
|
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||||
uit2=uchar2uint(receivedData[7],receivedData[6]);
|
uit2=uchar2uint(receivedData[7],receivedData[6]);
|
||||||
gpi_storeCurrentPayment(ultmp, uitmp, uit2);
|
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||||
|
if (newInsertedAmount != lastInsertedAmount)
|
||||||
|
{
|
||||||
|
emit datif_gotNewCoin();
|
||||||
|
lastInsertedAmount=newInsertedAmount;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 113: // get wake source, 8byte
|
case 113: // get wake source, 8byte
|
||||||
@ -1465,17 +1479,35 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
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;
|
break;
|
||||||
|
|
||||||
case 32: // Get current cash level (in vault)
|
case 32: // Get current cash level (in vault)
|
||||||
// bytes 0..3: amount bytes 4,5=Nr.ofCoins in vault
|
// bytes 0..3: amount bytes 4,5=Nr.ofCoins in vault
|
||||||
|
ultmp=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||||
|
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||||
|
gpi_storeCBlevel(ultmp, uitmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 33: // Get all backuped acc. Numbers
|
case 33: // Get all backuped acc. Numbers
|
||||||
// 8 UINTs with acc-nr
|
// 8 UINTs with acc-nr
|
||||||
|
gpi_storeDCbackupAccNr(RdDleng, receivedData);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 38: // Get stored account record backup
|
case 38: // Get stored account record backup
|
||||||
@ -1541,7 +1573,8 @@ struct T_vaultRecord
|
|||||||
UCHAR endofblock[4]; // end>
|
UCHAR endofblock[4]; // end>
|
||||||
// 316 byte Block im Speicher
|
// 316 byte Block im Speicher
|
||||||
*/
|
*/
|
||||||
|
// readAddress, &RdDleng, receivedData
|
||||||
|
gpi_storeVaultRecord(readAddress, receivedData ); // always 64byte
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1644,11 +1677,15 @@ bool T_datif::verifyLineTestresponse(uint8_t RdDlen, uint8_t *receivedData)
|
|||||||
if (RdDlen < 16)
|
if (RdDlen < 16)
|
||||||
return false;
|
return false;
|
||||||
QString myStr;
|
QString myStr;
|
||||||
|
char ctmp;
|
||||||
|
|
||||||
myStr.clear();
|
myStr.clear();
|
||||||
myStr.append("< Slave Response");
|
myStr.append("< Slave Response");
|
||||||
|
|
||||||
for (int nn=0; nn<16; nn++)
|
for (int nn=0; nn<16; nn++)
|
||||||
if (myStr[nn] !=receivedData[nn])
|
{
|
||||||
|
ctmp=receivedData[nn];
|
||||||
|
if (myStr[nn] != ctmp)
|
||||||
{
|
{
|
||||||
//qDebug() << " datif cmd 10: got wrong string ";
|
//qDebug() << " datif cmd 10: got wrong string ";
|
||||||
//qDebug() << myStr;
|
//qDebug() << myStr;
|
||||||
@ -1656,6 +1693,7 @@ bool T_datif::verifyLineTestresponse(uint8_t RdDlen, uint8_t *receivedData)
|
|||||||
//qDebug() << nn;
|
//qDebug() << nn;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
386
src/hwapi.cpp
386
src/hwapi.cpp
@ -21,29 +21,65 @@
|
|||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "storeINdata.h"
|
#include "storeINdata.h"
|
||||||
#include "dcBL.h"
|
#include "dcBL.h"
|
||||||
|
#include "shared_mem_buffer.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <../plugins/interfaces.h>
|
#include <QSharedMemory>
|
||||||
|
|
||||||
|
#include "interfaces.h"
|
||||||
|
|
||||||
|
static uint32_t hwapi_lastStartAmount;
|
||||||
|
|
||||||
static const QMap<QString, int> baudrateMap = {
|
static const QMap<QString, int> baudrateMap = {
|
||||||
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
{"1200" , 0}, {"9600" , 1}, {"19200" , 2}, {"38400" , 3},
|
||||||
{"57600" , 4}, {"115200" , 5}
|
{"57600" , 4}, {"115200" , 5}
|
||||||
};
|
};
|
||||||
|
|
||||||
hwapi::hwapi(QWidget *parent) : QObject(parent)
|
hwapi::hwapi(QWidget *parent) : QObject(parent) {
|
||||||
{
|
// create or attach shared memory segment
|
||||||
// constructor
|
// !!! The compoment creating the shared memory MUST be ATBQT !!!
|
||||||
//epi_resetAllDOs();
|
m_sharedMem = SharedMemBuffer::getShm(sizeof(SharedMemBuffer));
|
||||||
//PI_INI();
|
if (m_sharedMem) {
|
||||||
|
if (m_sharedMem->isAttached()) {
|
||||||
|
qInfo() << "Shared memory ("
|
||||||
|
<< sizeof(SharedMemBuffer) << "bytes) created and attached";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCritical() << "Creating/attaching shared memory failed";
|
||||||
|
}
|
||||||
sendWRcmd_INI();
|
sendWRcmd_INI();
|
||||||
|
|
||||||
myDatif = new T_datif();
|
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() {
|
||||||
|
if (m_sharedMem && m_sharedMem->isAttached()) {
|
||||||
|
m_sharedMem->detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hwapi::hwapi_slotPrintFinished_OK(void) {
|
||||||
|
emit hwapi_templatePrintFinished_OK();
|
||||||
|
}
|
||||||
|
|
||||||
void hwapi::sub_storeSendingText(QByteArray *buf) const
|
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!
|
char local[70], copie[1350]; // 64byte more then max buffer size!
|
||||||
int LL, nn, len, maxruns=20;
|
int LL, nn, len, maxruns=20;
|
||||||
@ -133,6 +169,22 @@ bool hwapi::dc_openSerial(int BaudNr, QString BaudStr,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList hwapi::dc_getStatus() const {
|
||||||
|
QStringList status;
|
||||||
|
|
||||||
|
if (m_sharedMem) {
|
||||||
|
SharedMemBuffer const *shMem = SharedMemBuffer::getDataConst();
|
||||||
|
status += QString("comport : %1").arg(shMem->rs.comportName);
|
||||||
|
status += QString("baudrate : %1").arg(shMem->rs.baudNr);
|
||||||
|
status += QString("baudNr : %1").arg(shMem->rs.baudStr);
|
||||||
|
status += QString("connect : %1").arg(shMem->rs.connect);
|
||||||
|
status += QString("port open: %1").arg(shMem->rs.portIsOpen);
|
||||||
|
// to be continued
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
bool hwapi::dc_closeSerial(void) const {
|
bool hwapi::dc_closeSerial(void) const {
|
||||||
epi_closeSerial();
|
epi_closeSerial();
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
@ -739,13 +791,16 @@ QString hwapi::rtc_getTimStr() const
|
|||||||
{
|
{
|
||||||
uint8_t hh, mm, ss, buf[20], nn;
|
uint8_t hh, mm, ss, buf[20], nn;
|
||||||
QString qbuf;
|
QString qbuf;
|
||||||
|
char ctmp;
|
||||||
qbuf.clear();
|
qbuf.clear();
|
||||||
for (nn=0; nn<20; nn++) buf[nn]=0;
|
for (nn=0; nn<20; nn++) buf[nn]=0;
|
||||||
epi_getTime(&hh, &mm, &ss);
|
epi_getTime(&hh, &mm, &ss);
|
||||||
GetTimeString(hh, mm, ss, HourSys24h, MITSEK, buf); // about 12byte long
|
GetTimeString(hh, mm, ss, HourSys24h, MITSEK, buf); // about 12byte long
|
||||||
for (nn=0; nn<20; nn++) qbuf[nn]=buf[nn];
|
for (nn=0; nn<20; nn++)
|
||||||
|
{
|
||||||
|
ctmp=buf[nn];
|
||||||
|
qbuf[nn]=ctmp;
|
||||||
|
}
|
||||||
return qbuf;
|
return qbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,14 +808,17 @@ QString hwapi::rtc_getDatStr() const
|
|||||||
{
|
{
|
||||||
uint8_t day, month, year, buf[20], nn;
|
uint8_t day, month, year, buf[20], nn;
|
||||||
QString qbuf;
|
QString qbuf;
|
||||||
|
char ctmp;
|
||||||
|
|
||||||
qbuf.clear();
|
qbuf.clear();
|
||||||
for (nn=0; nn<20; nn++) buf[nn]=0;
|
for (nn=0; nn<20; nn++) buf[nn]=0;
|
||||||
epi_getDate(&year, &month, &day);
|
epi_getDate(&year, &month, &day);
|
||||||
GetDateString(day, month, 0x20, year, DateFormatDeutsch, 0, buf);
|
GetDateString(day, month, 0x20, year, DateFormatDeutsch, 0, buf);
|
||||||
for (nn=0; nn<20; nn++)
|
for (nn=0; nn<20; nn++)
|
||||||
qbuf[nn]=buf[nn];
|
{
|
||||||
|
ctmp= buf[nn];
|
||||||
|
qbuf[nn]=ctmp;
|
||||||
|
}
|
||||||
return qbuf;
|
return qbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2221,7 +2279,8 @@ bool hwapi::pri_TD_addText(QByteArray text) const
|
|||||||
|
|
||||||
bool hwapi::pri_TD_addValue(int val) const
|
bool hwapi::pri_TD_addValue(int val) const
|
||||||
{
|
{
|
||||||
QString tmpStr;
|
// QString tmpStr;
|
||||||
|
QByteArray tmpStr;
|
||||||
tmpStr.setNum(val,10); // up to 12 chars
|
tmpStr.setNum(val,10); // up to 12 chars
|
||||||
if (ticketTemplate.length()>1266)
|
if (ticketTemplate.length()>1266)
|
||||||
return false;
|
return false;
|
||||||
@ -3071,7 +3130,7 @@ bool hwapi::bl_isUp(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hwapi::bl_sendAddress(u_int16_t blockNumber) const
|
void hwapi::bl_sendAddress(uint16_t blockNumber) const
|
||||||
{
|
{
|
||||||
// send start address, nr of 64byte-block, start with 0
|
// send start address, nr of 64byte-block, start with 0
|
||||||
// will be sent only for folling block-numbers:
|
// will be sent only for folling block-numbers:
|
||||||
@ -3106,7 +3165,7 @@ void hwapi::bl_openBinary(void) const
|
|||||||
dcBL_loadBinary(0);
|
dcBL_loadBinary(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const
|
void hwapi::bl_sendDataBlock(uint8_t length, uint8_t *buffer) const
|
||||||
{
|
{
|
||||||
// send 64 byte from bin file
|
// send 64 byte from bin file
|
||||||
uint8_t LL=length, sendBuf[80], sendLen;
|
uint8_t LL=length, sendBuf[80], sendLen;
|
||||||
@ -3137,6 +3196,7 @@ void hwapi::bl_sendLastBlock(void) const
|
|||||||
|
|
||||||
len=dcBL_writeLastPage(buf);
|
len=dcBL_writeLastPage(buf);
|
||||||
sendWRcmd_setSendBlock160(len, buf);
|
sendWRcmd_setSendBlock160(len, buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t hwapi::bl_wasSendingDataOK(void) const
|
uint8_t hwapi::bl_wasSendingDataOK(void) const
|
||||||
@ -3309,6 +3369,60 @@ bool hwapi::rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hwapi::rtc_getExtendedTime(struct T_extTime *exTime) const
|
||||||
|
{
|
||||||
|
uint8_t len;
|
||||||
|
uint16_t LL, nn;
|
||||||
|
uint8_t *start;
|
||||||
|
uint8_t buf[66];
|
||||||
|
|
||||||
|
epi_restoreExtendedTime(&len, buf);
|
||||||
|
// Puffer in struct eintragen:
|
||||||
|
LL=sizeof(struct T_extTime);
|
||||||
|
start = &(exTime->Hours);
|
||||||
|
nn=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*start = buf[nn];
|
||||||
|
start++;
|
||||||
|
} while(++nn<LL);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct T_extTime
|
||||||
|
{
|
||||||
|
uint8_t Hours;
|
||||||
|
uint8_t Min;
|
||||||
|
uint8_t Sec;
|
||||||
|
uint8_t Year;
|
||||||
|
uint8_t Month;
|
||||||
|
uint8_t Day;
|
||||||
|
uint8_t DOW;
|
||||||
|
uint8_t res1;
|
||||||
|
uint16_t MinOfDay;
|
||||||
|
uint16_t res2;
|
||||||
|
uint32_t SecOfDay;
|
||||||
|
uint8_t isLeapYear;
|
||||||
|
uint8_t nxtLeapYear;
|
||||||
|
uint8_t lastLeapYear;
|
||||||
|
uint8_t hoursOfThisWeek;
|
||||||
|
uint16_t minutesOfThisWeek;
|
||||||
|
uint16_t hoursOfThisMonth;
|
||||||
|
uint16_t daysOfThisYear;
|
||||||
|
uint16_t GetHoursOfYear;
|
||||||
|
uint16_t res3;
|
||||||
|
uint32_t GetMinutesOfYear;
|
||||||
|
uint8_t getWakeIntvSec;
|
||||||
|
uint8_t res4;
|
||||||
|
uint16_t res5;
|
||||||
|
uint32_t MinutesOfMillenium;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool hwapi::sys_runCompleteTest(void) const
|
bool hwapi::sys_runCompleteTest(void) const
|
||||||
{
|
{
|
||||||
// warning: lasts 20s in one pace
|
// warning: lasts 20s in one pace
|
||||||
@ -3320,9 +3434,8 @@ bool hwapi::sys_ready4sending(void) const
|
|||||||
// return true if a Json-file can be sent
|
// return true if a Json-file can be sent
|
||||||
|
|
||||||
// check free memory
|
// check free memory
|
||||||
uint8_t frei=FDLONG_STACKDEPTH - check4FDlongCmd();
|
uint8_t frei=check4freeFDlongCmd();
|
||||||
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
|
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
|
||||||
// in check4FDlongCmd() steht wieviele Plaetze bereits belegt sind
|
|
||||||
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
|
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
|
||||||
// das Json-File hat max 800 byte = 13 bloecke
|
// das Json-File hat max 800 byte = 13 bloecke
|
||||||
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
|
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
|
||||||
@ -3357,9 +3470,8 @@ bool hwapi::sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8
|
|||||||
dateiLang<<=6; // auf volle 64byte aufgerundet
|
dateiLang<<=6; // auf volle 64byte aufgerundet
|
||||||
|
|
||||||
// check free memory
|
// check free memory
|
||||||
frei=FDLONG_STACKDEPTH - check4FDlongCmd();
|
frei=check4freeFDlongCmd();
|
||||||
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
|
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
|
||||||
// in check4FDlongCmd() steht wieviele Plaetze bereits belegt sind
|
|
||||||
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
|
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
|
||||||
// das Json-File hat max 800 byte = 13 bloecke
|
// das Json-File hat max 800 byte = 13 bloecke
|
||||||
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
|
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
|
||||||
@ -3380,8 +3492,8 @@ bool hwapi::sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8
|
|||||||
{
|
{
|
||||||
biox_CopyBlock(inhaltOfJson, uitmp, temp, 0, 64);
|
biox_CopyBlock(inhaltOfJson, uitmp, temp, 0, 64);
|
||||||
longFDcmd_set(31,0, bn++, 64, temp);
|
longFDcmd_set(31,0, bn++, 64, temp);
|
||||||
uitmp += 64;
|
//uitmp<<=6; // falsch
|
||||||
// uitmp<<=6;
|
uitmp+=64;
|
||||||
} while(uitmp < dateiLang);
|
} while(uitmp < dateiLang);
|
||||||
|
|
||||||
longFDcmd_set(32, 0,0, 0,temp); // Abschluss
|
longFDcmd_set(32, 0,0, 0,temp); // Abschluss
|
||||||
@ -3412,11 +3524,12 @@ bool hwapi::prn_printTemplate(uint8_t nrOftemplate) const
|
|||||||
return sendFDcmd_set(152, 0,0, nrOftemplate,0,0,0);
|
return sendFDcmd_set(152, 0,0, nrOftemplate,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::log_getHoldAccountNumbers(uint32_t *accNr ) const
|
void hwapi::log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const
|
||||||
// returns all acc nrs of the backuped vault records
|
|
||||||
// use: uint32_t backupedAccNumbers[8]
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(accNr);
|
// returns all acc nrs of the backuped vault records
|
||||||
|
// use: uint16_t backupedAccNumbers[8]
|
||||||
|
|
||||||
|
epi_restoreDCbackupAccNr(nrOfVals, accNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3424,21 +3537,62 @@ void hwapi::log_getHoldAccountNumbers(uint32_t *accNr ) const
|
|||||||
bool hwapi::log_selectVaultRecord(uint16_t accountNr ) const
|
bool hwapi::log_selectVaultRecord(uint16_t accountNr ) const
|
||||||
{
|
{
|
||||||
// return true if sending, false if cmd-stack is full
|
// return true if sending, false if cmd-stack is full
|
||||||
uint8_t dat1, dat2;
|
// and trigger transfer
|
||||||
|
|
||||||
|
uint8_t dat1, dat2;
|
||||||
|
bool ret;
|
||||||
|
|
||||||
|
uint8_t frei=check4freeFDshortCmd();
|
||||||
|
if (frei<8)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
epi_iniVRstorage();
|
||||||
dat1=uint2uchar(accountNr, LOWBYTE);
|
dat1=uint2uchar(accountNr, LOWBYTE);
|
||||||
dat2=uint2uchar(accountNr, HIGHBYTE);
|
dat2=uint2uchar(accountNr, HIGHBYTE);
|
||||||
return sendFDcmd_set(153, 0,0, dat1,dat2,0,0);
|
ret=sendFDcmd_set(153, 0,0, dat1,dat2,0,0); // select this record
|
||||||
|
// true means "will be sent"
|
||||||
|
sendFDcmd_set(0,38,0, 0,0,0,0); // return VaultRecord block-Nr.0
|
||||||
|
sendFDcmd_set(0,38,1, 0,0,0,0); // return VaultRecord block-Nr.1
|
||||||
|
sendFDcmd_set(0,38,2, 0,0,0,0); // return VaultRecord block-Nr.2
|
||||||
|
sendFDcmd_set(0,38,3, 0,0,0,0); // return VaultRecord block-Nr.3
|
||||||
|
sendFDcmd_set(0,38,4, 0,0,0,0); // return VaultRecord block-Nr.4
|
||||||
|
sendFDcmd_set(0,38,5, 0,0,0,0); // return VaultRecord block-Nr.4
|
||||||
|
// 38: <100 to get long 64byte response
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hwapi::log_chkIfVaultRecordAvailable(void) const
|
||||||
|
{
|
||||||
|
// return true if completly received
|
||||||
|
return epi_checkIfVaultRecordAvailable();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//request, isAvailable
|
bool hwapi::log_getVaultRecord(struct T_vaultRecord *retVR) const
|
||||||
void hwapi::log_getVaultRecord(struct T_vaultRecord *retVR) const
|
|
||||||
// which was selected by: log_selectVaultRecord()
|
// which was selected by: log_selectVaultRecord()
|
||||||
// to be forwarded to Ismas
|
// to be forwarded to Ismas
|
||||||
|
// return true if completly received
|
||||||
{
|
{
|
||||||
Q_UNUSED(retVR);
|
|
||||||
|
uint16_t LL, nn, len;
|
||||||
|
char *start;
|
||||||
|
uint8_t buf[400];
|
||||||
|
bool ret;
|
||||||
|
|
||||||
|
ret=epi_restoreVaultRecord(&len, buf); // true if completly received
|
||||||
|
if (ret==false)
|
||||||
|
return false;
|
||||||
|
// Puffer in struct eintragen:
|
||||||
|
LL=sizeof(struct T_vaultRecord); // =320
|
||||||
|
start = &retVR->startbuffer[0];
|
||||||
|
nn=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*start = buf[nn];
|
||||||
|
start++;
|
||||||
|
} while(++nn<LL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::prn_printAccountReceipt(void) const
|
bool hwapi::prn_printAccountReceipt(void) const
|
||||||
@ -3453,14 +3607,19 @@ bool hwapi::prn_printTestTicket(void) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::cash_startPayment(uint16_t amount) const
|
bool hwapi::cash_startPayment(uint32_t amount) const
|
||||||
{
|
{
|
||||||
uint8_t dat1, dat2;
|
// 17.4.23TS: extended to 32bit
|
||||||
|
uint8_t dat1, dat2, dat3, dat4;
|
||||||
|
|
||||||
|
hwapi_lastStartAmount=amount;
|
||||||
epi_clearCurrentPayment();
|
epi_clearCurrentPayment();
|
||||||
dat1=uint2uchar(amount, LOWBYTE);
|
dat1=ulong2uchar(amount, 0);
|
||||||
dat2=uint2uchar(amount, HIGHBYTE);
|
dat2=ulong2uchar(amount, 1);
|
||||||
return sendFDcmd_set(155, 0,0, dat1,dat2,0,0);
|
dat3=ulong2uchar(amount, 2);
|
||||||
|
dat4=ulong2uchar(amount, 3);
|
||||||
|
|
||||||
|
return sendFDcmd_set(155, 0,0, dat1,dat2,dat3,dat4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3494,6 +3653,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
|
||||||
|
emit hwapi_vendStopByPushbutton();
|
||||||
return sendFDcmd_set(156, 0,0, 3,0,0,0);
|
return sendFDcmd_set(156, 0,0, 3,0,0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3516,17 +3676,24 @@ bool hwapi::vend_failed(void) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t hwapi::mif_getCardType(QString *cardholder) const
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t hwapi::mif_getCardType(QString cardholder) const
|
|
||||||
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
||||||
// cardholder: 7byte Name-String
|
// cardholder: 7byte Name-String
|
||||||
{
|
{
|
||||||
Q_UNUSED(cardholder);
|
uint8_t type, buf[8], nn;
|
||||||
return 0; // to satisfy compiler
|
char ctmp;
|
||||||
|
|
||||||
|
memset(buf, 0x00, sizeof(buf));
|
||||||
|
|
||||||
|
type=epi_mifGetCardType(&buf[0]);
|
||||||
|
//holder[8] = name of card holder
|
||||||
|
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
||||||
|
for (nn=0;nn<8; nn++) {
|
||||||
|
ctmp=buf[nn];
|
||||||
|
cardholder[nn]=ctmp;
|
||||||
|
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t hwapi::sys_getWakeSource(void) const
|
uint64_t hwapi::sys_getWakeSource(void) const
|
||||||
@ -3535,17 +3702,138 @@ uint64_t hwapi::sys_getWakeSource(void) const
|
|||||||
return epi_getWakeSources();
|
return epi_getWakeSources();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
|
||||||
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];
|
//uint8_t leng, data[66];
|
||||||
epi_restoreDeviceConditions(leng, data);
|
epi_restoreDeviceConditions(leng, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void hwapi::sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const
|
void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
||||||
void hwapi::sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const
|
|
||||||
{
|
{
|
||||||
epi_restoreDeviceConditions(leng, data);
|
uint16_t LL, nn;
|
||||||
|
uint8_t *start;
|
||||||
|
uint8_t buf[70], leng;
|
||||||
|
|
||||||
|
epi_restoreDeviceConditions(&leng, buf);
|
||||||
|
|
||||||
|
// Puffer in struct eintragen:
|
||||||
|
LL=sizeof(struct T_moduleCondition);
|
||||||
|
start = &devCond->ram;
|
||||||
|
nn=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*start = buf[nn];
|
||||||
|
start++;
|
||||||
|
} while(++nn<LL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void hwapi::sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const
|
||||||
|
{
|
||||||
|
epi_restoreDynMachineConditions(leng, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hwapi::sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const
|
||||||
|
{
|
||||||
|
|
||||||
|
uint16_t LL, nn;
|
||||||
|
char *start;
|
||||||
|
uint8_t buf[70], leng;
|
||||||
|
|
||||||
|
epi_restoreDynMachineConditions(&leng, buf);
|
||||||
|
// Puffer in struct eintragen:
|
||||||
|
LL=sizeof(struct T_dynamicCondition);
|
||||||
|
start = &dynMachCond->allDoorsDebounced;
|
||||||
|
nn=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*start = buf[nn];
|
||||||
|
start++;
|
||||||
|
} while(++nn<LL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t hwapi::cash_getAmountInVault(void) const
|
||||||
|
{
|
||||||
|
return epi_getCashBoxContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t hwapi::cash_getNrCoinsInVault(void) const
|
||||||
|
{
|
||||||
|
return epi_getNrOfCoinsInCashBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,11 +563,17 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
|
|||||||
|
|
||||||
uint8_t check4FDshortCmd(void)
|
uint8_t check4FDshortCmd(void)
|
||||||
{
|
{
|
||||||
// returns number of waiting command
|
// returns number of waiting command, max FDCMD_STACKDEPTH
|
||||||
return p_nextFDcmdsInQueue;
|
return p_nextFDcmdsInQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t check4freeFDshortCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of free places in short-command stack
|
||||||
|
return FDCMD_STACKDEPTH - p_nextFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// long command, 64 data bytes
|
// long command, 64 data bytes
|
||||||
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
|
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
|
||||||
@ -602,7 +608,7 @@ bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
|
|||||||
uint8_t nn;
|
uint8_t nn;
|
||||||
if (p_longFDcmdsInQueue>=FDLONG_STACKDEPTH)
|
if (p_longFDcmdsInQueue>=FDLONG_STACKDEPTH)
|
||||||
{
|
{
|
||||||
qCritical() << "cannot save cmd because stack is full";
|
qDebug() << "cannot save cmd because stack is full";
|
||||||
return false; // not possible
|
return false; // not possible
|
||||||
}
|
}
|
||||||
longFDwrCmd[p_longFDcmdsInQueue]=nextWrCmd;
|
longFDwrCmd[p_longFDcmdsInQueue]=nextWrCmd;
|
||||||
@ -613,7 +619,6 @@ bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
|
|||||||
longFDpara[p_longFDcmdsInQueue][nn]=data[nn];
|
longFDpara[p_longFDcmdsInQueue][nn]=data[nn];
|
||||||
|
|
||||||
p_longFDcmdsInQueue++;
|
p_longFDcmdsInQueue++;
|
||||||
|
|
||||||
return true; // ok, will be sent
|
return true; // ok, will be sent
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,5 +664,10 @@ uint8_t check4FDlongCmd(void)
|
|||||||
return p_longFDcmdsInQueue;
|
return p_longFDcmdsInQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t check4freeFDlongCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of free places in command stack
|
||||||
|
return FDLONG_STACKDEPTH - p_longFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
39
src/shared_mem_buffer.cpp
Normal file
39
src/shared_mem_buffer.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "shared_mem_buffer.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
#ifdef QT_POSIX_IPC
|
||||||
|
// The POSIX backend can be explicitly selected using the -feature-ipc_posix
|
||||||
|
// option to the Qt configure script. If it is enabled, the QT_POSIX_IPC
|
||||||
|
// macro will be defined. -> we use SystemV shared memory
|
||||||
|
#error "QT_POSIX_IPC defined"
|
||||||
|
#else
|
||||||
|
#include <sys/ipc.h> // ftok
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// std::atomic_bool SharedMemBuffer::__sharedMemLocked{false};
|
||||||
|
|
||||||
|
QSharedMemory *SharedMemBuffer::getShm(std::size_t size) {
|
||||||
|
static QSharedMemory shMem;
|
||||||
|
if (size > 0) {
|
||||||
|
static const long nativeKey = ftok("/etc/os-release", 'H');
|
||||||
|
static const QString fkey = std::to_string(nativeKey).c_str();
|
||||||
|
shMem.setKey(fkey);
|
||||||
|
if (!shMem.isAttached()) {
|
||||||
|
if (shMem.create(size)) {
|
||||||
|
return &shMem;
|
||||||
|
} else {
|
||||||
|
if (shMem.error() == QSharedMemory::AlreadyExists) {
|
||||||
|
if (shMem.attach()) {
|
||||||
|
return &shMem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qCritical() << shMem.nativeKey() << shMem.key() << shMem.data()
|
||||||
|
<< shMem.error() << shMem.errorString();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &shMem;
|
||||||
|
}
|
1530
src/storeINdata.cpp
1530
src/storeINdata.cpp
File diff suppressed because it is too large
Load Diff
@ -76,6 +76,23 @@ 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)
|
void delay(uint16_t MilliSec)
|
||||||
{
|
{
|
||||||
QThread::msleep(uint32_t(MilliSec));
|
QThread::msleep(uint32_t(MilliSec));
|
||||||
|
Loading…
Reference in New Issue
Block a user