#ifndef STOREINDATA_H #define STOREINDATA_H #include #include "tslib.h" #include #define MAXNROF_AO 3 #define MAXNROF_GENSTR 16 #define MAXNROF_CONTR_PORTS 11 #define MAXNROF_DIports 2 #define MAXNROF_DOports 2 #define MAXNROF_CTR 2 #define MEASCHAN_TEMPERATURE 0 #define MEASCHAN_VOLTAGE 1 // gpi: DC-driver stores data for graphic peripheral interface // epi: gui reads values from external peripheral interface // store power on/off condition of the devices to control the data request void indat_storePrinterPower(bool isOn); bool indat_isPrinterOn(); void indat_storeMifarePower(bool isOn); bool indat_isMifareOn(); void indat_storeMDBisOn(bool isOn); bool indat_isMdbOn(); void gpi_storeHWver(QString text); QString epi_loadHWver(void); void gpi_storeSWver(QString text); QString epi_loadSWver(void); void gpi_storeDCstate(QString text); QString epi_loadDCstate(void); void gpi_storeUID(uint8_t const *buf8byteUid); //void gpi_storeUID(uint8_t *buf8byteUid); // buffer size: 8 byte void epi_getUIDdec(uint8_t *buf8byteUid); // buffer size: 8 byte QString epi_getUIDstr(); // /////////////////////////////////////////////////////////////////////////////////// // Time and Date // /////////////////////////////////////////////////////////////////////////////////// uint8_t epi_getSquareMode(); void gpi_backupSquareMode(uint8_t squMode); void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng); // 104, <=8byte void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss); void epi_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd); void epi_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday); bool epi_isLeapYear(uint8_t *lastLeapYear, uint8_t *NextLeapYear); bool epi_isLeapYear(); void epi_getSpecialWeekTimeDate(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek); void epi_getSpecialMonthTimeDate(uint8_t *DayOfMonth, uint16_t *HoursOfMonth, uint16_t *MinutesOfMonth); void epi_getSpecialYearTimeDate(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint32_t *MinutesOfYear); // /////////////////////////////////////////////////////////////////////////////////// // Analog values // /////////////////////////////////////////////////////////////////////////////////// void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata uint8_t gpi_getMaxNrAIs(); uint16_t epi_loadAIs(uint8_t aiNr); // Sdata -> gui // return value of one ADC with channel nr: aiNr 0...15 uint32_t epi_loadMeasureValue(uint8_t ValueNr); // ValueNr 0=ADC0, 1=ADC1 aso... void gpi_storeMeasureValue(uint8_t ValueNr, uint32_t val); // in mV, also bis 65,535V QString epi_getSlaveTemperatureStr(); QString epi_getSlaveVoltageStr(); // value in "meas_volt" in mV, also bis 65,535V. Value range [6000...16000] (6V...16V) // /////////////////////////////////////////////////////////////////////////////////// // digital inputs // /////////////////////////////////////////////////////////////////////////////////// void gpi_storeDI_doorSwitches(uint8_t upperDoor, uint8_t lowerDoor, uint8_t vaultDoor); uint8_t epi_getDI_doorSwitches(void); // bit0: upper door 1: low door 2:vault door void gpi_storeDI_vaultSwitches(uint8_t CashBoxIn, uint8_t BillBoxIn); uint8_t epi_getDI_vaultSwitches(void); // bit0: cash box 1: bill box in void gpi_storeDI_lockSwitches(uint8_t indatUL, uint8_t indatLL); // D5: bit 0: upper lockbar up bit1:down // D6: bit 0: lower lockbar up bit1:down uint8_t epi_getDI_lockSwitches(void); // retval: bit 0: upper lockbar up bit1: upper lockbar is down // bit 2: lower lockbar up bit1: lower lockbar is down void gpi_storeDI_optos(uint8_t indatOpto); // OptoIn bit 0,1: optoin 1,2 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); bool epi_getDI_ptuWake(void); void gpi_storeDI_mbdWake(uint8_t indat); bool epi_getDI_mdbWake(void); void gpi_storeDI_prnReady(uint8_t indat); bool epi_getDI_prnReady(void); void gpi_storeDI_CoinAttach(uint8_t indat); bool epi_getDI_CoinAttach(void); void gpi_storeDI_CoinEscrow(uint8_t indat); bool epi_getDI_CoinEscrow(void); void gpi_storeDI_mifareCardTapped(uint8_t indat); bool epi_getDI_mifareCardTapped(void); void gpi_storeDI_modemWake(uint8_t indat); bool epi_getDI_modemWake(void); void gpi_storeDI_contactPowerIsOn(bool di_contact_PwrOn); bool epi_getDI_contactPwr(void); void gpi_storeDI_MifarePowerIsOn(bool di_mifare_PwrOn); bool epi_getDI_mifarePwr(void); void gpi_storeDI_readbackMdbTxD(bool di_rdbkMdbTxd); bool epi_getDI_mdbTxd(void); void gpi_storeDI_AuxPowerIsOn(bool di_Aux_PwrOn); bool epi_getDI_auxPwr(void); void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn); bool epi_getDI_gsmPwr(void); void gpi_storeDI_CreditPowerIsOn(bool di_credit_PwrOn); bool epi_getDI_creditPwr(void); void gpi_storeDI_PrinterPowerIsOn(bool di_printer_PwrOn); bool epi_getDI_printerPwr(void); void gpi_storeDI_MdbPowerIsOn(bool di_mdb_PwrOn); bool epi_getDI_mdbPwr(void); void gpi_storeDI_rejMot_home(bool di); bool epi_getDI_rejectMotor_homepos(void); void 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); bool epi_getDO_mdbRxTestOut(void); void 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); // 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); 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); bool epi_getDO_sirene(void); bool epi_getDO_relay(void); void gpi_storeDO_ptuWake(uint8_t state); bool epi_getDO_ptuWake(void); void gpi_storeDO_auxPower(uint8_t pwr); bool epi_getDO_auxPower(void); void 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 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 epi_getDO_printerPwr(void); // --------------------------------------------------------------------------------------------- // counterchecks, make sure that DC-outputs are correct /* bool epi_cntchk_wakePtu(void); bool epi_cntchk_enabDrv01(void); // no communication possible if 0 !!!!! bool epi_cntchk_swRs1toModem(void); bool epi_cntchk_modemWake(void); bool epi_cntchk_enabDrv2(void); bool epi_cntchk_swRs2toMIF(void); bool epi_cntchk_shutterIsOpen(void); // counter check if shutter is really open, PJ4 must be OUT and HIGH, PB5 must be OUT and HIGH // retval TRUE: shutter is open FALSE: shutter is closed bool epi_cntchk_escrowReturnIsOpen(void); bool epi_cntchk_escrowTakeIsOpen(void); bool epi_cntchk_aux1DirOut(uint8_t auxNr); bool epi_cntchk_aux1OutHigh(uint8_t auxNr); bool epi_cntchk_ledPaperOn(void); bool epi_cntchk_ledPinpadOn(void); bool epi_cntchk_ledStartOn(void); bool epi_cntchk_ledServiceOn(void); bool epi_cntchk_ledCoinOn(void); bool epi_cntchk_ledIllumOn(void); bool epi_cntchk_FanOn(void); bool epi_cntchk_RelaisOn(void); bool epi_cntchk_LaermOn(void); bool epi_cntchk_Mot1Ron(void); bool epi_cntchk_Mot1Fon(void); bool epi_cntchk_Mot2Ron(void); bool epi_cntchk_Mot2Fon(void); */ // ------------------------------------------------------------------------------------ // MDB Sendind Data are store here for next transport to DC (Device Controller) // Transport to Slave runs every 100ms, answer from mdb-slave (e.g. coin changer) comes right // with next slave answer // start with: SENDDIRCMD_EXCHGMDB, // send crude data from here to DC, DC to mdb slaves, mdb answer, return here within 50ms 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 void gpi_clearMifHwData(void); void gpi_storeMifHwData(uint8_t *receivedData); // blkNr=0...11 receivedData[64] uint8_t epi_restoreMifHwData(uint8_t *buf, uint8_t maxBufferSize); // blkNr=0...11 return buf[64] // retval: 1=error 0=OK void gpi_clearMifAtbData(void); void gpi_storeMifAtbData(uint8_t *receivedData); uint8_t epi_restoreMifAtbData( uint8_t *buf, uint8_t maxBufferSize); void epi_restorePrinterState(uint8_t *buf); void gpi_storePrinterState(uint8_t *buf); void epi_restorePrinterFonts(uint8_t *buf); void gpi_storePrinterFonts(uint8_t *buf); void gpi_storeMdbState(uint8_t busReady, uint8_t V12on, uint8_t V5on ); bool epi_restoreMdbBusReady(void); bool epi_restoreMdbV12Ready(void); bool epi_restoreMdbV5Ready(void); void gpi_storeMdbResponse(uint8_t leng, uint8_t *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 // DB0: mdb Device-Nr // DB1: last sent mdb command // 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 epi_restoreEmpSettings(uint8_t *leng, uint8_t *data); /* void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data); void epi_restoreEmpCoinSignal(uint8_t *leng, uint8_t *data); // return 5 byte: // data[0]=got coin 0xFF=emp reported an error 0=got nothing // data[1]=emp-signal of last inserted coin // data[2,3]=emp-value of last inserted coin // data[4] = emp-error or warning void epi_clearEmpCoinSignal(); */ void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *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 epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data); void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *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); uint64_t epi_getWakeSources(void); uint8_t epi_getWakeReason(void); void gpi_storeExtendedTime(uint8_t leng, uint8_t *data); void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data); void epi_clearDeviceConditions(void); void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data); void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data); void epi_clearDynMachineConditions(void); // new, 24.6.23 void gpi_storeDynMachineConditions(void const *data); void epi_restoreDynMachineConditions(void *data); void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t *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 *data ); bool epi_checkIfVaultRecordAvailable(void); uint8_t epi_getLoadedVaultBlocks(void); // return 0x0011 1111 if all 6 blocks arer loaded (one bit per block) 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 *holder ); uint8_t epi_mifGetCardType(uint8_t *holder); //holder[8] = name of card holder // retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins void gpi_storeDcDataValid(bool isVal); bool epi_areDcDataValid(); void epi_setDcDataValid(void); void epi_resetDcDataValid(void); void epi_clearDynData(void); void gpi_storeDynData(uint8_t *DCdynDat); // buffer size: 64 byte bool epi_getDynPrnData(uint8_t *DCdynDat); // buffer size: 64 byte // return true if data are new and valid void gpi_storeNextDCaccNr(uint16_t nxtDcAccNr); uint16_t epi_getNextDCaccNr(void ); void gpi_storeMifCardType(uint16_t length, uint8_t *data); void epi_restoreMifCardType(uint16_t *length, uint8_t *data); // move here from dcBL and use shared mem as ptu-updater uses CAslave Lib 6.9.23TS //#define RAW_BL_DATALEN 150 void gpi_storeRawReceivedData(uint8_t RdDlen, uint8_t *receivedData); uint8_t epi_getRawReceivedData(uint8_t *receivedData); // retval=length, will be zeroed after first reading uint8_t epi_getRawRecLength(void); // retval=length //QString epi_getRawReceivedString(); // not used void epi_clrRawReceivedString(); // new from 28.9.23 and earliest from DC version 4.45 // store all versions of the DC-Jsons //#define numberOfJsons 36 //#define versionStringLength 16 //char store_jsonVersion[versionStringLength][numberOfJsons]; void gpi_storeJsonVersion(uint8_t jsonNr, uint8_t *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 void epi_getJsonVersion(uint8_t jsonNr, char *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 void epi_setNowCoinPay(bool on_off); bool gpi_getNowCoinPay(void); void epi_setNowIsBootload(bool on_off); bool gpi_getNowIsBootload(void); void gpi_storeChangerResult(uint8_t result, uint32_t amount); uint8_t epi_getChangerResult(uint32_t *returnedAmount); // 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 void gpi_storeTubeLevel(uint8_t *data); void epi_restoreTubeLevel(uint8_t *data); void gpi_storeBnaParams(uint8_t *data); void epi_restoreBnaParams(uint8_t *data); void gpi_storeBnaCollection(uint8_t *data); void epi_restoreBnaCollection(uint8_t *data); void gpi_storeBnaContent(uint8_t *data); void epi_restoreBnaContent(uint8_t *data); #endif