Massive change: using shared memory containing devcie controller variables.

This commit is contained in:
Gerhard Hoffmann 2023-04-18 12:18:12 +02:00
parent dc00c69b82
commit a7aa75ae5f

View File

@ -8,7 +8,7 @@
#define MAXNROF_AO 3
#define MAXNROF_GENSTR 16
//#define MAXNROF_GENSTR 16
#define MAXNROF_CONTR_PORTS 11
#define MAXNROF_DIports 2
#define MAXNROF_DOports 2
@ -32,9 +32,6 @@ bool indat_isMifareOn();
void indat_storeMDBisOn(bool isOn);
bool indat_isMdbOn();
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
uint8_t parity, uint8_t NrStopBits);
@ -43,23 +40,16 @@ void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
QString epi_getSlaveParamSTR();
void gpi_storeGenerals(uint8_t genNr, QString text);
// 0=HW 1=SW 2=State
QString epi_loadGenerals(uint8_t genNr);
// genNr=0=HW 1=SW 2=State
void gpi_storeUID(uint8_t *buf8byteUid);
void gpi_storeUID(uint8_t const *buf8byteUid);
// buffer size: 8 byte
void epi_getUIDdec(uint8_t *buf8byteUid);
// buffer size: 8 byte
QString epi_getUIDstr();
@ -89,7 +79,7 @@ void epi_getSpecialYearTimeDate(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint
// ///////////////////////////////////////////////////////////////////////////////////
#define MAXNROF_AI 4
// #define MAXNROF_AI 4
void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata
@ -138,185 +128,119 @@ void gpi_storeDI_optos(uint8_t indatOpto);
uint8_t epi_getDI_optos(void);
// bit0: opto in 1 1: opto in 2
void gpi_storeDI_auxIn(uint8_t indatAuxIn);
// Aux0...5
uint8_t epi_getDI_auxIn(void);
// bit0: auxin 1 ... 5: auxin 6
void gpi_storeDI_ptuWake(uint8_t indat);
uint8_t gpi_storeDI_auxIn(uint8_t indatAuxIn); // Aux0...5
uint8_t epi_getDI_auxIn(void); // bit0: auxin 1 ... 5: auxin 6
bool gpi_storeDI_ptuWake(bool w);
bool epi_getDI_ptuWake(void);
void gpi_storeDI_mbdWake(uint8_t indat);
bool gpi_storeDI_mbdWake(bool w);
bool epi_getDI_mdbWake(void);
void gpi_storeDI_prnReady(uint8_t indat);
bool gpi_storeDI_prnReady(bool ready);
bool epi_getDI_prnReady(void);
void gpi_storeDI_CoinAttach(uint8_t indat);
bool gpi_storeDI_CoinAttach(bool attach);
bool epi_getDI_CoinAttach(void);
void gpi_storeDI_CoinEscrow(uint8_t indat);
bool gpi_storeDI_CoinEscrow(bool ce);
bool epi_getDI_CoinEscrow(void);
void gpi_storeDI_mifareCardTapped(uint8_t indat);
bool gpi_storeDI_mifareCardTapped(bool tapped);
bool epi_getDI_mifareCardTapped(void);
void gpi_storeDI_modemWake(uint8_t indat);
bool gpi_storeDI_modemWake(bool w);
bool epi_getDI_modemWake(void);
void gpi_storeDI_contactPowerIsOn(bool di_contact_PwrOn);
bool gpi_storeDI_contactPowerIsOn(bool on);
bool epi_getDI_contactPwr(void);
void gpi_storeDI_MifarePowerIsOn(bool di_mifare_PwrOn);
bool gpi_storeDI_MifarePowerIsOn(bool on);
bool epi_getDI_mifarePwr(void);
void gpi_storeDI_readbackMdbTxD(bool di_rdbkMdbTxd);
bool gpi_storeDI_readbackMdbTxD(bool rdbkMdbTxd);
bool epi_getDI_mdbTxd(void);
void gpi_storeDI_AuxPowerIsOn(bool di_Aux_PwrOn);
bool gpi_storeDI_AuxPowerIsOn(bool on);
bool epi_getDI_auxPwr(void);
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn);
bool gpi_storeDI_GsmPowerIsOn(bool on);
bool epi_getDI_gsmPwr(void);
void gpi_storeDI_CreditPowerIsOn(bool di_credit_PwrOn);
bool gpi_storeDI_CreditPowerIsOn(bool on);
bool epi_getDI_creditPwr(void);
void gpi_storeDI_PrinterPowerIsOn(bool di_printer_PwrOn);
bool gpi_storeDI_PrinterPowerIsOn(bool on);
bool epi_getDI_printerPwr(void);
void gpi_storeDI_MdbPowerIsOn(bool di_mdb_PwrOn);
bool gpi_storeDI_MdbPowerIsOn(bool on);
bool epi_getDI_mdbPwr(void);
void gpi_storeDI_rejMot_home(bool di);
bool gpi_storeDI_rejMot_home(bool reject);
bool epi_getDI_rejectMotor_homepos(void);
void gpi_storeDI_paperLow(uint8_t di);
uint8_t gpi_storeDI_paperLow(uint8_t di);
uint8_t epi_getDI_npe_sensor(void);
// 0: Sensor sees paper 1: no paper 99: off
// ///////////////////////////////////////////////////////////////////////////////////
// readback digital outputs
// ///////////////////////////////////////////////////////////////////////////////////
void gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
uint8_t gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
bool epi_getDO_mdbRxTestOut(void);
void gpi_storeDO_motorOutputs(uint8_t Pwr);
uint8_t gpi_storeDO_motorOutputs(uint8_t Pwr);
uint8_t epi_getDO_motorOuts(void);
// bit0: upper lock forward bit 1 backward
// bit2: lower lock forward bit 3 backward
void gpi_storeDO_serialSwitch(uint8_t state);
uint8_t gpi_storeDO_serialSwitch(uint8_t state);
// serial drv on/off, Serial mux1, Serial mux2
uint8_t epi_getDO_serialSwitch(void);
// serial drv on/off, Serial mux1, Serial mux2
bool epi_getDO_serialDriverIsOn(void);
bool epi_getDO_serialMux1isSetToPrinter(void);
// mux1 off: serial is switched to printer
bool epi_getDO_serialMux1isSetToModem(void);
// mux1 on: serial is switched to modem
bool epi_getDO_serialMux2isSetToCredit(void);
// mux2 off: serial is switched to credit card terminal
bool epi_getDO_serialMux2isSetToMifare(void);
// mux2 on: serial is switched to mifare reader
void gpi_storeDO_ledsAndFan(uint8_t ledState);
uint8_t gpi_storeDO_ledsAndFan(uint8_t ledState);
bool epi_getDO_led_coin(void);
bool epi_getDO_led_front(void);
bool epi_getDO_led_ticket(void);
bool epi_getDO_led_pin(void);
bool epi_getDO_led_start(void);
bool epi_getDO_led_inside(void);
bool epi_getDO_fan(void);
void gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
uint8_t gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
bool epi_getDO_sirene(void);
bool epi_getDO_relay(void);
void gpi_storeDO_ptuWake(uint8_t state);
uint8_t gpi_storeDO_ptuWake(uint8_t state);
bool epi_getDO_ptuWake(void);
void gpi_storeDO_auxPower(uint8_t pwr);
uint8_t gpi_storeDO_auxPower(uint8_t pwr);
bool epi_getDO_auxPower(void);
void gpi_storeDO_coinShutter(uint8_t state);
uint8_t gpi_storeDO_coinShutter(uint8_t state);
bool epi_getDO_coinShutterOpen(void);
bool epi_getDO_coinShutterTest(void);
void gpi_storeDO_coinEscrow(uint8_t state);
uint8_t gpi_storeDO_coinEscrow(uint8_t state);
uint8_t epi_getDO_coinEscrow(void);
// retval: 1:return flap is open 2:take flap is open 0:closed
void gpi_storeDO_printerPwrOn(uint8_t state);
uint8_t gpi_storeDO_printerPwrOn(uint8_t state);
uint8_t epi_getDO_printerPwr(void);
// ---------------------------------------------------------------------------------------------
// counterchecks, make sure that DC-outputs are correct
@ -363,21 +287,14 @@ bool epi_cntchk_Mot2Fon(void);
uint8_t gpi_storeMdbRecData(uint8_t length, uint8_t *buf);
// datif store received mdb data
uint8_t epi_getMdbResponse(void);
// 0=no response 1=ACK 2=NAK 3=ACK with data
uint8_t epi_getMdbRecLength(void);
// 0...31
uint8_t epi_restoreMdbRecData(uint8_t *buf);
// hwapi reads received mdb data from PI
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t *buf);
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t const *buf);
/* data description:
byte 0: current read state: 0=power off 1=reader-fault 2=ready
@ -401,41 +318,24 @@ byte 32: result, always 0
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize);
// retval 0=OK 1=error host buffer too small
void gpi_storeMifCardData(uint8_t blkNr, uint8_t *receivedData);
bool gpi_storeMifCardData(uint8_t blkNr, uint8_t const *receivedData);
// blkNr=0...11 receivedData[64]
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
// blkNr=0...11 return buf[64]
// retval: 1=error 0=OK
#define pi_prnStateArraySize 20
#define pi_prnFontArraySize 20
void epi_restorePrinterState(uint8_t *buf);
void gpi_storePrinterState(uint8_t *buf);
void gpi_storePrinterState(uint8_t const *buf);
void epi_restorePrinterFonts(uint8_t *buf);
void gpi_storePrinterFonts(uint8_t const *buf);
void gpi_storePrinterFonts(uint8_t *buf);
void gpi_storeMdbState(uint8_t busReady, uint8_t V12on, uint8_t V5on );
bool gpi_storeMdbState(bool busReady, bool V12on, bool V5on);
bool epi_restoreMdbBusReady(void);
bool epi_restoreMdbV12Ready(void);
bool epi_restoreMdbV5Ready(void);
void gpi_storeMdbResponse(uint8_t leng, uint8_t *data);
void gpi_storeMdbResponse(uint8_t leng, uint8_t const *data);
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
// last received mdb answer (from mdb device)
// only needed if a special command was sent directly
@ -444,12 +344,9 @@ void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
// DB3...DB38: rec.data (payload)
void gpi_storeEmpSettings(uint8_t leng, uint8_t *data);
void gpi_storeEmpSettings(uint8_t leng, uint8_t const *data);
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data);
/*
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
@ -463,67 +360,60 @@ void epi_restoreEmpCoinSignal(uint8_t *leng, uint8_t *data);
void epi_clearEmpCoinSignal();
*/
#define MEMDEPTH_GOTCOINS 16
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t const *data);
uint8_t epi_isNewCoinLeft(void);
// retval: 0...16 coins left in FIFO
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value);
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data);
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t const *data);
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *data);
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t const *data);
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
void epi_clearCurrentPayment(void);
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue);
uint32_t epi_CurrentPaymentGetAmount(void);
uint16_t epi_CurrentPaymentGetLastCoin(void);
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
void gpi_storeWakeSources(uint8_t *receivedData);
void gpi_storeWakeSources(uint8_t const *receivedData);
uint64_t epi_getWakeSources(void);
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data);
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data);
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data);
void gpi_storeDeviceConditions(uint8_t leng, uint8_t const *data);
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t const *data);
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t const *data);
void epi_restoreDCbackupAccNr(uint8_t *leng, uint16_t *accNrs);
// return accNrs[0..7]
void epi_iniVRstorage(void);
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t const *data);
bool epi_checkIfVaultRecordAvailable(void);
bool epi_restoreVaultRecord(uint16_t *length, uint8_t *buf);
// true if completly received
void gpi_storeCBlevel(uint32_t amount, uint16_t nrOfCoins);
uint32_t epi_getCashBoxContent(void);
uint16_t epi_getNrOfCoinsInCashBox(void);
void gpi_storeNewMifareCard(uint8_t typ, uint8_t const *holder);
uint8_t epi_mifGetCardType(uint8_t const *holder);
//holder[8] = name of card holder
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
#endif