From bb3ecc4b764f0dc720e3661621853d8576c733af Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 26 Jan 2024 11:39:21 +0100 Subject: [PATCH] Use same interfaces.h as DCLibraries (master branch) --- interfaces.h | 1901 ++++++++++++++++++++++++++++++++---------- plugins/interfaces.h | 1901 ++++++++++++++++++++++++++++++++---------- 2 files changed, 2966 insertions(+), 836 deletions(-) diff --git a/interfaces.h b/interfaces.h index d9f31b6..0aa4a1e 100644 --- a/interfaces.h +++ b/interfaces.h @@ -24,7 +24,8 @@ struct T_emp // dynamic: uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine): - // 0=start command + /* + // 0=start command // 1=powered, do emp ini, send reset // 2=delay // 3=wait for response, requesting status after response @@ -39,7 +40,7 @@ struct T_emp // 90: stop all, 1s delay // 99: off, all stopped - +*/ uint8_t pollingRunning; uint8_t paymentRunning; @@ -193,7 +194,7 @@ struct T_moduleCondition uint8_t coinChecker; // EMP, OMP or mei-cashflow uint8_t coinEscrow; - uint8_t mifareReader; + uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error uint8_t creditTerm; uint8_t coinReject; @@ -238,6 +239,7 @@ struct T_dynamicCondition uint8_t lastVDoorState; uint8_t lastCBstate; char paymentInProgress; + // Version Szeged: aug2023 // 0: stopped by timeout // 1: running 2: wait4lastCoin // 3: payment stopped manually, coins in Escrow @@ -246,6 +248,21 @@ struct T_dynamicCondition // 6: coins encashed 7:coins returned // 8: CoinChecker or MDB on Error + // since Schoenau with bill and changer, nov2023 + //0 = no payment + //will be set to 1 by cash_startCollection() + //neu 1: wait for devices getting ready for payment + //2 = payment, + //3 = wait for last coin/bill + //4 = Bezahlvorgang manuell beendet + //5 = payment stopped autom, amount collected, coins in Escrow + //6 = Bezahlvorgang beendet weil ZK voll + //4,5,6: payment done, keep on polling, wait for cash or return command + //7 = encash collected money from coin escrow into cash box + //8 = return "amountToReturn", can be complete inserted amount or only overpayment + //9 = wait for changer result + //10= print refund receipt with "amountToReturn" + char res1; uint16_t U_Batt; @@ -344,8 +361,60 @@ struct T_devices }; +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 DownloadThread; class hwinf { @@ -363,80 +432,118 @@ public: // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const =0; + virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const { + Q_UNUSED(BaudNr); + Q_UNUSED(BaudStr); + Q_UNUSED(ComName); + Q_UNUSED(connect); + return false; + } // 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; + virtual void dc_closeSerial(void) const {} // 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; + virtual bool dc_isPortOpen(void) const { + return false; + } // 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; + virtual void dc_autoRequest(bool on) const { + Q_UNUSED(on); + } // 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; + virtual void dc_requTestResponse() const {} // tell DC2 to send a test-string, useful to see if cable and baudrate is OK - virtual bool dc_readAnswTestResponse() const =0; + virtual bool dc_readAnswTestResponse() const { + return false; + } // retval: true: test was successful, got right response - virtual uint8_t dc_isRequestDone(void) const =0; + virtual uint8_t dc_isRequestDone(void) const { + return 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; + virtual uint16_t dc_getCompletePayLoad(uint16_t plBufSiz, uint8_t *payLoad) const { + Q_UNUSED(plBufSiz); + Q_UNUSED(payLoad); + return 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; + virtual void dc_setWakeFrequency(uint8_t period) const { + Q_UNUSED(period); + } // RTC wakes DC2 (and PTU) by hardware signal every 32seconds // change wake signal period to 1...64s - virtual void dc_OrderToReset(void) const =0; + virtual void dc_OrderToReset(void) const {} // want DC2 to reset (in order to start Bootloader) - virtual QString dc_getSerialState(void) const =0; + virtual QString dc_getSerialState(void) const { + return QString(); + } // 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; + virtual void dc_clrSerialStateText(void) const {} // clear above text to avoid multiple repetive displaying - virtual void bl_sendDataDirectly(uint8_t length, uint8_t *buf) const =0; + virtual void bl_sendDataDirectly(uint8_t length, uint8_t *buf) const { + Q_UNUSED(length); + Q_UNUSED(buf); + } // send without protocol frame, needed for the DC bootloader - virtual uint8_t getRawRecLength(void) const =0; + virtual uint8_t getRawRecLength(void) const { + return 0; + } // only needed if protocol stack in Cashagent-Library is bypassed - virtual uint8_t getRawReceivedData(uint8_t *receivedData) const =0; + virtual uint8_t getRawReceivedData(uint8_t *receivedData) const { + Q_UNUSED(receivedData); + return 0; + } // only needed if protocol stack in Cashagent-Library is bypassed - virtual QString dc_getSerialParams(void) const =0; + virtual QString dc_getSerialParams(void) const { + return QString(); + } // get DC2 serial settings (not very meaningful as they will not come if different from master settings) - virtual QString dc_getHWversion(void) const =0; + virtual QString dc_getHWversion(void) const { + return QString(); + } // get DC2 hardware version - virtual QString dc_getSWversion(void) const =0; + virtual QString dc_getSWversion(void) const { + return QString(); + } // get DC2 software version - virtual QString dc_getState(void) const =0; + virtual QString dc_getState(void) const { + return QString(); + } // get DC2 status (every OK or any error/warning? ) @@ -444,55 +551,103 @@ public: // Date and Time // ---------------------------------------------------------------------------------------------------------- - virtual uint8_t rtc_getDateTime(struct Trtc_DateTime *rtc_DateTime) const =0; + virtual uint8_t rtc_getDateTime(struct Trtc_DateTime *rtc_DateTime) const { + Q_UNUSED(rtc_DateTime); + return 0; + } - virtual uint8_t rtc_setDateTime(void) const =0; + virtual uint8_t rtc_setDateTime(void) const { + return 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; + virtual void rtc_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss) const { + Q_UNUSED(hh); + Q_UNUSED(mm); + Q_UNUSED(ss); + } // get time directly - virtual void rtc_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd) const =0; + virtual void rtc_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd) const { + Q_UNUSED(yy); + Q_UNUSED(mm); + Q_UNUSED(dd); + } // get date directly - virtual uint8_t rtc_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday) const =0; + virtual uint8_t rtc_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday) const { + Q_UNUSED(dow); + Q_UNUSED(minOfToday); + Q_UNUSED(secOfToday); + return 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; + virtual bool rtc_isLeapYear(uint8_t *lastLeapYear, uint8_t *NextLeapYear) const { + Q_UNUSED(lastLeapYear); + Q_UNUSED(NextLeapYear); + return false; + } // retval true: this year is leap year - virtual bool rtc_isLeapYear() const =0; + virtual bool rtc_isLeapYear() const { + return false; + } - virtual void rtc_getWeek(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek) const =0; + virtual void rtc_getWeek(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek) const { + Q_UNUSED(DayOfWeek); + Q_UNUSED(HoursOfWeek); + Q_UNUSED(MinutesOfWeek); + } // 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; + virtual void rtc_getMonth(uint8_t *DayOfMonth, uint16_t *HoursOfMonth, uint16_t *MinutesOfMonth) const { + Q_UNUSED(DayOfMonth); + Q_UNUSED(HoursOfMonth); + Q_UNUSED(MinutesOfMonth); + } // 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; + virtual void rtc_getYear(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint32_t *MinutesOfYear) const { + Q_UNUSED(DayOfYear); + Q_UNUSED(HoursOfYear); + Q_UNUSED(MinutesOfYear); + } // 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; + virtual QString rtc_getTimStr(void) const { + return QString(); + } + virtual QString rtc_getDatStr(void) const { + return QString(); + } + virtual QString rtc_getTimDatStr(void) const { + return QString(); + } // UID - unique number, different in every DC - virtual void dc_getUID8byte(uint8_t *buf8byteUid) const =0; + virtual void dc_getUID8byte(uint8_t *buf8byteUid) const { + Q_UNUSED(buf8byteUid); + } // get 8 single bytes in buffer - virtual QString dc_getUIDstr() const =0; + virtual QString dc_getUIDstr() const { + return QString(); + } // get as string - virtual uint64_t dc_getUIDnumber(void) const =0; + virtual uint64_t dc_getUIDnumber(void) const { + return 0; + } // get UID as one long number // ---------------------------------------------------------------------------------------------------------- @@ -500,19 +655,29 @@ public: // ---------------------------------------------------------------------------------------------------------- // Analog values: - virtual uint32_t dc_getTemperature(void) const =0; + virtual uint32_t dc_getTemperature(void) const { + return 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; + virtual QString dc_getTemperaturStr(void) const { + return QString(); + } // as string like "-12,5degC" - virtual uint32_t dc_getVoltage(void) const =0; + virtual uint32_t dc_getVoltage(void) const { + return 0; + } // as value in mV, 0...65,535V - virtual QString dc_getVoltagStr(void) const =0; + virtual QString dc_getVoltagStr(void) const { + return QString(); + } // as string in mV - virtual bool dc_mainFuseIsOk(void) const=0; + virtual bool dc_mainFuseIsOk(void) const { + return false; + } // true if 12V fuse is OK // false: fuse blown, DC will continue working but no 12V device can be used! @@ -520,60 +685,124 @@ public: // digital outputs // ------------------------------------------------------------------------------ - virtual uint8_t lock_switchUpperLock(uint8_t dir) const =0; + virtual uint8_t lock_switchUpperLock(uint8_t dir) const { + Q_UNUSED(dir); + return 0; + } // dir 0=off 1=up 2=down // move lock until stop cmd (0) - virtual uint8_t lock_switchLowerLock(uint8_t dir) const =0; + virtual uint8_t lock_switchLowerLock(uint8_t dir) const { + Q_UNUSED(dir); + return 0; + } // dir 0=off 1=up 2=down // move lock until stop cmd (0) - virtual void lock_switchVaultDoor(void) const =0; + virtual void lock_switchVaultDoor(void) const {} - virtual void coin_switchRejectMotor(uint8_t dir) const =0; + virtual void coin_switchRejectMotor(uint8_t dir) const { + Q_UNUSED(dir); + } - virtual void coin_rejectCoins(void) const =0; + virtual void coin_rejectCoins(void) const {} // 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 led_switchLedService(uint8_t on) const { + Q_UNUSED(on); + } + virtual void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedPinPad(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedStart(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedCoinbassin(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } - 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 fan_switchFan(bool on) const { + Q_UNUSED(on); + } + virtual void alarm_switchSiren(bool on) const { + Q_UNUSED(on); + } + virtual void bar_OpenBarrier(bool open) const { + Q_UNUSED(open); + } + virtual void ptu_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - 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 aux_power(bool on) const { + Q_UNUSED(on); + } + virtual void aux_setUsage(uint8_t PinDirection) const { + Q_UNUSED(PinDirection); + } + virtual void aux_setOutputs(uint8_t PinIsHigh) const { + Q_UNUSED(PinIsHigh); + } - virtual void lock_switchContactPower(bool on) const =0; + virtual void lock_switchContactPower(bool on) const { + Q_UNUSED(on); + } - virtual void prn_switchPower(bool on) const =0; + virtual void prn_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mif_readerOn(bool on) const =0; + virtual void mif_readerOn(bool on) const { + Q_UNUSED(on); + } - virtual void mif_creatAtbCard(uint8_t cardType) const =0; + virtual void mif_creatAtbCard(uint8_t cardType) const { + Q_UNUSED(cardType); + } - virtual void mod_switchPower(bool on) const=0; + virtual void mod_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mod_switchWake(bool WAKEACTIVE) const=0; + virtual void mod_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void mdb_switchPower(bool on) const =0; + virtual void mdb_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mdb_switchWake(bool WAKEACTIVE) const =0; + virtual void mdb_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void credit_switchPower(bool on) const =0; + virtual void credit_switchPower(bool on) const { + Q_UNUSED(on); + } // the same as modem power - virtual void credit_switchWake(bool WAKEACTIVE) const =0; + virtual void credit_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void shut_move(bool open) const =0; + virtual void shut_move(bool open) const { + Q_UNUSED(open); + } - virtual void esc_moveFlaps(uint8_t flap ) const =0; + virtual void esc_moveFlaps(uint8_t flap ) const { + Q_UNUSED(flap); + } // 0: close both 1: open take-flap 2: open return @@ -581,78 +810,142 @@ public: // door, cashbox and lock switches // ------------------------------------------------------------------------------ - virtual uint8_t door_getSwitches(void) const =0; + virtual uint8_t door_getSwitches(void) const { + return 0; + } // retval: bit0: upper door 1: low door 2:vault door - virtual bool door_isUpperDoorOpen(void) const =0; + virtual bool door_isUpperDoorOpen(void) const { + return false; + } - virtual bool door_isLowerDoorOpen(void) const =0; + virtual bool door_isLowerDoorOpen(void) const { + return false; + } - virtual bool vault_isVaultDoorOpen(void) const =0; + virtual bool vault_isVaultDoorOpen(void) const { + return false; + } - virtual uint8_t vault_getSwitches(void) const =0; + virtual uint8_t vault_getSwitches(void) const { + return 0; + } // retval bit0: cash box, bit 1: bill box - virtual bool vault_isCoinVaultIn(void) const =0; + virtual bool vault_isCoinVaultIn(void) const { + return false; + } - virtual bool vault_isBillVaultIn(void) const =0; + virtual bool vault_isBillVaultIn(void) const { + return false; + } - virtual uint8_t door_getLocks(void) const =0; + virtual uint8_t door_getLocks(void) const { + return 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_upperDoorIsLocked(void) const { + return false; + } - virtual bool door_upperDoorIsUnlocked(void) const =0; + virtual bool door_upperDoorIsUnlocked(void) const { + return false; + } - virtual bool door_lowerDoorIsLocked(void) const =0; + virtual bool door_lowerDoorIsLocked(void) const { + return false; + } - virtual bool door_lowerDoorIsUnlocked(void) const =0; + virtual bool door_lowerDoorIsUnlocked(void) const { + return false; + } - virtual bool bar_optoIn1isOn(void) const =0; + virtual bool bar_optoIn1isOn(void) const { + return false; + } - virtual bool bar_optoIn2isOn(void) const =0; + virtual bool bar_optoIn2isOn(void) const { + return false; + } - virtual uint8_t aux_getAuxInputs(void) const =0; + virtual uint8_t aux_getAuxInputs(void) const { + return 0; + } - virtual bool ptu_WakeINisActive(void) const =0; + virtual bool ptu_WakeINisActive(void) const { + return false; + } - virtual bool mdb_WakeINisActive(void) const =0; + virtual bool mdb_WakeINisActive(void) const { + return false; + } - virtual bool prn_readyINisActive(void) const =0; + virtual bool prn_readyINisActive(void) const { + return false; + } - virtual bool coid_isAttached(void) const =0; + virtual bool coid_isAttached(void) const { + return false; + } - virtual bool coin_escrowIsOpen(void) const =0; + virtual bool coin_escrowIsOpen(void) const { + return false; + } - virtual bool mif_cardIsAttached(void) const =0; + virtual bool mif_cardIsAttached(void) const { + return false; + } //bool hwapi::mod_WakeINisActive(void); - virtual bool door_isContactPowerOn(void) const =0; + virtual bool door_isContactPowerOn(void) const { + return false; + } - virtual bool mif_isMifarePowerOn(void) const =0; + virtual bool mif_isMifarePowerOn(void) const { + return false; + } - virtual bool mdb_testIsmdbTxDon(void) const =0; + virtual bool mdb_testIsmdbTxDon(void) const { + return false; + } - virtual bool aux_isAuxPowerOn(void) const =0; + virtual bool aux_isAuxPowerOn(void) const { + return false; + } - virtual bool mod_isGsmPowerOn(void) const =0; + virtual bool mod_isGsmPowerOn(void) const { + return false; + } - virtual bool cred_isCreditPowerOn(void) const =0; + virtual bool cred_isCreditPowerOn(void) const { + return false; + } - virtual bool prn_isPrinterPowerOn(void) const =0; + virtual bool prn_isPrinterPowerOn(void) const { + return false; + } - virtual uint8_t prn_PrnFuseIsOk(void) const=0; + virtual uint8_t prn_PrnFuseIsOk(void) const { + return 0; + } //retval: 0: fuse blown 1: fuse OK 2:unknown as printer power is off - virtual bool mdb_isMdbPowerOn(void) const =0; + virtual bool mdb_isMdbPowerOn(void) const { + return false; + } - virtual bool cash_getRejectMotorHomePos(void) const=0; + virtual bool cash_getRejectMotorHomePos(void) const { + return false; + } - virtual uint8_t cash_getLowPaperSensor(void) const=0; + virtual uint8_t cash_getLowPaperSensor(void) const { + return 0; + } // 0: Sensor sees paper 1: no paper 99: off @@ -664,44 +957,46 @@ public: // or automatically in background by: void hwapi::dc_autoRequest(bool on) - virtual void request_DC2serialConfig() const =0; + virtual void request_DC2serialConfig() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_HWversion() const =0; + virtual void request_DC2_HWversion() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_SWversion() const =0; + virtual void request_DC2_SWversion() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_condition() const =0; + virtual void request_DC2_condition() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_UID() const =0; + virtual void request_DC2_UID() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_TimeAndDate() const =0; + virtual void request_DC2_TimeAndDate() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_analogues() const =0; + virtual void request_DC2_analogues() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_digitalInputs() const =0; + virtual void request_DC2_digitalInputs() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_digitalOutputs() const =0; + virtual void request_DC2_digitalOutputs() const {} // 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_PrinterHwState() const {} + virtual void request_PrinterCurrentFonts() const {} + virtual void request_PrinterStateComplete() const {} - 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_MifareReaderState() const {} + virtual void request_MifareCardType() const {} + virtual void request_MifareAtbType() const {} + virtual void request_MifareID() const {} + virtual void request_MifareData(uint8_t dataBlockNumber) const { + Q_UNUSED(dataBlockNumber); + } //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; + virtual void request_MDB_Status() const {} + virtual void request_MDB_lastResponse() const {} + virtual void request_EMP_allParameters() const {} + virtual void request_EMP_lastCoin() const {} // ------------------------------------------------------------------------------ @@ -711,44 +1006,88 @@ public: // ------------------------------------------------------------------------------ - virtual bool test_getDO_mdbRXtst(void) const =0; + virtual bool test_getDO_mdbRXtst(void) const { + return false; + } // 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; + virtual uint8_t lock_getDO_motors(void) const { + return 0; + } // bit0: upper lock forward bit 1 backward // bit2: lower lock forward bit 3 backward - virtual uint8_t test_serialState(void) const =0; + virtual uint8_t test_serialState(void) const { + return 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_serialIsOn(void) const { + return false; + } - 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 test_serialMux1isSetToPrinter(void) const { + return false; + } + virtual bool test_serialMux1isSetToModem(void) const { + return false; + } + virtual bool test_serialMux2isSetToCredit(void) const { + return false; + } + virtual bool test_serialMux2isSetToMifare(void) const { + return false; + } - 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 led_coinIsOn(void) const { + return false; + } + virtual bool led_frontIsOn(void) const { + return false; + } + virtual bool led_ticketIsOn(void) const { + return false; + } + virtual bool led_pinIsOn(void) const { + return false; + } + virtual bool led_StartIsOn(void) const { + return false; + } + virtual bool led_insideIsOn(void) const { + return false; + } - 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 fan_isOn(void) const { + return false; + } + virtual bool siren_isOn(void) const { + return false; + } + virtual bool bar_relayIsOn(void) const { + return false; + } + virtual bool ptu_WakeOutIsOn(void) const { + return false; + } - virtual bool aux_powerIsOn(void) const =0; + virtual bool aux_powerIsOn(void) const { + return false; + } - virtual bool coin_shutterIsOpen(void) const =0; - virtual bool coin_shutterTestOutput(void) const =0; + virtual bool coin_shutterIsOpen(void) const { + return false; + } + virtual bool coin_shutterTestOutput(void) const { + return false; + } - virtual uint8_t coin_escrowFlapOpened(void) const =0; + virtual uint8_t coin_escrowFlapOpened(void) const { + return 0; + } // retval: 1:return flap is open 2:take flap is open 0:closed @@ -762,7 +1101,14 @@ public: virtual void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker, uint8_t kindOfMifareReader, uint8_t suppressSleep, - uint8_t kindOfModem, uint8_t kindOfCredit ) const =0; + uint8_t kindOfModem, uint8_t kindOfCredit ) const { + Q_UNUSED(kindOfPrinter); + Q_UNUSED(kindOfCoinChecker); + Q_UNUSED(kindOfMifareReader); + Q_UNUSED(suppressSleep); + Q_UNUSED(kindOfModem); + Q_UNUSED(kindOfCredit); + } // enable hardware in device controller: // kindOfPrinter: 0:off 1: GPT4672 (only this one implemented) // kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: Csquare_changer @@ -771,9 +1117,12 @@ public: // 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 request_ReadbackDeviceSettings() const {} - virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0; + virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const { + Q_UNUSED(length); + Q_UNUSED(data); + } // 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 @@ -781,36 +1130,58 @@ public: virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr, uint16_t borough, uint16_t zone, - uint16_t alias, char *location) const =0; + uint16_t alias, char *location) const { + Q_UNUSED(customerNr); + Q_UNUSED(machineNr); + Q_UNUSED(borough); + Q_UNUSED(zone); + Q_UNUSED(alias); + Q_UNUSED(location); + } virtual void request_ReadbackMachineID() const =0; - virtual void readback_machineIDdata(uint8_t *length, uint8_t *data) const =0; + virtual void readback_machineIDdata(uint8_t *length, uint8_t *data) const { + Q_UNUSED(length); + Q_UNUSED(data); + } // 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_openUpperDoor(void) const { + return 0; + } + virtual uint8_t lock_closeUpperDoor(void) const { + return 0; + } - virtual uint8_t lock_openLowerDoor(void) const =0; - virtual uint8_t lock_closeLowerDoor(void) const =0; + virtual uint8_t lock_openLowerDoor(void) const { + return 0; + } + virtual uint8_t lock_closeLowerDoor(void) const { + return 0; + } - virtual void shut_openOnce(void) const =0; + virtual void shut_openOnce(void) const {} // and close automatic after shutter time - virtual void shut_openForCoin(bool start) const =0; + virtual void shut_openForCoin(bool start) const { + Q_UNUSED(start); + } // 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; + virtual void shut_sendOpeningTime(uint16_t timeIn_ms ) const { + Q_UNUSED(timeIn_ms); + } // after this time without retrigger the flap is closed - virtual void esc_takeMoney(void) const =0; + virtual void esc_takeMoney(void) const {} // and close automatically after escrow time (1s) - virtual void esc_returnMoney(void) const =0; + virtual void esc_returnMoney(void) const {} // and close automatically after escrow time (1s) @@ -818,8 +1189,12 @@ public: // --------------------------------------------- MIFARE ----------------------------------------------------- // ---------------------------------------------------------------------------------------------------------- - - virtual uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const =0; +// obsolete + virtual uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const { + Q_UNUSED(buf); + Q_UNUSED(maxBufferSize); + return 0; + } // retval 0=OK 1=error host buffer too small /* data description, new fast version: byte 0= still the same: current read state: @@ -837,18 +1212,34 @@ public: byte 7: length of UID 4 or 7 (byte) */ - virtual bool mif_readerIsOK(void) const =0; + virtual bool mif_readerIsOK(void) const { + return false; + } - virtual bool mif_cardAttached(void) const =0; + virtual bool mif_cardAttached(void) const { + return false; + } + // not working! use mif_cardIsAttached() instead - virtual uint8_t mif_readResult(void) const =0; + virtual uint8_t mif_readResult(void) const { + return 0; + } // result: 0: unknown or still in progress // 1: card read successful // 2: reading error + // not working! - virtual QString mif_cardUID(void) const =0; + virtual QString mif_cardUID(void) const { + return QString(); + } + // not working - virtual uint8_t mif_getCardDataDec(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize) const =0; + virtual uint8_t mif_getCardDataDec(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize) const { + Q_UNUSED(blkNr); + Q_UNUSED(buf); + Q_UNUSED(maxBufferSize); + return 0; + } virtual QString mif_getCardDataStr(uint8_t blockNumber) const =0; // with blockNumber=0...11 @@ -861,7 +1252,10 @@ public: // read printer condition and settings - virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const =0; + virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const { + Q_UNUSED(prn_hw_state); + return 0; + } // retval: status byte // byte 0 = 0: prnter OK, >0: error // bit0: paper low 1: no paper 2: temperature error @@ -869,68 +1263,116 @@ public: // 6: no response 7: bad response from printer // and return struct "Tprn_hw_state" - virtual bool prn_isUpAndReady(void) const =0; + virtual bool prn_isUpAndReady(void) const { + return false; + } // 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; + virtual void prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) const { + Q_UNUSED(prn_fonts); + } // send Commands to printer: - virtual void prn_sendText(QByteArray *buf) const =0; + virtual void prn_sendText(QByteArray *buf) const { + Q_UNUSED(buf); + } // up to 1280 bytes - virtual void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) const =0; + virtual void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) const { + Q_UNUSED(para1); + Q_UNUSED(para2); + Q_UNUSED(para3); + } // 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; + virtual void prn_sendPrnEscCmd(uint8_t para1, uint8_t para2, uint8_t para3, uint8_t para4) const { + Q_UNUSED(para1); + Q_UNUSED(para2); + Q_UNUSED(para3); + Q_UNUSED(para4); + } // 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; + virtual void prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alignment, uint8_t orientation) const { + Q_UNUSED(paperSpeed); + Q_UNUSED(density); + Q_UNUSED(alignment); + Q_UNUSED(orientation); + } // 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; + virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const { + Q_UNUSED(wayInMm); + Q_UNUSED(direction); + } //direction: 1=forward 2=backward // - virtual void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const =0; + virtual void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const { + Q_UNUSED(font); + Q_UNUSED(size); + Q_UNUSED(width); + Q_UNUSED(height); + } // 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; + virtual void prn_setLetters(uint8_t bold, uint8_t invers, uint8_t underlined) const { + Q_UNUSED(bold); + Q_UNUSED(invers); + Q_UNUSED(underlined); + } // bold: 0/1 // invers: 0/1 // underlined: 0/1 - virtual void prn_cut(uint8_t kindof) const =0; + virtual void prn_cut(uint8_t kindof) const { + Q_UNUSED(kindof); + } // kindof: 1=full cut 2=partial cut 3=eject (5xLF + full cut) - virtual void prn_newLine(uint8_t nrOfLines) const =0; + virtual void prn_newLine(uint8_t nrOfLines) const { + Q_UNUSED(nrOfLines); + } - virtual void prn_printCompleteFontTable(void) const =0; + virtual void prn_printCompleteFontTable(void) const {} - virtual void prn_printBarcode(uint8_t kindOf, uint8_t withText, uint8_t offset, uint8_t rotation, uint8_t dataLeng, uint8_t *data) 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 { + Q_UNUSED(kindOf); + Q_UNUSED(withText); + Q_UNUSED(offset); + Q_UNUSED(rotation); + Q_UNUSED(dataLeng); + Q_UNUSED(data); + } // 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; + virtual void prn_sendQRdata(QByteArray *buf) const { + Q_UNUSED(buf); + } // maximal 150 alphanummeric bytes - virtual void prn_printQRcode(void) const =0; + virtual void prn_printQRcode(void) const {} // QRcode may have 1...150 alphanummeric data, must be transfered in advance - virtual void prn_printLogo(uint8_t nrOfLogo, uint8_t offset ) const =0; + virtual void prn_printLogo(uint8_t nrOfLogo, uint8_t offset ) const { + Q_UNUSED(nrOfLogo); + Q_UNUSED(offset); + } // nrOfLogo: 1..4 in flash 5...8 in Ram // offset: in mm form left border @@ -945,24 +1387,44 @@ public: // --------------------------------------------- MDB Bus ---------------------------------------------------- // ---------------------------------------------------------------------------------------------------------- - virtual void mdb_sendBusReset(void) const =0; + virtual void mdb_sendBusReset(void) const {} - virtual void mdb_sendCommand(uint8_t toMdbDevice, uint8_t mdbCommand) const =0; + virtual void mdb_sendCommand(uint8_t toMdbDevice, uint8_t mdbCommand) const { + Q_UNUSED(toMdbDevice); + Q_UNUSED(mdbCommand); + } // 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; + virtual void mdb_sendMessage(uint8_t toMdbDevice, uint8_t mdbCommand, uint8_t nrOfData, uint8_t *dataBuffer) const { + Q_UNUSED(toMdbDevice); + Q_UNUSED(mdbCommand); + Q_UNUSED(nrOfData); + Q_UNUSED(dataBuffer); + } // 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_busIsReadyToWork() const { + return false; + } - virtual bool mdb_deviceVoltageOK() const =0; + virtual bool mdb_deviceVoltageOK() const { + return false; + } - virtual bool mdb_busVoltageOk() const =0; + virtual bool mdb_busVoltageOk() const { + return false; + } virtual uint8_t mdb_getLastDeviceResponse(uint8_t *fromDevice, uint8_t *lastRequest, - uint8_t *responseLength, uint8_t *responseBuffer) const =0; + uint8_t *responseLength, uint8_t *responseBuffer) const { + Q_UNUSED(fromDevice); + Q_UNUSED(lastRequest); + Q_UNUSED(responseLength); + Q_UNUSED(responseBuffer); + return 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 @@ -975,69 +1437,106 @@ public: // ---------------------------------------------------------------------------------------------------------- - 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_sendSettings(uint16_t coinAcceptance, uint8_t tokenChannel, uint16_t *coinDenomination ) const { + Q_UNUSED(coinAcceptance); + Q_UNUSED(tokenChannel); + Q_UNUSED(coinDenomination); + } + // 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_pollingOnOff(uint8_t on) const { + Q_UNUSED(on); + } - virtual void emp_startCoinAcceptance(void) const =0; + virtual void emp_startCoinAcceptance() const {} - virtual void emp_stopCoinAcceptance(void) const =0; + virtual void emp_stopCoinAcceptance() const {} - 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 void emp_getAllParameters(struct T_emp *emp) const { + Q_UNUSED(emp); + } + // 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 uint8_t emp_chkIfCoinInserted(void) const { + return 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. + virtual void emp_getNewCoinRecord(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value) const { + Q_UNUSED(value); + Q_UNUSED(signal); + Q_UNUSED(error); + Q_UNUSED(valid); + } + // 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_giveLastCoin(uint16_t *value, uint8_t *signal) const { + Q_UNUSED(value); + Q_UNUSED(signal); + return 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 uint8_t emp_returnLastCoin(uint16_t *value, uint8_t *signal) const { + Q_UNUSED(value); + Q_UNUSED(signal); + return 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; + virtual QString dc_getTxt4RsDiagWin(void) const { + return QString(); + } + virtual void dc_clrTxt4RsDiagWin(void) const {} + virtual QString dc_get2ndTxt4RsDiagWin(void) const { + return QString(); + } + virtual void dc_clr2ndTxt4RsDiagWin(void) const {} + virtual QString dc_getTxt4HsStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4HsStateLine(void) const {} + virtual QString dc_getTxt4masterStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4masterStateLine(void) const {} + virtual QString dc_getTxt4resultStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4resultStateLine(void) const {} + virtual QString dc_getdataStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4dataStateLine(void) const {} + virtual QString dc_getdatifLine(void) const { + return QString(); + } + virtual void dc_clrTxt4datifLine(void) const {} @@ -1046,27 +1545,54 @@ public: // ---------------------------------------------------------------------------------------------------------- // 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 void bl_iniChain() const {} + virtual bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const { + Q_UNUSED(readBinFile); + Q_UNUSED(fileSize); + Q_UNUSED(withDispl); + return false; + } + virtual uint8_t bl_activatBootloader(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + virtual uint8_t bl_startChain() const { + return 0; + } + virtual uint8_t bl_readBLversion(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + // minimum size of sendData-buffer: 5byte retval: length + virtual uint8_t bl_readFWversion(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 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_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const { + Q_UNUSED(Cmd); + Q_UNUSED(SendDataLength); + Q_UNUSED(sendData); + Q_UNUSED(outBuf); + return 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 uint8_t bl_exitBL(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + // minimum size of sendData-buffer: 5byte retval: length - virtual void led_switchLedIllumination(uint8_t on) const =0; + virtual void led_switchLedIllumination(uint8_t on) const { + Q_UNUSED(on); + } @@ -1075,33 +1601,44 @@ public: // 27.3.2023: Use Device-Controller's Bootloader to send hex-file // ------------------------------------------------------------------------------------ - virtual void bl_rebootDC(void) const =0; + virtual void bl_rebootDC(void) const {} - 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_startBL() const {} + virtual void bl_checkBL() const {} + virtual bool bl_isUp() const { + return false; + } + // 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 void bl_sendAddress(uint16_t blockNumber) const { + Q_UNUSED(blockNumber); + } + // 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; + virtual uint8_t bl_wasSendingAddOK() const { + return 0; + } // return val: 0: no response by now 1:error 10: OK - virtual void bl_openBinary(void) const =0; + virtual void bl_openBinary() const {} - virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const =0; + virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const { + Q_UNUSED(length); + Q_UNUSED(buffer); + } // send 64 byte from bin file - virtual void bl_sendLastBlock(void) const =0; + virtual void bl_sendLastBlock() const {} - virtual uint8_t bl_wasSendingDataOK(void) const =0; + virtual uint8_t bl_wasSendingDataOK() const { + return false; + } // return val: 0: no response by now 1:error 10: OK - virtual void bl_stopBL(void) const =0; + virtual void bl_stopBL() const {} // ------------------------------------------------------------------------------------ @@ -1110,240 +1647,726 @@ public: // ------------------------------------------------------------------------------------ - 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_setTimeDateDirect(struct Trtc_DateTime *DateTime) const { + Q_UNUSED(DateTime); + return false; + } + // 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(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + return false; + } - virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const =0; + virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const { + Q_UNUSED(exTime); + return false; + } - virtual bool sys_runCompleteTest(void) const =0; - // warning: lasts 20s in one pace + virtual bool sys_runCompleteTest() const { + return false; + } + // warning: lasts 20s in one pace - virtual bool sys_ready4sending(void) const =0; + virtual bool sys_ready4sending() const { + return false; + } // 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 sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const { + Q_UNUSED(kindOfFile); + Q_UNUSED(nrOfTemplate); + Q_UNUSED(content); + return false; + } + // 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; + virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const { + Q_UNUSED(dynPrnVal); + return false; + } // 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 bool prn_printTemplate(uint8_t nrOftemplate) const { + Q_UNUSED(nrOftemplate); + return false; + } + // 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; + virtual void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const { + Q_UNUSED(nrOfVals); + Q_UNUSED(accNr); + } // 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_selectVaultRecord(uint16_t accountNr ) const { + Q_UNUSED(accountNr); + return false; + } + // 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_chkIfVaultRecordAvailable() const { + return false; + } + // 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 + // 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_printAccountReceipt() const { + return false; + } + // 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 prn_printTestTicket() const { + return false; + } + // return true if sending to DC OK, false if cmd-stack is full - virtual bool cash_startPayment(uint32_t amount) const =0; - // 17.4.23TS: extended to 32bit + virtual bool cash_startPayment(uint32_t amount) const { + Q_UNUSED(amount); + return false; + } + // 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 uint8_t cash_paymentProcessing() const { + return 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 uint32_t getInsertedAmount() const { + return 0; + } - virtual uint16_t getLastInsertedCoin(void) const =0; + virtual uint16_t getLastInsertedCoin(void) const { + return 0; + } - virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const =0; - // alle bei diesem Verkauf eingeworfenen Muenzen sind gespeichert, max 64 + virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const { + Q_UNUSED(types); + Q_UNUSED(values); + return false; + } + // alle bei diesem Verkauf eingeworfenen Muenzen sind gespeichert, max 64 - virtual bool cash_cancelPayment(void) const =0; - // and return coins + virtual bool cash_cancelPayment() const { + return false; + } + // and return coins - virtual bool cash_stopPayment(void) const =0; - // and keep coins in escrow + virtual bool cash_stopPayment() const { + return false; + } + // 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_success() const { + return false; + } + // 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 bool vend_failed() const { + return false; + } + // 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 uint8_t mif_getCardType(QString *cardholder) const { + Q_UNUSED(cardholder); + return 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 uint64_t sys_getWakeSource() const { + return 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 uint8_t sys_getWakeReason() const { + return 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(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + } - virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const =0; + virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const { + Q_UNUSED(devCond); + } - virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const =0; + virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + } - virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const =0; + virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const { + Q_UNUSED(dynMachCond); + } - virtual uint32_t cash_getAmountInVault(void) const =0; + virtual uint32_t cash_getAmountInVault() const { + return 0; + } - virtual uint16_t cash_getNrCoinsInVault(void) const =0; + virtual uint16_t cash_getNrCoinsInVault() const { + return 0; + } - virtual uint8_t prn_getPrintResult() const =0; + virtual uint8_t prn_getPrintResult() const { + return 0; + } + // return: 0: just printing, wait + // 1: OK - last print was succesful + // 2: error - not printed - 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 uint8_t prn_getCurrentPrinterState() const { + return 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_sendDeviceParameter(struct T_devices *deviceSettings) const { + Q_UNUSED(deviceSettings); + } - 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 void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const { + Q_UNUSED(deviceSettings); + } + // 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_areDCdataValid() const { + return false; + } - virtual bool sys_sendingTest(void) const =0; + virtual bool sys_sendingTest() const { + return false; + } - virtual void prn_requestCurrentDynData(void) const =0; + virtual void prn_requestCurrentDynData() const {} - virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const =0; + virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const { + Q_UNUSED(dynPrnVal); + return false; + } // which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const =0; - virtual bool prn_dynDataAreEqual(uint8_t *buf) const =0; + virtual bool prn_dynDataAreEqual(uint8_t *buf) const { + Q_UNUSED(buf); + return false; + } - virtual bool prn_printKombiticket(uint8_t nrOfKombi) const =0; - // print four of the templates loaded by Json prior - // nr = 1..8 + virtual bool prn_printKombiticket(uint8_t nrOfKombi) const { + Q_UNUSED(nrOfKombi); + return false; + } + // print four of the templates loaded by Json prior + // nr = 1..8 - virtual void lock_triggerUpperSolenoid(void) const =0; + virtual void lock_triggerUpperSolenoid(void) const {} - virtual void lock_triggerLowerSolenoid(void) const =0; + virtual void lock_triggerLowerSolenoid(void) const {} - virtual bool doors_supervise(void) const =0; + virtual bool doors_supervise() const { + return false; + } - virtual bool dc_isAutoRequestOn(void) const =0; + virtual bool dc_isAutoRequestOn() const { + return false; + } - virtual uint16_t log_getLatestAccountNumber(void) const=0; + virtual uint16_t log_getLatestAccountNumber() const { + return 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 + virtual uint8_t log_getAvailableVaultBlocks() const { + return 0; + } + // return 0x0011 1111 if all 6 blocks are loaded (one bit per block) + virtual uint8_t log_getAnswerToLastSlaveRequest() const { + return 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 void log_startSupervision() const {} - 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 + virtual uint8_t log_getAnswerToLastCmdBatch() const { + return 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 + virtual bool log_getVaultData(uint8_t *data) const { + Q_UNUSED(data); + return false; + } + // 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_printOneAccountReceipt(uint16_t accountNr) const { + Q_UNUSED(accountNr); + return false; + } + // 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 prn_printAllAvailAccountReceipts() const { + return false; + } + // 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 bool log_verifyVaultRecordByCrc() const { + return false; + } + // 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 uint16_t log_DC_getNextAccountNumber() const { + return 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_setNextAccountNumber(uint16_t newAccountingNumber) const { + Q_UNUSED(newAccountingNumber); + } + // 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_deleteAllVaultrecordsInDc() const {} + // 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 log_DC_deleteAllTotalCounters() const {} + // 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_setNewCustomerNumber(uint16_t newCustNr) const { + Q_UNUSED(newCustNr); + } - virtual void dc_setNewMachineNumber(uint16_t newMachNr) const =0; + virtual void dc_setNewMachineNumber(uint16_t newMachNr) const { + Q_UNUSED(newMachNr); + } - virtual void dc_setNewBorough(uint16_t newBorough) const =0; + virtual void dc_setNewBorough(uint16_t newBorough) const { + Q_UNUSED(newBorough); + } - virtual void dc_setNewZone(uint16_t newZone) const =0; + virtual void dc_setNewZone(uint16_t newZone) const { + Q_UNUSED(newZone); + } + // new functions from 8.9.23 + virtual QString mif_getReaderType() const { + return QString(); + } + // return "SL025" if correct reader is connected + + virtual void mif_getCardSize(uint8_t *cardSize, uint8_t *idLeng) const { + Q_UNUSED(cardSize); + Q_UNUSED(idLeng); + } + // cardSize=1k or 4kByte + // idLeng =4Byte or 7 byte + + virtual char mif_getAtbCardData(uint8_t *buf, uint8_t maxBuffSiz) const { + Q_UNUSED(buf); + Q_UNUSED(maxBuffSiz); + return 0; + } + // return complete buffer binary, just for test purpose + + virtual bool mif_isValidAtbCard() const { + return false; + } + + virtual uint32_t mif_getAtbCardCuNu() const { + return 0; + } + + virtual uint8_t mif_getAtbCardTyp() const { + return 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() const { + return QString(); + } + // 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 { + Q_UNUSED(year); + Q_UNUSED(month); + Q_UNUSED(day); + Q_UNUSED(hour); + Q_UNUSED(minute); + } + + + // ------------------------------------------------------------------------------------ + // 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() const { + return false; + } + // 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 { + Q_UNUSED(fileName); + return false; + } + // 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() const { + return 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 { + Q_UNUSED(blockNumber); + return false; + } + // 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() const { + return 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 { + Q_UNUSED(jsonNr); + } + // 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 { + Q_UNUSED(jsonNr); + Q_UNUSED(versionString); + } + // 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 { + Q_UNUSED(amountInCent); + } + + virtual void changer_requestChangeResult() const {} + + virtual uint8_t changer_getChangeResult(uint32_t *returnedAmount) const { + Q_UNUSED(returnedAmount); + return 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 { + Q_UNUSED(mw); + } + // requested automatically with 23, same like EMP + + virtual void changer_requestTubelevel(void) const {} + + virtual void changer_getTubelevel(struct T_chg_Tub *tubLevel) const { + Q_UNUSED(tubLevel); + } + // 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 { + Q_UNUSED(notesToAccept); + Q_UNUSED(parameters); + Q_UNUSED(billDenomination); + Q_UNUSED(acceptanceLimit); + + } + // 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 { + Q_UNUSED(notesToAccept); + } + // 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() const {} + // 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 { + Q_UNUSED(bna); + return false; + } + // 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() const {} + // send command to DC in order to get transaction data + + virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const + { + Q_UNUSED(latestBill); + Q_UNUSED(currentNotes); + return 0; + } + // returns number of collected bank notes since start-command (current transaction) + // return value: numbers of bills or 99 in case of error + // latestBill: not used + // in case of error: currentNotes[0,1,2,3] = 1..4 error number(s) + // in normal case: + // currentNotes[0]: last bill in cent (e.g. 1000 = 10€) + // currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked + // note: by now (dec2023) escrow is not used, bills always go to stacker (box) + // currentNotes[2]: total sum of bills in cent, low word (16bit) + // currentNotes[3]: total sum of bills in cent, high word (16bit) + + + virtual void bna_requestStackerLevel() const {} + + virtual uint16_t bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOfBills) const { + Q_UNUSED(amountInStacker); + Q_UNUSED(countOfBills); + return 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 + + + // download device controller + virtual bool dcDownloadRequest(QString const &fileToDownload) const { + Q_UNUSED(fileToDownload); + return false; + } + virtual bool dcDownloadRequested() const { return false; } + virtual bool dcDownloadResetRequest() const { return false; } + virtual bool dcDownloadRequestAck() const { return false; } + virtual bool dcDownloadRunning() const { return false; } + virtual bool dcDownloadFinished() { return false; } + + virtual bool dcDownloadReportStart() const { return false; } + virtual bool dcDownloadReportRunning() const { return true; } + virtual bool dcDownloadReportFinished() { return true; } + + virtual bool dcDownloadThreadStart() { return false; } + virtual bool dcDownloadThreadRunning() const { return true; } + virtual void dcDownloadThreadFinalize(DownloadThread *) {} + virtual bool dcDownloadThreadFinished() const { return true; } + virtual bool dcDownloadReportThreadStart() { return false; } + virtual bool dcDownloadReportThreadRunning() const { return true; } + virtual void dcDownloadReportThreadFinalize() {} + virtual void dcDownloadReportThreadQuit() {} + virtual bool dcDownloadReportThreadFinished() const { return true; } + + + virtual QString dcDownloadFileName() const { return ""; } + virtual bool dcDownloadSetRequested(bool requested) { + Q_UNUSED(requested); return false; + } + virtual bool dcDownloadSetRunning(bool running) { + Q_UNUSED(running); return false; + } + virtual bool dcDownloadSetFinished(bool finished) { + Q_UNUSED(finished); return false; + } + virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) { + Q_UNUSED(totalBlockNumber); + } + virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) { + Q_UNUSED(currentBlockNumber); + } + virtual bool dcDownloadGetRequested() const { return false; } + virtual bool dcDownloadGetRunning() const { return false; } + virtual bool dcDownloadGetFinished() const { return false; } + virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; } + virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; } + + virtual QObject const *getAPI() { return nullptr; } + + signals: + /* + NOTE: the difference between a virtual Qt signal and a normal Qt signal: + A Qt virtual signal is a connection that is established using a pointer + or reference and is not connected to an object or data. It is therefore + not bound to a particular object, but to a specific class (object type). + Qt virtual signals are useful because they allow you to create + connections without worrying about whether an object or a specific data + element has been destroyed. + https://www.youtube.com/watch?v=HTH3VFfqsXw + + */ + virtual void hwapi_reportDCDownloadStatus(QString const&) const {} + virtual void hwapi_reportDCDownloadSuccess(QString const&) const {} + virtual void hwapi_reportDCDownloadFailure(QString const&) const {} + virtual void hwapi_templatePrintFinished_OK(void) const=0; virtual void hwapi_templatePrintFinished_Err(void) const=0; @@ -1360,8 +2383,6 @@ signals: virtual void hwapi_payCancelled(void) const=0; virtual void hwapi_coinProcessJustStopped(void) const=0; - - // new from 2023.06.12 virtual void hwapi_doorServiceDoorOpened(void) const=0; virtual void hwapi_doorVaultDoorOpened(void) const=0; virtual void hwapi_doorCoinBoxRemoved(void) const=0; @@ -1370,7 +2391,31 @@ signals: virtual void hwapi_doorAllDoorsClosed(void) const=0; + // NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid. + /* GH Version, bringt Fehler + void hwapi_templatePrintFinished_OK() const; + void hwapi_templatePrintFinished_Err() const; + void hwapi_coinCollectionJustStarted() const; + void hwapi_coinCollectionAborted() const; + + void hwapi_gotNewCoin() const; + void hwapi_payStopByMax() const; + void hwapi_payStopByPushbutton() const; + + void hwapi_payStopByEscrow() const; + void hwapi_payStopByError() const; + void hwapi_payStopByTimeout() const; + void hwapi_payCancelled() const; + void hwapi_coinProcessJustStopped() const; + + void hwapi_doorServiceDoorOpened() const; + void hwapi_doorVaultDoorOpened() const; + void hwapi_doorCoinBoxRemoved() const; + void hwapi_doorCoinBoxInserted() const; + void hwapi_doorCBinAndAllDoorsClosed() const; + void hwapi_doorAllDoorsClosed() const; + */ }; @@ -1413,9 +2458,29 @@ signals: //#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" +//#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 +// hier dazwischen: Umstellung ALLER Prototypen +// hier von =0 auf {} durch Gerhard + +#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2" + // 7.11.2023: bna functions activated Q_DECLARE_INTERFACE(hwinf, HWINF_iid) diff --git a/plugins/interfaces.h b/plugins/interfaces.h index d9f31b6..0aa4a1e 100755 --- a/plugins/interfaces.h +++ b/plugins/interfaces.h @@ -24,7 +24,8 @@ struct T_emp // dynamic: uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine): - // 0=start command + /* + // 0=start command // 1=powered, do emp ini, send reset // 2=delay // 3=wait for response, requesting status after response @@ -39,7 +40,7 @@ struct T_emp // 90: stop all, 1s delay // 99: off, all stopped - +*/ uint8_t pollingRunning; uint8_t paymentRunning; @@ -193,7 +194,7 @@ struct T_moduleCondition uint8_t coinChecker; // EMP, OMP or mei-cashflow uint8_t coinEscrow; - uint8_t mifareReader; + uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error uint8_t creditTerm; uint8_t coinReject; @@ -238,6 +239,7 @@ struct T_dynamicCondition uint8_t lastVDoorState; uint8_t lastCBstate; char paymentInProgress; + // Version Szeged: aug2023 // 0: stopped by timeout // 1: running 2: wait4lastCoin // 3: payment stopped manually, coins in Escrow @@ -246,6 +248,21 @@ struct T_dynamicCondition // 6: coins encashed 7:coins returned // 8: CoinChecker or MDB on Error + // since Schoenau with bill and changer, nov2023 + //0 = no payment + //will be set to 1 by cash_startCollection() + //neu 1: wait for devices getting ready for payment + //2 = payment, + //3 = wait for last coin/bill + //4 = Bezahlvorgang manuell beendet + //5 = payment stopped autom, amount collected, coins in Escrow + //6 = Bezahlvorgang beendet weil ZK voll + //4,5,6: payment done, keep on polling, wait for cash or return command + //7 = encash collected money from coin escrow into cash box + //8 = return "amountToReturn", can be complete inserted amount or only overpayment + //9 = wait for changer result + //10= print refund receipt with "amountToReturn" + char res1; uint16_t U_Batt; @@ -344,8 +361,60 @@ struct T_devices }; +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 DownloadThread; class hwinf { @@ -363,80 +432,118 @@ public: // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ - virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const =0; + virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const { + Q_UNUSED(BaudNr); + Q_UNUSED(BaudStr); + Q_UNUSED(ComName); + Q_UNUSED(connect); + return false; + } // 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; + virtual void dc_closeSerial(void) const {} // 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; + virtual bool dc_isPortOpen(void) const { + return false; + } // 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; + virtual void dc_autoRequest(bool on) const { + Q_UNUSED(on); + } // 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; + virtual void dc_requTestResponse() const {} // tell DC2 to send a test-string, useful to see if cable and baudrate is OK - virtual bool dc_readAnswTestResponse() const =0; + virtual bool dc_readAnswTestResponse() const { + return false; + } // retval: true: test was successful, got right response - virtual uint8_t dc_isRequestDone(void) const =0; + virtual uint8_t dc_isRequestDone(void) const { + return 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; + virtual uint16_t dc_getCompletePayLoad(uint16_t plBufSiz, uint8_t *payLoad) const { + Q_UNUSED(plBufSiz); + Q_UNUSED(payLoad); + return 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; + virtual void dc_setWakeFrequency(uint8_t period) const { + Q_UNUSED(period); + } // RTC wakes DC2 (and PTU) by hardware signal every 32seconds // change wake signal period to 1...64s - virtual void dc_OrderToReset(void) const =0; + virtual void dc_OrderToReset(void) const {} // want DC2 to reset (in order to start Bootloader) - virtual QString dc_getSerialState(void) const =0; + virtual QString dc_getSerialState(void) const { + return QString(); + } // 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; + virtual void dc_clrSerialStateText(void) const {} // clear above text to avoid multiple repetive displaying - virtual void bl_sendDataDirectly(uint8_t length, uint8_t *buf) const =0; + virtual void bl_sendDataDirectly(uint8_t length, uint8_t *buf) const { + Q_UNUSED(length); + Q_UNUSED(buf); + } // send without protocol frame, needed for the DC bootloader - virtual uint8_t getRawRecLength(void) const =0; + virtual uint8_t getRawRecLength(void) const { + return 0; + } // only needed if protocol stack in Cashagent-Library is bypassed - virtual uint8_t getRawReceivedData(uint8_t *receivedData) const =0; + virtual uint8_t getRawReceivedData(uint8_t *receivedData) const { + Q_UNUSED(receivedData); + return 0; + } // only needed if protocol stack in Cashagent-Library is bypassed - virtual QString dc_getSerialParams(void) const =0; + virtual QString dc_getSerialParams(void) const { + return QString(); + } // get DC2 serial settings (not very meaningful as they will not come if different from master settings) - virtual QString dc_getHWversion(void) const =0; + virtual QString dc_getHWversion(void) const { + return QString(); + } // get DC2 hardware version - virtual QString dc_getSWversion(void) const =0; + virtual QString dc_getSWversion(void) const { + return QString(); + } // get DC2 software version - virtual QString dc_getState(void) const =0; + virtual QString dc_getState(void) const { + return QString(); + } // get DC2 status (every OK or any error/warning? ) @@ -444,55 +551,103 @@ public: // Date and Time // ---------------------------------------------------------------------------------------------------------- - virtual uint8_t rtc_getDateTime(struct Trtc_DateTime *rtc_DateTime) const =0; + virtual uint8_t rtc_getDateTime(struct Trtc_DateTime *rtc_DateTime) const { + Q_UNUSED(rtc_DateTime); + return 0; + } - virtual uint8_t rtc_setDateTime(void) const =0; + virtual uint8_t rtc_setDateTime(void) const { + return 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; + virtual void rtc_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss) const { + Q_UNUSED(hh); + Q_UNUSED(mm); + Q_UNUSED(ss); + } // get time directly - virtual void rtc_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd) const =0; + virtual void rtc_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd) const { + Q_UNUSED(yy); + Q_UNUSED(mm); + Q_UNUSED(dd); + } // get date directly - virtual uint8_t rtc_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday) const =0; + virtual uint8_t rtc_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday) const { + Q_UNUSED(dow); + Q_UNUSED(minOfToday); + Q_UNUSED(secOfToday); + return 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; + virtual bool rtc_isLeapYear(uint8_t *lastLeapYear, uint8_t *NextLeapYear) const { + Q_UNUSED(lastLeapYear); + Q_UNUSED(NextLeapYear); + return false; + } // retval true: this year is leap year - virtual bool rtc_isLeapYear() const =0; + virtual bool rtc_isLeapYear() const { + return false; + } - virtual void rtc_getWeek(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek) const =0; + virtual void rtc_getWeek(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek) const { + Q_UNUSED(DayOfWeek); + Q_UNUSED(HoursOfWeek); + Q_UNUSED(MinutesOfWeek); + } // 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; + virtual void rtc_getMonth(uint8_t *DayOfMonth, uint16_t *HoursOfMonth, uint16_t *MinutesOfMonth) const { + Q_UNUSED(DayOfMonth); + Q_UNUSED(HoursOfMonth); + Q_UNUSED(MinutesOfMonth); + } // 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; + virtual void rtc_getYear(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint32_t *MinutesOfYear) const { + Q_UNUSED(DayOfYear); + Q_UNUSED(HoursOfYear); + Q_UNUSED(MinutesOfYear); + } // 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; + virtual QString rtc_getTimStr(void) const { + return QString(); + } + virtual QString rtc_getDatStr(void) const { + return QString(); + } + virtual QString rtc_getTimDatStr(void) const { + return QString(); + } // UID - unique number, different in every DC - virtual void dc_getUID8byte(uint8_t *buf8byteUid) const =0; + virtual void dc_getUID8byte(uint8_t *buf8byteUid) const { + Q_UNUSED(buf8byteUid); + } // get 8 single bytes in buffer - virtual QString dc_getUIDstr() const =0; + virtual QString dc_getUIDstr() const { + return QString(); + } // get as string - virtual uint64_t dc_getUIDnumber(void) const =0; + virtual uint64_t dc_getUIDnumber(void) const { + return 0; + } // get UID as one long number // ---------------------------------------------------------------------------------------------------------- @@ -500,19 +655,29 @@ public: // ---------------------------------------------------------------------------------------------------------- // Analog values: - virtual uint32_t dc_getTemperature(void) const =0; + virtual uint32_t dc_getTemperature(void) const { + return 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; + virtual QString dc_getTemperaturStr(void) const { + return QString(); + } // as string like "-12,5degC" - virtual uint32_t dc_getVoltage(void) const =0; + virtual uint32_t dc_getVoltage(void) const { + return 0; + } // as value in mV, 0...65,535V - virtual QString dc_getVoltagStr(void) const =0; + virtual QString dc_getVoltagStr(void) const { + return QString(); + } // as string in mV - virtual bool dc_mainFuseIsOk(void) const=0; + virtual bool dc_mainFuseIsOk(void) const { + return false; + } // true if 12V fuse is OK // false: fuse blown, DC will continue working but no 12V device can be used! @@ -520,60 +685,124 @@ public: // digital outputs // ------------------------------------------------------------------------------ - virtual uint8_t lock_switchUpperLock(uint8_t dir) const =0; + virtual uint8_t lock_switchUpperLock(uint8_t dir) const { + Q_UNUSED(dir); + return 0; + } // dir 0=off 1=up 2=down // move lock until stop cmd (0) - virtual uint8_t lock_switchLowerLock(uint8_t dir) const =0; + virtual uint8_t lock_switchLowerLock(uint8_t dir) const { + Q_UNUSED(dir); + return 0; + } // dir 0=off 1=up 2=down // move lock until stop cmd (0) - virtual void lock_switchVaultDoor(void) const =0; + virtual void lock_switchVaultDoor(void) const {} - virtual void coin_switchRejectMotor(uint8_t dir) const =0; + virtual void coin_switchRejectMotor(uint8_t dir) const { + Q_UNUSED(dir); + } - virtual void coin_rejectCoins(void) const =0; + virtual void coin_rejectCoins(void) const {} // 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 led_switchLedService(uint8_t on) const { + Q_UNUSED(on); + } + virtual void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedPinPad(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedStart(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } + virtual void led_switchLedCoinbassin(uint8_t on, uint8_t ton, uint8_t tof) const { + Q_UNUSED(on); + Q_UNUSED(ton); + Q_UNUSED(tof); + } - 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 fan_switchFan(bool on) const { + Q_UNUSED(on); + } + virtual void alarm_switchSiren(bool on) const { + Q_UNUSED(on); + } + virtual void bar_OpenBarrier(bool open) const { + Q_UNUSED(open); + } + virtual void ptu_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - 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 aux_power(bool on) const { + Q_UNUSED(on); + } + virtual void aux_setUsage(uint8_t PinDirection) const { + Q_UNUSED(PinDirection); + } + virtual void aux_setOutputs(uint8_t PinIsHigh) const { + Q_UNUSED(PinIsHigh); + } - virtual void lock_switchContactPower(bool on) const =0; + virtual void lock_switchContactPower(bool on) const { + Q_UNUSED(on); + } - virtual void prn_switchPower(bool on) const =0; + virtual void prn_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mif_readerOn(bool on) const =0; + virtual void mif_readerOn(bool on) const { + Q_UNUSED(on); + } - virtual void mif_creatAtbCard(uint8_t cardType) const =0; + virtual void mif_creatAtbCard(uint8_t cardType) const { + Q_UNUSED(cardType); + } - virtual void mod_switchPower(bool on) const=0; + virtual void mod_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mod_switchWake(bool WAKEACTIVE) const=0; + virtual void mod_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void mdb_switchPower(bool on) const =0; + virtual void mdb_switchPower(bool on) const { + Q_UNUSED(on); + } - virtual void mdb_switchWake(bool WAKEACTIVE) const =0; + virtual void mdb_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void credit_switchPower(bool on) const =0; + virtual void credit_switchPower(bool on) const { + Q_UNUSED(on); + } // the same as modem power - virtual void credit_switchWake(bool WAKEACTIVE) const =0; + virtual void credit_switchWake(bool WAKEACTIVE) const { + Q_UNUSED(WAKEACTIVE); + } - virtual void shut_move(bool open) const =0; + virtual void shut_move(bool open) const { + Q_UNUSED(open); + } - virtual void esc_moveFlaps(uint8_t flap ) const =0; + virtual void esc_moveFlaps(uint8_t flap ) const { + Q_UNUSED(flap); + } // 0: close both 1: open take-flap 2: open return @@ -581,78 +810,142 @@ public: // door, cashbox and lock switches // ------------------------------------------------------------------------------ - virtual uint8_t door_getSwitches(void) const =0; + virtual uint8_t door_getSwitches(void) const { + return 0; + } // retval: bit0: upper door 1: low door 2:vault door - virtual bool door_isUpperDoorOpen(void) const =0; + virtual bool door_isUpperDoorOpen(void) const { + return false; + } - virtual bool door_isLowerDoorOpen(void) const =0; + virtual bool door_isLowerDoorOpen(void) const { + return false; + } - virtual bool vault_isVaultDoorOpen(void) const =0; + virtual bool vault_isVaultDoorOpen(void) const { + return false; + } - virtual uint8_t vault_getSwitches(void) const =0; + virtual uint8_t vault_getSwitches(void) const { + return 0; + } // retval bit0: cash box, bit 1: bill box - virtual bool vault_isCoinVaultIn(void) const =0; + virtual bool vault_isCoinVaultIn(void) const { + return false; + } - virtual bool vault_isBillVaultIn(void) const =0; + virtual bool vault_isBillVaultIn(void) const { + return false; + } - virtual uint8_t door_getLocks(void) const =0; + virtual uint8_t door_getLocks(void) const { + return 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_upperDoorIsLocked(void) const { + return false; + } - virtual bool door_upperDoorIsUnlocked(void) const =0; + virtual bool door_upperDoorIsUnlocked(void) const { + return false; + } - virtual bool door_lowerDoorIsLocked(void) const =0; + virtual bool door_lowerDoorIsLocked(void) const { + return false; + } - virtual bool door_lowerDoorIsUnlocked(void) const =0; + virtual bool door_lowerDoorIsUnlocked(void) const { + return false; + } - virtual bool bar_optoIn1isOn(void) const =0; + virtual bool bar_optoIn1isOn(void) const { + return false; + } - virtual bool bar_optoIn2isOn(void) const =0; + virtual bool bar_optoIn2isOn(void) const { + return false; + } - virtual uint8_t aux_getAuxInputs(void) const =0; + virtual uint8_t aux_getAuxInputs(void) const { + return 0; + } - virtual bool ptu_WakeINisActive(void) const =0; + virtual bool ptu_WakeINisActive(void) const { + return false; + } - virtual bool mdb_WakeINisActive(void) const =0; + virtual bool mdb_WakeINisActive(void) const { + return false; + } - virtual bool prn_readyINisActive(void) const =0; + virtual bool prn_readyINisActive(void) const { + return false; + } - virtual bool coid_isAttached(void) const =0; + virtual bool coid_isAttached(void) const { + return false; + } - virtual bool coin_escrowIsOpen(void) const =0; + virtual bool coin_escrowIsOpen(void) const { + return false; + } - virtual bool mif_cardIsAttached(void) const =0; + virtual bool mif_cardIsAttached(void) const { + return false; + } //bool hwapi::mod_WakeINisActive(void); - virtual bool door_isContactPowerOn(void) const =0; + virtual bool door_isContactPowerOn(void) const { + return false; + } - virtual bool mif_isMifarePowerOn(void) const =0; + virtual bool mif_isMifarePowerOn(void) const { + return false; + } - virtual bool mdb_testIsmdbTxDon(void) const =0; + virtual bool mdb_testIsmdbTxDon(void) const { + return false; + } - virtual bool aux_isAuxPowerOn(void) const =0; + virtual bool aux_isAuxPowerOn(void) const { + return false; + } - virtual bool mod_isGsmPowerOn(void) const =0; + virtual bool mod_isGsmPowerOn(void) const { + return false; + } - virtual bool cred_isCreditPowerOn(void) const =0; + virtual bool cred_isCreditPowerOn(void) const { + return false; + } - virtual bool prn_isPrinterPowerOn(void) const =0; + virtual bool prn_isPrinterPowerOn(void) const { + return false; + } - virtual uint8_t prn_PrnFuseIsOk(void) const=0; + virtual uint8_t prn_PrnFuseIsOk(void) const { + return 0; + } //retval: 0: fuse blown 1: fuse OK 2:unknown as printer power is off - virtual bool mdb_isMdbPowerOn(void) const =0; + virtual bool mdb_isMdbPowerOn(void) const { + return false; + } - virtual bool cash_getRejectMotorHomePos(void) const=0; + virtual bool cash_getRejectMotorHomePos(void) const { + return false; + } - virtual uint8_t cash_getLowPaperSensor(void) const=0; + virtual uint8_t cash_getLowPaperSensor(void) const { + return 0; + } // 0: Sensor sees paper 1: no paper 99: off @@ -664,44 +957,46 @@ public: // or automatically in background by: void hwapi::dc_autoRequest(bool on) - virtual void request_DC2serialConfig() const =0; + virtual void request_DC2serialConfig() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_HWversion() const =0; + virtual void request_DC2_HWversion() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_SWversion() const =0; + virtual void request_DC2_SWversion() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_condition() const =0; + virtual void request_DC2_condition() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_UID() const =0; + virtual void request_DC2_UID() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_TimeAndDate() const =0; + virtual void request_DC2_TimeAndDate() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_analogues() const =0; + virtual void request_DC2_analogues() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_digitalInputs() const =0; + virtual void request_DC2_digitalInputs() const {} // read-request can be sent manually by this function, not needed if auto-request is on - virtual void request_DC2_digitalOutputs() const =0; + virtual void request_DC2_digitalOutputs() const {} // 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_PrinterHwState() const {} + virtual void request_PrinterCurrentFonts() const {} + virtual void request_PrinterStateComplete() const {} - 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_MifareReaderState() const {} + virtual void request_MifareCardType() const {} + virtual void request_MifareAtbType() const {} + virtual void request_MifareID() const {} + virtual void request_MifareData(uint8_t dataBlockNumber) const { + Q_UNUSED(dataBlockNumber); + } //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; + virtual void request_MDB_Status() const {} + virtual void request_MDB_lastResponse() const {} + virtual void request_EMP_allParameters() const {} + virtual void request_EMP_lastCoin() const {} // ------------------------------------------------------------------------------ @@ -711,44 +1006,88 @@ public: // ------------------------------------------------------------------------------ - virtual bool test_getDO_mdbRXtst(void) const =0; + virtual bool test_getDO_mdbRXtst(void) const { + return false; + } // 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; + virtual uint8_t lock_getDO_motors(void) const { + return 0; + } // bit0: upper lock forward bit 1 backward // bit2: lower lock forward bit 3 backward - virtual uint8_t test_serialState(void) const =0; + virtual uint8_t test_serialState(void) const { + return 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_serialIsOn(void) const { + return false; + } - 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 test_serialMux1isSetToPrinter(void) const { + return false; + } + virtual bool test_serialMux1isSetToModem(void) const { + return false; + } + virtual bool test_serialMux2isSetToCredit(void) const { + return false; + } + virtual bool test_serialMux2isSetToMifare(void) const { + return false; + } - 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 led_coinIsOn(void) const { + return false; + } + virtual bool led_frontIsOn(void) const { + return false; + } + virtual bool led_ticketIsOn(void) const { + return false; + } + virtual bool led_pinIsOn(void) const { + return false; + } + virtual bool led_StartIsOn(void) const { + return false; + } + virtual bool led_insideIsOn(void) const { + return false; + } - 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 fan_isOn(void) const { + return false; + } + virtual bool siren_isOn(void) const { + return false; + } + virtual bool bar_relayIsOn(void) const { + return false; + } + virtual bool ptu_WakeOutIsOn(void) const { + return false; + } - virtual bool aux_powerIsOn(void) const =0; + virtual bool aux_powerIsOn(void) const { + return false; + } - virtual bool coin_shutterIsOpen(void) const =0; - virtual bool coin_shutterTestOutput(void) const =0; + virtual bool coin_shutterIsOpen(void) const { + return false; + } + virtual bool coin_shutterTestOutput(void) const { + return false; + } - virtual uint8_t coin_escrowFlapOpened(void) const =0; + virtual uint8_t coin_escrowFlapOpened(void) const { + return 0; + } // retval: 1:return flap is open 2:take flap is open 0:closed @@ -762,7 +1101,14 @@ public: virtual void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker, uint8_t kindOfMifareReader, uint8_t suppressSleep, - uint8_t kindOfModem, uint8_t kindOfCredit ) const =0; + uint8_t kindOfModem, uint8_t kindOfCredit ) const { + Q_UNUSED(kindOfPrinter); + Q_UNUSED(kindOfCoinChecker); + Q_UNUSED(kindOfMifareReader); + Q_UNUSED(suppressSleep); + Q_UNUSED(kindOfModem); + Q_UNUSED(kindOfCredit); + } // enable hardware in device controller: // kindOfPrinter: 0:off 1: GPT4672 (only this one implemented) // kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: Csquare_changer @@ -771,9 +1117,12 @@ public: // 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 request_ReadbackDeviceSettings() const {} - virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0; + virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const { + Q_UNUSED(length); + Q_UNUSED(data); + } // 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 @@ -781,36 +1130,58 @@ public: virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr, uint16_t borough, uint16_t zone, - uint16_t alias, char *location) const =0; + uint16_t alias, char *location) const { + Q_UNUSED(customerNr); + Q_UNUSED(machineNr); + Q_UNUSED(borough); + Q_UNUSED(zone); + Q_UNUSED(alias); + Q_UNUSED(location); + } virtual void request_ReadbackMachineID() const =0; - virtual void readback_machineIDdata(uint8_t *length, uint8_t *data) const =0; + virtual void readback_machineIDdata(uint8_t *length, uint8_t *data) const { + Q_UNUSED(length); + Q_UNUSED(data); + } // 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_openUpperDoor(void) const { + return 0; + } + virtual uint8_t lock_closeUpperDoor(void) const { + return 0; + } - virtual uint8_t lock_openLowerDoor(void) const =0; - virtual uint8_t lock_closeLowerDoor(void) const =0; + virtual uint8_t lock_openLowerDoor(void) const { + return 0; + } + virtual uint8_t lock_closeLowerDoor(void) const { + return 0; + } - virtual void shut_openOnce(void) const =0; + virtual void shut_openOnce(void) const {} // and close automatic after shutter time - virtual void shut_openForCoin(bool start) const =0; + virtual void shut_openForCoin(bool start) const { + Q_UNUSED(start); + } // 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; + virtual void shut_sendOpeningTime(uint16_t timeIn_ms ) const { + Q_UNUSED(timeIn_ms); + } // after this time without retrigger the flap is closed - virtual void esc_takeMoney(void) const =0; + virtual void esc_takeMoney(void) const {} // and close automatically after escrow time (1s) - virtual void esc_returnMoney(void) const =0; + virtual void esc_returnMoney(void) const {} // and close automatically after escrow time (1s) @@ -818,8 +1189,12 @@ public: // --------------------------------------------- MIFARE ----------------------------------------------------- // ---------------------------------------------------------------------------------------------------------- - - virtual uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const =0; +// obsolete + virtual uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const { + Q_UNUSED(buf); + Q_UNUSED(maxBufferSize); + return 0; + } // retval 0=OK 1=error host buffer too small /* data description, new fast version: byte 0= still the same: current read state: @@ -837,18 +1212,34 @@ public: byte 7: length of UID 4 or 7 (byte) */ - virtual bool mif_readerIsOK(void) const =0; + virtual bool mif_readerIsOK(void) const { + return false; + } - virtual bool mif_cardAttached(void) const =0; + virtual bool mif_cardAttached(void) const { + return false; + } + // not working! use mif_cardIsAttached() instead - virtual uint8_t mif_readResult(void) const =0; + virtual uint8_t mif_readResult(void) const { + return 0; + } // result: 0: unknown or still in progress // 1: card read successful // 2: reading error + // not working! - virtual QString mif_cardUID(void) const =0; + virtual QString mif_cardUID(void) const { + return QString(); + } + // not working - virtual uint8_t mif_getCardDataDec(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize) const =0; + virtual uint8_t mif_getCardDataDec(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize) const { + Q_UNUSED(blkNr); + Q_UNUSED(buf); + Q_UNUSED(maxBufferSize); + return 0; + } virtual QString mif_getCardDataStr(uint8_t blockNumber) const =0; // with blockNumber=0...11 @@ -861,7 +1252,10 @@ public: // read printer condition and settings - virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const =0; + virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const { + Q_UNUSED(prn_hw_state); + return 0; + } // retval: status byte // byte 0 = 0: prnter OK, >0: error // bit0: paper low 1: no paper 2: temperature error @@ -869,68 +1263,116 @@ public: // 6: no response 7: bad response from printer // and return struct "Tprn_hw_state" - virtual bool prn_isUpAndReady(void) const =0; + virtual bool prn_isUpAndReady(void) const { + return false; + } // 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; + virtual void prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) const { + Q_UNUSED(prn_fonts); + } // send Commands to printer: - virtual void prn_sendText(QByteArray *buf) const =0; + virtual void prn_sendText(QByteArray *buf) const { + Q_UNUSED(buf); + } // up to 1280 bytes - virtual void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) const =0; + virtual void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) const { + Q_UNUSED(para1); + Q_UNUSED(para2); + Q_UNUSED(para3); + } // 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; + virtual void prn_sendPrnEscCmd(uint8_t para1, uint8_t para2, uint8_t para3, uint8_t para4) const { + Q_UNUSED(para1); + Q_UNUSED(para2); + Q_UNUSED(para3); + Q_UNUSED(para4); + } // 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; + virtual void prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alignment, uint8_t orientation) const { + Q_UNUSED(paperSpeed); + Q_UNUSED(density); + Q_UNUSED(alignment); + Q_UNUSED(orientation); + } // 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; + virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const { + Q_UNUSED(wayInMm); + Q_UNUSED(direction); + } //direction: 1=forward 2=backward // - virtual void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const =0; + virtual void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const { + Q_UNUSED(font); + Q_UNUSED(size); + Q_UNUSED(width); + Q_UNUSED(height); + } // 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; + virtual void prn_setLetters(uint8_t bold, uint8_t invers, uint8_t underlined) const { + Q_UNUSED(bold); + Q_UNUSED(invers); + Q_UNUSED(underlined); + } // bold: 0/1 // invers: 0/1 // underlined: 0/1 - virtual void prn_cut(uint8_t kindof) const =0; + virtual void prn_cut(uint8_t kindof) const { + Q_UNUSED(kindof); + } // kindof: 1=full cut 2=partial cut 3=eject (5xLF + full cut) - virtual void prn_newLine(uint8_t nrOfLines) const =0; + virtual void prn_newLine(uint8_t nrOfLines) const { + Q_UNUSED(nrOfLines); + } - virtual void prn_printCompleteFontTable(void) const =0; + virtual void prn_printCompleteFontTable(void) const {} - virtual void prn_printBarcode(uint8_t kindOf, uint8_t withText, uint8_t offset, uint8_t rotation, uint8_t dataLeng, uint8_t *data) 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 { + Q_UNUSED(kindOf); + Q_UNUSED(withText); + Q_UNUSED(offset); + Q_UNUSED(rotation); + Q_UNUSED(dataLeng); + Q_UNUSED(data); + } // 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; + virtual void prn_sendQRdata(QByteArray *buf) const { + Q_UNUSED(buf); + } // maximal 150 alphanummeric bytes - virtual void prn_printQRcode(void) const =0; + virtual void prn_printQRcode(void) const {} // QRcode may have 1...150 alphanummeric data, must be transfered in advance - virtual void prn_printLogo(uint8_t nrOfLogo, uint8_t offset ) const =0; + virtual void prn_printLogo(uint8_t nrOfLogo, uint8_t offset ) const { + Q_UNUSED(nrOfLogo); + Q_UNUSED(offset); + } // nrOfLogo: 1..4 in flash 5...8 in Ram // offset: in mm form left border @@ -945,24 +1387,44 @@ public: // --------------------------------------------- MDB Bus ---------------------------------------------------- // ---------------------------------------------------------------------------------------------------------- - virtual void mdb_sendBusReset(void) const =0; + virtual void mdb_sendBusReset(void) const {} - virtual void mdb_sendCommand(uint8_t toMdbDevice, uint8_t mdbCommand) const =0; + virtual void mdb_sendCommand(uint8_t toMdbDevice, uint8_t mdbCommand) const { + Q_UNUSED(toMdbDevice); + Q_UNUSED(mdbCommand); + } // 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; + virtual void mdb_sendMessage(uint8_t toMdbDevice, uint8_t mdbCommand, uint8_t nrOfData, uint8_t *dataBuffer) const { + Q_UNUSED(toMdbDevice); + Q_UNUSED(mdbCommand); + Q_UNUSED(nrOfData); + Q_UNUSED(dataBuffer); + } // 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_busIsReadyToWork() const { + return false; + } - virtual bool mdb_deviceVoltageOK() const =0; + virtual bool mdb_deviceVoltageOK() const { + return false; + } - virtual bool mdb_busVoltageOk() const =0; + virtual bool mdb_busVoltageOk() const { + return false; + } virtual uint8_t mdb_getLastDeviceResponse(uint8_t *fromDevice, uint8_t *lastRequest, - uint8_t *responseLength, uint8_t *responseBuffer) const =0; + uint8_t *responseLength, uint8_t *responseBuffer) const { + Q_UNUSED(fromDevice); + Q_UNUSED(lastRequest); + Q_UNUSED(responseLength); + Q_UNUSED(responseBuffer); + return 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 @@ -975,69 +1437,106 @@ public: // ---------------------------------------------------------------------------------------------------------- - 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_sendSettings(uint16_t coinAcceptance, uint8_t tokenChannel, uint16_t *coinDenomination ) const { + Q_UNUSED(coinAcceptance); + Q_UNUSED(tokenChannel); + Q_UNUSED(coinDenomination); + } + // 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_pollingOnOff(uint8_t on) const { + Q_UNUSED(on); + } - virtual void emp_startCoinAcceptance(void) const =0; + virtual void emp_startCoinAcceptance() const {} - virtual void emp_stopCoinAcceptance(void) const =0; + virtual void emp_stopCoinAcceptance() const {} - 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 void emp_getAllParameters(struct T_emp *emp) const { + Q_UNUSED(emp); + } + // 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 uint8_t emp_chkIfCoinInserted(void) const { + return 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. + virtual void emp_getNewCoinRecord(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value) const { + Q_UNUSED(value); + Q_UNUSED(signal); + Q_UNUSED(error); + Q_UNUSED(valid); + } + // 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_giveLastCoin(uint16_t *value, uint8_t *signal) const { + Q_UNUSED(value); + Q_UNUSED(signal); + return 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 uint8_t emp_returnLastCoin(uint16_t *value, uint8_t *signal) const { + Q_UNUSED(value); + Q_UNUSED(signal); + return 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; + virtual QString dc_getTxt4RsDiagWin(void) const { + return QString(); + } + virtual void dc_clrTxt4RsDiagWin(void) const {} + virtual QString dc_get2ndTxt4RsDiagWin(void) const { + return QString(); + } + virtual void dc_clr2ndTxt4RsDiagWin(void) const {} + virtual QString dc_getTxt4HsStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4HsStateLine(void) const {} + virtual QString dc_getTxt4masterStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4masterStateLine(void) const {} + virtual QString dc_getTxt4resultStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4resultStateLine(void) const {} + virtual QString dc_getdataStateLine(void) const { + return QString(); + } + virtual void dc_clrTxt4dataStateLine(void) const {} + virtual QString dc_getdatifLine(void) const { + return QString(); + } + virtual void dc_clrTxt4datifLine(void) const {} @@ -1046,27 +1545,54 @@ public: // ---------------------------------------------------------------------------------------------------------- // 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 void bl_iniChain() const {} + virtual bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const { + Q_UNUSED(readBinFile); + Q_UNUSED(fileSize); + Q_UNUSED(withDispl); + return false; + } + virtual uint8_t bl_activatBootloader(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + virtual uint8_t bl_startChain() const { + return 0; + } + virtual uint8_t bl_readBLversion(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + // minimum size of sendData-buffer: 5byte retval: length + virtual uint8_t bl_readFWversion(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 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_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const { + Q_UNUSED(Cmd); + Q_UNUSED(SendDataLength); + Q_UNUSED(sendData); + Q_UNUSED(outBuf); + return 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 uint8_t bl_exitBL(uint8_t *sendData) const { + Q_UNUSED(sendData); + return 0; + } + // minimum size of sendData-buffer: 5byte retval: length - virtual void led_switchLedIllumination(uint8_t on) const =0; + virtual void led_switchLedIllumination(uint8_t on) const { + Q_UNUSED(on); + } @@ -1075,33 +1601,44 @@ public: // 27.3.2023: Use Device-Controller's Bootloader to send hex-file // ------------------------------------------------------------------------------------ - virtual void bl_rebootDC(void) const =0; + virtual void bl_rebootDC(void) const {} - 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_startBL() const {} + virtual void bl_checkBL() const {} + virtual bool bl_isUp() const { + return false; + } + // 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 void bl_sendAddress(uint16_t blockNumber) const { + Q_UNUSED(blockNumber); + } + // 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; + virtual uint8_t bl_wasSendingAddOK() const { + return 0; + } // return val: 0: no response by now 1:error 10: OK - virtual void bl_openBinary(void) const =0; + virtual void bl_openBinary() const {} - virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const =0; + virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const { + Q_UNUSED(length); + Q_UNUSED(buffer); + } // send 64 byte from bin file - virtual void bl_sendLastBlock(void) const =0; + virtual void bl_sendLastBlock() const {} - virtual uint8_t bl_wasSendingDataOK(void) const =0; + virtual uint8_t bl_wasSendingDataOK() const { + return false; + } // return val: 0: no response by now 1:error 10: OK - virtual void bl_stopBL(void) const =0; + virtual void bl_stopBL() const {} // ------------------------------------------------------------------------------------ @@ -1110,240 +1647,726 @@ public: // ------------------------------------------------------------------------------------ - 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_setTimeDateDirect(struct Trtc_DateTime *DateTime) const { + Q_UNUSED(DateTime); + return false; + } + // 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(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + return false; + } - virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const =0; + virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const { + Q_UNUSED(exTime); + return false; + } - virtual bool sys_runCompleteTest(void) const =0; - // warning: lasts 20s in one pace + virtual bool sys_runCompleteTest() const { + return false; + } + // warning: lasts 20s in one pace - virtual bool sys_ready4sending(void) const =0; + virtual bool sys_ready4sending() const { + return false; + } // 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 sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const { + Q_UNUSED(kindOfFile); + Q_UNUSED(nrOfTemplate); + Q_UNUSED(content); + return false; + } + // 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; + virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const { + Q_UNUSED(dynPrnVal); + return false; + } // 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 bool prn_printTemplate(uint8_t nrOftemplate) const { + Q_UNUSED(nrOftemplate); + return false; + } + // 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; + virtual void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const { + Q_UNUSED(nrOfVals); + Q_UNUSED(accNr); + } // 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_selectVaultRecord(uint16_t accountNr ) const { + Q_UNUSED(accountNr); + return false; + } + // 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_chkIfVaultRecordAvailable() const { + return false; + } + // 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 + // 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_printAccountReceipt() const { + return false; + } + // 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 prn_printTestTicket() const { + return false; + } + // return true if sending to DC OK, false if cmd-stack is full - virtual bool cash_startPayment(uint32_t amount) const =0; - // 17.4.23TS: extended to 32bit + virtual bool cash_startPayment(uint32_t amount) const { + Q_UNUSED(amount); + return false; + } + // 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 uint8_t cash_paymentProcessing() const { + return 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 uint32_t getInsertedAmount() const { + return 0; + } - virtual uint16_t getLastInsertedCoin(void) const =0; + virtual uint16_t getLastInsertedCoin(void) const { + return 0; + } - virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const =0; - // alle bei diesem Verkauf eingeworfenen Muenzen sind gespeichert, max 64 + virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const { + Q_UNUSED(types); + Q_UNUSED(values); + return false; + } + // alle bei diesem Verkauf eingeworfenen Muenzen sind gespeichert, max 64 - virtual bool cash_cancelPayment(void) const =0; - // and return coins + virtual bool cash_cancelPayment() const { + return false; + } + // and return coins - virtual bool cash_stopPayment(void) const =0; - // and keep coins in escrow + virtual bool cash_stopPayment() const { + return false; + } + // 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_success() const { + return false; + } + // 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 bool vend_failed() const { + return false; + } + // 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 uint8_t mif_getCardType(QString *cardholder) const { + Q_UNUSED(cardholder); + return 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 uint64_t sys_getWakeSource() const { + return 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 uint8_t sys_getWakeReason() const { + return 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(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + } - virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const =0; + virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const { + Q_UNUSED(devCond); + } - virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const =0; + virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const { + Q_UNUSED(leng); + Q_UNUSED(data); + } - virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const =0; + virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const { + Q_UNUSED(dynMachCond); + } - virtual uint32_t cash_getAmountInVault(void) const =0; + virtual uint32_t cash_getAmountInVault() const { + return 0; + } - virtual uint16_t cash_getNrCoinsInVault(void) const =0; + virtual uint16_t cash_getNrCoinsInVault() const { + return 0; + } - virtual uint8_t prn_getPrintResult() const =0; + virtual uint8_t prn_getPrintResult() const { + return 0; + } + // return: 0: just printing, wait + // 1: OK - last print was succesful + // 2: error - not printed - 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 uint8_t prn_getCurrentPrinterState() const { + return 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_sendDeviceParameter(struct T_devices *deviceSettings) const { + Q_UNUSED(deviceSettings); + } - 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 void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const { + Q_UNUSED(deviceSettings); + } + // 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_areDCdataValid() const { + return false; + } - virtual bool sys_sendingTest(void) const =0; + virtual bool sys_sendingTest() const { + return false; + } - virtual void prn_requestCurrentDynData(void) const =0; + virtual void prn_requestCurrentDynData() const {} - virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const =0; + virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const { + Q_UNUSED(dynPrnVal); + return false; + } // which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const =0; - virtual bool prn_dynDataAreEqual(uint8_t *buf) const =0; + virtual bool prn_dynDataAreEqual(uint8_t *buf) const { + Q_UNUSED(buf); + return false; + } - virtual bool prn_printKombiticket(uint8_t nrOfKombi) const =0; - // print four of the templates loaded by Json prior - // nr = 1..8 + virtual bool prn_printKombiticket(uint8_t nrOfKombi) const { + Q_UNUSED(nrOfKombi); + return false; + } + // print four of the templates loaded by Json prior + // nr = 1..8 - virtual void lock_triggerUpperSolenoid(void) const =0; + virtual void lock_triggerUpperSolenoid(void) const {} - virtual void lock_triggerLowerSolenoid(void) const =0; + virtual void lock_triggerLowerSolenoid(void) const {} - virtual bool doors_supervise(void) const =0; + virtual bool doors_supervise() const { + return false; + } - virtual bool dc_isAutoRequestOn(void) const =0; + virtual bool dc_isAutoRequestOn() const { + return false; + } - virtual uint16_t log_getLatestAccountNumber(void) const=0; + virtual uint16_t log_getLatestAccountNumber() const { + return 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 + virtual uint8_t log_getAvailableVaultBlocks() const { + return 0; + } + // return 0x0011 1111 if all 6 blocks are loaded (one bit per block) + virtual uint8_t log_getAnswerToLastSlaveRequest() const { + return 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 void log_startSupervision() const {} - 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 + virtual uint8_t log_getAnswerToLastCmdBatch() const { + return 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 + virtual bool log_getVaultData(uint8_t *data) const { + Q_UNUSED(data); + return false; + } + // 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_printOneAccountReceipt(uint16_t accountNr) const { + Q_UNUSED(accountNr); + return false; + } + // 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 prn_printAllAvailAccountReceipts() const { + return false; + } + // 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 bool log_verifyVaultRecordByCrc() const { + return false; + } + // 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 uint16_t log_DC_getNextAccountNumber() const { + return 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_setNextAccountNumber(uint16_t newAccountingNumber) const { + Q_UNUSED(newAccountingNumber); + } + // 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_deleteAllVaultrecordsInDc() const {} + // 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 log_DC_deleteAllTotalCounters() const {} + // 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_setNewCustomerNumber(uint16_t newCustNr) const { + Q_UNUSED(newCustNr); + } - virtual void dc_setNewMachineNumber(uint16_t newMachNr) const =0; + virtual void dc_setNewMachineNumber(uint16_t newMachNr) const { + Q_UNUSED(newMachNr); + } - virtual void dc_setNewBorough(uint16_t newBorough) const =0; + virtual void dc_setNewBorough(uint16_t newBorough) const { + Q_UNUSED(newBorough); + } - virtual void dc_setNewZone(uint16_t newZone) const =0; + virtual void dc_setNewZone(uint16_t newZone) const { + Q_UNUSED(newZone); + } + // new functions from 8.9.23 + virtual QString mif_getReaderType() const { + return QString(); + } + // return "SL025" if correct reader is connected + + virtual void mif_getCardSize(uint8_t *cardSize, uint8_t *idLeng) const { + Q_UNUSED(cardSize); + Q_UNUSED(idLeng); + } + // cardSize=1k or 4kByte + // idLeng =4Byte or 7 byte + + virtual char mif_getAtbCardData(uint8_t *buf, uint8_t maxBuffSiz) const { + Q_UNUSED(buf); + Q_UNUSED(maxBuffSiz); + return 0; + } + // return complete buffer binary, just for test purpose + + virtual bool mif_isValidAtbCard() const { + return false; + } + + virtual uint32_t mif_getAtbCardCuNu() const { + return 0; + } + + virtual uint8_t mif_getAtbCardTyp() const { + return 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() const { + return QString(); + } + // 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 { + Q_UNUSED(year); + Q_UNUSED(month); + Q_UNUSED(day); + Q_UNUSED(hour); + Q_UNUSED(minute); + } + + + // ------------------------------------------------------------------------------------ + // 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() const { + return false; + } + // 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 { + Q_UNUSED(fileName); + return false; + } + // 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() const { + return 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 { + Q_UNUSED(blockNumber); + return false; + } + // 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() const { + return 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 { + Q_UNUSED(jsonNr); + } + // 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 { + Q_UNUSED(jsonNr); + Q_UNUSED(versionString); + } + // 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 { + Q_UNUSED(amountInCent); + } + + virtual void changer_requestChangeResult() const {} + + virtual uint8_t changer_getChangeResult(uint32_t *returnedAmount) const { + Q_UNUSED(returnedAmount); + return 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 { + Q_UNUSED(mw); + } + // requested automatically with 23, same like EMP + + virtual void changer_requestTubelevel(void) const {} + + virtual void changer_getTubelevel(struct T_chg_Tub *tubLevel) const { + Q_UNUSED(tubLevel); + } + // 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 { + Q_UNUSED(notesToAccept); + Q_UNUSED(parameters); + Q_UNUSED(billDenomination); + Q_UNUSED(acceptanceLimit); + + } + // 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 { + Q_UNUSED(notesToAccept); + } + // 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() const {} + // 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 { + Q_UNUSED(bna); + return false; + } + // 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() const {} + // send command to DC in order to get transaction data + + virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const + { + Q_UNUSED(latestBill); + Q_UNUSED(currentNotes); + return 0; + } + // returns number of collected bank notes since start-command (current transaction) + // return value: numbers of bills or 99 in case of error + // latestBill: not used + // in case of error: currentNotes[0,1,2,3] = 1..4 error number(s) + // in normal case: + // currentNotes[0]: last bill in cent (e.g. 1000 = 10€) + // currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked + // note: by now (dec2023) escrow is not used, bills always go to stacker (box) + // currentNotes[2]: total sum of bills in cent, low word (16bit) + // currentNotes[3]: total sum of bills in cent, high word (16bit) + + + virtual void bna_requestStackerLevel() const {} + + virtual uint16_t bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOfBills) const { + Q_UNUSED(amountInStacker); + Q_UNUSED(countOfBills); + return 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 + + + // download device controller + virtual bool dcDownloadRequest(QString const &fileToDownload) const { + Q_UNUSED(fileToDownload); + return false; + } + virtual bool dcDownloadRequested() const { return false; } + virtual bool dcDownloadResetRequest() const { return false; } + virtual bool dcDownloadRequestAck() const { return false; } + virtual bool dcDownloadRunning() const { return false; } + virtual bool dcDownloadFinished() { return false; } + + virtual bool dcDownloadReportStart() const { return false; } + virtual bool dcDownloadReportRunning() const { return true; } + virtual bool dcDownloadReportFinished() { return true; } + + virtual bool dcDownloadThreadStart() { return false; } + virtual bool dcDownloadThreadRunning() const { return true; } + virtual void dcDownloadThreadFinalize(DownloadThread *) {} + virtual bool dcDownloadThreadFinished() const { return true; } + virtual bool dcDownloadReportThreadStart() { return false; } + virtual bool dcDownloadReportThreadRunning() const { return true; } + virtual void dcDownloadReportThreadFinalize() {} + virtual void dcDownloadReportThreadQuit() {} + virtual bool dcDownloadReportThreadFinished() const { return true; } + + + virtual QString dcDownloadFileName() const { return ""; } + virtual bool dcDownloadSetRequested(bool requested) { + Q_UNUSED(requested); return false; + } + virtual bool dcDownloadSetRunning(bool running) { + Q_UNUSED(running); return false; + } + virtual bool dcDownloadSetFinished(bool finished) { + Q_UNUSED(finished); return false; + } + virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) { + Q_UNUSED(totalBlockNumber); + } + virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) { + Q_UNUSED(currentBlockNumber); + } + virtual bool dcDownloadGetRequested() const { return false; } + virtual bool dcDownloadGetRunning() const { return false; } + virtual bool dcDownloadGetFinished() const { return false; } + virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; } + virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; } + + virtual QObject const *getAPI() { return nullptr; } + + signals: + /* + NOTE: the difference between a virtual Qt signal and a normal Qt signal: + A Qt virtual signal is a connection that is established using a pointer + or reference and is not connected to an object or data. It is therefore + not bound to a particular object, but to a specific class (object type). + Qt virtual signals are useful because they allow you to create + connections without worrying about whether an object or a specific data + element has been destroyed. + https://www.youtube.com/watch?v=HTH3VFfqsXw + + */ + virtual void hwapi_reportDCDownloadStatus(QString const&) const {} + virtual void hwapi_reportDCDownloadSuccess(QString const&) const {} + virtual void hwapi_reportDCDownloadFailure(QString const&) const {} + virtual void hwapi_templatePrintFinished_OK(void) const=0; virtual void hwapi_templatePrintFinished_Err(void) const=0; @@ -1360,8 +2383,6 @@ signals: virtual void hwapi_payCancelled(void) const=0; virtual void hwapi_coinProcessJustStopped(void) const=0; - - // new from 2023.06.12 virtual void hwapi_doorServiceDoorOpened(void) const=0; virtual void hwapi_doorVaultDoorOpened(void) const=0; virtual void hwapi_doorCoinBoxRemoved(void) const=0; @@ -1370,7 +2391,31 @@ signals: virtual void hwapi_doorAllDoorsClosed(void) const=0; + // NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid. + /* GH Version, bringt Fehler + void hwapi_templatePrintFinished_OK() const; + void hwapi_templatePrintFinished_Err() const; + void hwapi_coinCollectionJustStarted() const; + void hwapi_coinCollectionAborted() const; + + void hwapi_gotNewCoin() const; + void hwapi_payStopByMax() const; + void hwapi_payStopByPushbutton() const; + + void hwapi_payStopByEscrow() const; + void hwapi_payStopByError() const; + void hwapi_payStopByTimeout() const; + void hwapi_payCancelled() const; + void hwapi_coinProcessJustStopped() const; + + void hwapi_doorServiceDoorOpened() const; + void hwapi_doorVaultDoorOpened() const; + void hwapi_doorCoinBoxRemoved() const; + void hwapi_doorCoinBoxInserted() const; + void hwapi_doorCBinAndAllDoorsClosed() const; + void hwapi_doorAllDoorsClosed() const; + */ }; @@ -1413,9 +2458,29 @@ signals: //#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" +//#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 +// hier dazwischen: Umstellung ALLER Prototypen +// hier von =0 auf {} durch Gerhard + +#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2" + // 7.11.2023: bna functions activated Q_DECLARE_INTERFACE(hwinf, HWINF_iid)