Added/merged from sources of Thomas (version CashAgentLib 3.3, 12.04.2023)

This commit is contained in:
Gerhard Hoffmann 2023-04-13 10:55:37 +02:00
parent debade9942
commit c1b945225b
11 changed files with 2412 additions and 254 deletions

View File

@ -1,4 +1,23 @@
/*
matching interfaces.h:
// History
// 11.10.2021: V1.0 222 functions
// 23.12.2021: V1.1 added block-parameter to function "read mifare data"
// 30.12.2021: V1.2 added function: mif_clearDataBuffer(), mif_isBlockAvailable(uint8_t blkNr) and mif_getAvailableDataBlocks()
// 1.1.2022: V1.3 Mifare extended. ( background: read 16 x 48byte from card to DC, read 12 x 64byte from DC to CA)
// new: read full card with 768bytes from HWapi without block borders
// added: mif_getNrOfAvailableDataBytes mif_getCardData768byteDec(uint8_t *buf, uint16_t bufferSize)
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
// mif_getCardDataStr(bool useHexFormat, char seperator)
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
// V3.2 Bootloader improvement
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
PSA1259 hardware control using the DeviceController DC2
@ -37,7 +56,7 @@ Level 3:
start/stop complete processes.
Example: 1) print (predefined) document nr 3 with Text, letter size, font set, cut.
Also power up/down the printer, check if paper ok and so on.
*/
*/
/*
Another access example: control the coin unit
@ -71,93 +90,11 @@ Level 3): send command: "start payment process"
#include <QTabWidget>
#include <QtPlugin>
#include <QObject>
#include <../plugins/interfaces.h>
#include "interfaces.h"
#include "datIf.h"
//public QWidget,
/*
struct Tprn_hw_state
{
// hardware (IO's)
bool powerRdBk; // prn pwr is on
bool rsSwOk; // serial switch (printer or modem) is set to printer
bool rsDrvOk; // RS232 converter for PTU, Printer and Modem in on
bool ReadyLine; // HW signal from printer showing ready
bool inIdle; // powered and free from errors
bool paperNearEnd; // paper roll runs out
bool noPaper;
bool ErrorTemp;
bool HeadOpen;
bool cutterJam;
bool noResponse; // printer is not connected, cable broken, wrong baudrate
bool badResponse;
};
struct Tprn_currentSettings
{
uint8_t currFont;
uint8_t currSize;
uint8_t currHeigth;
uint8_t currWidth;
bool nowBold;
bool nowInvers;
bool nowUnderlined;
uint8_t currDensity;
uint8_t currSpeed;
bool nowAligned;
};
struct T_dynDat
{
uint8_t licensePlate[8];
uint8_t vendingPrice[8];
uint8_t parkingEnd[8];
uint8_t currentTime[8];
uint8_t currentDate[8];
uint8_t dynDat5[8];
uint8_t dynDat6[8];
uint8_t dynDat7[8];
};
struct T_emp
{
// Fixdata from EMP:
uint8_t shaft; // = changer level
uint16_t countryCode;
uint8_t scale;
uint8_t decimals;
uint8_t coinValues[16];
uint16_t routing;
// Master specs:
uint8_t gotSetup; // 1: got specifications from master 0: no specs
uint16_t coinAccept; // bit 0 = coin1 bit H=accept
uint8_t tokenChannel;
uint16_t denomination[16];
// dynamic:
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
// 0=Emp & Bus power off, 1=powered, poll off 2=polling on
// 3=device responded, requesting status
// 4=waiting for status 5=have status,
// 6: IDLE, have paramters from master, polling running, ready for payment
// Master can stop/start polling and acceptance
// 7: end of transaction, polling on, accept off, reporting coins, (wait for last coin)
// 8: transaction running, polling on, acceptance on, reporting coins,
uint8_t pollingRunning;
uint8_t paymentRunning;
};
*/
class hwapi : public QObject,
public hwinf
{
@ -182,6 +119,7 @@ public:
T_datif *myDatif;
// ------------------------------------------------------------------------------
// Level 0 commands, interface
// open, close, change serial interface
@ -258,7 +196,6 @@ public:
QString dc_getState(void) const override;
// neu, 25.8.21
QString dc_getTxt4RsDiagWin(void) const override;
void dc_clrTxt4RsDiagWin(void) const override;
QString dc_get2ndTxt4RsDiagWin(void) const override;
@ -295,13 +232,6 @@ public:
uint8_t bl_exitBL(uint8_t *sendData) const override;
// minimum size of sendData-buffer: 5byte retval: length
// ------------------------------------------------------------------------------
// Level 2 DC2-onboard devices
// WR: set time
@ -983,7 +913,7 @@ public:
// return true is bl is up and running
// also initializes "sendFile"
void bl_sendAddress(u_int16_t blockNumber) const override;
void bl_sendAddress(uint16_t blockNumber) const override;
// 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
@ -993,7 +923,7 @@ public:
void bl_openBinary(void) const override;
void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override;
void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const override;
// send 64 byte from bin file
void bl_sendLastBlock(void) const override;
@ -1003,61 +933,52 @@ public:
void bl_stopBL(void) const override;
// Bootlader, not used or obsolete
//bool bl_isDiagAvailable(void) const override;
//QString dc_getDiagText(void) const override;
// Komplett-schreib Funktion, noch nicht getestet
// Nachteil: keine Rückmeldung wie lang's noch dauert
//void bl_startSending(void) const override;
//void bl_sendFile(void) const override;
/*
// neu, ab 6.4.23
// bereits vorhanden, nochmal getestet/verbessert:
// void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const override;
// void alarm_switchSiren(bool on) const override;
// neu, 25.8.21
QString dc_getTxt4RsDiagWin(void) const override;
void dc_clrTxt4RsDiagWin(void) const override;
QString dc_get2ndTxt4RsDiagWin(void) const override;
void dc_clr2ndTxt4RsDiagWin(void) const override;
QString dc_getTxt4HsStateLine(void) const override;
void dc_clrTxt4HsStateLine(void) const override;
QString dc_getTxt4masterStateLine(void) const override;
void dc_clrTxt4masterStateLine(void) const override;
QString dc_getTxt4resultStateLine(void) const override;
void dc_clrTxt4resultStateLine(void) const override;
QString dc_getdataStateLine(void) const override;
void dc_clrTxt4dataStateLine(void) const override;
QString dc_getdatifLine(void) const override;
void dc_clrTxt4datifLine(void) const override;
// void mif_readerOn(bool on) const override;
// bool mif_cardIsAttached(void) const override;
// using DC2 Bootloader
void bl_iniChain(void) const override;
bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const override;
uint8_t bl_activatBootloader(uint8_t *sendData) const override;
uint8_t bl_startChain(void) const override;
uint8_t bl_readBLversion(uint8_t *sendData) const override;
// minimum size of sendData-buffer: 5byte retval: length
uint8_t bl_readFWversion(uint8_t *sendData) const override;
// minimum size of sendData-buffer: 5byte retval: length
// void shut_move(bool open) const override;
// void esc_moveFlaps(uint8_t flap ) const override;
// 0: close both 1: open take-flap 2: open return
// void shut_openOnce(void) const override;
// and close automatic after shutter time
// void shut_openForCoin(bool start) const override;
// open flap if coin is attached
// once process is started it runs until stop command
// void shut_sendOpeningTime(uint16_t timeIn_ms ) const override;
// after this time without retrigger the flap is closed
// void esc_takeMoney(void) const override;
// and close automatically after escrow time (1s)
// void esc_returnMoney(void) const override;
// and close automatically after escrow time (1s)
uint8_t bl_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const override;
// 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
// void prn_switchPower(bool on) const override;
// void prn_sendText(QByteArray *buf) const override;
// up to 1280 bytes
uint8_t bl_exitBL(uint8_t *sendData) const override;
// minimum size of sendData-buffer: 5byte retval: length
*/
// uint8_t rtc_setDateTime(void) const override;
// send system time
//void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker,
// uint8_t kindOfMifareReader, uint8_t suppressSleep,
// uint8_t kindOfModem, uint8_t kindOfCredit ) const override;
//void sendMachineID(uint16_t customerNr, uint16_t machineNr,
// uint16_t borough, uint16_t zone,
// uint16_t alias, char *location) const override;
/*
uint8_t emp_getInsertedCoinSignal(void) const override;
@ -1073,6 +994,96 @@ public:
// emp_chkIfCoinInserted() must be called before!
*/
bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const override;
// return true if successful. could fail if more the 8 commands are waiting
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
bool sys_runCompleteTest(void) const override;
// warning: lasts 20s in one pace
bool sys_ready4sending(void) const override;
// return true if a Json-file can be sent
bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const override;
// 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
bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
// 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
bool prn_printTemplate(uint8_t nrOftemplate) const override;
// print one of the templates loaded by Json prior
// nr = 1..32
// return true if sending, false if cmd-stack is full
void log_getHoldAccountNumbers(uint32_t *accNr ) const override;
// returns all acc nrs of the backuped vault records
// use: uint32_t backupedAccNumbers[8]
bool log_selectVaultRecord(uint16_t accountNr ) const override;
// return true if sending, false if cmd-stack is full
//request, isAvailable
void log_getVaultRecord(struct T_vaultRecord *retVR) const override;
// which was selected by: log_selectVaultRecord()
// to be forwarded to Ismas
bool prn_printAccountReceipt(void) const override;
// return true if sending to DC OK, false if cmd-stack is full
bool prn_printTestTicket(void) const override;
// return true if sending to DC OK, false if cmd-stack is full
bool cash_startPayment(uint16_t amount) const override;
bool cash_cancelPayment(void) const override;
// and return coins
bool cash_stopPayment(void) const override;
// and keep coins in escrow
uint32_t getInsertedAmount(void) const override;
uint16_t getLastInsertedCoin(void) const override;
bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const override;
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert, max 64
// after ticket/goods issue:
bool vend_success(void) const override;
// conclude payment process, encash all inserted coins to vault. Printing was successful
// if possible return change
bool vend_failed(void) const override;
// conclude payment process and return all inserted coins
uint8_t mif_getCardType(QString cardholder) const override;
// return 1,2,3,4 = upper, lower access card, printer test, coin test
// cardholder: 7byte Name-String
uint64_t sys_getWakeSource(void) const override;
// retval: 6 bytes, bit coded, 1=event keeps DC awake
//void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
//void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
private:
void sub_storeSendingText(QByteArray *buf) const;
@ -1081,27 +1092,6 @@ private:
/*
// Modem:
uint8_t mod_power(bool on) const override;
uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
uint8_t mod_setCondition(uint16_t chgCmd) const override; // e.g. change to state registered, sleep, open, off....
uint16_t mod_getCondition(void) const override; // e.g. now socket open
bool mod_sendBufferFree(void) const override; // sending allowed (before writing) and sending finished (after writing)
uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
void mod_wantReadData(uint16_t nrOfData) const override; // start reading
uint16_t mod_gotData(void) const override; // return nr of received bytes
uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
// Credit Card Terminal:
uint8_t cc_power(bool on) const override;
uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) const override;
*/
};
@ -1110,8 +1100,6 @@ private:
/*
// Coin checker and changer mdb4.2 / section 5
// Level 2 Commands (predefined device msg acc. mdb manual and auto-poll)
@ -1229,3 +1217,23 @@ struct Tcc_hw_state
*/
/*
// not yet implemented
uint8_t mod_power(bool on) const override;
uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
uint8_t mod_setCondition(uint16_t chgCmd) const override; // e.g. change to state registered, sleep, open, off....
uint16_t mod_getCondition(void) const override; // e.g. now socket open
bool mod_sendBufferFree(void) const override; // sending allowed (before writing) and sending finished (after writing)
uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
void mod_wantReadData(uint16_t nrOfData) const override; // start reading
uint16_t mod_gotData(void) const override; // return nr of received bytes
uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
// Credit Card Terminal:
uint8_t cc_power(bool on) const override;
uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) const override;
*/

View File

@ -93,6 +93,172 @@ struct Tprn_hw_state
};
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 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;
//16
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
//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;
// 56
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;
// 64
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
uint8_t structStart; // always first!!!
uint8_t ram; // v
uint8_t intEe; // v
uint8_t extEe; // v
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
uint8_t boardHw; // v
uint8_t printer; // v
uint8_t modem; // v
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; // v
uint8_t mifareReader; // v
uint8_t creditTerm; // not available
uint8_t coinReject; // v
uint8_t coinSafe; // v
uint8_t billSafe; // v
uint8_t voltage; // v // 1:11..14V
uint8_t temper; // v
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;
};
struct T_dynamicCondition
{
// dynamic conditions, change rapidly and frequently
// these are values for the Heartbeat
// T?rschalter entprellt:
char upperDoor; // 0:fehlt 1:drin
char middleDoor;
char lowerDoor;
char coinBox;
char billBox;
char modeAbrech;
char onAlarm;
char nowCardTest;
char nowPayment;
char lastMifCardType;
char openedAuthorized;
char allDoorsDebounced;
uint8_t lastSDoorState;
uint8_t lastVDoorState;
uint8_t CBinDebounced;
uint8_t lastCBstate;
char paymentInProgress;
char res1;
char res2;
char res3;
uint16_t U_Batt;
uint16_t Temperatur;
uint16_t cash_storedaccNumbers[8]; // List all stored accounting numbers in ext. eeprom
uint16_t nrCoinsInBox;
uint16_t resui1;
uint32_t amountInBox;
uint32_t amountJustPaid;
uint16_t lastInsCoinType; // wahrscheinlich uchar
uint16_t resui2;
uint32_t totalTransVolume;
uint32_t totalNrOfVends;
};
class hwinf
{
@ -101,6 +267,8 @@ public:
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
virtual ~hwinf() {}
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Use serial interface and protocol stack in Cashagent-Library
@ -123,6 +291,8 @@ public:
virtual bool dc_isPortOpen(void) const =0;
// returns true if port open (don't send unless open. Sending to closed port will crash program)
virtual uint8_t test_serialState(void) const =0;
// test on-board signals for the serials
@ -439,11 +609,31 @@ public:
virtual void request_ReadbackDeviceSettings() const =0;
virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0;
// 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
// byte[4]=kindOfModem byte[5]=kind of cc terminal
/*
buf66[0]=devPara.kindOfPrinter;
buf66[1]=devPara.kindOfCoinChecker;
buf66[2]=devPara.kindOfMifareReader;
buf66[3]=devPara.suppressSleepMode;
buf66[4]=devPara.kindOfModem;
buf66[5]=devPara.kindOfCreditcard;
buf66[6]=devPara.CoinEscrow;
buf66[7]=devPara.CoinRejectUnit;
buf66[8]=devPara.CoinShutter;
buf66[9]=devPara.BillAcceptor;
buf66[10]=devPara.usevaultLock;
buf66[11]=devPara.autoAlarm;
buf66[12]=devPara.autoOpen;
buf66[13]=devPara.printAccReceipt;
buf66[14]=devPara.printDoorReceipt;
buf66[15]=devPara.printTokenTicket;
uitmp=devPara.VaultFullWarnLevel;
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=devPara.VaultFullErrorLevel;
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
*/
virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
uint16_t borough, uint16_t zone,
@ -455,8 +645,8 @@ public:
// 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
// 12.4.23TS still the same
// 9
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Printer
@ -1053,7 +1243,7 @@ public:
// return true is bl is up and running
// also initializes "sendFile"
virtual void bl_sendAddress(u_int16_t blockNumber) const=0;
virtual void bl_sendAddress(uint16_t blockNumber) const=0;
// send start address, nr of 64byte-block, start with 0
// will be sent only for following block-numbers:
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
@ -1065,7 +1255,7 @@ public:
virtual void bl_openBinary(void) const=0;
// to be used within CashAgent, momentary not processed
virtual void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const=0;
virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const=0;
// send 64 byte from bin file
virtual void bl_sendLastBlock(void) const=0;
@ -1091,6 +1281,266 @@ public:
// ------------------------------------------------------------------------------------
// 6.4.2023: new functions for coin collection and printing
// some new system functions
// ------------------------------------------------------------------------------------
virtual bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const=0;
// return true if sending, false if cmd-stack is full
virtual bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const=0;
/*
buf[0]=GlobTime.Hours;
buf[1]=GlobTime.Min;
buf[2]=GlobTime.Sec;
buf[3]=GlobTime.Year;
buf[4]=GlobTime.Month;
buf[5]=GlobTime.Day;
buf[6]=GlobTime.DOW;
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
uitmp=GlobTime.MinOfDay;
buf[8]=swl_getOneByteFromUint(uitmp, 0);
buf[9]=swl_getOneByteFromUint(uitmp, 1);
buf[10]=' ';
buf[11]=' ';
ultmp=GlobTime.SecOfDay;
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
buf[16]=swl_isLeap(GlobTime.Year);
buf[17]=swl_getNextLeapYear(GlobTime.Year);
buf[18]=swl_getLastLeapYear(GlobTime.Year);
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
buf[21]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
buf[22]=swl_getOneByteFromUint(uitmp, 0);
buf[23]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
buf[24]=swl_getOneByteFromUint(uitmp, 0);
buf[25]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
buf[26]=swl_getOneByteFromUint(uitmp, 0);
buf[27]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
buf[28]=swl_getOneByteFromUint(uitmp, 0);
buf[29]=swl_getOneByteFromUint(uitmp, 1);
buf[30]=0;
buf[31]=0;
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
GlobTime.Hours, GlobTime.Min);
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
buf[36]=rtc_getSqwaveSettings();
buf[37]=0;
buf[38]=0;
buf[39]=0;
ultmp= 0; // Minutes of the Millenium
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
dc2prot_setReadData(44, buf);
*/
virtual bool sys_runCompleteTest(void) const=0;
// warning: lasts 20s in one pace
// return true if sending, false if cmd-stack is full
virtual bool sys_ready4sending(void) const=0;
// 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 true if sending, false if cmd-stack is full
virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const=0;
// 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 void log_getHoldAccountNumbers(uint32_t *accNr ) const=0;
// returns all acc nrs of the backuped vault records
// use: uint32_t backupedAccNumbers[8]
virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
// return true if sending, false if cmd-stack is full
//request, isAvailable
virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
// which was selected by: log_selectVaultRecord()
// to be forwarded to Ismas
virtual bool prn_printAccountReceipt(void) const=0;
// 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 cash_startPayment(uint16_t amount) const=0;
virtual uint32_t getInsertedAmount(void) const=0;
virtual uint16_t getLastInsertedCoin(void) const=0;
virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const=0;
// all inserted coins (max 64) since "cash_startPayment"
virtual bool cash_cancelPayment(void) const=0;
// and return coins
virtual bool cash_stopPayment(void) const=0;
// 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_failed(void) const=0;
// 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 uint64_t sys_getWakeSource(void) const =0;
// retval: 6 bytes, bit coded, 1=event keeps DC awake
//virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
/*
outBuf[0]=modCond.ram;
outBuf[1]=modCond.intEe;
outBuf[2]=modCond.extEe;
outBuf[3]=modCond.rtc;
outBuf[4]=modCond.boardHw;
outBuf[5]=modCond.printer;
outBuf[6]=modCond.modem;
outBuf[7]=modCond.signal;
outBuf[8]=modCond.regist;
outBuf[9]=modCond.mdbBus;
outBuf[10]=modCond.coinChecker;
outBuf[11]=modCond.coinEscrow;
outBuf[12]=modCond.mifareReader;
outBuf[13]=modCond.creditTerm;
outBuf[14]=modCond.coinReject;
outBuf[15]=modCond.coinSafe;
outBuf[16]=modCond.billSafe;
outBuf[17]=modCond.voltage;
outBuf[18]=modCond.temper;
outBuf[19]=modCond.poweronTest;
outBuf[20]=modCond.doorState;
outBuf[21]=modCond.doorWasOpened;
outBuf[22]=modCond.changer;
outBuf[23]=modCond.coinBlocker;
outBuf[24]=modCond.billReader;
outBuf[25]=modCond.ResetReason;
outBuf[26]=modCond.allModulesChecked;
outBuf[27]=modCond.alarmState;
outBuf[28]=0;
outBuf[29]=0;
*/
//virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
/*
outBuf[pBuf++]=dynCond.allDoorsDebounced;
outBuf[pBuf++]=dynCond.openedAuthorized;
outBuf[pBuf++]=dynCond.CBinDebounced;
outBuf[pBuf++]=dynCond.upperDoor;
outBuf[pBuf++]=dynCond.middleDoor;
outBuf[pBuf++]=dynCond.lowerDoor;
outBuf[pBuf++]=dynCond.coinBox;
outBuf[pBuf++]=dynCond.billBox;
outBuf[pBuf++]=dynCond.modeAbrech;
outBuf[pBuf++]=dynCond.onAlarm;
outBuf[pBuf++]=dynCond.nowCardTest;
outBuf[pBuf++]=dynCond.nowPayment;
outBuf[pBuf++]=dynCond.lastMifCardType;
outBuf[pBuf++]=dynCond.lastSDoorState;
outBuf[pBuf++]=dynCond.lastVDoorState;
outBuf[pBuf++]=dynCond.lastCBstate;
outBuf[pBuf++]=dynCond.paymentInProgress;
outBuf[pBuf++]=0;
uitmp=dynCond.U_Batt;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.Temperatur;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.nrCoinsInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
ultmp=dynCond.amountInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalTransVolume;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalNrOfVends;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
// 36
outBuf[pBuf++]=dynCond.jsonValid_config;
outBuf[pBuf++]=dynCond.jsonValid_device;
outBuf[pBuf++]=dynCond.jsonValid_cash;
outBuf[pBuf++]=dynCond.jsonValid_print;
outBuf[pBuf++]=dynCond.jsonValid_serial;
outBuf[pBuf++]=dynCond.jsonValid_time;
outBuf[pBuf++]=dynCond.lastFileType;
outBuf[pBuf++]=0;
*/
};
@ -1104,8 +1554,15 @@ public:
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
// mif_getCardDataStr(bool useHexFormat, char seperator)
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
// V3.2 Bootloader improvement
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)

View File

@ -211,6 +211,25 @@ uint8_t gpi_getUserOfSendingTextBuffer(uint8_t *para1, uint8_t *para2, uint8_t *
// user=1: Text-Print is using this buffer
// 2: QR-code-Printer is using this buffer
#define FDCMD_STACKDEPTH 16
void sendFDcmd_clrStack(void);
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
// write Command to memory, wait for transport
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
uint8_t check4FDshortCmd(void);
// returns number of waiting command
#define FDLONG_STACKDEPTH 16
void longFDcmd_clrStack(void);
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
// write Command to memory, wait for transport
// data buffer size always 64! data[64], padded with 0
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
uint8_t check4FDlongCmd(void);
// returns number of waiting command
#endif

View File

@ -73,7 +73,7 @@ QString epi_getUIDstr();
uint8_t epi_getSquareMode();
void gpi_backupSquareMode(uint8_t squMode);
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng);
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);
@ -474,15 +474,57 @@ void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, u
void gpi_storeDeviceSettings(uint8_t leng, uint8_t *data);
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data);
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
void epi_restoreDeviceSettings(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);
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data);
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data);
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
#endif

View File

@ -59,6 +59,7 @@ void GetShortDateString(uint8_t day, uint8_t month, uint8_t yearlow, uint8_t for
uint16_t tslib_strlen(char *buf);
uint16_t tslib_strlen(uint8_t *buf);
void tslib_strclr(char *buf, char clrsign, uint16_t len);
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
@ -79,6 +80,8 @@ int tslib_getMinimum(int val1, int val2);
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
// usage: tslib_text2array("my text", ctmp, 50);
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len);
// both buffers starting from pos 0
#endif // TSLIB_H

View File

@ -93,11 +93,179 @@ struct Tprn_hw_state
};
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 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;
//16
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
//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;
// 56
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;
// 64
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
uint8_t structStart; // always first!!!
uint8_t ram; // v
uint8_t intEe; // v
uint8_t extEe; // v
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
uint8_t boardHw; // v
uint8_t printer; // v
uint8_t modem; // v
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; // v
uint8_t mifareReader; // v
uint8_t creditTerm; // not available
uint8_t coinReject; // v
uint8_t coinSafe; // v
uint8_t billSafe; // v
uint8_t voltage; // v // 1:11..14V
uint8_t temper; // v
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;
};
struct T_dynamicCondition
{
// dynamic conditions, change rapidly and frequently
// these are values for the Heartbeat
// T?rschalter entprellt:
char upperDoor; // 0:fehlt 1:drin
char middleDoor;
char lowerDoor;
char coinBox;
char billBox;
char modeAbrech;
char onAlarm;
char nowCardTest;
char nowPayment;
char lastMifCardType;
char openedAuthorized;
char allDoorsDebounced;
uint8_t lastSDoorState;
uint8_t lastVDoorState;
uint8_t CBinDebounced;
uint8_t lastCBstate;
char paymentInProgress;
char res1;
char res2;
char res3;
uint16_t U_Batt;
uint16_t Temperatur;
uint16_t cash_storedaccNumbers[8]; // List all stored accounting numbers in ext. eeprom
uint16_t nrCoinsInBox;
uint16_t resui1;
uint32_t amountInBox;
uint32_t amountJustPaid;
uint16_t lastInsCoinType; // wahrscheinlich uchar
uint16_t resui2;
uint32_t totalTransVolume;
uint32_t totalNrOfVends;
};
class hwinf
{
public:
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
virtual ~hwinf() {}
@ -110,18 +278,18 @@ public:
// Furthermore the Cashagent-Library answers with status strings about sending and reading result
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
virtual void 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 = 0;
// 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 bool dc_closeSerial(void) const = 0;
// 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 =0;
// returns true if port open (don't send unless open. Sending to closed port will crash program)
@ -132,7 +300,10 @@ public:
virtual bool test_serialIsOn(void) const =0;
virtual bool dc_updateDC(QString binFileName,
QString baudrate,
QString comPort) const = 0;
// download binary file down into device controller
virtual void dc_autoRequest(bool on) const =0;
// on = true: select that all READ-Requests are sent automatically
@ -438,11 +609,31 @@ public:
virtual void request_ReadbackDeviceSettings() const =0;
virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0;
// 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
// byte[4]=kindOfModem byte[5]=kind of cc terminal
/*
buf66[0]=devPara.kindOfPrinter;
buf66[1]=devPara.kindOfCoinChecker;
buf66[2]=devPara.kindOfMifareReader;
buf66[3]=devPara.suppressSleepMode;
buf66[4]=devPara.kindOfModem;
buf66[5]=devPara.kindOfCreditcard;
buf66[6]=devPara.CoinEscrow;
buf66[7]=devPara.CoinRejectUnit;
buf66[8]=devPara.CoinShutter;
buf66[9]=devPara.BillAcceptor;
buf66[10]=devPara.usevaultLock;
buf66[11]=devPara.autoAlarm;
buf66[12]=devPara.autoOpen;
buf66[13]=devPara.printAccReceipt;
buf66[14]=devPara.printDoorReceipt;
buf66[15]=devPara.printTokenTicket;
uitmp=devPara.VaultFullWarnLevel;
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=devPara.VaultFullErrorLevel;
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
*/
virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
uint16_t borough, uint16_t zone,
@ -454,8 +645,8 @@ public:
// 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
// 12.4.23TS still the same
// 9
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// Printer
@ -1042,17 +1233,17 @@ public:
virtual void bl_rebootDC(void) const =0;
virtual void bl_startBL(void) const =0;
virtual void bl_startBL(void) const = 0;
// send command within 4s after DC power-on, otherwise bl is left
virtual void bl_checkBL(void) const =0;
virtual bool bl_checkBL(void) const = 0;
// send command to verify if bl is up
virtual bool bl_isUp(void) const =0;
// return true is bl is up and running
// also initializes "sendFile"
virtual void bl_sendAddress(u_int16_t blockNumber) const=0;
virtual void bl_sendAddress(uint16_t blockNumber) const=0;
// send start address, nr of 64byte-block, start with 0
// will be sent only for following block-numbers:
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
@ -1064,7 +1255,7 @@ public:
virtual void bl_openBinary(void) const=0;
// to be used within CashAgent, momentary not processed
virtual void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const=0;
virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const=0;
// send 64 byte from bin file
virtual void bl_sendLastBlock(void) const=0;
@ -1090,6 +1281,266 @@ public:
// ------------------------------------------------------------------------------------
// 6.4.2023: new functions for coin collection and printing
// some new system functions
// ------------------------------------------------------------------------------------
virtual bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const=0;
// return true if sending, false if cmd-stack is full
virtual bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const=0;
/*
buf[0]=GlobTime.Hours;
buf[1]=GlobTime.Min;
buf[2]=GlobTime.Sec;
buf[3]=GlobTime.Year;
buf[4]=GlobTime.Month;
buf[5]=GlobTime.Day;
buf[6]=GlobTime.DOW;
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
uitmp=GlobTime.MinOfDay;
buf[8]=swl_getOneByteFromUint(uitmp, 0);
buf[9]=swl_getOneByteFromUint(uitmp, 1);
buf[10]=' ';
buf[11]=' ';
ultmp=GlobTime.SecOfDay;
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
buf[16]=swl_isLeap(GlobTime.Year);
buf[17]=swl_getNextLeapYear(GlobTime.Year);
buf[18]=swl_getLastLeapYear(GlobTime.Year);
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
buf[21]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
buf[22]=swl_getOneByteFromUint(uitmp, 0);
buf[23]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
buf[24]=swl_getOneByteFromUint(uitmp, 0);
buf[25]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
buf[26]=swl_getOneByteFromUint(uitmp, 0);
buf[27]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
buf[28]=swl_getOneByteFromUint(uitmp, 0);
buf[29]=swl_getOneByteFromUint(uitmp, 1);
buf[30]=0;
buf[31]=0;
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
GlobTime.Hours, GlobTime.Min);
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
buf[36]=rtc_getSqwaveSettings();
buf[37]=0;
buf[38]=0;
buf[39]=0;
ultmp= 0; // Minutes of the Millenium
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
dc2prot_setReadData(44, buf);
*/
virtual bool sys_runCompleteTest(void) const=0;
// warning: lasts 20s in one pace
// return true if sending, false if cmd-stack is full
virtual bool sys_ready4sending(void) const=0;
// 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 true if sending, false if cmd-stack is full
virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const=0;
// 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 void log_getHoldAccountNumbers(uint32_t *accNr ) const=0;
// returns all acc nrs of the backuped vault records
// use: uint32_t backupedAccNumbers[8]
virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
// return true if sending, false if cmd-stack is full
//request, isAvailable
virtual void log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
// which was selected by: log_selectVaultRecord()
// to be forwarded to Ismas
virtual bool prn_printAccountReceipt(void) const=0;
// 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 cash_startPayment(uint16_t amount) const=0;
virtual uint32_t getInsertedAmount(void) const=0;
virtual uint16_t getLastInsertedCoin(void) const=0;
virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const=0;
// all inserted coins (max 64) since "cash_startPayment"
virtual bool cash_cancelPayment(void) const=0;
// and return coins
virtual bool cash_stopPayment(void) const=0;
// 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_failed(void) const=0;
// 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 uint64_t sys_getWakeSource(void) const =0;
// retval: 6 bytes, bit coded, 1=event keeps DC awake
//virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
/*
outBuf[0]=modCond.ram;
outBuf[1]=modCond.intEe;
outBuf[2]=modCond.extEe;
outBuf[3]=modCond.rtc;
outBuf[4]=modCond.boardHw;
outBuf[5]=modCond.printer;
outBuf[6]=modCond.modem;
outBuf[7]=modCond.signal;
outBuf[8]=modCond.regist;
outBuf[9]=modCond.mdbBus;
outBuf[10]=modCond.coinChecker;
outBuf[11]=modCond.coinEscrow;
outBuf[12]=modCond.mifareReader;
outBuf[13]=modCond.creditTerm;
outBuf[14]=modCond.coinReject;
outBuf[15]=modCond.coinSafe;
outBuf[16]=modCond.billSafe;
outBuf[17]=modCond.voltage;
outBuf[18]=modCond.temper;
outBuf[19]=modCond.poweronTest;
outBuf[20]=modCond.doorState;
outBuf[21]=modCond.doorWasOpened;
outBuf[22]=modCond.changer;
outBuf[23]=modCond.coinBlocker;
outBuf[24]=modCond.billReader;
outBuf[25]=modCond.ResetReason;
outBuf[26]=modCond.allModulesChecked;
outBuf[27]=modCond.alarmState;
outBuf[28]=0;
outBuf[29]=0;
*/
//virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
/*
outBuf[pBuf++]=dynCond.allDoorsDebounced;
outBuf[pBuf++]=dynCond.openedAuthorized;
outBuf[pBuf++]=dynCond.CBinDebounced;
outBuf[pBuf++]=dynCond.upperDoor;
outBuf[pBuf++]=dynCond.middleDoor;
outBuf[pBuf++]=dynCond.lowerDoor;
outBuf[pBuf++]=dynCond.coinBox;
outBuf[pBuf++]=dynCond.billBox;
outBuf[pBuf++]=dynCond.modeAbrech;
outBuf[pBuf++]=dynCond.onAlarm;
outBuf[pBuf++]=dynCond.nowCardTest;
outBuf[pBuf++]=dynCond.nowPayment;
outBuf[pBuf++]=dynCond.lastMifCardType;
outBuf[pBuf++]=dynCond.lastSDoorState;
outBuf[pBuf++]=dynCond.lastVDoorState;
outBuf[pBuf++]=dynCond.lastCBstate;
outBuf[pBuf++]=dynCond.paymentInProgress;
outBuf[pBuf++]=0;
uitmp=dynCond.U_Batt;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.Temperatur;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.nrCoinsInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
ultmp=dynCond.amountInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalTransVolume;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalNrOfVends;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
// 36
outBuf[pBuf++]=dynCond.jsonValid_config;
outBuf[pBuf++]=dynCond.jsonValid_device;
outBuf[pBuf++]=dynCond.jsonValid_cash;
outBuf[pBuf++]=dynCond.jsonValid_print;
outBuf[pBuf++]=dynCond.jsonValid_serial;
outBuf[pBuf++]=dynCond.jsonValid_time;
outBuf[pBuf++]=dynCond.lastFileType;
outBuf[pBuf++]=0;
*/
};
@ -1103,8 +1554,15 @@ public:
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
// mif_getCardDataStr(bool useHexFormat, char seperator)
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
// V3.2 Bootloader improvement
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)

View File

@ -61,6 +61,10 @@ char T_datif::datif_cycleSend()
uint8_t dataSendBuf[160], dataBufLen, dbl, who;
static uint8_t BlockCounter;
uint8_t nextWrCmd, nextRdCmd, blockNum, dat1, dat2, dat3, dat4;
uint8_t length, data[66];
bool b_ret;
if (cycl_running)
{
// request is still running, wait for response before next sending
@ -77,6 +81,43 @@ char T_datif::datif_cycleSend()
if (myDCIF->isSerialFree())
#endif
{
// new, from 11.4.23: direkt access to fastDevice Interface
// always use this three functions to send data:
//void myDCIF->setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr, uint8_t WrDatLen, uint8_t *data);
//void myDCIF->setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr);
//void myDCIF->setUserWriteData(uint16_t WriteCmd);
//void myDCIF->setUserWrite1DB (uint16_t WriteCmd, uint16_t WrAddr, uint8_t val);
//void myDCIF->setUserWrite2DB (uint16_t WriteCmd, uint16_t WrAddr, uint8_t val0, uint8_t val1);
//void myDCIF->setUserReadData( uint16_t ReadCmd, uint16_t RdAddr, uint16_t reserv);
//void myDCIF->setUserReadData( uint16_t ReadCmd, uint16_t RdAddr);
//void myDCIF->setUserReadData( uint16_t ReadCmd);
//void myDCIF->sendUserData(uint16_t slaveAdr);
if (check4FDshortCmd())
{
b_ret=sendFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &dat1, &dat2, &dat3, &dat4);
if (b_ret)
{
data[0]=dat1; data[1]=dat2; data[2]=dat3; data[3]=dat4; data[4]=0;
myDCIF->setUserWriteData(nextWrCmd, blockNum, 4, data);
myDCIF->setUserReadData(nextRdCmd);
myDCIF->sendUserData(selectedSlaveAddr);
}
}
if (check4FDlongCmd())
{
b_ret=longFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &length, data);
if (b_ret)
{
myDCIF->setUserWriteData(nextWrCmd, blockNum, length, data);
myDCIF->setUserReadData(nextRdCmd);
myDCIF->sendUserData(selectedSlaveAddr);
}
}
// direct commands have highest prio (setting OUTPUTS)
nxtAsCmd=sendWRcmd_getSendCommand0(); // command was stored by Gui
if (nxtAsCmd>0)
@ -624,62 +665,71 @@ char T_datif::sendINrequestsAutomatic(void)
{
//qDebug() << "send IN request " << dif_scanStep;
// one time: 105, 11,12,101,18
// cyclic: 22,23,24,27, 102,103,104,106,107,108,109,
// fehlen: 112, 113,14,17, 19, 30,31,32,33,
// 38 on request
switch (dif_scanStep)
{
// first 5 items are performed only one time after startup as this data never change
case 0:
datif_sendIOrequest(0, CMD2DC_GetSerialConfig, 0);
datif_sendIOrequest(0, CMD2DC_GetSerialConfig, 0); // 105
break;
case 1:
datif_sendIOrequest(0, CMD2DC_RdBkHWversion, 0);
datif_sendIOrequest(0, CMD2DC_RdBkHWversion, 0); // 11
break;
case 2:
datif_sendIOrequest(0, CMD2DC_RdBkSWversion, 0);
datif_sendIOrequest(0, CMD2DC_RdBkSWversion, 0); // 12
break;
case 3:
datif_sendIOrequest(0, CMD2DC_RdBkDCstate, 0);
datif_sendIOrequest(0, CMD2DC_RdBkDCstate, 0); // 101
break;
case 4:
datif_sendIOrequest(0, CMD2DC_RdBkUID, 0);
datif_sendIOrequest(0, CMD2DC_RdBkUID, 0); // 18
break;
// repeat cyclic from here:
case 5:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0); // 102
break;
case 6:
datif_sendIOrequest(0, CMD2DC_RdBkTime, 0);
datif_sendIOrequest(0, CMD2DC_RdBkTime, 0); // 104
break;
case 7:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 112, 0);
break;
case 8:
datif_sendIOrequest(0, CMD2DC_RdBkAnalog, 0);
datif_sendIOrequest(0, CMD2DC_RdBkAnalog, 0); // 106
break;
case 9:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 113, 0);
break;
case 10:
datif_sendIOrequest(0, CMD2DC_RdBkAllOutputs, 0);
datif_sendIOrequest(0, CMD2DC_RdBkAllOutputs, 0); // 103
break;
case 11:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 14, 0);
break;
case 12:
if (indat_isPrinterOn())
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0);
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0); // 27
// datif_sendIOrequest(0, CMD2DC_RdBk_PrnState, 0);
break;
@ -690,20 +740,21 @@ char T_datif::sendINrequestsAutomatic(void)
case 14:
if (indat_isMifareOn())
{
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0);
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0); // 109
//qDebug()<<"requesting MIF reader state";
}
break;
case 15:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 17, 0);
break;
case 16:
if (indat_isMifareOn())
{
datif_OutCmdpara1=0; // data block number 0 contains the Mifare-ID
datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1);
datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1); // 24
// qDebug()<<"automatically requesting mif card data";
if (++RDBLKNR>11)
RDBLKNR=0;
@ -712,23 +763,24 @@ char T_datif::sendINrequestsAutomatic(void)
} break;
case 17:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 19, 0);
break;
case 18:
if (indat_isMdbOn())
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0);
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0); // 107
//else
// dif_scanStep=24; unsinn
break;
case 19:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 30, 0);
break;
case 20:
//if (indat_isMdbOn())
datif_sendIOrequest(0, CMD2DC_MDB_GETRESP, 0);
datif_sendIOrequest(0, CMD2DC_MDB_GETRESP, 0); // 22
break;
@ -738,23 +790,32 @@ char T_datif::sendINrequestsAutomatic(void)
case 22:
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
datif_sendIOrequest(0, CMD2DC_EMP_GET_ALL, 0);
datif_sendIOrequest(0, CMD2DC_EMP_GET_ALL, 0); // 23
break;
case 23:
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
datif_sendIOrequest(0, 31, 0);
break;
case 24:
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
datif_sendIOrequest(0, CMD2DC_EMP_GOTCOIN, 0);
datif_sendIOrequest(0, CMD2DC_EMP_GOTCOIN, 0); // 108
break;
case 25:
datif_sendIOrequest(0, 32, 0);
break;
case 26:
datif_sendIOrequest(0, 33, 0);
break;
}
dif_scanStep++;
if (dif_scanStep>=25)
dif_scanStep=0; //dif_scanStep=5;
if (dif_scanStep>26)
dif_scanStep=5;
return 0;
@ -792,13 +853,13 @@ void T_datif::StoredRecData()
char T_datif::loadRecDataFromFrame()
{
// necessary data in T_prot:
uint16_t readSource, uitmp;
uint16_t readSource, uitmp,uit2;
uint16_t readAddress;
//uint8_t pp;
uint8_t SlaveAdr, RdDleng;
uint8_t receivedData[FRAME_DATALEN];
QString localStr;
//uint32_t ultmp;
uint32_t ultmp;
//int portNr;
bool ret;
uint8_t uctmp; // maxai
@ -837,7 +898,7 @@ char T_datif::loadRecDataFromFrame()
// receivedData[1]='B';
// receivedData[2]='1';
// receivedData[3]='-';
// for (int ii=0; ii<4; ii++) haut hin :)
for (int ii=0; ii<RdDleng; ii++)
{
@ -847,7 +908,7 @@ char T_datif::loadRecDataFromFrame()
//qDebug() << "got HW version: " << localStr;
switch (readSource) // = request command
{
case CMD2DC_TestSerial: // serial line check
case CMD2DC_TestSerial: // serial line check 10
ret=verifyLineTestresponse(RdDleng, receivedData);
gpi_storeResult_serialTestOK(ret);
if (ret==true)
@ -856,41 +917,41 @@ char T_datif::loadRecDataFromFrame()
gpi_setTxt4datifLine("false");
break;
case CMD2DC_GetSerialConfig: // get slave's RS232 config
case CMD2DC_GetSerialConfig: // get slave's RS232 config 105
gpi_storeSlaveSerParams(receivedData[0], receivedData[1], receivedData[2], receivedData[3]);
//gpi_storeSlaveBusAddr(SlaveAdr);
break;
case CMD2DC_RdBkHWversion:
case CMD2DC_RdBkHWversion: //11
//qDebug() << "got HW version: " << localStr;
gpi_storeGenerals(0, localStr);
// 0=HW 1=SW 2=State
//gpi_storeSlaveBusAddr(SlaveAdr);
break;
case CMD2DC_RdBkSWversion:
case CMD2DC_RdBkSWversion: //12
//qDebug() << "got SW version: " << localStr;
gpi_storeGenerals(1, localStr);
break;
case CMD2DC_RdBkDCstate:
case CMD2DC_RdBkDCstate: //101
//qDebug() << "got DC state " << localStr;
localStr[8]=0;
gpi_storeGenerals(2, localStr);
// 0=HW 1=SW 2=State
break;
case CMD2DC_RdBkUID: // getback UID in DB0....7
case CMD2DC_RdBkUID: // getback UID in DB0....7 18
gpi_storeUID(receivedData);
break;
case CMD2DC_RdBkTime: // slave returned RTC time and date
case CMD2DC_RdBkTime: // slave returned RTC time and date 104
// new, FastProt: 0=dayOfWeek 1=min 2=sec 3=hours 4=year 5=month 6=dayOfYear
gpi_backupTime(receivedData, RdDleng); // function reads 20 bytes from the buffer
break;
case CMD2DC_RdBkAnalog: // get ALL AIs 0...3, 4byte + 2byte each
case CMD2DC_RdBkAnalog: // get ALL AIs 0...3, 4byte + 2byte each 106
// DB0,1: Value0=Temperature
// DB2,3: Value1=Voltage
@ -906,7 +967,7 @@ char T_datif::loadRecDataFromFrame()
gpi_storeAIs(1, uitmp);
break;
case CMD2DC_GetAllInputs:
case CMD2DC_GetAllInputs: //102
/*
// alle DI's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
@ -990,7 +1051,7 @@ char T_datif::loadRecDataFromFrame()
gpi_storeDI_paperLow(receivedData[5]);
break;
case CMD2DC_RdBkAllOutputs:
case CMD2DC_RdBkAllOutputs: //103
/*
// alle DO's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
@ -1048,27 +1109,27 @@ char T_datif::loadRecDataFromFrame()
break;
case CMD2DC_RdBk_MifState:
case CMD2DC_RdBk_MifState: //109
// get reader status and card type
gpi_storeMifReaderStateAndCardType(receivedData);
break;
case CMD2DC_RdBk_MifData:
case CMD2DC_RdBk_MifData: //24
// one block of data (64byte) comes in
// blkNr 0...11 in "Addr"
gpi_storeMifCardData(readAddress, receivedData);
//qDebug()<<"datif storing mif data: (adr/data) "<<readAddress<<receivedData;
break;
case CMD2DC_RdBk_AtbCardType:
case CMD2DC_RdBk_AtbCardType: //25
// DC reports the type of mif-card (valid ATB card?)
break;
case CMD2DC_RdBk_PrnState: // 0x2A02
case CMD2DC_RdBk_PrnState: // 110
// byte 1...6 come right from printer, see printer manual
// byte 0 = all important infos:
@ -1080,7 +1141,7 @@ char T_datif::loadRecDataFromFrame()
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
break;
case CMD2DC_RdBk_PrnFonts: // 0x2A12
case CMD2DC_RdBk_PrnFonts: // 26
//D0: font table/type
//D1: size
//D2: height
@ -1094,7 +1155,7 @@ char T_datif::loadRecDataFromFrame()
gpi_storePrinterFonts(receivedData); // derzeit 10bytes
break;
case CMD2DC_RdBk_AllPrnData: // 0x2A40
case CMD2DC_RdBk_AllPrnData: // 27
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
gpi_storePrinterFonts(&receivedData[10]); // derzeit 10bytes
/*
@ -1107,7 +1168,7 @@ char T_datif::loadRecDataFromFrame()
*/
break;
case CMD2DC_MDB_GET_STATE:
case CMD2DC_MDB_GET_STATE: //107
// DB0: mdb_bus_ready (switched on)
// DB1: rdBackV12devicePower
// DB2: rdBackV5busPwr
@ -1116,7 +1177,7 @@ char T_datif::loadRecDataFromFrame()
gpi_storeMdbState(receivedData[0],receivedData[1],receivedData[2]);
break;
case CMD2DC_MDB_GETRESP:
case CMD2DC_MDB_GETRESP: //22
// last received mdb answer (from mdb device)
// only needed if a special command was sent directly
// DB0: mdb Device-Nr
@ -1127,12 +1188,12 @@ char T_datif::loadRecDataFromFrame()
gpi_storeMdbResponse(receivedData[2]+3, receivedData);
break;
case CMD2DC_EMP_GET_ALL:
case CMD2DC_EMP_GET_ALL: //23
//qDebug() << "got emp parameters "<< receivedData[1];
gpi_storeEmpSettings(64, receivedData);
break;
case CMD2DC_EMP_GOTCOIN:
case CMD2DC_EMP_GOTCOIN: //108
// DB0: 1=coin 0xFF=error 0=got nothing
// DB1: last coin signal (value / scale)
// DB2,3: last coin value
@ -1140,18 +1201,355 @@ char T_datif::loadRecDataFromFrame()
gpi_storeEmpCoinSignal(receivedData[0], &receivedData[1]);
break;
case CMD2DC_RDBK_DEV_PARA:
gpi_storeDeviceSettings(RdDleng, receivedData);
// ab hier neu: XXX
case CMD2DC_RDBK_DEV_PARA: //14
/*
buf66[0]=devPara.kindOfPrinter;
buf66[1]=devPara.kindOfCoinChecker;
buf66[2]=devPara.kindOfMifareReader;
buf66[3]=devPara.suppressSleepMode;
buf66[4]=devPara.kindOfModem;
buf66[5]=devPara.kindOfCreditcard;
buf66[6]=devPara.CoinEscrow;
buf66[7]=devPara.CoinRejectUnit;
buf66[8]=devPara.CoinShutter;
buf66[9]=devPara.BillAcceptor;
buf66[10]=devPara.usevaultLock;
buf66[11]=devPara.autoAlarm;
buf66[12]=devPara.autoOpen;
buf66[13]=devPara.printAccReceipt;
buf66[14]=devPara.printDoorReceipt;
buf66[15]=devPara.printTokenTicket;
uitmp=devPara.VaultFullWarnLevel;
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=devPara.VaultFullErrorLevel;
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
*/
gpi_storeRbDeviceSettings(RdDleng, receivedData);
break;
case CMD2DC_RDBK_MACH_ID:
// get machine parameters and location
case CMD2DC_RDBK_MACH_ID: //15
case 17:
/*
buf66[0]=swl_getOneByteFromUint(machPara.customerNumber, GETLOWBYT);
buf66[1]=swl_getOneByteFromUint(machPara.customerNumber, GETHIGHBYT);
buf66[2]=swl_getOneByteFromUint(machPara.machineNumber, GETLOWBYT);
buf66[3]=swl_getOneByteFromUint(machPara.machineNumber, GETHIGHBYT);
buf66[4]=swl_getOneByteFromUint(machPara.borough, GETLOWBYT);
buf66[5]=swl_getOneByteFromUint(machPara.borough, GETHIGHBYT);
buf66[6]=swl_getOneByteFromUint(machPara.zone, GETLOWBYT);
buf66[7]=swl_getOneByteFromUint(machPara.zone, GETHIGHBYT);
buf66[8]=swl_getOneByteFromUint(machPara.alias, GETLOWBYT);
buf66[9]=swl_getOneByteFromUint(machPara.alias, GETHIGHBYT);
for (pp=0; pp<32; pp++)
buf66[10+pp]=machPara.location[pp];
dc2prot_setReadData(42, buf66);
*/
gpi_storeMachineIDsettings(RdDleng, receivedData);
break;
case 19: // get time and date and Extra values
/*
buf[0]=GlobTime.Hours;
buf[1]=GlobTime.Min;
buf[2]=GlobTime.Sec;
buf[3]=GlobTime.Year;
buf[4]=GlobTime.Month;
buf[5]=GlobTime.Day;
buf[6]=GlobTime.DOW;
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
uitmp=GlobTime.MinOfDay;
buf[8]=swl_getOneByteFromUint(uitmp, 0);
buf[9]=swl_getOneByteFromUint(uitmp, 1);
buf[10]=' ';
buf[11]=' ';
ultmp=GlobTime.SecOfDay;
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
buf[16]=swl_isLeap(GlobTime.Year);
buf[17]=swl_getNextLeapYear(GlobTime.Year);
buf[18]=swl_getLastLeapYear(GlobTime.Year);
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
buf[21]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
buf[22]=swl_getOneByteFromUint(uitmp, 0);
buf[23]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
buf[24]=swl_getOneByteFromUint(uitmp, 0);
buf[25]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
buf[26]=swl_getOneByteFromUint(uitmp, 0);
buf[27]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
buf[28]=swl_getOneByteFromUint(uitmp, 0);
buf[29]=swl_getOneByteFromUint(uitmp, 1);
buf[30]=0;
buf[31]=0;
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
GlobTime.Hours, GlobTime.Min);
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
buf[36]=rtc_getSqwaveSettings();
buf[37]=0;
buf[38]=0;
buf[39]=0;
ultmp= 0; // Minutes of the Millenium
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
dc2prot_setReadData(44, buf);
*/
// speicher-fkt fehlt noch, gpi_backupTime ist nur kurz
gpi_storeExtendedTime(RdDleng, receivedData);
break;
case 111: // get square wafe settings
gpi_backupSquareMode(receivedData[0]);
break;
case 112: // get inserted amount in cent in sum
// byte 0..3: amount just paid 4,5:last coin type 6,7: last coin value
ultmp=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
uitmp=uchar2uint(receivedData[5],receivedData[4]);
uit2=uchar2uint(receivedData[7],receivedData[6]);
gpi_storeCurrentPayment(ultmp, uitmp, uit2);
break;
case 113: // get wake source, 8byte
gpi_storeWakeSources(receivedData);
break;
case 30: // Get Devices Condition (warnings, errors)
/*
outBuf[0]=modCond.ram;
outBuf[1]=modCond.intEe;
outBuf[2]=modCond.extEe;
outBuf[3]=modCond.rtc;
outBuf[4]=modCond.boardHw;
outBuf[5]=modCond.printer;
outBuf[6]=modCond.modem;
outBuf[7]=modCond.signal;
outBuf[8]=modCond.regist;
outBuf[9]=modCond.mdbBus;
outBuf[10]=modCond.coinChecker;
outBuf[11]=modCond.coinEscrow;
outBuf[12]=modCond.mifareReader;
outBuf[13]=modCond.creditTerm;
outBuf[14]=modCond.coinReject;
outBuf[15]=modCond.coinSafe;
outBuf[16]=modCond.billSafe;
outBuf[17]=modCond.voltage;
outBuf[18]=modCond.temper;
outBuf[19]=modCond.poweronTest;
outBuf[20]=modCond.doorState;
outBuf[21]=modCond.doorWasOpened;
outBuf[22]=modCond.changer;
outBuf[23]=modCond.coinBlocker;
outBuf[24]=modCond.billReader;
outBuf[25]=modCond.ResetReason;
outBuf[26]=modCond.allModulesChecked;
outBuf[27]=modCond.alarmState;
outBuf[28]=0;
outBuf[29]=0;
*/
gpi_storeDeviceConditions(RdDleng, receivedData);
break;
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
/*
outBuf[pBuf++]=dynCond.allDoorsDebounced;
outBuf[pBuf++]=dynCond.openedAuthorized;
outBuf[pBuf++]=dynCond.CBinDebounced;
outBuf[pBuf++]=dynCond.upperDoor;
outBuf[pBuf++]=dynCond.middleDoor;
outBuf[pBuf++]=dynCond.lowerDoor;
outBuf[pBuf++]=dynCond.coinBox;
outBuf[pBuf++]=dynCond.billBox;
outBuf[pBuf++]=dynCond.modeAbrech;
outBuf[pBuf++]=dynCond.onAlarm;
outBuf[pBuf++]=dynCond.nowCardTest;
outBuf[pBuf++]=dynCond.nowPayment;
outBuf[pBuf++]=dynCond.lastMifCardType;
outBuf[pBuf++]=dynCond.lastSDoorState;
outBuf[pBuf++]=dynCond.lastVDoorState;
outBuf[pBuf++]=dynCond.lastCBstate;
outBuf[pBuf++]=dynCond.paymentInProgress;
outBuf[pBuf++]=0;
uitmp=dynCond.U_Batt;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.Temperatur;
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=dynCond.nrCoinsInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
ultmp=dynCond.amountInBox; // send seperate also
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalTransVolume;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
ultmp=dynCond.totalNrOfVends;
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
// 36
outBuf[pBuf++]=dynCond.jsonValid_config;
outBuf[pBuf++]=dynCond.jsonValid_device;
outBuf[pBuf++]=dynCond.jsonValid_cash;
outBuf[pBuf++]=dynCond.jsonValid_print;
outBuf[pBuf++]=dynCond.jsonValid_serial;
outBuf[pBuf++]=dynCond.jsonValid_time;
outBuf[pBuf++]=dynCond.lastFileType;
outBuf[pBuf++]=0;
*/
gpi_storeDynMachineConditions(RdDleng, receivedData);
break;
case 32: // Get current cash level (in vault)
// bytes 0..3: amount bytes 4,5=Nr.ofCoins in vault
break;
case 33: // Get all backuped acc. Numbers
// 8 UINTs with acc-nr
break;
case 38: // Get stored account record backup
/*
struct T_vaultRecord
{
UCHAR startbuffer[4]; // Psa> // never move or change this 1st entry
UINT AccountingNumber;
UINT CUNU;
UINT MANU;
UINT resint1;
//UINT resint2;
UCHAR label1buffer[4]; // tim>
UCHAR year;
UCHAR month;
UCHAR dom;
UCHAR hour;
UCHAR min;
UCHAR sec;
UCHAR DoW;
UCHAR reschar3;
UCHAR label2buffer[4]; // abs>
ULONG AbsIncome1;
ULONG AbsReserve;
ULONG AbsNrOfCuts;
//16
UCHAR label3buffer[4]; // mw >
// Verkauf, Tür zu:
ULONG VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
ULONG VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
//88
// Service, Tür offen:
UINT ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
UINT ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
UINT resint3;
UINT resint4;
UINT currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
UINT resint5;
UINT resint6;
// 56
UCHAR label4buffer[4]; // box>
UINT coinsInVault[16];
UINT billsInStacker[8];
// 48
UCHAR label5buffer[4]; // val>
// actually constant unless exchange rate is changed
UINT coinDenomination[16]; // 5..50000 (z.B. 2€ sind in Ungarn 760Ft)
UINT billDenom[8];
UINT tubeDenom[6];
UINT exchangeRate;
UINT resint9;
// 64
UCHAR endofblock[4]; // end>
// 316 byte Block im Speicher
*/
break;
}
return 0;
}
// fehlen: 112, 113,14,17, 19, 30,31,32,33,
// subs:

View File

@ -1490,8 +1490,32 @@ void hwapi::request_ReadbackDeviceSettings() const
void hwapi::readback_DeviceSettings(uint8_t *length, uint8_t *data) const
{
epi_restoreDeviceSettings(length, data);
epi_restoreRbDeviceSettings(length, data);
/*
buf66[0]=devPara.kindOfPrinter;
buf66[1]=devPara.kindOfCoinChecker;
buf66[2]=devPara.kindOfMifareReader;
buf66[3]=devPara.suppressSleepMode;
buf66[4]=devPara.kindOfModem;
buf66[5]=devPara.kindOfCreditcard;
buf66[6]=devPara.CoinEscrow;
buf66[7]=devPara.CoinRejectUnit;
buf66[8]=devPara.CoinShutter;
buf66[9]=devPara.BillAcceptor;
buf66[10]=devPara.usevaultLock;
buf66[11]=devPara.autoAlarm;
buf66[12]=devPara.autoOpen;
buf66[13]=devPara.printAccReceipt;
buf66[14]=devPara.printDoorReceipt;
buf66[15]=devPara.printTokenTicket;
uitmp=devPara.VaultFullWarnLevel;
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
uitmp=devPara.VaultFullErrorLevel;
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
*/
}
// ....................................................................................
@ -1530,6 +1554,22 @@ void hwapi::request_ReadbackMachineID() const
void hwapi::readback_machineIDdata(uint8_t *length, uint8_t *data) const
{
epi_restoreMachineIDsettings(length, data);
/*
buf66[0]=swl_getOneByteFromUint(machPara.customerNumber, GETLOWBYT);
buf66[1]=swl_getOneByteFromUint(machPara.customerNumber, GETHIGHBYT);
buf66[2]=swl_getOneByteFromUint(machPara.machineNumber, GETLOWBYT);
buf66[3]=swl_getOneByteFromUint(machPara.machineNumber, GETHIGHBYT);
buf66[4]=swl_getOneByteFromUint(machPara.borough, GETLOWBYT);
buf66[5]=swl_getOneByteFromUint(machPara.borough, GETHIGHBYT);
buf66[6]=swl_getOneByteFromUint(machPara.zone, GETLOWBYT);
buf66[7]=swl_getOneByteFromUint(machPara.zone, GETHIGHBYT);
buf66[8]=swl_getOneByteFromUint(machPara.alias, GETLOWBYT);
buf66[9]=swl_getOneByteFromUint(machPara.alias, GETHIGHBYT);
for (pp=0; pp<32; pp++)
buf66[10+pp]=machPara.location[pp];
dc2prot_setReadData(42, buf66);
*/
}
@ -2831,6 +2871,10 @@ void hwapi::led_switchLedIllumination(uint8_t on) const
// neu, 25.3.23
// ------------------------------------------------------------------------------------
// 27.3.2023: Use Device-Controller's Bootloader to send hex-file
// ------------------------------------------------------------------------------------
void hwapi::bl_rebootDC(void) const
{
uint8_t len, buf[20];
@ -3014,4 +3058,361 @@ void hwapi::bl_sendFile(void) const
*/
// ------------------------------------------------------------------------------------
// 6.4.2023: new functions for coin collection and printing
// some new system functions
// ------------------------------------------------------------------------------------
// use:
// bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
// write Command to memory, wait for transport
// bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
// write Command to memory, wait for transport
// data buffer size always 64! data[64], padded with 0
bool hwapi::rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const
{
// return true if successful. could fail if more the 8 commands are waiting
uint8_t temp[66];
bool b_ret;
/* in interfaces.h:
struct Trtc_DateTime
{
uint8_t rtc_hour;
uint8_t rtc_min;
uint8_t rtc_sec;
uint8_t rtc_dayOfMonth;
uint8_t rtc_month;
uint8_t rtc_year;
uint8_t rtc_dayOfWeek;
};
*/
tslib_strclr(temp,0,66);
temp[0]= DateTime->rtc_hour;
temp[1]= DateTime->rtc_min;
temp[2]= DateTime->rtc_sec;
temp[3]= 20;
temp[4]= DateTime->rtc_year;
temp[5]= DateTime->rtc_month;
temp[6]= DateTime->rtc_dayOfMonth;
temp[7]= DateTime->rtc_dayOfWeek;
b_ret=longFDcmd_set(20,0,0,8,temp);
return b_ret;
}
bool hwapi::rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const
{
epi_restoreExtendedTime(leng, data);
return true;
/*
buf[0]=GlobTime.Hours;
buf[1]=GlobTime.Min;
buf[2]=GlobTime.Sec;
buf[3]=GlobTime.Year;
buf[4]=GlobTime.Month;
buf[5]=GlobTime.Day;
buf[6]=GlobTime.DOW;
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
uitmp=GlobTime.MinOfDay;
buf[8]=swl_getOneByteFromUint(uitmp, 0);
buf[9]=swl_getOneByteFromUint(uitmp, 1);
buf[10]=' ';
buf[11]=' ';
ultmp=GlobTime.SecOfDay;
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
buf[16]=swl_isLeap(GlobTime.Year);
buf[17]=swl_getNextLeapYear(GlobTime.Year);
buf[18]=swl_getLastLeapYear(GlobTime.Year);
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
buf[21]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
buf[22]=swl_getOneByteFromUint(uitmp, 0);
buf[23]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
buf[24]=swl_getOneByteFromUint(uitmp, 0);
buf[25]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
buf[26]=swl_getOneByteFromUint(uitmp, 0);
buf[27]=swl_getOneByteFromUint(uitmp, 1);
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
buf[28]=swl_getOneByteFromUint(uitmp, 0);
buf[29]=swl_getOneByteFromUint(uitmp, 1);
buf[30]=0;
buf[31]=0;
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
GlobTime.Hours, GlobTime.Min);
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
buf[36]=rtc_getSqwaveSettings();
buf[37]=0;
buf[38]=0;
buf[39]=0;
ultmp= 0; // Minutes of the Millenium
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
dc2prot_setReadData(44, buf);
*/
}
bool hwapi::sys_runCompleteTest(void) const
{
// warning: lasts 20s in one pace
return sendFDcmd_set(149, 0,0, 0,0,0,0);
}
bool hwapi::sys_ready4sending(void) const
{
// return true if a Json-file can be sent
// check free memory
uint8_t frei=FDLONG_STACKDEPTH - check4FDlongCmd();
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
// in check4FDlongCmd() steht wieviele Plaetze bereits belegt sind
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
// das Json-File hat max 800 byte = 13 bloecke
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
return false;
return true;
}
bool hwapi::sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const
{
// 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
uint8_t dateiArt, NummDesTempl;
uint8_t inhaltOfJson[802], temp[66];
uint16_t dateiLang, uitmp;
uint8_t nrOfBlocks;
uint8_t frei, bn=0;
dateiArt=kindOfFile;
NummDesTempl=nrOfTemplate;
tslib_strclr(inhaltOfJson,0,801);
dateiLang=tslib_strlen(content);
if (dateiLang>800) dateiLang=800;
tslib_strcpy(content, inhaltOfJson, dateiLang); // enthaelt genaue Laenge, Rest =0
nrOfBlocks=dateiLang/64;
if (dateiLang%64>0)
nrOfBlocks++;
dateiLang=nrOfBlocks;
dateiLang<<=6; // auf volle 64byte aufgerundet
// check free memory
frei=FDLONG_STACKDEPTH - check4FDlongCmd();
// Command-Stack sollte 16 Commands fassen, je 64byte Nutzdaten = 1024byte
// in check4FDlongCmd() steht wieviele Plaetze bereits belegt sind
// frei gibt also die Anzahl freier 64byte Bloecke zurueck
// das Json-File hat max 800 byte = 13 bloecke
if (frei<16) // Puffer muss ganz leer sein! nicht dass was durcheinander kommt
return false;
// Start- und Stop auch als langes Kommando schicken
// PROBLEM: wuerden sie in einem anderen Batch gespeichert (short command stack),
// dann kann die Reihenfolge nicht gewaehrleistet werden
// Das Startkommando muss sicher zuerst kommen
// Das Abschlusskommando muss sicher zuletzt kommen
tslib_strclr(temp,0,65);
temp[0]=dateiArt;
temp[1]=NummDesTempl;
longFDcmd_set(30, 0,0, 2,temp); // sende "Starte-file-DL"
uitmp=0; bn=0;
do
{
biox_CopyBlock(inhaltOfJson, uitmp, temp, 0, 64);
longFDcmd_set(31,0, bn++, 64, temp);
uitmp<<=6;
} while(uitmp < dateiLang);
longFDcmd_set(32, 0,0, 0,temp); // Abschluss
return true;
}
//char prn_dynPrnVal[8][8];
bool hwapi::prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const
// 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
{
uint8_t temp[66];
tslib_strcpy(dynPrnVal, temp, 64); // Vorsicht, kann \0en enthalten
return longFDcmd_set(33,0,0, 64, temp);
}
bool hwapi::prn_printTemplate(uint8_t nrOftemplate) const
// print one of the templates loaded by Json prior
// nr = 1..32
{
// return true if sending, false if cmd-stack is full
return sendFDcmd_set(152, 0,0, nrOftemplate,0,0,0);
}
void hwapi::log_getHoldAccountNumbers(uint32_t *accNr ) const
// returns all acc nrs of the backuped vault records
// use: uint32_t backupedAccNumbers[8]
{
Q_UNUSED(accNr);
}
bool hwapi::log_selectVaultRecord(uint16_t accountNr ) const
{
// return true if sending, false if cmd-stack is full
uint8_t dat1, dat2;
dat1=uint2uchar(accountNr, LOWBYTE);
dat2=uint2uchar(accountNr, HIGHBYTE);
return sendFDcmd_set(153, 0,0, dat1,dat2,0,0);
}
//request, isAvailable
void hwapi::log_getVaultRecord(struct T_vaultRecord *retVR) const
// which was selected by: log_selectVaultRecord()
// to be forwarded to Ismas
{
Q_UNUSED(retVR);
}
bool hwapi::prn_printAccountReceipt(void) const
{
return sendFDcmd_set(154, 0,0, 0,0,0,0);
}
bool hwapi::prn_printTestTicket(void) const
{
// return true if sending to DC OK, false if cmd-stack is full
return sendFDcmd_set(157, 0,0, 0,0,0,0);
}
bool hwapi::cash_startPayment(uint16_t amount) const
{
uint8_t dat1, dat2;
epi_clearCurrentPayment();
dat1=uint2uchar(amount, LOWBYTE);
dat2=uint2uchar(amount, HIGHBYTE);
return sendFDcmd_set(155, 0,0, dat1,dat2,0,0);
}
uint32_t hwapi::getInsertedAmount(void) const
{
return epi_CurrentPaymentGetAmount();
}
uint16_t hwapi::getLastInsertedCoin(void) const
{
return epi_CurrentPaymentGetLastCoin();
}
bool hwapi::getAllInsertedCoins(uint16_t *types, uint16_t *values) const
{
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert, max 64
return epi_CurrentPaymentGetAllCoins(types, values);
}
bool hwapi::cash_cancelPayment(void) const
// and return coins
{
// DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow
return sendFDcmd_set(156, 0,0, 2,0,0,0);
}
bool hwapi::cash_stopPayment(void) const
// and keep coins in escrow
{
// DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow
return sendFDcmd_set(156, 0,0, 3,0,0,0);
}
// after ticket/goods issue:
bool hwapi::vend_success(void) const
// conclude payment process, encash all inserted coins to vault. Printing was successful
// if possible return change
{
// DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow
return sendFDcmd_set(156, 0,0, 1,0,0,0);
}
bool hwapi::vend_failed(void) const
// conclude payment process and return all inserted coins
{
// DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow
return sendFDcmd_set(156, 0,0, 2,0,0,0);
}
uint8_t hwapi::mif_getCardType(QString cardholder) const
// return 1,2,3,4 = upper, lower access card, printer test, coin test
// cardholder: 7byte Name-String
{
Q_UNUSED(cardholder);
return 0; // to satisfy compiler
}
uint64_t hwapi::sys_getWakeSource(void) const
{
// retval: 6 bytes, bit coded, 1=event keeps DC awake
return epi_getWakeSources();
}
//void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
void hwapi::sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const
{
//uint8_t leng, data[66];
epi_restoreDeviceConditions(leng, data);
}
//void hwapi::sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const
void hwapi::sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const
{
epi_restoreDeviceConditions(leng, data);
}

View File

@ -13,7 +13,8 @@ void sendWRcmd_INI(void)
sendWRcmd_clrCmdStack();
sendWRcmd_clrCmd4Stack();
sendFDcmd_clrStack();
longFDcmd_clrStack();
}
// Command Stack for commands without parameters
@ -60,13 +61,19 @@ bool sendWRcmd_setSendCommand0(uint16_t nextCmd)
uint16_t sendWRcmd_getSendCommand0(void)
{
uint16_t nxtAsynchCmd;
uint8_t nn;
uint8_t nn, ll;
if (nrOfCmdsInQueue==0 || nrOfCmdsInQueue>CMDSTACKDEPTH)
return 0; // error
nxtAsynchCmd=nextAsynchsendCmd0[0];
// move Puffer down by one element
for (nn=0; nn<CMDSTACKDEPTH; nn++)
if (CMDSTACKDEPTH>0)
ll=CMDSTACKDEPTH-1;
else
ll=0;
for (nn=0; nn<ll; nn++)
nextAsynchsendCmd0[nn]=nextAsynchsendCmd0[nn+1];
if (nrOfCmdsInQueue>0)
nrOfCmdsInQueue--;
//qDebug() << "PI cmd queued:"<< nxtAsynchCmd << ", restored, pp now =" << nrOfCmdsInQueue;
@ -138,7 +145,7 @@ bool sendWRcmd_setSendCommand4(uint16_t nextCmd, uint8_t dat1, uint8_t dat2, uin
uint16_t sendWRcmd_getSendCommand4(uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
{
uint16_t nxtAsynchCmd;
uint8_t nn;
uint8_t nn, ll;
if (nrOfCmds4InQueue==0 || nrOfCmds4InQueue>CMD4STACKDEPTH)
return 0; // error
@ -152,7 +159,11 @@ uint16_t sendWRcmd_getSendCommand4(uint8_t *dat1, uint8_t *dat2, uint8_t *dat3,
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
// move Puffer down by one element
for (nn=0; nn<CMD4STACKDEPTH; nn++)
if (CMD4STACKDEPTH>0)
ll=CMD4STACKDEPTH-1;
else
ll=0;
for (nn=0; nn<ll; nn++)
{
nextAsynchsendCmd4[nn]=nextAsynchsendCmd4[nn+1];
nextCmd4para1[nn]=nextCmd4para1[nn+1];
@ -211,9 +222,9 @@ bool sendWRcmd_setSendCommand8(uint16_t nextCmd, uint8_t dat1, uint8_t dat2, uin
uint16_t sendWRcmd_getSendCommand8(uint8_t *dat1, uint8_t *dat2, uint16_t *dat3, uint32_t *dat4)
{
uint16_t nxtAsynchCmd;
uint8_t nn;
uint8_t nn, ll;
if (nrOfCmds8InQueue==0 || nrOfCmds8InQueue>CMD4STACKDEPTH)
if (nrOfCmds8InQueue==0 || nrOfCmds8InQueue>CMD8STACKDEPTH)
return 0; // error
nxtAsynchCmd=nextAsynchsendCmd8[0];
*dat1=nextCmd8para1[0];
@ -222,7 +233,11 @@ uint16_t sendWRcmd_getSendCommand8(uint8_t *dat1, uint8_t *dat2, uint16_t *dat3,
*dat4=nextCmd8para4[0];
// move buffer down by one element
for (nn=0; nn<CMD8STACKDEPTH; nn++)
if (CMD8STACKDEPTH>0)
ll=CMD8STACKDEPTH-1;
else
ll=0;
for (nn=0; nn<ll; nn++)
{
nextAsynchsendCmd8[nn]=nextAsynchsendCmd8[nn+1];
nextCmd8para1[nn]=nextCmd8para1[nn+1];
@ -433,3 +448,215 @@ uint8_t gpi_chk4remainingText(void)
// ---------------------------------------------------------------------------------
// 11.4.23 neu, Kommando direkt an "FastDevice"-protokoll senden, nicht mehr umsetzen
// ---------------------------------------------------------------------------------
// short command, 4 data bytes
static uint8_t nextFDwrCmd[FDCMD_STACKDEPTH];
static uint8_t nextFDrdCmd[FDCMD_STACKDEPTH];
static uint8_t nextFDblkNr[FDCMD_STACKDEPTH];
static uint8_t nextFDpara1[FDCMD_STACKDEPTH];
static uint8_t nextFDpara2[FDCMD_STACKDEPTH];
static uint8_t nextFDpara3[FDCMD_STACKDEPTH];
static uint8_t nextFDpara4[FDCMD_STACKDEPTH];
static uint8_t p_nextFDcmdsInQueue;
/* convention: use simple (not rotating) FIFO Stack:
Example: nrOfCmdsInQueue=4 then
nextAsynchsendCmd0[0]=cmd1 // was stored as first
nextAsynchsendCmd0[1]=cmd2
nextAsynchsendCmd0[2]=cmd3
nextAsynchsendCmd0[3]=cmd4 // came in as last
Send: [0] first, then move buffer 1 down:
nextAsynchsendCmd0[0]=cmd2
nextAsynchsendCmd0[1]=cmd3
nextAsynchsendCmd0[2]=cmd4
nextAsynchsendCmd0[3]=0;
nrOfCmdsInQueue=3 now
*/
void sendFDcmd_clrStack(void)
{
uint8_t nn;
for (nn=0; nn<FDCMD_STACKDEPTH; nn++)
{
nextFDwrCmd[nn]=0;
nextFDrdCmd[nn]=0;
nextFDblkNr[nn]=0;
nextFDpara1[nn]=0;
nextFDpara2[nn]=0;
nextFDpara3[nn]=0;
nextFDpara4[nn]=0;
}
p_nextFDcmdsInQueue=0;
}
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4)
{
// write Command to memory, wait for transport
if (p_nextFDcmdsInQueue>=FDCMD_STACKDEPTH)
{
qDebug() << "cannot save cmd because stack is full";
return false; // not possible
}
nextFDwrCmd[p_nextFDcmdsInQueue]=nextWrCmd;
nextFDrdCmd[p_nextFDcmdsInQueue]=nextRdCmd;
nextFDblkNr[p_nextFDcmdsInQueue]=blockNum;
nextFDpara1[p_nextFDcmdsInQueue]=dat1;
nextFDpara2[p_nextFDcmdsInQueue]=dat2;
nextFDpara3[p_nextFDcmdsInQueue]=dat3;
nextFDpara4[p_nextFDcmdsInQueue]=dat4;
//qDebug() << "data with 4 data byte saved, pp=" << nrOfCmds4InQueue;
//qDebug() << " dat1=" << nextCmd4para1[nrOfCmds4InQueue] << " dat2=" << nextCmd4para2[nrOfCmds4InQueue]
// << " dat3=" << nextCmd4para3[nrOfCmds4InQueue] << " dat4=" << nextCmd4para4[nrOfCmds4InQueue];
p_nextFDcmdsInQueue++;
return true; // ok, will be sent
}
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
{
uint8_t nn, ll;
if (p_nextFDcmdsInQueue==0 || p_nextFDcmdsInQueue>FDCMD_STACKDEPTH)
return false; // not possible
*nextWrCmd=nextFDwrCmd[0];
*nextRdCmd=nextFDrdCmd[0];
*blockNum=nextFDblkNr[0];
*dat1=nextFDpara1[0];
*dat2=nextFDpara2[0];
*dat3=nextFDpara3[0];
*dat4=nextFDpara4[0];
//qDebug() << "cmd4 restored to send from [0]; pp=" << nrOfCmds4InQueue;
//qDebug() << " data1: " << nextCmd4para1[0] << " data2: " << nextCmd4para2[0] <<
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
// move Puffer down by one element
if (FDCMD_STACKDEPTH>0)
ll=FDCMD_STACKDEPTH-1;
else
ll=0;
for (nn=0; nn<ll; nn++)
{
nextFDwrCmd[nn]=nextFDwrCmd[nn+1];
nextFDrdCmd[nn]=nextFDrdCmd[nn+1];
nextFDblkNr[nn]=nextFDblkNr[nn+1];
nextFDpara1[nn]=nextFDpara1[nn+1];
nextFDpara2[nn]=nextFDpara2[nn+1];
nextFDpara3[nn]=nextFDpara3[nn+1];
nextFDpara4[nn]=nextFDpara4[nn+1];
}
if (p_nextFDcmdsInQueue>0)
p_nextFDcmdsInQueue--;
//qDebug() << "cmd4 after push down: pp=" << nrOfCmds4InQueue;
return true; // ok, will be sent
}
uint8_t check4FDshortCmd(void)
{
// returns number of waiting command
return p_nextFDcmdsInQueue;
}
// long command, 64 data bytes
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
static uint8_t longFDrdCmd[FDLONG_STACKDEPTH];
static uint8_t longFDblkNr[FDLONG_STACKDEPTH];
static uint8_t longFDlength[FDLONG_STACKDEPTH];
static uint8_t longFDpara[FDLONG_STACKDEPTH][64];
static uint8_t p_longFDcmdsInQueue;
void longFDcmd_clrStack(void)
{
uint8_t nn, mm;
for (nn=0; nn<FDLONG_STACKDEPTH; nn++)
{
longFDwrCmd[nn]=0;
longFDrdCmd[nn]=0;
longFDblkNr[nn]=0;
longFDlength[nn]=0;
for (mm=0; mm<64; mm++)
longFDpara[nn][mm]=0;
}
p_longFDcmdsInQueue=0;
}
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data)
{
// write Command to memory, wait for transport
// data buffer size always 64! data[64], padded with 0
uint8_t nn;
if (p_longFDcmdsInQueue>=FDLONG_STACKDEPTH)
{
qDebug() << "cannot save cmd because stack is full";
return false; // not possible
}
longFDwrCmd[p_longFDcmdsInQueue]=nextWrCmd;
longFDrdCmd[p_longFDcmdsInQueue]=nextRdCmd;
longFDblkNr[p_longFDcmdsInQueue]=blockNum;
longFDlength[p_longFDcmdsInQueue]=length;
for (nn=0; nn<64; nn++)
longFDpara[p_longFDcmdsInQueue][nn]=data[nn];
p_longFDcmdsInQueue++;
return true; // ok, will be sent
}
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data)
{
uint8_t nn, mm, ll;
if (p_longFDcmdsInQueue==0 || p_longFDcmdsInQueue>FDLONG_STACKDEPTH)
return false; // not possible
*nextWrCmd= longFDwrCmd[0];
*nextRdCmd= longFDrdCmd[0];
*blockNum = longFDblkNr[0];
*length = longFDlength[0];
for (mm=0; mm<64; mm++)
data[mm] = longFDpara[0][mm];
// move Puffer down by one element
if (FDLONG_STACKDEPTH>0)
ll=FDLONG_STACKDEPTH-1;
else
ll=0;
for (nn=0; nn<ll; nn++)
{
longFDwrCmd[nn] = longFDwrCmd[nn+1];
longFDrdCmd[nn] = longFDrdCmd[nn+1];
longFDblkNr[nn] = longFDblkNr[nn+1];
longFDlength[nn] = longFDlength[nn+1];
for (mm=0; mm<64; mm++)
longFDpara[nn][mm] = longFDpara[nn+1][mm];
}
if (p_longFDcmdsInQueue>0)
p_longFDcmdsInQueue--;
return true; // ok, will be sent
}
uint8_t check4FDlongCmd(void)
{
// returns number of waiting command
return p_longFDcmdsInQueue;
}

View File

@ -1522,20 +1522,17 @@ qDebug()<<"read emp data, nr "<<ctr_gotCoin << "valid: " << *valid
static uint8_t Sdata_NrOfDeviceSetting;
static uint8_t Sdata_DeviceSettingBuff[66];
void gpi_storeDeviceSettings(uint8_t leng, uint8_t *data)
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data) // getestet am 12.4.23TS
{
if (leng>64) leng=64;
Sdata_NrOfDeviceSetting=leng;
tslib_strcpy(data, Sdata_DeviceSettingBuff, leng);
tslib_strcpy(data, Sdata_DeviceSettingBuff, leng); // getestet am 12.4.23TS
}
void epi_restoreDeviceSettings(uint8_t *leng, uint8_t *data)
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data) // getestet am 12.4.23TS
{
*leng=Sdata_NrOfDeviceSetting;
@ -1563,10 +1560,134 @@ void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data)
}
static uint32_t store_insertedAmount;
static uint16_t store_lastCoinType[64];
static uint16_t store_lastCoinValue[64];
static uint8_t p_lastCoin;
void epi_clearCurrentPayment(void)
{
// call at beginning of coin collection
store_insertedAmount=0;
p_lastCoin=0;
}
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
{
store_insertedAmount=insertedAmount;
store_lastCoinType[p_lastCoin]=lastCoinType;
store_lastCoinValue[p_lastCoin]=lastCoinValue;
p_lastCoin++;
}
uint32_t epi_CurrentPaymentGetAmount(void)
{
return store_insertedAmount;
}
uint16_t epi_CurrentPaymentGetLastCoin(void)
{
uint8_t pp;
pp=p_lastCoin;
if (pp==0)
return 0; // noch keine Münze erhalten
if (pp>0) pp--;
return store_lastCoinValue[pp];
}
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values)
{
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
uint8_t nn;
if (p_lastCoin==0)
return false;
for (nn=0; nn<64; nn++)
{
types[nn]=store_lastCoinType[nn];
values[nn]=store_lastCoinValue[nn];
}
return true;
}
uint64_t stor_wakSrc;
void gpi_storeWakeSources(uint8_t *receivedData)
{
uint8_t uctmp;
int nn;
stor_wakSrc=0;
for (nn=7; nn>=0; nn--)
{
uctmp=receivedData[nn];
stor_wakSrc |=uctmp;
stor_wakSrc<<=8;
}
}
uint64_t epi_getWakeSources(void)
{
return stor_wakSrc;
}
static uint8_t store_rbDevParamLen;
static uint8_t store_rbDevParams[66];
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data)
{
if (leng>64) leng=64;
store_rbDevParamLen=leng;
tslib_strcpy(data, store_rbDevParams, leng);
}
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data)
{
*leng=store_rbDevParamLen;
tslib_strcpy(store_rbDevParams, data, store_rbDevParamLen);
}
// store device conditions
static uint8_t store_deviceCondLen;
static uint8_t store_deviceCond[66];
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data)
{
if (leng>64) leng=64;
store_deviceCondLen=leng;
tslib_strcpy(data, store_deviceCond, leng);
}
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data)
{
*leng=store_deviceCondLen;
tslib_strcpy(store_deviceCond, data, store_deviceCondLen);
}
// store dynamic machine conditions
static uint8_t store_machCondLen;
static uint8_t store_machCond[66];
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data)
{
if (leng>64) leng=64;
store_machCondLen=leng;
tslib_strcpy(data, store_machCond, leng);
}
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data)
{
*leng=store_machCondLen;
tslib_strcpy(store_machCond, data, store_machCondLen);
}

View File

@ -344,6 +344,15 @@ uint16_t tslib_strlen(char *buf)
return 0;
}
uint16_t tslib_strlen(uint8_t *buf)
{
uint16_t nn;
for (nn=0; nn<0xFFF0; nn++)
if (buf[nn]==0)
return nn;
return 0;
}
void tslib_strclr(char *buf, char clrsign, uint16_t len)
{
@ -555,3 +564,18 @@ uint8_t tslib_sendFlashStartAddr2BL(uint32_t startAddr, uint8_t *sendData)
// -----------------------------------------------------------------------------------------------
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len)
{
// both buffers starting from pos 0
uint16_t xx,yy,zz,ii;
xx = srcPos;
yy = destPos;
zz = len;
for (ii = 0; ii < zz; ++ii)
{
dest[yy + ii] = src[xx + ii];
}
}