Merge commit '8a216c43c05db28340cf5e4272bf2e66c6a868e9'

This commit is contained in:
Gerhard Hoffmann 2023-04-18 15:07:55 +02:00
commit 9620d58373
3 changed files with 151 additions and 158 deletions

View File

@ -124,6 +124,8 @@ public:
T_datif *myDatif;
virtual QStringList dc_getStatus() const;
// ------------------------------------------------------------------------------
// Level 0 commands, interface
// open, close, change serial interface

View File

@ -2,12 +2,9 @@
#define INTERFACE_H
#include <QtPlugin>
#include <QStringList>
struct T_emp
{
struct T_emp {
// Fixdata from EMP:
uint8_t shaft; // = changer level
uint16_t countryCode;
@ -34,11 +31,9 @@ struct T_emp
uint8_t pollingRunning;
uint8_t paymentRunning;
};
struct Trtc_DateTime
{
struct Trtc_DateTime {
uint8_t rtc_hour;
uint8_t rtc_min;
uint8_t rtc_sec;
@ -48,8 +43,7 @@ struct Trtc_DateTime
uint8_t rtc_dayOfWeek;
};
struct Tprn_hw_state
{
struct Tprn_hw_state {
// hardware (IO's)
bool powerRdBk; // prn pwr is on
bool rsSwOk; // serial switch (printer or modem) is set to printer
@ -66,8 +60,7 @@ struct Tprn_hw_state
bool badResponse;
};
struct Tprn_currentSettings
{
struct Tprn_currentSettings {
uint8_t currFont;
uint8_t currSize;
uint8_t currHeigth;
@ -80,8 +73,7 @@ struct Tprn_hw_state
bool nowAligned;
};
struct T_dynDat
{
struct T_dynDat {
uint8_t licensePlate[8];
uint8_t vendingPrice[8];
uint8_t parkingEnd[8];
@ -92,172 +84,158 @@ struct Tprn_hw_state
uint8_t dynDat7[8];
};
struct T_vaultRecord
{
struct T_vaultRecord {
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
char startbuffer[4]; // Psa> // never move or change this 1st entry
uint16_t AccountingNumber;
uint16_t CUNU;
uint16_t MANU;
uint16_t resint1;
//uint16_t resint2;
char startbuffer[4]; // Psa> // never move or change this 1st entry
uint16_t AccountingNumber;
uint16_t CUNU;
uint16_t MANU;
uint16_t resint1;
//uint16_t resint2;
char label1buffer[4]; // tim>
uint8_t year;
uint8_t month;
uint8_t dom;
uint8_t hour;
uint8_t min;
uint8_t sec;
uint8_t DoW;
uint8_t reschar3;
char label1buffer[4]; // tim>
uint8_t year;
uint8_t month;
uint8_t dom;
uint8_t hour;
uint8_t min;
uint8_t sec;
uint8_t DoW;
uint8_t reschar3;
char label2buffer[4]; // abs>
uint32_t AbsIncome1;
uint32_t AbsReserve;
uint32_t AbsNrOfCuts;
char label2buffer[4]; // abs>
uint32_t AbsIncome1;
uint32_t AbsReserve;
uint32_t AbsNrOfCuts;
//16
char label3buffer[4]; // mw >
char label3buffer[4]; // mw >
// Verkauf, Tür zu:
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
// Verkauf, Tür zu:
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
//88
// Service, Tür offen:
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
uint16_t resint3;
uint16_t resint4;
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
uint16_t resint5;
uint16_t resint6;
// Service, Tür offen:
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
uint16_t resint3;
uint16_t resint4;
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
uint16_t resint5;
uint16_t resint6;
// 56
char label4buffer[4]; // box>
uint16_t coinsInVault[16];
uint16_t billsInStacker[8];
char label4buffer[4]; // box>
uint16_t coinsInVault[16];
uint16_t billsInStacker[8];
// 48
char label5buffer[4]; // val>
// actually constant unless exchange rate is changed
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
uint16_t billDenom[8];
uint16_t tubeDenom[6];
uint16_t exchangeRate;
uint16_t resint9;
char label5buffer[4]; // val>
// actually constant unless exchange rate is changed
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
uint16_t billDenom[8];
uint16_t tubeDenom[6];
uint16_t exchangeRate;
uint16_t resint9;
// 64
char endofblock[4]; // end>
char endofblock[4]; // end>
// 316 byte Block im Speicher
};
struct T_moduleCondition
{
// store conditon of all system components, hold in RAM
// 0 means unknown, not yet tested/used
// 1 means OK
// 50..99 = HINT / Notification
// 100..150 = WARNING
// 200..250 = ERROR
struct T_moduleCondition {
// store conditon of all system components, hold in RAM
// 0 means unknown, not yet tested/used
// 1 means OK
// 50..99 = HINT / Notification
// 100..150 = WARNING
// 200..250 = ERROR
uint8_t ram;
uint8_t intEe;
uint8_t extEe;
uint8_t 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 rtc; // 1: time/date OK 100: time not plausible 200: hardware error
uint8_t boardHw;
uint8_t printer;
uint8_t modem;
uint8_t signal; // 1...99
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
uint8_t mdbBus;
uint8_t coinChecker; // EMP, OMP or mei-cashflow
uint8_t signal; // 1...99
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
uint8_t mdbBus;
uint8_t coinChecker; // EMP, OMP or mei-cashflow
uint8_t coinEscrow;
uint8_t mifareReader;
uint8_t creditTerm;
uint8_t coinReject;
uint8_t coinEscrow;
uint8_t mifareReader;
uint8_t creditTerm;
uint8_t coinReject;
uint8_t coinSafe;
uint8_t billSafe;
uint8_t voltage; // 1:11..14V
uint8_t temper;
uint8_t coinSafe;
uint8_t billSafe;
uint8_t voltage; // 1:11..14V
uint8_t temper;
uint8_t poweronTest;
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
uint8_t changer; // can only be tested by usage
uint8_t poweronTest;
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
uint8_t changer; // can only be tested by usage
uint8_t coinBlocker; // can only be tested by usage
uint8_t billReader; // can only be tested by usage
uint8_t ResetReason;
uint8_t allModulesChecked;
uint8_t alarmState;
uint8_t res11;
uint8_t res12;
uint8_t res13;
uint8_t coinBlocker; // can only be tested by usage
uint8_t billReader; // can only be tested by usage
uint8_t ResetReason;
uint8_t allModulesChecked;
uint8_t alarmState;
uint8_t res11;
uint8_t res12;
uint8_t res13;
};
struct T_dynamicCondition
{
char allDoorsDebounced;
char openedAuthorized;
uint8_t CBinDebounced;
char upperDoor; // 0:fehlt 1:drin
char middleDoor;
char lowerDoor;
char coinBox;
char billBox;
char modeAbrech;
char onAlarm;
char nowCardTest;
char nowPayment;
char lastMifCardType;
uint8_t lastSDoorState;
uint8_t lastVDoorState;
uint8_t lastCBstate;
char paymentInProgress;
char res1;
uint16_t U_Batt;
uint16_t Temperatur;
uint16_t nrCoinsInBox;
uint32_t amountInBox;
uint32_t totalTransVolume;
uint32_t totalNrOfVends;
char jsonValid_config;
char jsonValid_device;
char jsonValid_cash;
char jsonValid_print;
char jsonValid_serial;
char jsonValid_time;
char lastFileType;
struct T_dynamicCondition {
char allDoorsDebounced;
char openedAuthorized;
uint8_t CBinDebounced;
char upperDoor; // 0:fehlt 1:drin
char middleDoor;
char lowerDoor;
char coinBox;
char billBox;
char modeAbrech;
char onAlarm;
char nowCardTest;
char nowPayment;
char lastMifCardType;
uint8_t lastSDoorState;
uint8_t lastVDoorState;
uint8_t lastCBstate;
char paymentInProgress;
char res1;
uint16_t U_Batt;
uint16_t Temperatur;
uint16_t nrCoinsInBox;
uint32_t amountInBox;
uint32_t totalTransVolume;
uint32_t totalNrOfVends;
char jsonValid_config;
char jsonValid_device;
char jsonValid_cash;
char jsonValid_print;
char jsonValid_serial;
char jsonValid_time;
char lastFileType;
// 44
uint8_t MifCardHolder[8];
uint8_t resultOfLastTemplPrint;
// 0: unknown or printing in progress
// 1: OK, doc was printed 2: error, doc was not printed
uint8_t lastPrinterStatus;
// 0: printer OK
// bit0: near paper end bit1: no paper
// bit2: temperature error bit3: error head open
// bit4: paper jam in cutter
// bit6: no response bit7: serial rec. error
// bit5: printer not ready
uint8_t MifCardHolder[8];
uint8_t resultOfLastTemplPrint;
// 0: unknown or printing in progress
// 1: OK, doc was printed 2: error, doc was not printed
uint8_t lastPrinterStatus;
// 0: printer OK
// bit0: near paper end bit1: no paper
// bit2: temperature error bit3: error head open
// bit4: paper jam in cutter
// bit6: no response bit7: serial rec. error
// bit5: printer not ready
//54
};
struct T_extTime
{
struct T_extTime {
uint8_t Hours;
uint8_t Min;
uint8_t Sec;
@ -283,19 +261,16 @@ struct T_extTime
uint8_t res4;
uint16_t res5;
uint32_t MinutesOfMillenium;
};
class hwinf
{
class hwinf {
public:
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER};
virtual ~hwinf() {}
virtual QStringList dc_getStatus() const = 0;
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Use serial interface and protocol stack in Cashagent-Library

View File

@ -169,6 +169,22 @@ bool hwapi::dc_openSerial(int BaudNr, QString BaudStr,
return false;
}
QStringList hwapi::dc_getStatus() const {
QStringList status;
if (m_sharedMem) {
SharedMemBuffer const *shMem = SharedMemBuffer::getDataConst();
status += QString("comport : %1").arg(shMem->rs.comportName);
status += QString("baudrate : %1").arg(shMem->rs.baudNr);
status += QString("baudNr : %1").arg(shMem->rs.baudStr);
status += QString("connect : %1").arg(shMem->rs.connect);
status += QString("port open: %1").arg(shMem->rs.portIsOpen);
// to be continued
}
return status;
}
bool hwapi::dc_closeSerial(void) const {
epi_closeSerial();
for (int i = 0; i < 10; ++i) {