From 6f920604b737b0f97337793f620f09f98170daed Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 14 Mar 2024 15:12:33 +0100 Subject: [PATCH 1/4] Add cash_isCashCollectionSTarted(). --- include/hwapi.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/hwapi.h b/include/hwapi.h index b9b58f3..ea64981 100644 --- a/include/hwapi.h +++ b/include/hwapi.h @@ -1318,6 +1318,10 @@ public: // countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker // countOfBills[1] for 10€ and so on + bool cash_isCollectionStarted(void) const override; + + + // download device controller bool dcDownloadRequest(QString const &fileToDownload) const override; bool dcDownloadRequested() const override; @@ -1355,9 +1359,9 @@ public: virtual QObject const *getAPI() override; signals: - void hwapi_reportDCDownloadStatus(QString const&) const; - void hwapi_reportDCDownloadSuccess(QString const&) const; - void hwapi_reportDCDownloadFailure(QString const&) const; + void hwapi_reportDCDownloadStatus(QString const&) const override; + void hwapi_reportDCDownloadSuccess(QString const&) const override; + void hwapi_reportDCDownloadFailure(QString const&) const override; void hwapi_templatePrintFinished_OK(void) const override; void hwapi_templatePrintFinished_Err(void) const override; From 961fc6b5dc84c3a3a8b258f4ce32e92a4ba5df8b Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 14 Mar 2024 15:14:47 +0100 Subject: [PATCH 2/4] Fill several struct to align on proper address --- include/interfaces.h | 70 ++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/include/interfaces.h b/include/interfaces.h index 81afbdd..cd2026b 100755 --- a/include/interfaces.h +++ b/include/interfaces.h @@ -170,6 +170,7 @@ struct T_vaultRecord }; +// ATTENTION: struct length must be 64 exactly!!! struct T_moduleCondition { // store conditon of all system components, hold in RAM @@ -182,44 +183,53 @@ struct T_moduleCondition uint8_t ram; uint8_t intEe; uint8_t extEe; - uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error uint8_t boardHw; uint8_t printer; uint8_t modem; - uint8_t signal; // 1...99 uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime uint8_t mdbBus; + // 10 uint8_t coinChecker; // EMP, OMP or mei-cashflow - uint8_t coinEscrow; uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error uint8_t creditTerm; uint8_t coinReject; - uint8_t coinSafe; uint8_t billSafe; uint8_t voltage; // 1:11..14V uint8_t temper; - uint8_t poweronTest; + // 20 uint8_t doorState; // 1: alles zu 200: tuer offen + bit1(S) +bit2(CB) + bit3(CB) uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened uint8_t changer; // can only be tested by usage - uint8_t coinBlocker; // can only be tested by usage uint8_t billReader; // can only be tested by usage uint8_t ResetReason; uint8_t allModulesChecked; - uint8_t alarmState; uint8_t res11; uint8_t res12; + // 30 uint8_t res13; -// 31 + uint8_t padd01; + uint8_t padd02; + uint8_t padd03; + uint32_t padd04; + uint32_t padd05; + uint32_t padd06; + uint32_t padd07; + // 50 + uint32_t padd08; + uint32_t padd09; + uint32_t padd10; + uint16_t padd11; + // 64 }; +// ATTENTION: struct length must be 64 exactly!!! struct T_dynamicCondition { char allDoorsDebounced; @@ -228,10 +238,11 @@ struct T_dynamicCondition char upperDoor; // 99: undefined 0:closed 1:open char middleDoor; // 99: undefined 0:closed 1:open char lowerDoor; // 99: undefined 0:closed 1:open - char reserve; + char coinAttached; char billBox; char modeAbrech; char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest + // 10 char nowCardTest; char nowPayment; // not used, always 0 char lastMifCardType; @@ -266,6 +277,7 @@ struct T_dynamicCondition char res1; uint16_t U_Batt; + // 20 uint16_t Temperatur; uint16_t nrCoinsInBox; uint32_t amountInBox; @@ -275,10 +287,10 @@ struct T_dynamicCondition char jsonValid_device; char jsonValid_cash; char jsonValid_print; + // 40 char jsonValid_serial; char jsonValid_time; char lastFileType; -// 44 uint8_t MifCardHolder[8]; uint8_t resultOfLastTemplPrint; // 0: unknown or printing in progress @@ -292,7 +304,15 @@ struct T_dynamicCondition // bit5: printer not ready uint8_t startupTestIsRunning; - //54 + uint8_t padd01; + uint8_t padd02; + uint8_t padd03; + //50 + uint32_t padd04; + uint32_t padd05; + uint32_t padd06; + uint16_t padd07; + // 64 }; struct T_extTime @@ -329,6 +349,7 @@ struct T_extTime typedef uint8_t UCHAR; typedef uint16_t UINT; +// ATTENTION: struct length must be 64 exactly!!! struct T_devices { // set by master, used(1) or notused (0) or type 2....20 @@ -337,27 +358,33 @@ struct T_devices UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW) UCHAR kindOfMifareReader; // by now only stronglink SL025 =1 UCHAR solarPower; // 1:sleep allowed 0: no sleep - //UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep - UCHAR kindOfModem; // 0:off 1:Sunlink UCHAR kindOfCreditcard; // 0:off 1:Feig NFC UCHAR CoinEscrow; UCHAR CoinRejectUnit; - UCHAR CoinShutter; UCHAR BillAcceptor; + // 10 UCHAR usevaultLock; UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized - UCHAR autoOpen; // 1: open door covers after valid ATBcard UCHAR printAccReceipt; // 0/1 UCHAR printDoorReceipt; UCHAR printTokenTicket; - UINT VaultFullWarnLevel; UINT VaultFullErrorLevel; + // 30 UINT BattEmptyWarnLevel; UINT BattEmptyErrorLevel; + uint32_t padd01; + uint32_t padd02; + uint32_t padd03; + uint32_t padd04; + uint32_t padd05; + uint32_t padd06; + uint32_t padd07; + uint16_t padd08; + // 64 }; @@ -2299,6 +2326,9 @@ public: // countOfBills: array of up to 16 sums, countOfBills[0]=nr of 5€-bills in stacker // countOfBills[1] for 10€ and so on + virtual bool cash_isCollectionStarted(void) const {return false;} + // return true is coin collection in DC is running + // download device controller virtual bool dcDownloadRequest(QString const &fileToDownload) const { @@ -2479,10 +2509,12 @@ signals: // hier dazwischen: Umstellung ALLER Prototypen // hier von =0 auf {} durch Gerhard - -#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2" +//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2" // 7.11.2023: bna functions activated - +#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.3" + // 14.3.24:new function bool hwapi::cash_isCollectionStarted(void) const + // padding three struct to 64 byte to avoid stack overflow when using + // signal coin attached is much faster now Q_DECLARE_INTERFACE(hwinf, HWINF_iid) From ea462ba5c8042f82a5c74fe15adb28341ec0afbc Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 14 Mar 2024 15:16:27 +0100 Subject: [PATCH 3/4] call gpi_storeDI_CoinAttach to speed up coin attach detection --- src/datIf.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/datIf.cpp b/src/datIf.cpp index d3af537..0a10c11 100644 --- a/src/datIf.cpp +++ b/src/datIf.cpp @@ -1041,6 +1041,9 @@ char T_datif::loadRecDataFromFrame() // Could be set to every response but this (31) // is a very common and very important request gpi_storeDynMachineConditions(RdDleng, receivedData); + + gpi_storeDI_CoinAttach(receivedData[6]); // new, 14.2.24 needed for direct coin insertion + } /* funktioniert, ist aber nicht nötig. Signal wird nach dem shared memory erzeugt prnResult=receivedData[52]; From 3486c4ccaf3dcf51ad6cf62ed19fec4a33706fcb Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 14 Mar 2024 15:17:40 +0100 Subject: [PATCH 4/4] Added cash_isCollectionStarted() --- src/hwapi.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/hwapi.cpp b/src/hwapi.cpp index 3c60a1f..ba0208b 100644 --- a/src/hwapi.cpp +++ b/src/hwapi.cpp @@ -17,6 +17,9 @@ und hier in hwapi die entprellten Werte fuer Tueren und Kasse verwenden. Problem war: Signal "Kasse entnommen" war zu langsam -> manchmal abr nicht gesendet +14.3.24 new function bool hwapi::cash_isCollectionStarted(void) const + padding three struct to 64 byte to avoid stack overflow when using + */ #include "hwapi.h" @@ -4402,6 +4405,17 @@ uint16_t hwapi::bna_getStackerLevel(uint32_t *amountInStacker, uint16_t *countOf return anzahl; } + +// new, 14.3.24TS +bool hwapi::cash_isCollectionStarted(void) const +{ + struct T_dynamicCondition myDynMachCond; + sys_getDynMachineConditions(&myDynMachCond); + if (myDynMachCond.paymentInProgress >=2) + return true; + return false; +} + QObject const *hwapi::getAPI() { return this; }