DCLibraries/include/datIf.h

207 lines
6.4 KiB
C++

// Data Interface between slave (DC) and pi buffer
// determines sending and receiving order of data
// cares for storing input data and restoring output data
#ifndef DIF_H
#define DIF_H
#include "tslib.h"
#include "prot.h"
#include "dcBL.h"
//#include <QMainWindow>
#include <QString>
#include <QTimer>
#include <QDebug>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include "interfaces.h"
#define CMD2DC_sendTime 20
#define CMD2DC_setWakeFrequ 112
#define CMD2DC_MOV_UPLOCK 113
#define CMD2DC_MOV_DNLOCK 114
#define CMD2DC_UPPER_DOOR 115
#define CMD2DC_LOWER_DOOR 116
#define CMD2DC_VAULT_DOOR 117
#define CMD2DC_REJMOT_ON 118
#define CMD2DC_REJMOT_RUN 119
#define CMD2DC_LED_COIN 100
#define CMD2DC_LED_ILLU 101
#define CMD2DC_LED_TICKET 102
#define CMD2DC_LED_START 104
#define CMD2DC_LED_PIN 103
#define CMD2DC_LED_IN 105
#define CMD2DC_FAN 106
#define CMD2DC_SIREN 107
#define CMD2DC_BARRIER 108
#define CMD2DC_WAKEPTU 109
#define CMD2DC_SWITCHAUXPWR 110
#define CMD2DC_SWITCHAUXDDR 18
#define CMD2DC_SWITCHAUXOUT 19
#define CMD2DC_UCONTACTON 111
#define CMD2DC_DEVICE_PARAM 23
#define CMD2DC_SEND_MACH_ID 11
#define CMD2DC_RDBK_DEV_PARA 14
#define CMD2DC_RDBK_MACH_ID 15
#define CMD2DC_MDB_ON 120
#define CMD2DC_MDB_GET_STATE 107 // REQ
#define CMD2DC_MDB_DORESET 121
#define CMD2DC_MDB_SETWAK 122
#define CMD2DC_MDB_SENDCMD 123
#define CMD2DC_MDB_SENDMSG 12
#define CMD2DC_MDB_GETRESP 22 // REQ
#define CMD2DC_EMP_SET 24
#define CMD2DC_EMP_GET_ALL 23 // REQ
#define CMD2DC_EMP_STARTPOLL 124
#define CMD2DC_EMP_STARTPAY 125
#define CMD2DC_EMP_STOPPAY 126
#define CMD2DC_EMP_GOTCOIN 108 // REQ
#define CMD2DC_SHUTTER_OPEN 129
#define CMD2DC_ESCR_OPEN 132
#define CMD2DC_ESCR_TAKE 133
#define CMD2DC_ESCR_RETURN 134
#define CMD2DC_MOD_ON 135
#define CMD2DC_MOD_WAK 136
#define CMD2DC_CRED_ON 137
#define CMD2DC_CRED_WAK 138
// READ Commands ((e.g. get input)
#define CMD2DC_TestSerial 10
#define CMD2DC_GetSerialConfig 105
#define CMD2DC_RdBkHWversion 11
#define CMD2DC_RdBkSWversion 12
#define CMD2DC_RdBkDCstate 101
#define CMD2DC_RdBkUID 18
#define CMD2DC_RdBkTime 104
#define CMD2DC_RdBkAnalog 106
#define CMD2DC_GetAllInputs 102
#define CMD2DC_RdBkAllOutputs 103
#define CMD2DC_MIFREADERON 127
#define CMD2DC_ATB_CREATE 128
// Mif read data:
//#define CMD2DC_RdBk_MifState 109
//#define CMD2DC_RdBk_MifData 24
#define CMD2DC_RdBk_AtbCardType 25
#define CMD2DC_SHUTTER_COIN 131
#define CMD2DC_SHUTTER_OPEN3S 130
//#define CMD2DC_SEND_SHUT_TIME 0x2915
#define CMD2DC_ESCR_TAKE 133
#define CMD2DC_ESCR_RETURN 134
#define CMD2DC_PRINTERON 139
#define CMD2DC_RdBk_PrnState 110
#define CMD2DC_RdBk_PrnFonts 26
#define CMD2DC_RdBk_AllPrnData 27
// nr of params:
#define CMD2DC_PRI_SYS_CMD 25 // 3
#define CMD2DC_PRI_ESC_CMD 26 // 4
#define CMD2DC_PRI_SETUP 27 // 5
#define CMD2DC_PRI_MOVE 140 // 2
#define CMD2DC_PRI_SETFONT 141 // 4
#define CMD2DC_PRI_SETLETTER 142 // 3
#define CMD2DC_PRI_CUT 143 // 1
#define CMD2DC_PRI_PRINT_TXT 13 // 64
#define CMD2DC_PRI_LF 144 // 1
#define CMD2DC_PRI_PRIFONTTABLE 145
#define CMD2DC_PRI_BARCODE 14 // ca 15...25
#define CMD2DC_STOR_QR_DATA 15 // 150
#define CMD2DC_PRI_QR_CODE 146 // 0
#define CMD2DC_PRI_LOGOFROMFLASH 147 // 2
#define CMD2DC_PRI_STORE_DOC 16 // 1
#define CMD2DC_PRI_DOCUMENT_NR 17 // 1 + 64
#define CMD2DC_PRI_CLEAR_DOC 148 // 1
#define FIX_SLAVE_ADDR 0
#define SEND_ATONCE 1
#define SENDCOMBINED 0
class T_datif : public QObject
{
Q_OBJECT
char sendINrequestsAutomatic(void);
// sende alle Befehle um die Eingangsdaten abzufragen der Reihe nach
char loadRecDataFromFrame();
void datif_startSending(void);
void datif_sendIOrequest(uint16_t WRcmd, uint16_t RDcmd, uint8_t nrOfWrData);
void datif_send8byteOutCmd(uint16_t WRcmd, uint16_t RDcmd);
bool verifyLineTestresponse(uint8_t RdDlen, uint8_t *receivedData);
void datif_OUT_setTime(void);
uint8_t datif_OUT_SendRandomData(uint8_t *buf, uint8_t Length);
//void datif_send64byteOutCmd(uint16_t WRcmd, uint16_t addr, uint16_t RDcmd);
void datif_sendToMemory(uint16_t WRcmd, uint16_t docNr, uint16_t blockNr, uint8_t *data64);
// send printer documents to DC2 memory
// docNr: 0...15(31) with 1280 byte each (20 blocks a 64byte)
// blockNr=0...19 with 64byte each
// docNr =transmitted in WRITEADDRESS high byte
// blockNr=transmitted in WRITEADDRESS low byte
int datif_noResponseCtr;
T_prot *myDCIF;
QTimer *datif_trigger;
uint8_t selectedSlaveAddr;
private slots:
char datif_cycleSend();
void StoredRecData();
public:
T_datif(QObject *parent = nullptr);
void resetChain(void);
char isPortOpen(void);
//void sendWRcommand(uint16_t nxtAsCmd);
// Sende Schreibbefehle die bereits vorher asynchron gespeichert wurden
//void send_requests(uint16_t nextWrCmd);
//void sendHighLevel(uint16_t nxtHLCmd);
void startSupervision(void);
//void getOverallResult(void);
// 0xFF: no command sent by now
// 0: started, in progress
// 1: done and OK
// 2: done and error
void getOverallResult(void);
signals:
void ResponseRecieved();
//the requested data are stored in peripheral image
// can be loaded with epi
void datif_templatePrintFinished_OK();
void datif_templatePrintFinished_Err();
void datif_gotNewCoin();
};
#endif // CI_H