Added/merged from sources of Thomas (version CashAgentLib 3.3, 12.04.2023)
This commit is contained in:
		
							
								
								
									
										330
									
								
								include/hwapi.h
									
									
									
									
									
								
							
							
						
						
									
										330
									
								
								include/hwapi.h
									
									
									
									
									
								
							@@ -1,4 +1,23 @@
 | 
			
		||||
/*
 | 
			
		||||
matching interfaces.h:
 | 
			
		||||
 | 
			
		||||
// History
 | 
			
		||||
// 11.10.2021: V1.0  222 functions
 | 
			
		||||
// 23.12.2021: V1.1  added block-parameter to function "read mifare data"
 | 
			
		||||
// 30.12.2021: V1.2  added function: mif_clearDataBuffer(), mif_isBlockAvailable(uint8_t blkNr) and mif_getAvailableDataBlocks()
 | 
			
		||||
// 1.1.2022: V1.3    Mifare extended. ( background: read 16 x 48byte from card to DC, read 12 x 64byte from DC to CA)
 | 
			
		||||
//                   new:  read full card with 768bytes from HWapi without block borders
 | 
			
		||||
//                   added: mif_getNrOfAvailableDataBytes     mif_getCardData768byteDec(uint8_t *buf, uint16_t bufferSize)
 | 
			
		||||
//                           mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
 | 
			
		||||
//                            mif_getCardDataStr(bool useHexFormat, char seperator)
 | 
			
		||||
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
 | 
			
		||||
//             V3.2 Bootloader improvement
 | 
			
		||||
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
 | 
			
		||||
 | 
			
		||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
 | 
			
		||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
 | 
			
		||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
PSA1259 hardware control using the DeviceController DC2
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +56,7 @@ Level 3:
 | 
			
		||||
    start/stop complete processes.
 | 
			
		||||
    Example: 1) print (predefined) document nr 3 with Text, letter size, font set, cut.
 | 
			
		||||
                Also power up/down the printer, check if paper ok and so on.
 | 
			
		||||
 */
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
Another access example: control the coin unit
 | 
			
		||||
@@ -71,93 +90,11 @@ Level 3): send command: "start payment process"
 | 
			
		||||
#include <QTabWidget>
 | 
			
		||||
#include <QtPlugin>
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <../plugins/interfaces.h>
 | 
			
		||||
#include "interfaces.h"
 | 
			
		||||
#include "datIf.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//public QWidget,
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
struct Tprn_hw_state
 | 
			
		||||
{
 | 
			
		||||
    // hardware (IO's)
 | 
			
		||||
    bool powerRdBk;     // prn pwr is on
 | 
			
		||||
    bool rsSwOk;        // serial switch (printer or modem) is set to printer
 | 
			
		||||
    bool rsDrvOk;       // RS232 converter for PTU, Printer and Modem in on
 | 
			
		||||
 | 
			
		||||
    bool ReadyLine;     // HW signal from printer showing ready
 | 
			
		||||
    bool inIdle;        // powered and free from errors
 | 
			
		||||
    bool paperNearEnd;  // paper roll runs out
 | 
			
		||||
    bool noPaper;
 | 
			
		||||
    bool ErrorTemp;
 | 
			
		||||
    bool HeadOpen;
 | 
			
		||||
    bool cutterJam;
 | 
			
		||||
    bool noResponse;    // printer is not connected, cable broken, wrong baudrate
 | 
			
		||||
    bool badResponse;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct Tprn_currentSettings
 | 
			
		||||
{
 | 
			
		||||
    uint8_t currFont;
 | 
			
		||||
    uint8_t currSize;
 | 
			
		||||
    uint8_t currHeigth;
 | 
			
		||||
    uint8_t currWidth;
 | 
			
		||||
    bool    nowBold;
 | 
			
		||||
    bool    nowInvers;
 | 
			
		||||
    bool    nowUnderlined;
 | 
			
		||||
    uint8_t currDensity;
 | 
			
		||||
    uint8_t currSpeed;
 | 
			
		||||
    bool    nowAligned;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct T_dynDat
 | 
			
		||||
{
 | 
			
		||||
    uint8_t licensePlate[8];
 | 
			
		||||
    uint8_t vendingPrice[8];
 | 
			
		||||
    uint8_t parkingEnd[8];
 | 
			
		||||
    uint8_t currentTime[8];
 | 
			
		||||
    uint8_t currentDate[8];
 | 
			
		||||
    uint8_t dynDat5[8];
 | 
			
		||||
    uint8_t dynDat6[8];
 | 
			
		||||
    uint8_t dynDat7[8];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct T_emp
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    // Fixdata from EMP:
 | 
			
		||||
    uint8_t shaft;      // = changer level
 | 
			
		||||
    uint16_t countryCode;
 | 
			
		||||
    uint8_t scale;
 | 
			
		||||
    uint8_t decimals;
 | 
			
		||||
    uint8_t coinValues[16];
 | 
			
		||||
    uint16_t routing;
 | 
			
		||||
 | 
			
		||||
    // Master specs:
 | 
			
		||||
    uint8_t gotSetup;       // 1: got specifications from master   0: no specs
 | 
			
		||||
    uint16_t coinAccept;    //  bit 0 = coin1  bit H=accept
 | 
			
		||||
    uint8_t tokenChannel;
 | 
			
		||||
    uint16_t denomination[16];
 | 
			
		||||
 | 
			
		||||
    // dynamic:
 | 
			
		||||
    uint8_t state;      // step counter of EMP (electronic coin checker) FSM (finite state machine):
 | 
			
		||||
                        // 0=Emp & Bus power off,  1=powered, poll off    2=polling on
 | 
			
		||||
                        // 3=device responded, requesting status
 | 
			
		||||
                        // 4=waiting for status     5=have status,
 | 
			
		||||
                        // 6: IDLE,  have paramters from master, polling running, ready for payment
 | 
			
		||||
                        //          Master can stop/start polling and acceptance
 | 
			
		||||
                        // 7: end of transaction,  polling on, accept off, reporting coins, (wait for last coin)
 | 
			
		||||
                        // 8: transaction running, polling on, acceptance on, reporting coins,
 | 
			
		||||
 | 
			
		||||
    uint8_t pollingRunning;
 | 
			
		||||
    uint8_t paymentRunning;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class hwapi :   public QObject,
 | 
			
		||||
                public hwinf
 | 
			
		||||
{
 | 
			
		||||
@@ -182,6 +119,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    T_datif *myDatif;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // ------------------------------------------------------------------------------
 | 
			
		||||
    // Level 0 commands, interface
 | 
			
		||||
    // open, close, change serial interface
 | 
			
		||||
@@ -258,7 +196,6 @@ public:
 | 
			
		||||
 | 
			
		||||
    QString dc_getState(void) const override;
 | 
			
		||||
 | 
			
		||||
    // neu, 25.8.21
 | 
			
		||||
    QString dc_getTxt4RsDiagWin(void) const override;
 | 
			
		||||
    void dc_clrTxt4RsDiagWin(void) const override;
 | 
			
		||||
    QString dc_get2ndTxt4RsDiagWin(void) const override;
 | 
			
		||||
@@ -295,13 +232,6 @@ public:
 | 
			
		||||
    uint8_t bl_exitBL(uint8_t *sendData) const override;
 | 
			
		||||
        // minimum size of sendData-buffer: 5byte  retval: length
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // ------------------------------------------------------------------------------
 | 
			
		||||
    // Level 2  DC2-onboard devices
 | 
			
		||||
    //          WR: set time
 | 
			
		||||
@@ -983,7 +913,7 @@ public:
 | 
			
		||||
        // return true is bl is up and running
 | 
			
		||||
        // also initializes "sendFile"
 | 
			
		||||
 | 
			
		||||
    void bl_sendAddress(u_int16_t blockNumber) const override;
 | 
			
		||||
    void bl_sendAddress(uint16_t blockNumber) const override;
 | 
			
		||||
        // send start address, nr of 64byte-block, start with 0
 | 
			
		||||
        // will be sent only for folling block-numbers:
 | 
			
		||||
        // 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
 | 
			
		||||
@@ -993,7 +923,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    void bl_openBinary(void) const override;
 | 
			
		||||
 | 
			
		||||
    void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override;
 | 
			
		||||
    void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const override;
 | 
			
		||||
    // send 64 byte from bin file
 | 
			
		||||
 | 
			
		||||
    void bl_sendLastBlock(void) const override;
 | 
			
		||||
@@ -1003,61 +933,52 @@ public:
 | 
			
		||||
 | 
			
		||||
    void bl_stopBL(void) const override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Bootlader, not used or obsolete
 | 
			
		||||
    //bool bl_isDiagAvailable(void) const override;
 | 
			
		||||
 | 
			
		||||
    //QString dc_getDiagText(void) const override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Komplett-schreib Funktion, noch nicht getestet
 | 
			
		||||
    // Nachteil: keine Rückmeldung wie lang's noch dauert
 | 
			
		||||
 | 
			
		||||
    //void bl_startSending(void) const override;
 | 
			
		||||
 | 
			
		||||
    //void bl_sendFile(void) const override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
// neu, ab 6.4.23
 | 
			
		||||
// bereits vorhanden, nochmal getestet/verbessert:
 | 
			
		||||
    // void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const override;
 | 
			
		||||
    // void alarm_switchSiren(bool on) const override;
 | 
			
		||||
 | 
			
		||||
    // neu, 25.8.21
 | 
			
		||||
    QString dc_getTxt4RsDiagWin(void) const override;
 | 
			
		||||
    void dc_clrTxt4RsDiagWin(void) const override;
 | 
			
		||||
    QString dc_get2ndTxt4RsDiagWin(void) const override;
 | 
			
		||||
    void dc_clr2ndTxt4RsDiagWin(void) const override;
 | 
			
		||||
    QString dc_getTxt4HsStateLine(void) const override;
 | 
			
		||||
    void dc_clrTxt4HsStateLine(void) const override;
 | 
			
		||||
    QString dc_getTxt4masterStateLine(void) const override;
 | 
			
		||||
    void dc_clrTxt4masterStateLine(void) const override;
 | 
			
		||||
    QString dc_getTxt4resultStateLine(void) const override;
 | 
			
		||||
    void dc_clrTxt4resultStateLine(void) const override;
 | 
			
		||||
    QString dc_getdataStateLine(void) const override;
 | 
			
		||||
    void dc_clrTxt4dataStateLine(void) const override;
 | 
			
		||||
    QString dc_getdatifLine(void) const override;
 | 
			
		||||
    void dc_clrTxt4datifLine(void) const override;
 | 
			
		||||
    // void mif_readerOn(bool on) const override;
 | 
			
		||||
    // bool mif_cardIsAttached(void) const override;
 | 
			
		||||
 | 
			
		||||
    // using DC2 Bootloader
 | 
			
		||||
    void bl_iniChain(void) const override;
 | 
			
		||||
    bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const override;
 | 
			
		||||
    uint8_t bl_activatBootloader(uint8_t *sendData) const override;
 | 
			
		||||
    uint8_t bl_startChain(void) const override;
 | 
			
		||||
    uint8_t bl_readBLversion(uint8_t *sendData) const override;
 | 
			
		||||
        // minimum size of sendData-buffer: 5byte  retval: length
 | 
			
		||||
    uint8_t bl_readFWversion(uint8_t *sendData) const override;
 | 
			
		||||
        // minimum size of sendData-buffer: 5byte  retval: length
 | 
			
		||||
    // void shut_move(bool open) const override;
 | 
			
		||||
    // void esc_moveFlaps(uint8_t flap ) const override;
 | 
			
		||||
        // 0: close both  1: open take-flap   2: open return
 | 
			
		||||
    // void shut_openOnce(void) const override;
 | 
			
		||||
        // and close automatic after shutter time
 | 
			
		||||
    // void shut_openForCoin(bool start) const override;
 | 
			
		||||
        // open flap if coin is attached
 | 
			
		||||
        // once process is started it runs until stop command
 | 
			
		||||
    // void shut_sendOpeningTime(uint16_t timeIn_ms ) const override;
 | 
			
		||||
        // after this time without retrigger the flap is closed
 | 
			
		||||
    // void esc_takeMoney(void) const override;
 | 
			
		||||
        // and close automatically after escrow time (1s)
 | 
			
		||||
    // void esc_returnMoney(void) const override;
 | 
			
		||||
        // and close automatically after escrow time (1s)
 | 
			
		||||
 | 
			
		||||
    uint8_t bl_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const override;
 | 
			
		||||
        // make BL protocol, retval = outbuf length (5...133)
 | 
			
		||||
        // bring data in correct form: start always with 0x02   finish with 0x03 and append checksum
 | 
			
		||||
        // 0x02 Cmd < ...sendData ..>  CRC  CRC 0x03
 | 
			
		||||
        // Data length = 0...64
 | 
			
		||||
        // special conversion: if data contain 2 or 3 (STX, ETX) then write two bytes:  0x1B (=ESC) and data|0x80
 | 
			
		||||
        // so maxlength = 5 + 2 x 64 (if all data are 2 or 3)  without 2,3: maxlength = 5 + 64
 | 
			
		||||
    // void prn_switchPower(bool on) const override;
 | 
			
		||||
    // void prn_sendText(QByteArray *buf) const override;
 | 
			
		||||
        // up to 1280 bytes
 | 
			
		||||
 | 
			
		||||
    uint8_t bl_exitBL(uint8_t *sendData) const override;
 | 
			
		||||
        // minimum size of sendData-buffer: 5byte  retval: length
 | 
			
		||||
*/
 | 
			
		||||
    // uint8_t rtc_setDateTime(void) const override;
 | 
			
		||||
            // send system time
 | 
			
		||||
 | 
			
		||||
    //void sendDeviceSettings(uint8_t kindOfPrinter,      uint8_t kindOfCoinChecker,
 | 
			
		||||
    //                        uint8_t kindOfMifareReader, uint8_t suppressSleep,
 | 
			
		||||
    //                        uint8_t kindOfModem,        uint8_t kindOfCredit        ) const override;
 | 
			
		||||
 | 
			
		||||
    //void sendMachineID(uint16_t customerNr, uint16_t machineNr,
 | 
			
		||||
    //                          uint16_t borough, uint16_t zone,
 | 
			
		||||
    //                          uint16_t alias,   char *location) const override;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    uint8_t emp_getInsertedCoinSignal(void) const override;
 | 
			
		||||
@@ -1073,6 +994,96 @@ public:
 | 
			
		||||
        // emp_chkIfCoinInserted() must be called before!
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const override;
 | 
			
		||||
        // return true if successful. could fail if more the 8 commands are waiting
 | 
			
		||||
 | 
			
		||||
    bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
 | 
			
		||||
 | 
			
		||||
    bool sys_runCompleteTest(void) const override;
 | 
			
		||||
        // warning: lasts 20s in one pace
 | 
			
		||||
 | 
			
		||||
    bool sys_ready4sending(void) const override;
 | 
			
		||||
    // return true if a Json-file can be sent
 | 
			
		||||
 | 
			
		||||
    bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const override;
 | 
			
		||||
        // kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
 | 
			
		||||
        //      nrOfTemplate=1...32 if kindOfFile==6
 | 
			
		||||
        //      content = content of the Json file, max 800byte ascii signs
 | 
			
		||||
        // file is 0-terminated!
 | 
			
		||||
        // return false if sending is not possible, wait a second
 | 
			
		||||
 | 
			
		||||
    bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
 | 
			
		||||
    // dynPrnVal = array of 8 Variables with 8 byte each, come as ascii string
 | 
			
		||||
    //            like:     char prn_dynPrnVal[8][8];
 | 
			
		||||
    // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    bool prn_printTemplate(uint8_t nrOftemplate) const override;
 | 
			
		||||
        // print one of the templates loaded by Json prior
 | 
			
		||||
        // nr = 1..32
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    void log_getHoldAccountNumbers(uint32_t *accNr ) const override;
 | 
			
		||||
        // returns all acc nrs of the backuped vault records
 | 
			
		||||
        // use: uint32_t backupedAccNumbers[8]
 | 
			
		||||
 | 
			
		||||
    bool log_selectVaultRecord(uint16_t accountNr ) const override;
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
//request, isAvailable
 | 
			
		||||
    void log_getVaultRecord(struct T_vaultRecord *retVR) const override;
 | 
			
		||||
        // which was selected by: log_selectVaultRecord()
 | 
			
		||||
        // to be forwarded to Ismas
 | 
			
		||||
 | 
			
		||||
    bool prn_printAccountReceipt(void) const override;
 | 
			
		||||
        // return true if sending to DC OK, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    bool prn_printTestTicket(void) const override;
 | 
			
		||||
        // return true if sending to DC OK, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    bool cash_startPayment(uint16_t amount) const override;
 | 
			
		||||
 | 
			
		||||
    bool cash_cancelPayment(void) const override;
 | 
			
		||||
        // and return coins
 | 
			
		||||
 | 
			
		||||
    bool cash_stopPayment(void) const override;
 | 
			
		||||
        // and keep coins in escrow
 | 
			
		||||
 | 
			
		||||
    uint32_t getInsertedAmount(void) const override;
 | 
			
		||||
 | 
			
		||||
    uint16_t getLastInsertedCoin(void) const override;
 | 
			
		||||
 | 
			
		||||
    bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const override;
 | 
			
		||||
        // alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert, max 64
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // after ticket/goods issue:
 | 
			
		||||
    bool vend_success(void) const override;
 | 
			
		||||
        // conclude payment process, encash all inserted coins to vault. Printing was successful
 | 
			
		||||
        // if possible return change
 | 
			
		||||
 | 
			
		||||
    bool vend_failed(void) const override;
 | 
			
		||||
        // conclude payment process and return all inserted coins
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    uint8_t mif_getCardType(QString cardholder) const override;
 | 
			
		||||
        // return 1,2,3,4 = upper, lower access card, printer test, coin test
 | 
			
		||||
        // cardholder: 7byte Name-String
 | 
			
		||||
 | 
			
		||||
    uint64_t sys_getWakeSource(void) const override;
 | 
			
		||||
        // retval: 6 bytes, bit coded, 1=event keeps DC awake
 | 
			
		||||
 | 
			
		||||
    //void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
 | 
			
		||||
    void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
 | 
			
		||||
 | 
			
		||||
    //void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
 | 
			
		||||
    void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void sub_storeSendingText(QByteArray *buf) const;
 | 
			
		||||
@@ -1081,27 +1092,6 @@ private:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    // Modem:
 | 
			
		||||
 | 
			
		||||
    uint8_t mod_power(bool on) const override;
 | 
			
		||||
    uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
 | 
			
		||||
    uint8_t mod_setCondition(uint16_t chgCmd) const override;      // e.g. change to state registered, sleep, open, off....
 | 
			
		||||
    uint16_t mod_getCondition(void) const override;                // e.g. now socket open
 | 
			
		||||
    bool    mod_sendBufferFree(void) const override;               // sending allowed (before writing) and sending finished (after writing)
 | 
			
		||||
    uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
 | 
			
		||||
    void    mod_wantReadData(uint16_t nrOfData) const override;                        // start reading
 | 
			
		||||
    uint16_t mod_gotData(void) const override;                             // return nr of received bytes
 | 
			
		||||
    uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
 | 
			
		||||
    uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
 | 
			
		||||
    uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
 | 
			
		||||
 | 
			
		||||
    // Credit Card Terminal:
 | 
			
		||||
 | 
			
		||||
    uint8_t cc_power(bool on) const override;
 | 
			
		||||
    uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) const override;
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -1110,8 +1100,6 @@ private:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    // Coin checker and changer mdb4.2 / section 5
 | 
			
		||||
    // Level 2 Commands  (predefined device msg acc. mdb manual and auto-poll)
 | 
			
		||||
@@ -1229,3 +1217,23 @@ struct Tcc_hw_state
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
    // not yet implemented
 | 
			
		||||
    uint8_t mod_power(bool on) const override;
 | 
			
		||||
    uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
 | 
			
		||||
    uint8_t mod_setCondition(uint16_t chgCmd) const override;      // e.g. change to state registered, sleep, open, off....
 | 
			
		||||
    uint16_t mod_getCondition(void) const override;                // e.g. now socket open
 | 
			
		||||
    bool    mod_sendBufferFree(void) const override;               // sending allowed (before writing) and sending finished (after writing)
 | 
			
		||||
    uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
 | 
			
		||||
    void    mod_wantReadData(uint16_t nrOfData) const override;                        // start reading
 | 
			
		||||
    uint16_t mod_gotData(void) const override;                             // return nr of received bytes
 | 
			
		||||
    uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
 | 
			
		||||
    uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
 | 
			
		||||
    uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
 | 
			
		||||
 | 
			
		||||
    // Credit Card Terminal:
 | 
			
		||||
    uint8_t cc_power(bool on) const override;
 | 
			
		||||
    uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) const override;
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,172 @@ struct Tprn_hw_state
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct T_vaultRecord
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    // Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
 | 
			
		||||
        char startbuffer[4];		// Psa>  // never move or change this 1st entry
 | 
			
		||||
        uint16_t AccountingNumber;
 | 
			
		||||
        uint16_t CUNU;
 | 
			
		||||
        uint16_t MANU;
 | 
			
		||||
        uint16_t resint1;
 | 
			
		||||
        //uint16_t resint2;
 | 
			
		||||
 | 
			
		||||
        char label1buffer[4];	 // tim>
 | 
			
		||||
        uint8_t year;
 | 
			
		||||
        uint8_t month;
 | 
			
		||||
        uint8_t dom;
 | 
			
		||||
        uint8_t hour;
 | 
			
		||||
        uint8_t min;
 | 
			
		||||
        uint8_t sec;
 | 
			
		||||
        uint8_t DoW;
 | 
			
		||||
        uint8_t reschar3;
 | 
			
		||||
 | 
			
		||||
        char label2buffer[4];	// abs>
 | 
			
		||||
        uint32_t AbsIncome1;
 | 
			
		||||
        uint32_t AbsReserve;
 | 
			
		||||
        uint32_t AbsNrOfCuts;
 | 
			
		||||
 | 
			
		||||
//16
 | 
			
		||||
        char label3buffer[4];	// mw >
 | 
			
		||||
 | 
			
		||||
        // Verkauf, T<>r zu:
 | 
			
		||||
        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<75>ckgegeben
 | 
			
		||||
//88
 | 
			
		||||
 | 
			
		||||
        // Service, T<>r offen:
 | 
			
		||||
        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<75>ckgegeben
 | 
			
		||||
        uint16_t resint3;
 | 
			
		||||
        uint16_t resint4;
 | 
			
		||||
        uint16_t currentTubeContent[6];		//  nur f<>r Wechsler, aktueller F<>llstand
 | 
			
		||||
        uint16_t resint5;
 | 
			
		||||
        uint16_t resint6;
 | 
			
		||||
// 56
 | 
			
		||||
 | 
			
		||||
        char label4buffer[4];	// box>
 | 
			
		||||
        uint16_t coinsInVault[16];
 | 
			
		||||
        uint16_t billsInStacker[8];
 | 
			
		||||
// 48
 | 
			
		||||
 | 
			
		||||
        char label5buffer[4];	// val>
 | 
			
		||||
        // actually constant unless exchange rate is changed
 | 
			
		||||
        uint16_t coinDenomination[16];	// 5..50000 (z.B. 2? sind in Ungarn 760Ft)
 | 
			
		||||
        uint16_t billDenom[8];
 | 
			
		||||
        uint16_t tubeDenom[6];
 | 
			
		||||
        uint16_t exchangeRate;
 | 
			
		||||
        uint16_t resint9;
 | 
			
		||||
 | 
			
		||||
// 64
 | 
			
		||||
 | 
			
		||||
        char endofblock[4];	// end>
 | 
			
		||||
 | 
			
		||||
// 316 byte Block im Speicher
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct T_moduleCondition
 | 
			
		||||
{
 | 
			
		||||
        // store conditon of all system components, hold in RAM
 | 
			
		||||
        // 0 means unknown, not yet tested/used
 | 
			
		||||
        // 1 means OK
 | 
			
		||||
        // 50..99	= HINT / Notification
 | 
			
		||||
        // 100..150	= WARNING
 | 
			
		||||
        // 200..250	= ERROR
 | 
			
		||||
 | 
			
		||||
        uint8_t	structStart;		// always first!!!
 | 
			
		||||
        uint8_t	ram;				// v
 | 
			
		||||
        uint8_t	intEe;				// v
 | 
			
		||||
        uint8_t	extEe;				// v
 | 
			
		||||
 | 
			
		||||
        uint8_t	rtc;				// 1: time/date OK   100: time not plausible  200: hardware error
 | 
			
		||||
        uint8_t	boardHw;			// v
 | 
			
		||||
        uint8_t	printer;			// v
 | 
			
		||||
        uint8_t	modem;				// v
 | 
			
		||||
 | 
			
		||||
        uint8_t	signal;				//		1...99
 | 
			
		||||
        uint8_t	regist;				// 100:not  1:reg  2:ping OK   3:gotTime
 | 
			
		||||
        uint8_t	mdbBus;
 | 
			
		||||
        uint8_t	coinChecker;		// EMP, OMP or mei-cashflow
 | 
			
		||||
 | 
			
		||||
        uint8_t	coinEscrow;			// v
 | 
			
		||||
        uint8_t	mifareReader;		// v
 | 
			
		||||
        uint8_t	creditTerm;			// not available
 | 
			
		||||
        uint8_t	coinReject;			// v
 | 
			
		||||
 | 
			
		||||
        uint8_t	coinSafe;			// v
 | 
			
		||||
        uint8_t   billSafe;			// v
 | 
			
		||||
        uint8_t	voltage;			// v	// 1:11..14V
 | 
			
		||||
        uint8_t   temper;				// v
 | 
			
		||||
 | 
			
		||||
        uint8_t	poweronTest;
 | 
			
		||||
        uint8_t   doorState;			// 1: alles zu  200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
 | 
			
		||||
        uint8_t	doorWasOpened;		// 1: all doors are closed   200: any door was just opened
 | 
			
		||||
        uint8_t	changer;			// can only be tested by usage
 | 
			
		||||
 | 
			
		||||
        uint8_t   coinBlocker;		// can only be tested by usage
 | 
			
		||||
        uint8_t   billReader;			// can only be tested by usage
 | 
			
		||||
        uint8_t   ResetReason;
 | 
			
		||||
        uint8_t	allModulesChecked;
 | 
			
		||||
 | 
			
		||||
        uint8_t   alarmState;
 | 
			
		||||
        uint8_t   res11;
 | 
			
		||||
        uint8_t   res12;
 | 
			
		||||
        uint8_t   res13;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct T_dynamicCondition
 | 
			
		||||
{
 | 
			
		||||
        // dynamic conditions, change rapidly and frequently
 | 
			
		||||
        // these are values for the Heartbeat
 | 
			
		||||
 | 
			
		||||
        // T?rschalter entprellt:
 | 
			
		||||
        char upperDoor;		// 0:fehlt  1:drin
 | 
			
		||||
        char middleDoor;
 | 
			
		||||
        char lowerDoor;
 | 
			
		||||
        char coinBox;
 | 
			
		||||
 | 
			
		||||
        char billBox;
 | 
			
		||||
        char modeAbrech;
 | 
			
		||||
        char onAlarm;
 | 
			
		||||
        char nowCardTest;
 | 
			
		||||
 | 
			
		||||
        char nowPayment;
 | 
			
		||||
        char lastMifCardType;
 | 
			
		||||
        char openedAuthorized;
 | 
			
		||||
        char allDoorsDebounced;
 | 
			
		||||
 | 
			
		||||
        uint8_t lastSDoorState;
 | 
			
		||||
        uint8_t lastVDoorState;
 | 
			
		||||
        uint8_t CBinDebounced;
 | 
			
		||||
        uint8_t lastCBstate;
 | 
			
		||||
 | 
			
		||||
        char  paymentInProgress;
 | 
			
		||||
        char res1;
 | 
			
		||||
        char res2;
 | 
			
		||||
        char res3;
 | 
			
		||||
 | 
			
		||||
        uint16_t U_Batt;
 | 
			
		||||
        uint16_t	Temperatur;
 | 
			
		||||
 | 
			
		||||
        uint16_t	cash_storedaccNumbers[8];	// List all stored accounting numbers in ext. eeprom
 | 
			
		||||
 | 
			
		||||
        uint16_t	nrCoinsInBox;
 | 
			
		||||
        uint16_t	resui1;
 | 
			
		||||
 | 
			
		||||
        uint32_t	amountInBox;
 | 
			
		||||
        uint32_t	amountJustPaid;
 | 
			
		||||
 | 
			
		||||
        uint16_t	lastInsCoinType;	// wahrscheinlich uchar
 | 
			
		||||
        uint16_t	resui2;
 | 
			
		||||
 | 
			
		||||
        uint32_t	totalTransVolume;
 | 
			
		||||
        uint32_t	totalNrOfVends;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class hwinf
 | 
			
		||||
{
 | 
			
		||||
@@ -101,6 +267,8 @@ public:
 | 
			
		||||
    enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
 | 
			
		||||
 | 
			
		||||
    virtual ~hwinf() {}
 | 
			
		||||
               
 | 
			
		||||
    
 | 
			
		||||
                                           
 | 
			
		||||
    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$    
 | 
			
		||||
    //       Use serial interface and protocol stack in Cashagent-Library
 | 
			
		||||
@@ -123,6 +291,8 @@ public:
 | 
			
		||||
        
 | 
			
		||||
    virtual bool dc_isPortOpen(void) const =0;
 | 
			
		||||
        // returns true if port open (don't send unless open. Sending to closed port will crash program)
 | 
			
		||||
                   
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
    virtual uint8_t test_serialState(void) const =0;
 | 
			
		||||
        // test on-board signals for the serials
 | 
			
		||||
@@ -439,11 +609,31 @@ public:
 | 
			
		||||
    virtual void request_ReadbackDeviceSettings() const =0;
 | 
			
		||||
 | 
			
		||||
    virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0;
 | 
			
		||||
        // refer to DC2 manual for exact content
 | 
			
		||||
        // state 5.5.21: byte[0]=kindOfPrinter   byte[1]=kindOfCoinChecker
 | 
			
		||||
    //               byte[2]=kindOfMifarereadr   byte[3]=suppress sleep mode
 | 
			
		||||
    //               byte[4]=kindOfModem         byte[5]=kind of cc terminal
 | 
			
		||||
                                                      
 | 
			
		||||
/*
 | 
			
		||||
            buf66[0]=devPara.kindOfPrinter;
 | 
			
		||||
            buf66[1]=devPara.kindOfCoinChecker;
 | 
			
		||||
            buf66[2]=devPara.kindOfMifareReader;
 | 
			
		||||
            buf66[3]=devPara.suppressSleepMode;
 | 
			
		||||
            buf66[4]=devPara.kindOfModem;
 | 
			
		||||
            buf66[5]=devPara.kindOfCreditcard;
 | 
			
		||||
            buf66[6]=devPara.CoinEscrow;
 | 
			
		||||
            buf66[7]=devPara.CoinRejectUnit;
 | 
			
		||||
            buf66[8]=devPara.CoinShutter;
 | 
			
		||||
            buf66[9]=devPara.BillAcceptor;
 | 
			
		||||
            buf66[10]=devPara.usevaultLock;
 | 
			
		||||
            buf66[11]=devPara.autoAlarm;
 | 
			
		||||
            buf66[12]=devPara.autoOpen;
 | 
			
		||||
            buf66[13]=devPara.printAccReceipt;
 | 
			
		||||
            buf66[14]=devPara.printDoorReceipt;
 | 
			
		||||
            buf66[15]=devPara.printTokenTicket;
 | 
			
		||||
            uitmp=devPara.VaultFullWarnLevel;
 | 
			
		||||
            buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
 | 
			
		||||
            buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
 | 
			
		||||
            uitmp=devPara.VaultFullErrorLevel;
 | 
			
		||||
            buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
 | 
			
		||||
            buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
    virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
 | 
			
		||||
                              uint16_t borough, uint16_t zone,
 | 
			
		||||
@@ -455,8 +645,8 @@ public:
 | 
			
		||||
    // state 5.5.21: byte[0,1]=customer number    byte[2,3]=machine number
 | 
			
		||||
    //               byte[4,5]=borough   byte[6,7]=zone   byte[8,9]=alias name
 | 
			
		||||
    //               byte[10...41]=location
 | 
			
		||||
    // 12.4.23TS still the same
 | 
			
		||||
 | 
			
		||||
// 9
 | 
			
		||||
   
 | 
			
		||||
    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$    
 | 
			
		||||
    // Printer
 | 
			
		||||
@@ -1053,7 +1243,7 @@ public:
 | 
			
		||||
        // return true is bl is up and running
 | 
			
		||||
        // also initializes "sendFile"
 | 
			
		||||
 | 
			
		||||
    virtual void bl_sendAddress(u_int16_t blockNumber) const=0;
 | 
			
		||||
    virtual void bl_sendAddress(uint16_t blockNumber) const=0;
 | 
			
		||||
        // send start address, nr of 64byte-block, start with 0
 | 
			
		||||
        // will be sent only for following block-numbers:
 | 
			
		||||
        // 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
 | 
			
		||||
@@ -1065,7 +1255,7 @@ public:
 | 
			
		||||
    virtual void bl_openBinary(void) const=0;
 | 
			
		||||
        // to be used within CashAgent, momentary not processed
 | 
			
		||||
 | 
			
		||||
    virtual void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const=0;
 | 
			
		||||
    virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const=0;
 | 
			
		||||
    // send 64 byte from bin file
 | 
			
		||||
 | 
			
		||||
    virtual void bl_sendLastBlock(void) const=0;
 | 
			
		||||
@@ -1091,6 +1281,266 @@ public:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------
 | 
			
		||||
// 6.4.2023: new functions for coin collection and printing
 | 
			
		||||
//            some new system functions
 | 
			
		||||
// ------------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    virtual bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const=0;
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const=0;
 | 
			
		||||
/*
 | 
			
		||||
     buf[0]=GlobTime.Hours;
 | 
			
		||||
    buf[1]=GlobTime.Min;
 | 
			
		||||
    buf[2]=GlobTime.Sec;
 | 
			
		||||
    buf[3]=GlobTime.Year;
 | 
			
		||||
    buf[4]=GlobTime.Month;
 | 
			
		||||
    buf[5]=GlobTime.Day;
 | 
			
		||||
    buf[6]=GlobTime.DOW;
 | 
			
		||||
    buf[7]=' ';                   // immer auf 32bit auff<66>llen sonst Speicherproblem beim Master!
 | 
			
		||||
    uitmp=GlobTime.MinOfDay;
 | 
			
		||||
    buf[8]=swl_getOneByteFromUint(uitmp, 0);
 | 
			
		||||
    buf[9]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
    buf[10]=' ';
 | 
			
		||||
    buf[11]=' ';
 | 
			
		||||
    ultmp=GlobTime.SecOfDay;
 | 
			
		||||
    buf[12]=swl_getOneByteFromUlong(ultmp, 0);
 | 
			
		||||
    buf[13]=swl_getOneByteFromUlong(ultmp, 1);
 | 
			
		||||
    buf[14]=swl_getOneByteFromUlong(ultmp, 2);
 | 
			
		||||
    buf[15]=swl_getOneByteFromUlong(ultmp, 3);
 | 
			
		||||
 | 
			
		||||
    buf[16]=swl_isLeap(GlobTime.Year);
 | 
			
		||||
    buf[17]=swl_getNextLeapYear(GlobTime.Year);
 | 
			
		||||
    buf[18]=swl_getLastLeapYear(GlobTime.Year);
 | 
			
		||||
    buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
 | 
			
		||||
 | 
			
		||||
    uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
 | 
			
		||||
    buf[20]=swl_getOneByteFromUint(uitmp, 0);    // 0=low byte   1=high byte
 | 
			
		||||
    buf[21]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
 | 
			
		||||
    uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
 | 
			
		||||
    buf[22]=swl_getOneByteFromUint(uitmp, 0);
 | 
			
		||||
    buf[23]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
 | 
			
		||||
    uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
 | 
			
		||||
    buf[24]=swl_getOneByteFromUint(uitmp, 0);
 | 
			
		||||
    buf[25]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
 | 
			
		||||
    uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
 | 
			
		||||
    buf[26]=swl_getOneByteFromUint(uitmp, 0);
 | 
			
		||||
    buf[27]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
 | 
			
		||||
    uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
 | 
			
		||||
    buf[28]=swl_getOneByteFromUint(uitmp, 0);
 | 
			
		||||
    buf[29]=swl_getOneByteFromUint(uitmp, 1);
 | 
			
		||||
    buf[30]=0;
 | 
			
		||||
    buf[31]=0;
 | 
			
		||||
    ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
 | 
			
		||||
                                GlobTime.Hours, GlobTime.Min);
 | 
			
		||||
    buf[32]=swl_getOneByteFromUlong(ultmp, 0);
 | 
			
		||||
    buf[33]=swl_getOneByteFromUlong(ultmp, 1);
 | 
			
		||||
    buf[34]=swl_getOneByteFromUlong(ultmp, 2);
 | 
			
		||||
    buf[35]=swl_getOneByteFromUlong(ultmp, 3);
 | 
			
		||||
 | 
			
		||||
    buf[36]=rtc_getSqwaveSettings();
 | 
			
		||||
    buf[37]=0;
 | 
			
		||||
    buf[38]=0;
 | 
			
		||||
    buf[39]=0;
 | 
			
		||||
 | 
			
		||||
    ultmp= 0;       // Minutes of the Millenium
 | 
			
		||||
    buf[40]=swl_getOneByteFromUlong(ultmp, 0);
 | 
			
		||||
    buf[41]=swl_getOneByteFromUlong(ultmp, 1);
 | 
			
		||||
    buf[42]=swl_getOneByteFromUlong(ultmp, 2);
 | 
			
		||||
    buf[43]=swl_getOneByteFromUlong(ultmp, 3);
 | 
			
		||||
 | 
			
		||||
    dc2prot_setReadData(44, buf);
 | 
			
		||||
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
    virtual bool sys_runCompleteTest(void) const=0;
 | 
			
		||||
        // warning: lasts 20s in one pace
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool sys_ready4sending(void) const=0;
 | 
			
		||||
    // return true if a Json-file can be sent
 | 
			
		||||
 | 
			
		||||
    virtual bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const=0;
 | 
			
		||||
        // kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
 | 
			
		||||
        //      nrOfTemplate=1...32 if kindOfFile==6
 | 
			
		||||
        //      content = content of the Json file, max 800byte ascii signs
 | 
			
		||||
        // file is 0-terminated
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const=0;
 | 
			
		||||
        // dynPrnVal = array of 8 Variables with 8 byte each, come as ascii string
 | 
			
		||||
        //            like:     char prn_dynPrnVal[8][8];
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool prn_printTemplate(uint8_t nrOftemplate) const=0;
 | 
			
		||||
        // print one of the templates loaded by Json prior
 | 
			
		||||
        // nr = 1..32
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
        virtual void log_getHoldAccountNumbers(uint32_t *accNr ) const=0;
 | 
			
		||||
        // returns all acc nrs of the backuped vault records
 | 
			
		||||
        // use: uint32_t backupedAccNumbers[8]
 | 
			
		||||
 | 
			
		||||
    virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
 | 
			
		||||
        // return true if sending, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
//request, isAvailable
 | 
			
		||||
virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
 | 
			
		||||
        // which was selected by: log_selectVaultRecord()
 | 
			
		||||
        // to be forwarded to Ismas
 | 
			
		||||
 | 
			
		||||
    virtual bool prn_printAccountReceipt(void) const=0;
 | 
			
		||||
        // return true if sending to DC OK, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool prn_printTestTicket(void) const=0;
 | 
			
		||||
        // return true if sending to DC OK, false if cmd-stack is full
 | 
			
		||||
 | 
			
		||||
    virtual bool cash_startPayment(uint16_t amount) const=0;
 | 
			
		||||
 | 
			
		||||
    virtual uint32_t getInsertedAmount(void) const=0;
 | 
			
		||||
 | 
			
		||||
    virtual uint16_t getLastInsertedCoin(void) const=0;
 | 
			
		||||
 | 
			
		||||
    virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const=0;
 | 
			
		||||
        // all inserted coins (max 64) since "cash_startPayment"
 | 
			
		||||
 | 
			
		||||
    virtual bool cash_cancelPayment(void) const=0;
 | 
			
		||||
        // and return coins
 | 
			
		||||
 | 
			
		||||
    virtual bool cash_stopPayment(void) const=0;
 | 
			
		||||
        // and keep coins in escrow
 | 
			
		||||
 | 
			
		||||
    // after ticket/goods issue:
 | 
			
		||||
    virtual bool vend_success(void) const=0;
 | 
			
		||||
        // conclude payment process, encash all inserted coins to vault. Printing was successful
 | 
			
		||||
        // if possible return change
 | 
			
		||||
 | 
			
		||||
    virtual bool vend_failed(void) const=0;
 | 
			
		||||
        // conclude payment process and return all inserted coins
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    virtual uint8_t mif_getCardType(QString cardholder) const=0;
 | 
			
		||||
        // return 1,2,3,4 = upper, lower access card, printer test, coin test
 | 
			
		||||
        // cardholder: 7byte Name-String
 | 
			
		||||
 | 
			
		||||
    virtual uint64_t sys_getWakeSource(void) const =0;
 | 
			
		||||
        // retval: 6 bytes, bit coded, 1=event keeps DC awake
 | 
			
		||||
 | 
			
		||||
    //virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
 | 
			
		||||
    virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
 | 
			
		||||
    /*
 | 
			
		||||
 | 
			
		||||
    outBuf[0]=modCond.ram;
 | 
			
		||||
    outBuf[1]=modCond.intEe;
 | 
			
		||||
    outBuf[2]=modCond.extEe;
 | 
			
		||||
    outBuf[3]=modCond.rtc;
 | 
			
		||||
    outBuf[4]=modCond.boardHw;
 | 
			
		||||
    outBuf[5]=modCond.printer;
 | 
			
		||||
    outBuf[6]=modCond.modem;
 | 
			
		||||
    outBuf[7]=modCond.signal;
 | 
			
		||||
    outBuf[8]=modCond.regist;
 | 
			
		||||
    outBuf[9]=modCond.mdbBus;
 | 
			
		||||
    outBuf[10]=modCond.coinChecker;
 | 
			
		||||
    outBuf[11]=modCond.coinEscrow;
 | 
			
		||||
    outBuf[12]=modCond.mifareReader;
 | 
			
		||||
    outBuf[13]=modCond.creditTerm;
 | 
			
		||||
    outBuf[14]=modCond.coinReject;
 | 
			
		||||
    outBuf[15]=modCond.coinSafe;
 | 
			
		||||
    outBuf[16]=modCond.billSafe;
 | 
			
		||||
    outBuf[17]=modCond.voltage;
 | 
			
		||||
    outBuf[18]=modCond.temper;
 | 
			
		||||
    outBuf[19]=modCond.poweronTest;
 | 
			
		||||
    outBuf[20]=modCond.doorState;
 | 
			
		||||
    outBuf[21]=modCond.doorWasOpened;
 | 
			
		||||
    outBuf[22]=modCond.changer;
 | 
			
		||||
    outBuf[23]=modCond.coinBlocker;
 | 
			
		||||
    outBuf[24]=modCond.billReader;
 | 
			
		||||
    outBuf[25]=modCond.ResetReason;
 | 
			
		||||
    outBuf[26]=modCond.allModulesChecked;
 | 
			
		||||
    outBuf[27]=modCond.alarmState;
 | 
			
		||||
    outBuf[28]=0;
 | 
			
		||||
    outBuf[29]=0;
 | 
			
		||||
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
 | 
			
		||||
    virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
    outBuf[pBuf++]=dynCond.allDoorsDebounced;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.openedAuthorized;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.CBinDebounced;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.upperDoor;
 | 
			
		||||
 | 
			
		||||
    outBuf[pBuf++]=dynCond.middleDoor;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lowerDoor;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.coinBox;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.billBox;
 | 
			
		||||
 | 
			
		||||
    outBuf[pBuf++]=dynCond.modeAbrech;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.onAlarm;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.nowCardTest;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.nowPayment;
 | 
			
		||||
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lastMifCardType;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lastSDoorState;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lastVDoorState;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lastCBstate;
 | 
			
		||||
 | 
			
		||||
    outBuf[pBuf++]=dynCond.paymentInProgress;
 | 
			
		||||
    outBuf[pBuf++]=0;
 | 
			
		||||
    uitmp=dynCond.U_Batt;
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
 | 
			
		||||
    uitmp=dynCond.Temperatur;
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
 | 
			
		||||
 | 
			
		||||
    uitmp=dynCond.nrCoinsInBox;	// send seperate also
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
 | 
			
		||||
 | 
			
		||||
    ultmp=dynCond.amountInBox;	// send seperate also
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
 | 
			
		||||
 | 
			
		||||
    ultmp=dynCond.totalTransVolume;
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
 | 
			
		||||
 | 
			
		||||
    ultmp=dynCond.totalNrOfVends;
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
 | 
			
		||||
    outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
 | 
			
		||||
// 36
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_config;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_device;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_cash;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_print;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_serial;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.jsonValid_time;
 | 
			
		||||
    outBuf[pBuf++]=dynCond.lastFileType;
 | 
			
		||||
    outBuf[pBuf++]=0;
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1104,8 +1554,15 @@ public:
 | 
			
		||||
//                           mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize) 
 | 
			
		||||
//                            mif_getCardDataStr(bool useHexFormat, char seperator)    
 | 
			
		||||
 | 
			
		||||
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
 | 
			
		||||
//             V3.2 Bootloader improvement
 | 
			
		||||
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
 | 
			
		||||
 | 
			
		||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
 | 
			
		||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
 | 
			
		||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
 | 
			
		||||
 | 
			
		||||
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -211,6 +211,25 @@ uint8_t gpi_getUserOfSendingTextBuffer(uint8_t *para1, uint8_t *para2, uint8_t *
 | 
			
		||||
    // user=1: Text-Print is using this buffer
 | 
			
		||||
    //      2: QR-code-Printer is using this buffer
 | 
			
		||||
 | 
			
		||||
#define     FDCMD_STACKDEPTH    16
 | 
			
		||||
void sendFDcmd_clrStack(void);
 | 
			
		||||
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
 | 
			
		||||
    // write Command to memory, wait for transport
 | 
			
		||||
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);
 | 
			
		||||
    // returns number of waiting command
 | 
			
		||||
 | 
			
		||||
#define     FDLONG_STACKDEPTH    16
 | 
			
		||||
void longFDcmd_clrStack(void);
 | 
			
		||||
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
 | 
			
		||||
    // write Command to memory, wait for transport
 | 
			
		||||
    // data buffer size always 64! data[64], padded with 0
 | 
			
		||||
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
uint8_t check4FDlongCmd(void);
 | 
			
		||||
    // returns number of waiting command
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ QString epi_getUIDstr();
 | 
			
		||||
uint8_t epi_getSquareMode();
 | 
			
		||||
void gpi_backupSquareMode(uint8_t squMode);
 | 
			
		||||
 | 
			
		||||
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng);
 | 
			
		||||
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng);     // 104, <=8byte
 | 
			
		||||
void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss);
 | 
			
		||||
void epi_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd);
 | 
			
		||||
void epi_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday);
 | 
			
		||||
@@ -474,15 +474,57 @@ void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, u
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void gpi_storeDeviceSettings(uint8_t leng, uint8_t *data);
 | 
			
		||||
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreDeviceSettings(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void epi_clearCurrentPayment(void);
 | 
			
		||||
 | 
			
		||||
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue);
 | 
			
		||||
 | 
			
		||||
uint32_t epi_CurrentPaymentGetAmount(void);
 | 
			
		||||
 | 
			
		||||
uint16_t epi_CurrentPaymentGetLastCoin(void);
 | 
			
		||||
 | 
			
		||||
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
 | 
			
		||||
    // alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void gpi_storeWakeSources(uint8_t *receivedData);
 | 
			
		||||
 | 
			
		||||
uint64_t epi_getWakeSources(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,7 @@ void GetShortDateString(uint8_t day, uint8_t month, uint8_t yearlow, uint8_t for
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint16_t tslib_strlen(char *buf);
 | 
			
		||||
uint16_t tslib_strlen(uint8_t *buf);
 | 
			
		||||
 | 
			
		||||
void tslib_strclr(char *buf, char clrsign, uint16_t len);
 | 
			
		||||
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
 | 
			
		||||
@@ -79,6 +80,8 @@ int tslib_getMinimum(int val1, int val2);
 | 
			
		||||
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
 | 
			
		||||
    // usage:  tslib_text2array("my text", ctmp, 50);
 | 
			
		||||
 | 
			
		||||
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len);
 | 
			
		||||
    // both buffers starting from pos 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif // TSLIB_H
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user