Use interfaces from DCPlugin

This commit is contained in:
Gerhard Hoffmann 2023-04-13 11:28:00 +02:00
parent b62f71b49b
commit b741d89ceb

View File

@ -93,15 +93,184 @@ 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ü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ü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 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};
virtual ~hwinf() {} virtual ~hwinf() {}
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Use serial interface and protocol stack in Cashagent-Library // Use serial interface and protocol stack in Cashagent-Library
// Sending Output data to DeviceController DC2b // Sending Output data to DeviceController DC2b
@ -124,6 +293,8 @@ public:
virtual bool dc_isPortOpen(void) const =0; virtual bool dc_isPortOpen(void) const =0;
// returns true if port open (don't send unless open. Sending to closed port will crash program) // 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; virtual uint8_t test_serialState(void) const =0;
// test on-board signals for the serials // test on-board signals for the serials
// serial drv on/off, Serial mux1, Serial mux2 // serial drv on/off, Serial mux1, Serial mux2
@ -439,11 +610,31 @@ public:
virtual void request_ReadbackDeviceSettings() const =0; virtual void request_ReadbackDeviceSettings() const =0;
virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) 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 buf66[0]=devPara.kindOfPrinter;
// byte[2]=kindOfMifarereadr byte[3]=suppress sleep mode buf66[1]=devPara.kindOfCoinChecker;
// byte[4]=kindOfModem byte[5]=kind of cc terminal 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, virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
uint16_t borough, uint16_t zone, uint16_t borough, uint16_t zone,
@ -455,8 +646,8 @@ public:
// state 5.5.21: byte[0,1]=customer number byte[2,3]=machine number // 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[4,5]=borough byte[6,7]=zone byte[8,9]=alias name
// byte[10...41]=location // byte[10...41]=location
// 12.4.23TS still the same
// 9
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Printer // Printer
@ -1053,7 +1244,7 @@ public:
// return true is bl is up and running // return true is bl is up and running
// also initializes "sendFile" // 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 // send start address, nr of 64byte-block, start with 0
// will be sent only for following block-numbers: // will be sent only for following block-numbers:
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte // 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
@ -1065,7 +1256,7 @@ public:
virtual void bl_openBinary(void) const=0; virtual void bl_openBinary(void) const=0;
// to be used within CashAgent, momentary not processed // 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 // send 64 byte from bin file
virtual void bl_sendLastBlock(void) const=0; virtual void bl_sendLastBlock(void) const=0;
@ -1091,6 +1282,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ü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 +1555,15 @@ public:
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, 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) // 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) Q_DECLARE_INTERFACE(hwinf, HWINF_iid)