APservice/interfaces.h

1701 lines
69 KiB
C
Raw Permalink Normal View History

2023-11-14 09:32:56 +01:00
#ifndef INTERFACE_H
#define INTERFACE_H
#include <QtPlugin>
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=start command
// 1=powered, do emp ini, send reset
// 2=delay
// 3=wait for response, requesting status after response
// 4,5 through, startup
// 6: wait for status
// 7: through, startup
// 8: IDLE state. EMP is up and ready, polling is running
// 9: polling on, payment not yet on
// 10: payment, check coins
// 11: through
// 12: wait 1s for last coin
// 90: stop all, 1s delay
// 99: off, all stopped
uint8_t pollingRunning;
uint8_t paymentRunning;
};
struct Trtc_DateTime
{
uint8_t rtc_hour;
uint8_t rtc_min;
uint8_t rtc_sec;
uint8_t rtc_dayOfMonth;
uint8_t rtc_month;
uint8_t rtc_year;
uint8_t rtc_dayOfWeek;
};
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;
};
// obsolete
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_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;
char label3buffer[4]; // mw >
// Verkauf, Tuer zu:
uint32_t VKcoinsInserted[16]; // nur fuer Wechsler, soviel wurde eingeworfen
uint32_t VKcoinsReturned[6]; // nur fuer Wechsler, Anzahl Muenzen pro Typ, soviel wurde zurueckgegeben
// Service, Tuer offen:
uint16_t ServCoinsInserted[16]; // nur fuer Wechsler, soviel wurde eingeworfen
uint16_t ServCoinsReturned[6]; // nur fuer Wechsler, Anzahl Muenzen pro Typ, soviel wurde zurueckgegeben
uint16_t resint3;
uint16_t resint4;
uint16_t currentTubeContent[6]; // nur fuer Wechsler, aktueller Fuellstand
uint16_t resint5;
uint16_t resint6;
char label4buffer[4]; // box>
uint16_t coinsInVault[16];
uint16_t billsInStacker[8];
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;
// new from 1.8.23
uint32_t cutsSinceCBchange;
uint32_t CBcontent_cent;
uint32_t CBnrofCoins;
char endofblock[4]; // end
// 332 bytes
uint16_t CRC16; // Xmodem16 from startbuffer[0] to endofblock[3]
uint16_t resint11;
char endofRecord[4]; // ----
};
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 ram;
uint8_t intEe;
uint8_t extEe;
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
uint8_t boardHw;
uint8_t printer;
uint8_t modem;
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;
uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
uint8_t creditTerm;
uint8_t coinReject;
uint8_t coinSafe;
uint8_t billSafe;
uint8_t voltage; // 1:11..14V
uint8_t temper;
uint8_t poweronTest;
uint8_t doorState; // 1: alles zu 200: tuer 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;
// 31
};
struct T_dynamicCondition
{
char allDoorsDebounced;
char openedAuthorized;
uint8_t CBinDebounced; // 0:fehlt 1:drin
char upperDoor; // 99: undefined 0:closed 1:open
char middleDoor; // 99: undefined 0:closed 1:open
char lowerDoor; // 99: undefined 0:closed 1:open
char reserve;
char billBox;
char modeAbrech;
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
char nowCardTest;
char nowPayment; // not used, always 0
char lastMifCardType;
uint8_t lastSDoorState;
uint8_t lastVDoorState;
uint8_t lastCBstate;
char paymentInProgress;
// 0: stopped by timeout
// 1: running 2: wait4lastCoin
// 3: payment stopped manually, coins in Escrow
// 4: payment stopped autom, amount collected, coins in Escrow
// 5: payment stopped, escrow full, coins in Escrow
// 6: coins encashed 7:coins returned
// 8: CoinChecker or MDB on Error
char res1;
uint16_t U_Batt;
uint16_t Temperatur;
uint16_t nrCoinsInBox;
uint32_t amountInBox;
uint32_t totalTransVolume;
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
uint8_t startupTestIsRunning;
//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;
};
typedef uint8_t UCHAR;
typedef uint16_t UINT;
struct T_devices
{
// set by master, used(1) or notused (0) or type 2....20
UCHAR kindOfPrinter; // 0:off 1:Gebe
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW)
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
UCHAR solarPower; // 1:sleep allowed 0: no sleep
//UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
UCHAR kindOfModem; // 0:off 1:Sunlink
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
UCHAR CoinEscrow;
UCHAR CoinRejectUnit;
UCHAR CoinShutter;
UCHAR BillAcceptor;
UCHAR usevaultLock;
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
UCHAR autoOpen; // 1: open door covers after valid ATBcard
UCHAR printAccReceipt; // 0/1
UCHAR printDoorReceipt;
UCHAR printTokenTicket;
UINT VaultFullWarnLevel;
UINT VaultFullErrorLevel;
UINT BattEmptyWarnLevel;
UINT BattEmptyErrorLevel;
};
struct T_chg_Tub
{
uint8_t tubeLevel[8]; // [0]=nr coins of lowest value
uint8_t tubeFull[8]; // 1=full 0 else
uint16_t tubeValues[8]; // in cent [0]=lowest value 5c or 10cent
uint16_t tubeFilled[8]; // nr of every coin inserted
uint16_t tubeDispens[8]; // nr of every coin dispensed
// 64 byte
};
struct T_changer
{
// Fixdata from Coin Changer
uint8_t setup; // always 1
uint8_t state; // step of state machine
// 0..12 like EMP, 13...30 for coin dispense
uint8_t level; // mdb-level, always 3
uint16_t countryCode;
uint8_t scale;
uint8_t decimals;
uint8_t coinSetup[16]; // [0]=lowest coin, multiply with scale
uint16_t intendedAcceptance; //bitwise 0,1 1=accept coin, came from master
uint8_t tokenChannel;
uint8_t pollingRunning; // 1: emp is polled 0:not
uint8_t paymentRunning; // 1: coins are accepted
uint16_t denomination[16];
uint16_t availableTubes; //bitwise 0,1 1=av. bit0 = lowest coin value
};
struct T_bna
{
// reported with STATUS:
uint8_t setup; // 0: not 1: got valid parameters from device
uint8_t FeatureLevel;
uint16_t countryCode; // programmed in EMP
uint16_t scalingFactor; // z.B. 5
uint8_t decimalPlace;
uint8_t pad1;
uint16_t stackerCap;
uint16_t billSecureLevel;
uint8_t hasEscrow;
uint8_t accBillTypes[16]; // programmed in EMP z.B. (bit 0..7): 1 2 4 10 20 40 0 0
uint16_t currentStackerLevel; // requested number of notes in billbox
// settings from Master
uint16_t intendedAccept; // bit 0 =5€
uint16_t pad2;
uint16_t billDenomination[16];
};
class hwinf
{
public:
virtual ~hwinf() {}
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Use serial interface and protocol stack in Cashagent-Library
// Sending Output data to DeviceController DC2b
// Sending input requests to DC2 (single or auto-batch)
// Getting input data as receiver payload
// Furthermore the Cashagent-Library answers with status strings about sending and reading result
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const =0;
// Command: open serial interface
// BaudNr: 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
// BaudStr: for exapmle "19200"
// ComName: for example "COM48"
// connect: 0, 1
virtual void dc_closeSerial(void) const =0;
// Command: close serial interface in order to save power while power down
// or if another port must be used
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 void dc_autoRequest(bool on) const =0;
// on = true: select that all READ-Requests are sent automatically
// on = false: select that all READ-Requests are sent manually one by one
// Every input information from DC2 must be requested
// ( digital and analog sensors, get time/date, get status information )
virtual void dc_requTestResponse() const =0;
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
virtual bool dc_readAnswTestResponse() const =0;
// retval: true: test was successful, got right response
virtual uint8_t dc_isRequestDone(void) const =0;
// retval: 0: request is still in progress
// 1: answer from DC2 was OK
// 2: wrong answer from DC2
virtual uint16_t dc_getCompletePayLoad(uint16_t plBufSiz, uint8_t *payLoad) const =0;
// get data back in "payLoad", max 64 byte, can be used for diagnosis
// retval = nr of bytes received. If host buffer too small then
// only plBufSiz bytes are copied to "payLoad"
// plBufSiz = size of host buffer
virtual void dc_setWakeFrequency(uint8_t period) const =0;
// RTC wakes DC2 (and PTU) by hardware signal every 32seconds
// change wake signal period to 1...64s
virtual void dc_OrderToReset(void) const =0;
// want DC2 to reset (in order to start Bootloader)
virtual QString dc_getSerialState(void) const =0;
// get result of opening-command like "ttyS0 opened with 115200 8N1!
// or error messages like "comport not available..."
// was saved by last opening event, can be passed for 100ms
virtual void dc_clrSerialStateText(void) const =0;
// clear above text to avoid multiple repetive displaying
virtual void bl_sendDataDirectly(uint8_t length, uint8_t *buf) const =0;
// send without protocol frame, needed for the DC bootloader
virtual uint8_t getRawRecLength(void) const =0;
// only needed if protocol stack in Cashagent-Library is bypassed
virtual uint8_t getRawReceivedData(uint8_t *receivedData) const =0;
// only needed if protocol stack in Cashagent-Library is bypassed
virtual QString dc_getSerialParams(void) const =0;
// get DC2 serial settings (not very meaningful as they will not come if different from master settings)
virtual QString dc_getHWversion(void) const =0;
// get DC2 hardware version
virtual QString dc_getSWversion(void) const =0;
// get DC2 software version
virtual QString dc_getState(void) const =0;
// get DC2 status (every OK or any error/warning? )
// ----------------------------------------------------------------------------------------------------------
// Date and Time
// ----------------------------------------------------------------------------------------------------------
virtual uint8_t rtc_getDateTime(struct Trtc_DateTime *rtc_DateTime) const =0;
virtual uint8_t rtc_setDateTime(void) const =0;
// synch DC2 with PC or PTU system time and date
virtual void rtc_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss) const =0;
// get time directly
virtual void rtc_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd) const =0;
// get date directly
virtual uint8_t rtc_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday) const =0;
// dow=day of week, 1=monday...7
// minOfToday: 0=midnight...1439= 23:59
// secOfToday: 0=midnight...86399= 23:59:59
virtual bool rtc_isLeapYear(uint8_t *lastLeapYear, uint8_t *NextLeapYear) const =0;
// retval true: this year is leap year
virtual bool rtc_isLeapYear() const =0;
virtual void rtc_getWeek(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek) const =0;
// DayOfWeek: 1=monday...7
// HoursOfWeek: 0=Monday 0:00 o'clock...167=Sunday 23:00
// MinutesOfWeek: 0=Monday 0:00 o'clock...10079=Sunday 23:59
virtual void rtc_getMonth(uint8_t *DayOfMonth, uint16_t *HoursOfMonth, uint16_t *MinutesOfMonth) const =0;
// DayOfMonth: 1...31
// HoursOfMonth: 0 = 0:00o'clock of 1.day in month up to 743
// MinutesOfMonth:0 = 0:00o'clock of 1.day in month up to 44639
virtual void rtc_getYear(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint32_t *MinutesOfYear) const =0;
// DayOfYear: 1...366 1= 1.Jan of this current year
// HoursOfYear: 0=1.Jan 0:00o'clock ...8783=31.12 23 o'clock
// MinutesOfYear: 0=1.Jan 0:00o'clock ...527039=31.12 23:59 o'clock
virtual QString rtc_getTimStr(void) const =0;
virtual QString rtc_getDatStr(void) const =0;
virtual QString rtc_getTimDatStr(void) const =0;
// UID - unique number, different in every DC
virtual void dc_getUID8byte(uint8_t *buf8byteUid) const =0;
// get 8 single bytes in buffer
virtual QString dc_getUIDstr() const =0;
// get as string
virtual uint64_t dc_getUIDnumber(void) const =0;
// get UID as one long number
// ----------------------------------------------------------------------------------------------------------
// analogs
// ----------------------------------------------------------------------------------------------------------
// Analog values:
virtual uint32_t dc_getTemperature(void) const =0;
// in Sax-Format 0...400 (0=-50,0degC 100=0,0degC 141=20,5degC 400=150,0degC)
virtual QString dc_getTemperaturStr(void) const =0;
// as string like "-12,5degC"
virtual uint32_t dc_getVoltage(void) const =0;
// as value in mV, 0...65,535V
virtual QString dc_getVoltagStr(void) const =0;
// as string in mV
virtual bool dc_mainFuseIsOk(void) const=0;
// true if 12V fuse is OK
// false: fuse blown, DC will continue working but no 12V device can be used!
// ------------------------------------------------------------------------------
// digital outputs
// ------------------------------------------------------------------------------
virtual uint8_t lock_switchUpperLock(uint8_t dir) const =0;
// dir 0=off 1=up 2=down
// move lock until stop cmd (0)
virtual uint8_t lock_switchLowerLock(uint8_t dir) const =0;
// dir 0=off 1=up 2=down
// move lock until stop cmd (0)
virtual void lock_switchVaultDoor(void) const =0;
virtual void coin_switchRejectMotor(uint8_t dir) const =0;
virtual void coin_rejectCoins(void) const =0;
// LEDs
virtual void led_switchLedService(uint8_t on) const =0;
virtual void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const =0;
virtual void led_switchLedPinPad(uint8_t on, uint8_t ton, uint8_t tof) const =0;
virtual void led_switchLedStart(uint8_t on, uint8_t ton, uint8_t tof) const =0;
virtual void led_switchLedCoinbassin(uint8_t on, uint8_t ton, uint8_t tof) const =0;
virtual void fan_switchFan(bool on) const =0;
virtual void alarm_switchSiren(bool on) const =0;
virtual void bar_OpenBarrier(bool open) const =0;
virtual void ptu_switchWake(bool WAKEACTIVE) const =0;
virtual void aux_power(bool on) const =0;
virtual void aux_setUsage(uint8_t PinDirection) const =0;
virtual void aux_setOutputs(uint8_t PinIsHigh) const =0;
virtual void lock_switchContactPower(bool on) const =0;
virtual void prn_switchPower(bool on) const =0;
virtual void mif_readerOn(bool on) const =0;
virtual void mif_creatAtbCard(uint8_t cardType) const =0;
virtual void mod_switchPower(bool on) const=0;
virtual void mod_switchWake(bool WAKEACTIVE) const=0;
virtual void mdb_switchPower(bool on) const =0;
virtual void mdb_switchWake(bool WAKEACTIVE) const =0;
virtual void credit_switchPower(bool on) const =0;
// the same as modem power
virtual void credit_switchWake(bool WAKEACTIVE) const =0;
virtual void shut_move(bool open) const =0;
virtual void esc_moveFlaps(uint8_t flap ) const =0;
// 0: close both 1: open take-flap 2: open return
// ------------------------------------------------------------------------------
// door, cashbox and lock switches
// ------------------------------------------------------------------------------
virtual uint8_t door_getSwitches(void) const =0;
// retval: bit0: upper door 1: low door 2:vault door
virtual bool door_isUpperDoorOpen(void) const =0;
virtual bool door_isLowerDoorOpen(void) const =0;
virtual bool vault_isVaultDoorOpen(void) const =0;
virtual uint8_t vault_getSwitches(void) const =0;
// retval bit0: cash box, bit 1: bill box
virtual bool vault_isCoinVaultIn(void) const =0;
virtual bool vault_isBillVaultIn(void) const =0;
virtual uint8_t door_getLocks(void) const =0;
// retval bit0: upper lever is up (=open)
// bit1: upper lever is down (=locked)
// bit2: lower lever is up
// bit3: lower lever is down (=locked)
virtual bool door_upperDoorIsLocked(void) const =0;
virtual bool door_upperDoorIsUnlocked(void) const =0;
virtual bool door_lowerDoorIsLocked(void) const =0;
virtual bool door_lowerDoorIsUnlocked(void) const =0;
virtual bool bar_optoIn1isOn(void) const =0;
virtual bool bar_optoIn2isOn(void) const =0;
virtual uint8_t aux_getAuxInputs(void) const =0;
virtual bool ptu_WakeINisActive(void) const =0;
virtual bool mdb_WakeINisActive(void) const =0;
virtual bool prn_readyINisActive(void) const =0;
virtual bool coid_isAttached(void) const =0;
virtual bool coin_escrowIsOpen(void) const =0;
virtual bool mif_cardIsAttached(void) const =0;
//bool hwapi::mod_WakeINisActive(void);
virtual bool door_isContactPowerOn(void) const =0;
virtual bool mif_isMifarePowerOn(void) const =0;
virtual bool mdb_testIsmdbTxDon(void) const =0;
virtual bool aux_isAuxPowerOn(void) const =0;
virtual bool mod_isGsmPowerOn(void) const =0;
virtual bool cred_isCreditPowerOn(void) const =0;
virtual bool prn_isPrinterPowerOn(void) const =0;
virtual uint8_t prn_PrnFuseIsOk(void) const=0;
//retval: 0: fuse blown 1: fuse OK 2:unknown as printer power is off
virtual bool mdb_isMdbPowerOn(void) const =0;
virtual bool cash_getRejectMotorHomePos(void) const=0;
virtual uint8_t cash_getLowPaperSensor(void) const=0;
// 0: Sensor sees paper 1: no paper 99: off
// ------------------------------------------------------------------------------
// request commands
// ------------------------------------------------------------------------------
// all read-requests can be sent manually by the following functions
// or automatically in background by: void hwapi::dc_autoRequest(bool on)
virtual void request_DC2serialConfig() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_HWversion() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_SWversion() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_condition() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_UID() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_TimeAndDate() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_analogues() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_digitalInputs() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
virtual void request_DC2_digitalOutputs() const =0;
// read-request can be sent manually by this function, not needed if auto-request is on
// ------------------------------------------------------------------------------
// the following device state requests are deployed only if device is powered up:
virtual void request_PrinterHwState() const =0;
virtual void request_PrinterCurrentFonts() const =0;
virtual void request_PrinterStateComplete() const =0;
virtual void request_MifareReaderState() const =0;
virtual void request_MifareCardType() const =0;
virtual void request_MifareAtbType() const =0;
virtual void request_MifareID() const =0;
virtual void request_MifareData(uint8_t dataBlockNumber) const =0;
//virtual void request_MifareData() const =0;
virtual void request_MDB_Status() const =0;
virtual void request_MDB_lastResponse() const =0;
virtual void request_EMP_allParameters() const =0;
virtual void request_EMP_lastCoin() const =0;
// ------------------------------------------------------------------------------
// readback digital outputs of connected devices
// these functions are not needed for normal operation
// but can be used to test and verify conditions
// ------------------------------------------------------------------------------
virtual bool test_getDO_mdbRXtst(void) const =0;
// readback digital outputs of connected devices
// these functions are not needed for normal operation
// but can be used to test and verify conditions
virtual uint8_t lock_getDO_motors(void) const =0;
// bit0: upper lock forward bit 1 backward
// bit2: lower lock forward bit 3 backward
virtual uint8_t test_serialState(void) const =0;
// test on-board signals for the serials
// serial drv on/off, Serial mux1, Serial mux2
virtual bool test_serialIsOn(void) const =0;
virtual bool test_serialMux1isSetToPrinter(void) const =0;
virtual bool test_serialMux1isSetToModem(void) const =0;
virtual bool test_serialMux2isSetToCredit(void) const =0;
virtual bool test_serialMux2isSetToMifare(void) const =0;
virtual bool led_coinIsOn(void) const =0;
virtual bool led_frontIsOn(void) const =0;
virtual bool led_ticketIsOn(void) const =0;
virtual bool led_pinIsOn(void) const =0;
virtual bool led_StartIsOn(void) const =0;
virtual bool led_insideIsOn(void) const =0;
virtual bool fan_isOn(void) const =0;
virtual bool siren_isOn(void) const =0;
virtual bool bar_relayIsOn(void) const =0;
virtual bool ptu_WakeOutIsOn(void) const =0;
virtual bool aux_powerIsOn(void) const =0;
virtual bool coin_shutterIsOpen(void) const =0;
virtual bool coin_shutterTestOutput(void) const =0;
virtual uint8_t coin_escrowFlapOpened(void) const =0;
// retval: 1:return flap is open 2:take flap is open 0:closed
// ------------------------------------------------------------------------------
// devices are operated by DC
// processes with more then one devices
// timer controlled or long term processes
// ------------------------------------------------------------------------------
virtual void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker,
uint8_t kindOfMifareReader, uint8_t suppressSleep,
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
// enable hardware in device controller:
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: Csquare_changer
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
// kindOfCredit: 0:off 1: cVendTopp 2:cVendPin (not yet implemented)
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
virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
uint16_t borough, uint16_t zone,
uint16_t alias, char *location) const =0;
virtual void request_ReadbackMachineID() const =0;
virtual void readback_machineIDdata(uint8_t *length, uint8_t *data) const =0;
// 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
// Locks stops automatically at end switch or by timeout
virtual uint8_t lock_openUpperDoor(void) const =0;
virtual uint8_t lock_closeUpperDoor(void) const =0;
virtual uint8_t lock_openLowerDoor(void) const =0;
virtual uint8_t lock_closeLowerDoor(void) const =0;
virtual void shut_openOnce(void) const =0;
// and close automatic after shutter time
virtual void shut_openForCoin(bool start) const =0;
// open flap if coin is attached
// once process is started it runs until stop command
virtual void shut_sendOpeningTime(uint16_t timeIn_ms ) const =0;
// after this time without retrigger the flap is closed
virtual void esc_takeMoney(void) const =0;
// and close automatically after escrow time (1s)
virtual void esc_returnMoney(void) const =0;
// and close automatically after escrow time (1s)
// ----------------------------------------------------------------------------------------------------------
// --------------------------------------------- MIFARE -----------------------------------------------------
// ----------------------------------------------------------------------------------------------------------
// obsolete
virtual uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const =0;
// retval 0=OK 1=error host buffer too small
/* data description, new fast version:
byte 0= still the same: current read state:
0=power off 1=reader-fault 2=ready
3=just reading 4=read complete
5=read partial, removed too early
6=state unknown
byte 1: reader state 1=ok 0=nok
byte 2: card preent (0,1)
byte 3: card selected (0)
byte 4: card type: 0...5
byte 5: card allowed (0=no 1=MifareClassic 1k or 4k)
byte 6: CardSize: 1 or 4 (kB)
byte 7: length of UID 4 or 7 (byte)
*/
virtual bool mif_readerIsOK(void) const =0;
virtual bool mif_cardAttached(void) const =0;
// not working! use mif_cardIsAttached() instead
virtual uint8_t mif_readResult(void) const =0;
// result: 0: unknown or still in progress
// 1: card read successful
// 2: reading error
// not working!
virtual QString mif_cardUID(void) const =0;
// not working
virtual uint8_t mif_getCardDataDec(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize) const =0;
virtual QString mif_getCardDataStr(uint8_t blockNumber) const =0;
// with blockNumber=0...11
// ----------------------------------------------------------------------------------------------------------
// --------------------------------------------- PRINTER ----------------------------------------------------
// ----------------------------------------------------------------------------------------------------------
// read printer condition and settings
virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const =0;
// retval: status byte
// byte 0 = 0: prnter OK, >0: error
// bit0: paper low 1: no paper 2: temperature error
// 3: head open 4: paper jam in cutter
// 6: no response 7: bad response from printer
// and return struct "Tprn_hw_state"
virtual bool prn_isUpAndReady(void) const =0;
// true: printer is powered, serial is ok, no error, printer is connected and resonding
virtual void prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) const =0;
// send Commands to printer:
virtual void prn_sendText(QByteArray *buf) const =0;
// up to 1280 bytes
virtual void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) const =0;
// send three byte through to printer, see printers manual
virtual void prn_sendPrnEscCmd(uint8_t para1, uint8_t para2, uint8_t para3, uint8_t para4) const =0;
// send four byte through to printer, see printers manual
virtual void prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alignment, uint8_t orientation) const =0;
// send 5 byte: byte 0,1: speed 5...250 mm/s
// byte2: density 0....(25)....50
// byte3: alignment 'l', 'c', 'r' = left, center, right
// byte4: orientation 0, 90, 180 = 0deg, 90deg, 180deg rotation (by now not supported!)
// not batched! don't use twice within 100ms
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
//direction: 1=forward 2=backward
//
virtual void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const =0;
// font = kind of font 5...11 (0..22)
// size = 6...20, 9..9: too tiny 10: small ...12 = normal size ...20=huge
// width: 0...4 0=1x 1=2x 2=4x (huge!) 3=8x 4=16x (3,4 make no sense)
// heigth: 0...7 = 1x...8x only 0,1,2,(3) make sense
virtual void prn_setLetters(uint8_t bold, uint8_t invers, uint8_t underlined) const =0;
// bold: 0/1
// invers: 0/1
// underlined: 0/1
virtual void prn_cut(uint8_t kindof) const =0;
// kindof: 1=full cut 2=partial cut 3=eject (5xLF + full cut)
virtual void prn_newLine(uint8_t nrOfLines) const =0;
virtual void prn_printCompleteFontTable(void) const =0;
virtual void prn_printBarcode(uint8_t kindOf, uint8_t withText, uint8_t offset, uint8_t rotation, uint8_t dataLeng, uint8_t *data) const =0;
// kind of barcode: 0=Code39 1=Code128 2=EAN13 3= 2/5interleaved 4=UPC-A 5=EAN8
// withText: print readable text below
// offset: move by pixel from left border
// rotation
// dataLeng in byte
virtual void prn_sendQRdata(QByteArray *buf) const =0;
// maximal 150 alphanummeric bytes
virtual void prn_printQRcode(void) const =0;
// QRcode may have 1...150 alphanummeric data, must be transfered in advance
virtual void prn_printLogo(uint8_t nrOfLogo, uint8_t offset ) const =0;
// nrOfLogo: 1..4 in flash 5...8 in Ram
// offset: in mm form left border
// .........................................................
// Parking Ticket (print-out document) designer TD - obsolete
// .........................................................
// ----------------------------------------------------------------------------------------------------------
// --------------------------------------------- MDB Bus ----------------------------------------------------
// ----------------------------------------------------------------------------------------------------------
virtual void mdb_sendBusReset(void) const =0;
virtual void mdb_sendCommand(uint8_t toMdbDevice, uint8_t mdbCommand) const =0;
// send one bus command directly over mdb bus, refer to mdb manual for commands
// this command is not needed in normal operation, just for new or special things
virtual void mdb_sendMessage(uint8_t toMdbDevice, uint8_t mdbCommand, uint8_t nrOfData, uint8_t *dataBuffer) const =0;
// nrOfData = sizeOf(dataBuffer) maximal 34 byte according mdb specs
// same as mdb_sendCommand, just with data
virtual bool mdb_busIsReadyToWork() const =0;
virtual bool mdb_deviceVoltageOK() const =0;
virtual bool mdb_busVoltageOk() const =0;
virtual uint8_t mdb_getLastDeviceResponse(uint8_t *fromDevice, uint8_t *lastRequest,
uint8_t *responseLength, uint8_t *responseBuffer) const =0;
// fromDevice: device nr from which data was requested 0,1,2,3
// lastRequest: sent mdb command
// responseLength: nr of payload data (after mdb-ack) 0...34
// responseBuffer holds payload data (answer from mdb device)
// return val: mdb result of this request: 1=got ACK 2=got 3xNAK 3=no or bad response 4:got Data (after ACK)
// ----------------------------------------------------------------------------------------------------------
// ---------------------------------- Electronic Coin Validator EMP -----------------------------------------
// ----------------------------------------------------------------------------------------------------------
virtual void emp_sendSettings(uint16_t coinAcceptance, uint8_t tokenChannel, uint16_t *coinDenomination ) const =0;
// coinAcceptance: bit0=coin1 (lowest donomination) bit15=coin16 bitH=accept bit L = deny coin (no validation)
// tokenChannel 0...31: if this signal comes from emp then a token was inserted
// coinDenomination = array of 16 coin values (e.g. 5, 10, 20...)
virtual void emp_pollingOnOff(uint8_t on) const =0;
virtual void emp_startCoinAcceptance(void) const =0;
virtual void emp_stopCoinAcceptance(void) const =0;
virtual void emp_getAllParameters(struct T_emp *emp) const =0;
// see struct in hwapi.h
// usage example:
// hwapi *HWaccess const override;
// HWaccess = new hwapi() const override;
// struct T_emp myEmp const override;
// HWaccess->emp_getAllParameters(&myEmp) const override;
// readval=myEmp.pollingRunning const override;
virtual uint8_t emp_chkIfCoinInserted(void) const =0;
// retval: 0...16 coins left in FIFO
virtual void emp_getNewCoinRecord(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value) const =0;
// with every call ONE coin is taken out of FIFO and pointer decremented
// valid: should be 1
// signal: comes right from coin checker, 0...15 (0=first programmed coin type) 0xFF=no signal
// error: was reported from EMP as dynamic signal right after coin insertion (instead of
// coin signal), example: 3=unknown coin 4=coin is blocked by host. 0xFF=no error
// value: of the coin. Depends on parameter "coinDenomination" in function "emp_sendSettings"
// if coinDenomination[coin 0..15] = 0 then the value programmed in coin checker is taken
// if coinDenomination > 0 then this value is taken.
// Useful in case of two currencies (adapt to local currency) or for token.
// function gives more details as "emp getLastCoin()" but "emp getLastCoin()" is easier to use
// alternativ to emp_getNewCoinRecord( ):
virtual uint8_t emp_giveLastCoin(uint16_t *value, uint8_t *signal) const =0;
// retval: 0: NO coin stored 1: valid coin 2: got wrong coin or coin denied
// value: if retval1: value of the coin if reval=2: error number
// 0xFF means NO error or NO signal (as 0 is a valid error/signal)
// signal: channel nr reported from checker 0...15
virtual uint8_t emp_returnLastCoin(uint16_t *value, uint8_t *signal) const =0;
// use for changer
virtual QString dc_getTxt4RsDiagWin(void) const =0;
virtual void dc_clrTxt4RsDiagWin(void) const =0;
virtual QString dc_get2ndTxt4RsDiagWin(void) const =0;
virtual void dc_clr2ndTxt4RsDiagWin(void) const =0;
virtual QString dc_getTxt4HsStateLine(void) const =0;
virtual void dc_clrTxt4HsStateLine(void) const =0;
virtual QString dc_getTxt4masterStateLine(void) const =0;
virtual void dc_clrTxt4masterStateLine(void) const =0;
virtual QString dc_getTxt4resultStateLine(void) const =0;
virtual void dc_clrTxt4resultStateLine(void) const =0;
virtual QString dc_getdataStateLine(void) const =0;
virtual void dc_clrTxt4dataStateLine(void) const =0;
virtual QString dc_getdatifLine(void) const =0;
virtual void dc_clrTxt4datifLine(void) const =0;
// ----------------------------------------------------------------------------------------------------------
// -------- DC Bootloader 1.Version
// ----------------------------------------------------------------------------------------------------------
// using DC2 Bootloader
virtual void bl_iniChain(void) const =0;
virtual bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const =0;
virtual uint8_t bl_activatBootloader(uint8_t *sendData) const =0;
virtual uint8_t bl_startChain(void) const =0;
virtual uint8_t bl_readBLversion(uint8_t *sendData) const =0;
// minimum size of sendData-buffer: 5byte retval: length
virtual uint8_t bl_readFWversion(uint8_t *sendData) const =0;
// minimum size of sendData-buffer: 5byte retval: length
virtual uint8_t bl_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const =0;
// 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
virtual uint8_t bl_exitBL(uint8_t *sendData) const =0;
// minimum size of sendData-buffer: 5byte retval: length
virtual void led_switchLedIllumination(uint8_t on) const =0;
// ------------------------------------------------------------------------------------
// 27.3.2023: Use Device-Controller's Bootloader to send hex-file
// ------------------------------------------------------------------------------------
virtual void bl_rebootDC(void) const =0;
virtual void bl_startBL(void) const =0;
virtual void bl_checkBL(void) const =0;
virtual bool bl_isUp(void) const =0;
// return true is bl is up and running
// also initializes "sendFile"
virtual void bl_sendAddress(uint16_t blockNumber) const =0;
// 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
virtual uint8_t bl_wasSendingAddOK(void) const =0;
// return val: 0: no response by now 1:error 10: OK
virtual void bl_openBinary(void) 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;
virtual uint8_t bl_wasSendingDataOK(void) const =0;
// return val: 0: no response by now 1:error 10: OK
virtual void bl_stopBL(void) const =0;
// ------------------------------------------------------------------------------------
// 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 successful. could fail if more the 8 commands are waiting
virtual bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const =0;
virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const =0;
virtual bool sys_runCompleteTest(void) const =0;
// warning: lasts 20s in one pace
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 false if sending is not possible, wait a second
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(uint8_t *nrOfVals, uint16_t *accNr ) const =0;
// returns all acc nrs of the backuped vault records
// use: uint16_t backupedAccNumbers[8]
virtual bool log_selectVaultRecord(uint16_t accountNr ) const =0;
// return true if sending, false if cmd-stack is full
// and trigger transfer
virtual bool log_chkIfVaultRecordAvailable(void) const =0;
// return true if completly received
virtual bool 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;
// print all 8 backuped accounting receipts
// 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(uint32_t amount) const =0;
// 17.4.23TS: extended to 32bit
virtual uint8_t cash_paymentProcessing(void) const =0;
// run this function periodically while coin payment process to generate necessary signals
// return value:
// 0: stopped 1: starting up 2: coin collection
// 3: finished by User (Push button) 4: finished, Max-Value collected
// 5: finished by escrow
// 10,11: error cannot start
// 12: timeout while payment, coins returned
// 13: stopped by unexpected error
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;
// alle bei diesem Verkauf eingeworfenen Muenzen sind gespeichert, max 64
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 uint8_t sys_getWakeReason(void) const =0;
// Master was woken by following reason:
// 1: MDB Event
// 2: Coin Event
// ( 3: Master Event) - will not set the wake line
// ( 4: 32s pulse) - will not set the wake line
// 5: Door Event
// ( 6: Diag Event) - will not set the wake line
// 7: 30min-Pulse for HB
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const =0;
virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const =0;
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const =0;
virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const =0;
virtual uint32_t cash_getAmountInVault(void) const =0;
virtual uint16_t cash_getNrCoinsInVault(void) const =0;
virtual uint8_t prn_getPrintResult() const =0;
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
virtual void sys_sendDeviceParameter(struct T_devices *deviceSettings) const =0;
virtual void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const =0;
// attention: only applies if function "sys_sendDeviceParameter()" was used to send this settings before
// cannot be used to see settings programmed by JsonFile
virtual bool sys_areDCdataValid(void) const =0;
virtual bool sys_sendingTest(void) const =0;
virtual void prn_requestCurrentDynData(void) const =0;
virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const =0;
// which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const =0;
virtual bool prn_dynDataAreEqual(uint8_t *buf) const =0;
virtual bool prn_printKombiticket(uint8_t nrOfKombi) const =0;
// print four of the templates loaded by Json prior
// nr = 1..8
virtual void lock_triggerUpperSolenoid(void) const =0;
virtual void lock_triggerLowerSolenoid(void) const =0;
virtual bool doors_supervise(void) const =0;
virtual bool dc_isAutoRequestOn(void) const =0;
virtual uint16_t log_getLatestAccountNumber(void) const=0;
// new function 27.6.2023
// latest = highest of the backup's
virtual uint8_t log_getAvailableVaultBlocks(void) const=0;
// return 0x0011 1111 if all 6 blocks are loaded (one bit per block)
virtual uint8_t log_getAnswerToLastSlaveRequest(void) const =0;
// use only for ONE request/command
// return: 0xFF: result unknown by now as sending is ongoing
// 0=OK
// 1= wrong length 2=wrong start sign 5= wrong crc
// 6= slave: master cmd was wrong 7: slave: could not write/read data
// 8=timeout, got no response from slave
// 0,8 work, 1..6 not yet tested. 8 comes immed. and stays 8 until reconnect
// use for important and extended commands (print several templates, print ticket...)
virtual void log_startSupervision(void) const =0;
virtual uint8_t log_getAnswerToLastCmdBatch(void) const =0;
// 0xFF: no command sent by now
// 0: started, in progress
// 1: done and OK
// 2: done and error
// not working properly, always 0
virtual bool log_getVaultData(uint8_t *data) const =0;
// get vault record in linear 8bit buffer with 384 byte
// new from 1.8.23
virtual bool prn_printOneAccountReceipt(uint16_t accountNr) const =0;
// print one out of eight stored last accounting receipts
// function log_getHoldAccountNumbers() gives a list of acc-Nr. of the stored receipts
virtual bool prn_printAllAvailAccountReceipts(void) const =0;
// same as: prn_printAccountReceipt() from line 1153
// return true if sending to DC OK, false if cmd-stack is full
virtual bool log_verifyVaultRecordByCrc(void) const =0;
// return true if CRC16 is correct, data are 100% OK. Security level 1:65536
// verification is strongly recommended before further processing
// in case of "false"-result please reload from DC
virtual uint16_t log_DC_getNextAccountNumber(void) const=0;
// the current cash box content will be backuped with this number on next cashbox-change
virtual void log_DC_setNextAccountNumber(uint16_t newAccountingNumber) const=0;
// the current cash box content will be backuped with this number on next cashbox-change
// use only in case of hardware replacements or errors which derailed the number
virtual void log_DC_deleteAllVaultrecordsInDc(void) const=0;
// use only in case of hardware replacements or errors which derailed the number
virtual void log_DC_deleteAllTotalCounters(void) const=0;
// use only in case of hardware replacements or errors which derailed the number
virtual void dc_setNewCustomerNumber(uint16_t newCustNr) const =0;
virtual void dc_setNewMachineNumber(uint16_t newMachNr) const =0;
virtual void dc_setNewBorough(uint16_t newBorough) const =0;
virtual void dc_setNewZone(uint16_t newZone) const =0;
// new functions from 8.9.23
virtual QString mif_getReaderType(void) const =0;
// return "SL025" if correct reader is connected
virtual void mif_getCardSize(uint8_t *cardSize, uint8_t *idLeng) const =0;
// cardSize=1k or 4kByte
// idLeng =4Byte or 7 byte
virtual char mif_getAtbCardData(uint8_t *buf, uint8_t maxBuffSiz) const =0;
// return complete buffer binary, just for test purpose
virtual bool mif_isValidAtbCard(void) const =0;
virtual uint32_t mif_getAtbCardCuNu(void) const =0;
virtual uint8_t mif_getAtbCardTyp(void) const =0;
// return 1=upper door card 1=lower door 3=printer-test 4=coin-test
// 0: not a valid atb2020 card
virtual QString mif_getAtbCardPerso(void) const =0;
// e.g. "PNsax001" used for personal number, name shortcode, card number
// free to use, can be set in AtbMcw23.exe tool
virtual void mif_getAtbCardExpire(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute) const =0;
// ------------------------------------------------------------------------------------
// Device-Controller-Bootloader convenient version 21.09.2023
// ------------------------------------------------------------------------------------
// use this to jump to BL:
//void hwapi::bl_rebootDC(void) const
// use this to start BL:
// void hwapi::bl_startBL(void) const
// call this in order to get response from BL:
//void hwapi::bl_checkBL(void) const
// evaluate BL response:
//bool hwapi::bl_isUp(void) const
// 29.9.23: new: "completeStart" function, replaces bl_rebootDC(), bl_startBL() and bl_checkBL()
// result can be verified with bl_isUp() as before
virtual bool bl_completeStart(void) const =0;
// must be used in DC's normal operation
// select binfile-name in GUI
// send binfile-name to BL-processor:
virtual bool bl_storeFirmware(QString fileName) const =0;
// load binary file 3x and compare
// return true if loaded correctly
// return false: error, could not load correctly
// request the number of blocks for this file
virtual uint16_t bl_getNrOfFirmwareBlocks(void) const =0;
// size of the loaded bin file in 64byte blocks
// call after bl_storeFirmware()
// call the next two function's repetitive with "blockNumber"=0,1,2,3....."bl_getNrOfFirmwareBlocks()"
virtual bool bl_blockAutoLoad(uint16_t blockNumber) const =0;
// call in loop from block number 0 up to <= "dcBL_getNrOfBlocks()"
//the last block "bl_getNrOfFirmwareBlocks()" is sent as conclusion command (important!)
// but after every call WAIT (!) for response "bl_blockAutoResponse()" !!!!
// data will be sent to DC, if neccesary addr will be sent additionally
// if neccesary sending will automatically repeat up to 3times
// retval: false if blockNumber>4095, true else
// check out this response after every block-sending, wait until >0!!!
virtual int8_t bl_blockAutoResponse(void) const =0;
// after every "bl_blockAutoLoad()" call this until response
// retval 0: wait 1: OK, blk was sent 2: OK, transfer complete
// 3: error despite repeating, cancel. probably bin file corrupted
// Max duration: 3x no response from BL = 900ms
// finally call:
// void hwapi::bl_stopBL(void) const
// -------------- end of bootloader ---------------------------------------------------
// new from 28.9.23 and earliest from DC version 4.45
// get all versions of the DC-Jsons
virtual void sys_requestJsonVersions(uint8_t jsonNr) const =0;
// send one request for every single version
// jsonNr=1...36, 1=config file (cust.Nr) 2=devices 3=cash 4=res.
// 5=printer template 1 ..... 36= template 32
virtual void sys_getJsonVersions(uint8_t jsonNr, char *versionString) const =0;
// jsonNr=1...36, 1=config file (cust.Nr) 2=devices 3=cash 4=res.
// 5=printer template 1 ..... 36= template 32
// length of buffer is always 16 byte
// ------------------------------------------------------------------------------------
// Coin Changer
// ------------------------------------------------------------------------------------
// find above (same as for coin checker (EMP)):
// mdb_switchPower(true); // power on/off
// cash_startPayment(amount_cent); // start polling, enable coins, changer turns to green
// getInsertedAmount()
// getLastInsertedCoin()
// getAllInsertedCoins(uint16_t *types, uint16_t *values)
// all inserted coins of this past transaction are stored, max 64
// cash_stopPayment(); // and wait for further command (changer blinks yellow)
// cash_cancelPayment(); // and return complete paid amount
// after ticket/goods issue:
// vend_success()
// conclude payment process, keep all coins. Printing was successful
// return change (payment above start-amount), so it works only if
// Payment was started with real vending price (pre selection).
// if payment was started with maximum price (for direct coin insertion)
// then use "changer_returnCoins()", not vend_success()
// vend_failed()
// conclude payment process and return complete paid amount
// also valid for changer:
// emp_sendSettings(uint16_t coinAcceptance, uint8_t tokenChannel, uint16_t *coinDenomination ) const =0;
// coinAcceptance: bit0=coin1 (lowest donomination) bit15=coin16 bitH=accept bit L = deny coin (no validation)
// tokenChannel 0...31: if this signal comes from emp then a token was inserted
// coinDenomination = array of 16 coin values (e.g. 5, 10, 20...)
virtual void changer_returnCoins(uint32_t amountInCent) const =0;
virtual void changer_requestChangeResult(void) const =0;
virtual uint8_t changer_getChangeResult(uint32_t *returnedAmount) const =0;
// get result of coin dispensing
// receivedData[0]: 0: not yet started 1:amount returned
// 2:only partial return 3: no return possible
// receivedData[2,3,4,5]: returned amount
virtual void changer_getAllParameters(struct T_changer *mw) const =0;
// requested automatically with 23, same like EMP
virtual void changer_requestTubelevel(void) const =0;
virtual void changer_getTubelevel(struct T_chg_Tub *tubLevel) const =0;
// don't use tubeDispens[], it's not yet correct!
// ------------------------------------------------------------------------------------
// bank note acceptor
// ------------------------------------------------------------------------------------
// already defiened functions applying for BNA as well:
// mdb_switchPower(true); // power on/off
// bank notes are integrated in the normal transaction process, so use the usual functions to run a vending cycle:
// cash_startPayment(amount_cent); // start polling, enable bills, reader shows green
// getInsertedAmount()
// cash_stopPayment();
// cash_cancelPayment();
// vend_success()
// vend_failed()
virtual void bna_sendSettings(uint16_t notesToAccept, uint16_t parameters,
uint16_t *billDenomination,
uint32_t acceptanceLimit) const =0;
// notesToAccept: bit0=bill1 (lowest donomination) bitH=accept bit L = deny
// parameters: e.g. use escrow function for some notes
// billDenomination = array of 16 bill values (e.g. 5, 10, 20...)
// these can be set alternatively by Json-File DC2C_cash.json
// acceptanceLimit: device will stop acceptance once this amount is reached and
// optionally keep last bill in escrow until vend_success()
// is called (put bill to stacker) or vend_failed() is called (return bill)
virtual void bna_setCurrentAcceptance(uint16_t notesToAccept) const =0;
// can be used to block notes dynamically, example: from now only 5€ bills are allowed (if only 3€ are to be paid)
// only valid till next start-payment. Cannot add notes which are not activated in Json
virtual void bna_requestParameters(void) const =0;
// send command to DC in order to get static invariable device parameters like currency
// device must be powered and polled to get these
virtual bool bna_getAllParameters(struct T_bna *bna) const =0;
// get all constant data from reader (e.g. currency)
// and actual Host-Settings (sent with bna_sendSettings() or json)
// retval = true if data are valid
virtual void bna_requestCurrentNotes(void) const =0;
// send command to DC in order to get transaction data
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const =0;
// returns number of collected bank notes since start-command (current transaction)
// latestBill: last accepted bank note, value in cent
// currentNotes an array with up to 16 (further) notes collected
virtual void bna_requestStackerLevel(void) const =0;
virtual uint16_t bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOfBills) const =0;
// return val: nr of bills in stacker
// countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker
// countOfBills[1] for 10€ and so on
signals:
virtual void hwapi_templatePrintFinished_OK(void) const=0;
virtual void hwapi_templatePrintFinished_Err(void) const=0;
virtual void hwapi_coinCollectionJustStarted(void) const=0;
virtual void hwapi_coinCollectionAborted(void) const=0;
virtual void hwapi_gotNewCoin(void) const=0;
virtual void hwapi_payStopByMax(void) const=0;
virtual void hwapi_payStopByPushbutton(void) const=0;
virtual void hwapi_payStopByEscrow(void) const=0;
virtual void hwapi_payStopByError(void) const=0;
virtual void hwapi_payStopByTimeout(void) const=0;
virtual void hwapi_payCancelled(void) const=0;
virtual void hwapi_coinProcessJustStopped(void) const=0;
virtual void hwapi_doorServiceDoorOpened(void) const=0;
virtual void hwapi_doorVaultDoorOpened(void) const=0;
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
virtual void hwapi_doorCoinBoxInserted(void) const=0;
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
virtual void hwapi_doorAllDoorsClosed(void) const=0;
};
// 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
// 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
//
// 19.04.2023: V3.5 new function: sys_getWakeReason();
// 17.05.2023: V3.6 new function: cash_isCollectionActive(), cash_isPayProcessActive()
// new signals: hwapi_coinCollectionJustStopped, hwapi_coinCollectionJustStarted
// getAllInsertedCoins() fixed, also in datif and storeINdata
// 15.06.2023 V4.2 bring into same order as hwapi in order to set the THIS_IS_CA_MASTER correct
// 19.06.2023 V4.3 added some qCriticals to see emits
// 01.08.2023 V4.4 some new values at the end of struct T_vaultRecord
// two more values in struct T_devices
// 7 new functions at the end of the file
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.5"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.6"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.0"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.2"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.3"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.4"
// 8.9.2023 two new functions (end of file) for mifare test
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.5"
// 18.9.2023 major improvements for DC data exchange
// verification of door and cash box signals
// intensive verification of Json-Programming Master-Slave (PTU to DC), 100% ok
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.6"
// 20.9.2023: speeding up door and cash box signals
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.7"
// 26.09.2023: added improved DC-bootloader files
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/4.8"
// 28.09.2023: added version request of DC-Json-Files
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.0"
// 10.10.2023: added coin changer
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.1"
// 20.10.2023: added bill validator
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2"
// 7.11.2023: bna functions activated
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
#endif