Merged new function to DCPlugin (01.06.2023).

This commit is contained in:
2023-06-01 16:38:12 +02:00
parent 777fabe95d
commit 60726093df
19 changed files with 4055 additions and 3154 deletions

View File

@@ -170,7 +170,7 @@ uint8_t epi_getResultOfLastRequest();
// retval: 0: in progress 1: OK 2: error
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t const *receivedData);
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData);
// stored by Datif
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);

View File

@@ -303,6 +303,7 @@ class T_datif : public QMainWindow
// docNr =transmitted in WRITEADDRESS high byte
// blockNr=transmitted in WRITEADDRESS low byte
int datif_noResponseCtr;
T_prot *myDCIF;
QTimer *datif_trigger;
@@ -315,9 +316,6 @@ private slots:
public:
T_datif(QWidget *parent = nullptr);
T_prot *getProt() { return myDCIF; }
T_prot const *getProt() const { return myDCIF; }
void resetChain(void);
char isPortOpen(void);
void sendWRcommand(uint16_t nxtAsCmd);

202
include/datei.h Normal file
View File

@@ -0,0 +1,202 @@
#ifndef DATEI_H
#define DATEI_H
#include <stdint.h>
#include <QFile>
#include <QFileInfo>
#include <QDebug>
#include "tslib.h"
#include <QString>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonParseError>
// create csv file with:
#define FILESEPERATOR ','
// pasre csv with:
#define FILESEP1 ','
#define FILESEP2 ';'
#define NEWLINEINFILE '\n'
#define MAXNUMBEROFSEQUENCES 200
// only for csv files
// all generated files located in sudirectory "dynamic machine data - dmd"
#define FILENAME_SHAREDDATA "../dmd/DCshare.csv"
#define FILENAME_SHARED_UID "../dmd/DC_UID.csv"
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create csv file -------------------------------
// -------------------------------------------------------------------------------------------------
// create array with strings and values (to be written to file)
void csv_startCreatingFile(void);
void csv_addTextToFile(QString myText);
void csv_addIntToFile(int myValue);
void csv_addUintToFile(uint myValue);
void csv_addLongvalToFile(qlonglong myValue);
void csv_addUlongvalToFile(qulonglong myValue);
//void csv_addCurrentTimeToFile(void);
//void csv_addCurrentDateToFile(void);
void csv_addNewlineToFile(void);
QByteArray csv_readbackArray(void);
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse csv file -------------------------------
// -------------------------------------------------------------------------------------------------
// return number of entries in the just read file (entries are seperated by
// comma or line-feed)
uint32_t csv_nrOfEntriesInFile(QByteArray readFromFile);
// before: QByteArray sourceFile=datei_readFromFile(filename);
QByteArray csv_getOneFileSequence(QByteArray sourceFile, uint32_t sequNr);
// not needed, just for test // sequNr: 0....(size-1)
// get single entries of of the just read file:
int csv_getEntryAsInt(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
int32_t csv_getEntryAsLong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint8_t csv_getEntryAsUshort(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint16_t csv_getEntryAsUint(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint32_t csv_getEntryAsUlong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint64_t csv_getEntryAs2Ulong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
QString csv_getEntryAsString(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create Json Record -------------------------------
// -------------------------------------------------------------------------------------------------
void json_startRecord(void);
// clear buffer and write opening curly bracket {
void json_enterIntToRecord(QString attribute, ulong i_value);
// example: "parameter":1234567890
void json_enterTextToRecord(QString attribute, QString txt_value);
// example: "parameter":"slow"
//void json_addCurrentTimeToRecord(QString attribute);
// example: if attribute=myTime: "myTime":"hh_mm_ss"
//void json_addCurrentDateToRecord(QString attribute);
// example: if attribute=myDate: "myDate":"dd.mm.yyyy"
// also / possible as seperator
// further possible forms:
// format= 0: dd.mm.yyyy (deutsch)
// 1: mm.dd.yyyy (amerika)
// 2: yyyy.mm.dd (Iran, Dubai)
// 3: dd.yyyy.mm
// 4: mm.yyyy.dd
// 5: yyyy.dd.mm
void json_enterArrayToRecord(QString attribute, uint8_t *buf, ulong nrofVals);
// add array of numbers with "nrofVals" elements
void json_enterStructToRecord(QString attribute);
// every call must be concluded with an extra "json_finishFile()"
// example: "sname":{
void json_finishStruct(void);
void json_finishRecord(void);
// close curly bracket
QString json_readbackRecordStr(void);
QByteArray json_readbackRecordBa(void);
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse Json file -------------------------------
// -------------------------------------------------------------------------------------------------
// first: QByteArray datei_readFromFile(QString filename);
//void datei_json_readTestFile(QString filename);
int json_nrOfPairsInFile(QByteArray filename);
bool json_exists(QByteArray filename, QString searchForKey);
// look for "searchForKey" =name of the pair (left of : )
// retval true if exists
bool json_remove(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and remove the record from file
// retval true if removed
QString json_searchForStringInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_searchForIntInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
//.......................
QJsonObject json_searchForObjectInFile(QByteArray filename, QString searchFor);
// return an object from the json file
int json_nrOfPairsInObject(QJsonObject objname);
QString json_searchForStringInObject(QJsonObject objname, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_searchForIntInObject(QJsonObject objname, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
//.......................
QJsonArray json_searchForArrayInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_nrOfValuesInArray(QJsonArray arrayname);
bool json_getValuesOfArray(QJsonArray arrayname, int *buf, int MaxBufferSize);
// assuming that the array consists of integers
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ read, write, copy files -------------------
// -------------------------------------------------------------------------------------------------
void datei_closeFile(QString filename);
// read content of an exiting file:
QByteArray datei_readFromFile(QString filename);
bool datei_ifFileExists(QString filename);
char datei_writeToFile(QString filename, QByteArray content);
// retval=0 if successful 1: no write access allowed
// 2:cannot open to append 3:cannot create new file
bool datei_copyFile(QString currentFileName, QString newFileName);
// retval=true if successful
bool datei_clearFile(QString filename);
// retval=true if successful
#endif // DATEI_H

View File

@@ -17,81 +17,22 @@ matching interfaces.h:
//#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
covering enclosure (switches and doors) and money devices,
controls mifare card to access or program
optional it can control printer, modem, bar code reader and credit card
* API to the PSA1259 Hardware
* All data come in from device controller via serial interface and will be stored
* in "PI" = peripheral image
* PI is updated every 100ms (up to 30ms possible)
* This api uses stored pi data and returns them in the following functions
* created: Q1/2020 TS
*
The devices, connected to device controller2 (DC2) can be controlled in different access levels.
Level 1:
direct connection to DC2, check versions, state and parameters
control serial interfaces
digital/analog IO's
read and write to connected devices on lowest level, this is a kind of fall-back-level
in case higher levels fail or do not support the needed (new) function
Example: send a specific printer command, several bytes that need to be conform to
printer manual. This command is routed to the printer through the DC2 without
any action of the DC. You can write your own device driver that way.
Level 1 is flexible but complicated
Level 2:
The DC controls the connected devices containing a device driver. The DC offers
usage of the device by simple commands,
Example: "Printer on", "set Font size 3" "print "hello world"", "cut"
In opposite to level 1 where you had to send a set of numbers and letters.
In other words: you "talk" to the device controller, not to the device itself.
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
Level 1): read digital inputs to detect coin,
switch digital output which opens coin slot
communicate with coin checker by certain mdb-commands (manual conform)
poll coin checker for inserted coins
close coin slot after 3seconds by setting DO to 0....
Level 2): get message of attached coin from DC
send command "initialize coin checker" to DC
send command "open slot for 3s"
poll DC for inserted coins, DC polls coin checker in right way, no need
to know the data sheet of the coin checker or mdb-bus
command to DC "open coin escrow's return flap for 1s"
Level 3): send command: "start payment process"
all coin devices are started up
coin blocker opens for 3s if a coin is attached
coin checker summarizes inserted value and reports sum
later send command "stop payment process" (puts coins to vault) or
send command "cancel payment process" (returns coins to user)
*/
#ifndef hwapi_H
#define hwapi_H
#include <stdint.h>
#include <QTabWidget>
#include <QtPlugin>
#include <QTimer>
#include <QObject>
#include "interfaces.h"
#include <../plugins/interfaces.h>
#include "datIf.h"
class QSharedMemory;
class hwapi : public QObject,
public hwinf
{
@@ -100,32 +41,16 @@ class hwapi : public QObject,
Q_INTERFACES(hwinf)
private:
void sub_storeSendingText(QByteArray *buf) const;
QTimer *hwapi_TimerPayment;
DownloadResult sendNextAddress(int bNum) const;
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
DownloadResult sendStatus(int ret) const;
DownloadResult dc_downloadBinary(QByteArray const &binary) const;
bool startBootloader() const;
bool stopBootloader() const;
bool openSerial(int br, QString baudrate, QString comPort) const;
bool closeSerial(QString comport) const;
bool resetDeviceController() const;
QByteArray loadBinaryDCFile(QString filename) const;
bool downloadBinaryToDC(QString const &bFile) const;
QSharedMemory *m_sharedMem;
public:
explicit hwapi(QObject *parent = nullptr);
virtual ~hwapi();
explicit hwapi(QWidget *parent = nullptr);
T_datif *myDatif;
virtual QStringList dc_getStatus() const;
// ------------------------------------------------------------------------------
// Level 0 commands, interface
// commands, interface
// open, close, change serial interface
// actually not neccessary as it is opened automatically on program start
// start automatic READ requests
@@ -137,7 +62,7 @@ public:
// ComName: for example "COM48"
// connect: 0, 1
bool dc_closeSerial(void) const override;
void dc_closeSerial(void) const override;
bool dc_isPortOpen(void) const override ;
@@ -145,21 +70,10 @@ public:
// select if READ-Requests are sent manually one by one or automatically
// automatically request ALL digital and analog sensors, get time/date, get status information
bool dc_updateDC(QString binFileName, QString baudrate,
QString comPort) const override;
bool dc_updatePrinterTemplate(enum FileTypeJson type,
QVector<int> templateIdx,
QVector<QString> fnames,
QString br,
QString serial = QString()) const override;
bool dc_printTemplate(enum FileTypeJson type,
QVector<int> templateIdx,
QString br,
QString serial = QString()) const override;
// ------------------------------------------------------------------------------
// Level 1, control device-controller (functions of µC)
// control device-controller (functions of µC)
// check serial connection to deviceController
// read response from DC2 (input data)
// some test function for serial communication
@@ -246,8 +160,15 @@ public:
uint8_t bl_exitBL(uint8_t *sendData) const override;
// minimum size of sendData-buffer: 5byte retval: length
// ------------------------------------------------------------------------------
// Level 2 DC2-onboard devices
// DC2-onboard devices
// WR: set time
// RD. get time, get measure, get test results
// ------------------------------------------------------------------------------
@@ -321,7 +242,7 @@ public:
bool dc_mainFuseIsOk(void) const override;
// ------------------------------------------------------------------------------
// Level 3: digital outputs and simple switching of connected devices
// igital outputs and simple switching of connected devices
// simple processes like flashing a led or open flap for 1s
// ------------------------------------------------------------------------------
@@ -377,7 +298,7 @@ public:
// ------------------------------------------------------------------------------
// Level 3: digital inputs of connected devices
// digital inputs of connected devices
// ------------------------------------------------------------------------------
bool door_isContactPowerOn(void) const override;
@@ -739,29 +660,29 @@ public:
// up to 8 dynamic values can be defined in the template ("print val3 here") and will be sent with printing command
// example: print current time at this point (the time of printing not the storage time!!)
void pri_startTicketDesign(void) const override;
//void pri_startTicketDesign(void) const override;
// start for every new printer document, reseting collecting buffer
// all further functions write/append text, numbers and command to the ticket-buffer, up to 1278 bytes allowed
// return val of the appending functions: true=ok false=too long, buffer full
int pri_TD_getCurrentSize(void) const override;
//int pri_TD_getCurrentSize(void) const override;
// retval: 0...1278
bool pri_TD_addText(QByteArray text) const override;
//bool pri_TD_addText(QByteArray text) const override;
// example: pri_TD_addText("Hello") const override;
// example: pri_TD_addText(tempStr) const override;
// retval: true=ok false=too long, buffer full
bool pri_TD_addValue(int val) const override;
//bool pri_TD_addValue(int val) const override;
// +/- 0...2^(31)
bool pri_TD_addNewLine(void) const override;
//bool pri_TD_addNewLine(void) const override;
bool pri_TD_addSign(char sign) const override;
//bool pri_TD_addSign(char sign) const override;
// example: '.' ' ' 0x20 'W' '$'
bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const override;
//bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const override;
// always add 8 byte to the ticket layout: ESC & group & attribute & parameter1...5
/* complete list of possible commands:
group 50 : paper
@@ -802,11 +723,11 @@ public:
*/
char prn_clearDocument(uint8_t documentNumber) const override;
//char prn_clearDocument(uint8_t documentNumber) const override;
// clear memory buffer for ONE document
// function takes a second! don't send right before "store doc"
bool prn_store_Document(uint8_t documentNumber ) const override;
//bool prn_store_Document(uint8_t documentNumber ) const override;
// send the predefined Layout (generated with above TD functions) to DeviceController to save
// documentNumber=0...15
@@ -818,7 +739,7 @@ public:
// the place in the ticket layout is predefined (already in DC memory)
// the dynamics are first calculated at printing time
bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const override;
//bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const override;
@@ -922,7 +843,7 @@ public:
void bl_rebootDC(void) const override;
void bl_startBL(void) const override;
bool bl_checkBL(void) const override;
void bl_checkBL(void) const override;
bool bl_isUp(void) const override;
// return true is bl is up and running
// also initializes "sendFile"
@@ -999,6 +920,7 @@ public:
// 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 rtc_getExtendedTime(struct T_extTime *exTime) const override;
bool sys_runCompleteTest(void) const override;
@@ -1045,9 +967,23 @@ public:
bool prn_printTestTicket(void) const override;
// return true if sending to DC OK, false if cmd-stack is full
bool cash_startPayment(uint32_t amount) const override;
// 17.4.23TS: extended to 32bit
uint8_t cash_paymentProcessing(void) const override;
// run this function periodically while coin payment process to generate necessary signals
// return value:
// 0: stopped 1: starting up 2: coin collection
// 3: finished by User (Push button) 4: finished, Max-Value collected
// 5: finished by escrow
// 10,11: error cannot start
// 12: timeout while payment, coins returned
// 13: stopped by unexpected error
bool cash_cancelPayment(void) const override;
// and return coins
@@ -1081,11 +1017,22 @@ public:
uint64_t sys_getWakeSource(void) const override;
// retval: 6 bytes, bit coded, 1=event keeps DC awake
uint8_t sys_getWakeReason(void) const override;
// Master was woken by following reason:
// 1: MDB Event
// 2: Coin Event
// ( 3: Master Event) - will not set the wake line
// ( 4: 32s pulse) - will not set the wake line
// 5: Door Event
// ( 6: Diag Event) - will not set the wake line
// 7: 30min-Pulse for HB
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
@@ -1104,17 +1051,58 @@ public:
// bit5: printer not ready
void sys_sendDeviceParameter(struct T_devices *deviceSettings) const override;
void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const override;
bool sys_areDCdataValid(void) const override;
bool sys_sendingTest(void) const override;
void prn_requestCurrentDynData(void) const override;
bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const override;
// which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
bool prn_dynDataAreEqual(uint8_t *buf) const override;
bool prn_printKombiticket(uint8_t nrOfKombi) const override;
// print four of the templates loaded by Json prior
// nr = 1..8
void lock_triggerUpperSolenoid(void) const override;
void lock_triggerLowerSolenoid(void) const override;
signals:
void hwapi_templatePrintFinished_OK(void) const override;
void hwapi_templatePrintFinished_Err(void) const override;
void hwapi_coinCollectionJustStarted(void) const override;
void hwapi_coinCollectionAborted(void) const override;
void hwapi_gotNewCoin(void) const override;
void hwapi_vendStopByMax(void) const override;
void hwapi_vendStopByPushbutton(void) const override;
void hwapi_payStopByMax(void) const override;
void hwapi_payStopByPushbutton(void) const override;
void hwapi_payStopByEscrow(void) const override;
void hwapi_payStopByError(void) const override;
void hwapi_payStopByTimeout(void) const override;
void hwapi_payCancelled(void) const override;
void hwapi_coinProcessJustStopped(void) const override;
private slots:
void hwapi_slotPrintFinished_OK(void);
void hwapi_slotPrintFinished_Err(void);
void hwapi_slotGotCoin(void);
void hwapi_slotPayProc(void);
};

File diff suppressed because it is too large Load Diff

View File

@@ -93,9 +93,6 @@ private slots:
void analyseRecData(void);
public:
T_com *getSerialPort() { return mySerialPort; }
T_com const *getSerialPort() const { return mySerialPort; }
T_prot();
bool isPortOpen(void);
bool isSerialFree(void);

View File

@@ -211,8 +211,15 @@ 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);
@@ -220,23 +227,35 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
uint8_t check4FDshortCmd(void);
// returns number of waiting command, maxFDCMD_STACKDEPTH
uint8_t checkNextFDcmd(void);
// return 0: no command waiting
// 1: short cmd
// 2: long cmd
uint8_t check4freeFDshortCmd(void);
// returns number of free places in short-command stack
#define FDLONG_STACKDEPTH 16
void longFDcmd_clrStack(void);
//#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);
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
uint8_t check4FDlongCmd(void);
//uint8_t check4FDlongCmd(void);
// returns number of waiting command
uint8_t check4freeFDlongCmd(void);
//uint8_t check4freeFDlongCmd(void);
// returns number of free places in long-command stack
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf);
// HWapi writes data to be stored
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
#endif

View File

@@ -7,6 +7,12 @@
#include <QSharedMemory>
struct SharedMemBuffer {
struct rs {
char comportName[16]; // z.B. "COM48"
char baudStr[16]; // z.B. "19200"
@@ -198,6 +204,7 @@ struct SharedMemBuffer {
uint8_t mif_cardType;
uint8_t mif_cardHolder[8];
#if 0
#define MEMDEPTH_GOTCOINS (16)
struct T_coin {
uint8_t valid;
@@ -207,6 +214,7 @@ struct SharedMemBuffer {
uint16_t value;
} gotCoin[MEMDEPTH_GOTCOINS];
uint8_t ctr_gotCoin;
#endif
struct store {
uint32_t insertedAmount;

View File

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