Add updated sources of thomas.

This commit is contained in:
2023-03-29 14:32:22 +02:00
parent 49396c22ee
commit 7f23e3ea46
15 changed files with 2036 additions and 756 deletions

View File

@@ -33,7 +33,7 @@ class T_com : public QMainWindow //, public QPlainTextEdit
//char oeffneSerialPort();
char open_Serial_Port();
void closeSerialPort();
void receiveByLength(void);
private slots:
void readSomeBytes(void);
@@ -54,6 +54,8 @@ public:
void writeToSerial(const QByteArray &data, uint16_t sendLength);
void receiveFixLen(int64_t nrOfbytesToReceive);
bool readFromSerial(QByteArray &data, uint16_t &sendLength);
// retval: true: data available

View File

@@ -21,6 +21,115 @@
#include <QTime>
#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_GETWAK 0x2812 // REQ not nec.
#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
/*
// WRITE Commands (e.g. switch relay)
#define CMD2DC_sendTime 0x1310
#define CMD2DC_setWakeFrequ 0x1320
@@ -110,8 +219,8 @@
#define CMD2DC_MIFREADERON 0x2900
#define CMD2DC_ATB_CREATE 0x2907
// Mif read data:
#define CMD2DC_RdBk_MifReader 0x2902
#define CMD2DC_RdBk_Mifcard 0x2903
#define CMD2DC_RdBk_MifState 0x2902
#define CMD2DC_RdBk_MifData 0x2903
#define CMD2DC_RdBk_AtbCardType 0x2905
//#define CMD2DC_RdBk_CardData 0x2906
@@ -157,7 +266,7 @@
#define CMD2DC_PRI_DOCUMENT_NR 0x2A42 // 1 + 64
#define CMD2DC_PRI_CLEAR_DOC 0x2A43 // 1
*/

View File

@@ -62,6 +62,12 @@ uint8_t dcBL_startChain(void);
uint8_t dcBL_runChain(void);
void dcBL_iniLoading(void);
void dcBL_startLoading(void);
uint8_t dcBL_sendHexfile(void);
uint8_t dcBL_getResult(void);
// call after every step to what's going on....
@@ -85,7 +91,9 @@ QString epi_getRawReceivedString();
void epi_clrRawReceivedString();
uint8_t dcBL_sendSuccess(uint8_t lastCommand);
// return val: 0: no response by now 1:error 10: OK
// lastCommand=0x21 for sendAddr or 0x22 for send data

View File

@@ -71,7 +71,7 @@ Level 3): send command: "start payment process"
#include <QTabWidget>
#include <QtPlugin>
#include <QObject>
#include "interfaces.h"
#include <plugins/interfaces.h>
#include "datIf.h"
@@ -162,8 +162,8 @@ class hwapi : public QObject,
public hwinf
{
Q_OBJECT
//Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
//Q_INTERFACES(hwinf)
Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
Q_INTERFACES(hwinf)
public:
explicit hwapi(QWidget *parent = nullptr);
@@ -371,7 +371,7 @@ public:
uint32_t dc_getVoltage(void) const override; // in mV, 0...65,535V
QString dc_getVoltagStr(void) const override;
bool dc_mainFuseIsOk(void) const ; // override
bool dc_mainFuseIsOk(void) const override;
// ------------------------------------------------------------------------------
// Level 3: digital outputs and simple switching of connected devices
@@ -385,11 +385,11 @@ public:
// dir 0=off 1=up 2=down
uint8_t lock_switchLowerLock(uint8_t dir) const override;
// dir 0=off 1=up 2=down
void lock_switchVaultDoor(void) const; // override;
void lock_switchVaultDoor(void) const override;
void coin_switchRejectMotor(uint8_t dir) const; // override;
void coin_switchRejectMotor(uint8_t dir) const override;
void coin_rejectCoins(void) const; // override;
void coin_rejectCoins(void) const override;
// LEDs
void led_switchLedIllumination(uint8_t on) const override;
@@ -400,14 +400,13 @@ public:
void led_switchLedCoinbassin(uint8_t on, uint8_t ton, uint8_t tof) const override;
void fan_switchFan(bool on) const override;
void laerm_switchSiren(bool on) const override;
void alarm_switchSiren(bool on) const override;
void bar_OpenBarrier(bool open) const override;
void ptu_switchWake(bool WAKEACTIVE) const override;
void prn_switchPower(bool on) const override;
void mif_readerOn(bool on) const override;
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
@@ -473,7 +472,7 @@ public:
bool ptu_WakeINisActive(void) const override;
bool prn_isPrinterPowerOn(void) const override;
uint8_t prn_PrnFuseIsOk(void) const; // override;
uint8_t prn_PrnFuseIsOk(void) const override;
//retval: 0: fuse blown 1: fuse OK 2:unknown as printer power is off
bool prn_readyINisActive(void) const override;
@@ -496,10 +495,10 @@ public:
bool cred_isCreditPowerOn(void) const override;
bool cash_getRejectMotorHomePos(void) const; // override;
bool cash_getLowPaperSensor(void) const; // override;
bool cash_getRejectMotorHomePos(void) const override;
uint8_t cash_getLowPaperSensor(void) const override;
// 0: Sensor sees paper 1: no paper 99: off
// ------------------------------------------------------------------------------
@@ -531,7 +530,9 @@ public:
void request_MifareReaderState() const override;
void request_MifareCardType() const override;
void request_MifareAtbType() const override;
void request_MifareData() const override;
void request_MifareID() const override;
void request_MifareData(uint8_t dataBlockNumber) const override;
// dataBlockNumber must be 0....11, returns 64byte of data
void request_MDB_Status() const override;
void request_MDB_lastResponse() const override;
@@ -597,6 +598,13 @@ public:
void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker,
uint8_t kindOfMifareReader, uint8_t suppressSleep,
uint8_t kindOfModem, uint8_t kindOfCredit ) const override;
// enable hardware in device controller:
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
// kindOfCredit: 0:off 1: cVendTopp 2:cVendPin (not yet implemented)
void request_ReadbackDeviceSettings() const override;
@@ -626,7 +634,7 @@ public:
uint8_t lock_closeUpperDoor(void) const override;
uint8_t lock_openLowerDoor(void) const override;
//uint8_t lock_closeLowerDoor(void) const override;
uint8_t lock_closeLowerDoor(void) const override;
void shut_openOnce(void) const override;
@@ -652,29 +660,23 @@ public:
// read response from DC2 (input data)
// ------------------------------------------------------------------------------
/* data description:
byte 0: current read state: 0=power off 1=reader-fault 2=ready
uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const override;
// retval 0=OK 1=error host buffer too small
/* data description, new fast version:
byte 0= still the same: current read state:
0=power off 1=reader-fault 2=ready
3=just reading 4=read complete
5=read partial, removed too early
6=state unknown
byte 1,2: read data length from card
3: 1=reader is OK (reported serial nr is OK) 0=wrong or no reader
4...15: reader version, expected "ATB25-1.8"
byte16: 1=card is present 0:not
17: 0
18: card type reported from reader
19: 1=allowed card type 0=not
20: card size: 1 or 4 (dec) = card size
21: LengthOfUID: 4 or 7 (dec) (byte)
22: UID 8 byte in hex
byte 30: sector logged: 0
byte 31: current sector: 0
byte 32: result, always 0
byte 1: reader state 1=ok 0=nok
byte 2: card preent (0,1)
byte 3: card selected (0)
byte 4: card type: 0...5
byte 5: card allowed (0=no 1=MifareClassic 1k or 4k)
byte 6: CardSize: 1 or 4 (kB)
byte 7: length of UID 4 or 7 (byte)
*/
uint8_t mif_returnReaderStateAndCardType(uint8_t *buf, uint8_t maxBufferSize) const override;
// retval 0=OK 1=error host buffer too small
bool mif_readerIsOK(void) const override;
@@ -965,6 +967,53 @@ public:
// signal: channel nr reported from checker 0...15
// neu, 25.3.23
void bl_rebootDC(void) const override;
void bl_startBL(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"
void bl_sendAddress(u_int16_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
uint8_t bl_wasSendingAddOK(void) const override;
// return val: 0: no response by now 1:error 10: OK
void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override;
// send 64 byte from bin file
void bl_sendLastBlock(void) const override;
uint8_t bl_wasSendingDataOK(void) const override;
// return val: 0: no response by now 1:error 10: OK
void bl_stopBL(void) const override;
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, 25.8.21

File diff suppressed because it is too large Load Diff

View File

@@ -26,6 +26,23 @@
#define FRAME_MAXLEN FRAME_DATALEN+20
#define BL_DATA_LEN 150
#define DATALEN_SEND_FAST 4
#define DATALEN_SEND_LONG 64
#define HEADERLEN_SEND 4
#define TELEGRAMLEN_SEND_FAST 12
#define TELEGRAMLEN_SEND_LONG 70
#define STARTSIGN_SEND_FAST 0x3F
#define STARTSIGN_SEND_LONG 0x3D
#define DATALEN_RECEIVE_FAST 8
#define DATALEN_RECEIVE_LONG 64
#define HEADERLEN_RECEIVE 2
#define TELEGRAMLEN_RECEIVE_FAST 12
#define TELEGRAMLEN_RECEIVE_LONG 68
#define STARTSIGN_RECEIVE_FAST 0x5F
#define STARTSIGN_RECEIVE_LONG 0x5D
class T_prot : public QMainWindow
{
Q_OBJECT
@@ -62,9 +79,15 @@ class T_prot : public QMainWindow
T_com *mySerialPort;
void startPacking(void);
void startFastPacking(void);
uint8_t FramecheckInData(uint8_t *Inbuf, uint16_t LL);
uint8_t FastCheckInData(uint8_t *Inbuf, uint16_t LL);
uint8_t CheckInResult(uint8_t *Inbuf);
uint8_t CheckInData(uint8_t *recBuffer);
uint8_t ShowFastInData(uint8_t *recBuffer);
uint8_t ShowInData(uint8_t *recBuffer); // was CheckInData
void setRecLen(uint16_t WriteCmd);
private slots:
void analyseRecData(void);
@@ -87,6 +110,8 @@ public:
void setBLsendData( uint8_t len, uint8_t *buf);
void receiveFixLen(int64_t nrOfbytesToReceive);
void sendUserData(uint16_t slaveAdr);
bool ifDataReceived();
bool getReceivedInData(uint8_t *SlavAddr, uint16_t *readSrc, uint16_t *readAddr,

View File

@@ -73,10 +73,10 @@
#define SEND_REQU_PRN_FONTS 121
#define SEND_REQU_PRN_ALL 122
#define SEND_REQU_MIFREADER 123
#define SEND_REQU_MIFSTATE 123
// Type and state of reader
#define SEND_REQU_MIFCARD 124
#define SEND_REQU_MIFDATA 124
// Type, UID, Header of card
// read one card sector
// sectors must be addressed by RD_ADD

View File

@@ -210,10 +210,10 @@ void gpi_storeDI_rejMot_home(bool di);
bool epi_getDI_rejectMotor_homepos(void);
void gpi_storeDI_paperLow(bool di);
bool epi_getDI_npe_sensor(void);
void gpi_storeDI_paperLow(uint8_t di);
uint8_t epi_getDI_npe_sensor(void);
// 0: Sensor sees paper 1: no paper 99: off
@@ -407,7 +407,7 @@ void gpi_storeMifCardData(uint8_t blkNr, uint8_t *receivedData);
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
// blkNr=0...11 return buf[64]
// retval: 1=error 0=OK