Compare commits
11 Commits
master
...
fix-dynami
Author | SHA1 | Date | |
---|---|---|---|
91ce1c84d8 | |||
dda9e4ad8f | |||
81cba7e615 | |||
b4a6d4a073 | |||
c8d7f2f904 | |||
0dc38d8908 | |||
f28f102ca0 | |||
d04e9ead89 | |||
9a584713e9 | |||
0fca448c53 | |||
a4afc4ced7 |
@ -87,6 +87,7 @@ HEADERS += \
|
|||||||
$${PWD}/include/dcBL.h \
|
$${PWD}/include/dcBL.h \
|
||||||
$${PWD}/include/hwapi.h \
|
$${PWD}/include/hwapi.h \
|
||||||
$${PWD}/include/interfaces.h \
|
$${PWD}/include/interfaces.h \
|
||||||
|
$${PWD}/include/dynamic-machine-conditions.h \
|
||||||
$${PWD}/include/sendWRcmd.h \
|
$${PWD}/include/sendWRcmd.h \
|
||||||
$${PWD}/include/storeINdata.h \
|
$${PWD}/include/storeINdata.h \
|
||||||
$${PWD}/include/tslib.h \
|
$${PWD}/include/tslib.h \
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "CArun.h"
|
#include "CArun.h"
|
||||||
#include "datei.h"
|
#include "datei.h"
|
||||||
|
|
||||||
#include "CCWakelineAbstraction.h"
|
|
||||||
|
|
||||||
|
|
||||||
CArun::CArun(QObject *parent)
|
CArun::CArun(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -19,8 +17,6 @@ CArun::CArun(QObject *parent)
|
|||||||
qCritical() << "CArun: start setup...";
|
qCritical() << "CArun: start setup...";
|
||||||
|
|
||||||
this->timerChainCtrl->start();
|
this->timerChainCtrl->start();
|
||||||
|
|
||||||
this->ccWakelineAbstraction = new CCWakelineAbstraction(this->HWaccess, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +110,7 @@ void CArun::chainControl(void)
|
|||||||
case SETUP_STEP::OPEN_SERIAL_PORT:
|
case SETUP_STEP::OPEN_SERIAL_PORT:
|
||||||
qCritical() << "CArun: SETUP_STEP::OPEN_SERIAL_PORT";
|
qCritical() << "CArun: SETUP_STEP::OPEN_SERIAL_PORT";
|
||||||
this->openSerialPort();
|
this->openSerialPort();
|
||||||
this->setupStep = SETUP_STEP::TEST_OPEN_PORT;
|
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
||||||
this->timerChainCtrl->start();
|
this->timerChainCtrl->start();
|
||||||
break;
|
break;
|
||||||
case SETUP_STEP::TEST_OPEN_PORT:
|
case SETUP_STEP::TEST_OPEN_PORT:
|
||||||
@ -151,7 +147,7 @@ void CArun::chainControl(void)
|
|||||||
|
|
||||||
this->HWaccess->dc_autoRequest(1);
|
this->HWaccess->dc_autoRequest(1);
|
||||||
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
this->setupStep = SETUP_STEP::CHECK_VALID_DATA;
|
||||||
this->timerChainCtrl->start(2000);
|
this->timerChainCtrl->start();
|
||||||
break;
|
break;
|
||||||
case SETUP_STEP::CHECK_VALID_DATA:
|
case SETUP_STEP::CHECK_VALID_DATA:
|
||||||
qCritical() << "CArun: SETUP_STEP::CHECK_VALID_DATA";
|
qCritical() << "CArun: SETUP_STEP::CHECK_VALID_DATA";
|
||||||
|
@ -22,7 +22,7 @@ enum class SETUP_STEP {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CCWakelineAbstraction;
|
|
||||||
|
|
||||||
class CArun : public QObject
|
class CArun : public QObject
|
||||||
{
|
{
|
||||||
@ -45,8 +45,6 @@ private:
|
|||||||
|
|
||||||
void openSerialPort();
|
void openSerialPort();
|
||||||
|
|
||||||
CCWakelineAbstraction* ccWakelineAbstraction;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
#include <QFileSystemWatcher>
|
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "CCWakelineAbstraction.h"
|
|
||||||
#include "plugin.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* this is based on a solution from:
|
|
||||||
* https://embeddeduse.com/2018/09/18/monitoring-sys-files-qfilesystemwatcher/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
CCWakelineAbstraction::CCWakelineAbstraction(hwinf *dc, QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, dc(dc)
|
|
||||||
{
|
|
||||||
auto ccWakeMonitor = new QFileSystemWatcher(this);
|
|
||||||
|
|
||||||
ccWakeMonitor->addPath("/sys/class/leds/wakeupctrl_cc/brightness");
|
|
||||||
connect(ccWakeMonitor, &QFileSystemWatcher::fileChanged,
|
|
||||||
this, &CCWakelineAbstraction::ccWakeChanged);
|
|
||||||
|
|
||||||
qCritical() << "... init CCWakelineAbstraction";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CCWakelineAbstraction::ccWakeChanged(const QString &path)
|
|
||||||
{
|
|
||||||
QFile ccWakeFile(path);
|
|
||||||
if (!ccWakeFile.open(QIODevice::ReadOnly)) {
|
|
||||||
qWarning() << "ERROR: Could not open ccWakeFile file.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto ccWake = ccWakeFile.readAll();
|
|
||||||
if (!ccWake.isEmpty()) {
|
|
||||||
int state = ccWake.at(0);
|
|
||||||
//qCritical() << "INFO: ccWake = " << state;
|
|
||||||
switch (state) {
|
|
||||||
case 0x30: // '1'
|
|
||||||
qCritical() << "INFO: ccWake -> sleep";
|
|
||||||
this->dc->credit_switchWake(true); // switch 'sleep'
|
|
||||||
break;
|
|
||||||
case 0x31: // '0'
|
|
||||||
qCritical() << "INFO: ccWake -> wake";
|
|
||||||
this->dc->credit_switchWake(false); // switch 'wake'
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
#ifndef CCWAKELINEABSTRACTION_H
|
|
||||||
#define CCWAKELINEABSTRACTION_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class hwinf;
|
|
||||||
class QFileSystemWatcher;
|
|
||||||
|
|
||||||
|
|
||||||
class CCWakelineAbstraction : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CCWakelineAbstraction(hwinf *dc, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
hwinf *dc;
|
|
||||||
QFileSystemWatcher *ccWakeMonitor;
|
|
||||||
|
|
||||||
void ccWakeChanged(const QString &path);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CCWAKELINEABSTRACTION_H
|
|
@ -40,14 +40,12 @@ DEFINES+=APP_EXTENDED_VERSION=\\\"$$EXTENDED_VERSION\\\"
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
CArun.cpp \
|
CArun.cpp \
|
||||||
CCWakelineAbstraction.cpp \
|
|
||||||
main.cpp \
|
main.cpp \
|
||||||
tslib.cpp \
|
tslib.cpp \
|
||||||
datei.cpp
|
datei.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
CArun.h \
|
CArun.h \
|
||||||
CCWakelineAbstraction.h \
|
|
||||||
guidefs.h \
|
guidefs.h \
|
||||||
tslib.h \
|
tslib.h \
|
||||||
versionHistory.txt \
|
versionHistory.txt \
|
||||||
|
@ -161,8 +161,6 @@ class T_datif : public QObject
|
|||||||
// blockNr=transmitted in WRITEADDRESS low byte
|
// blockNr=transmitted in WRITEADDRESS low byte
|
||||||
|
|
||||||
int datif_noResponseCtr;
|
int datif_noResponseCtr;
|
||||||
int datif_nowNewDyns;
|
|
||||||
int datif_nowNewStats;
|
|
||||||
|
|
||||||
T_prot *myDCIF;
|
T_prot *myDCIF;
|
||||||
QTimer *datif_trigger;
|
QTimer *datif_trigger;
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
void incTextBuffer(void)
|
|
||||||
{
|
|
||||||
runProc_prnSeqNr++;
|
|
||||||
runProc_pointPrnTxt=0;
|
|
||||||
if (runProc_prnSeqNr>127)
|
|
||||||
runProc_prnSeqNr=127;
|
|
||||||
runProc_prnCmdSeq[runProc_pointPrnCmd]=1;
|
|
||||||
runProc_prnCmdPara[runProc_pointPrnCmd++]=runProc_prnSeqNr;
|
|
||||||
}*/
|
|
||||||
/*
|
|
||||||
void T_runProc::subAppendNxtTxt(char *textLine)
|
|
||||||
{
|
|
||||||
// append given text to current sequence, respect max. sequ.length
|
|
||||||
|
|
||||||
// also send a command "print text buffer nn" ==1 once for each buffer
|
|
||||||
//static uint8_t runProc_prnCmdSeq[512];
|
|
||||||
//static uint8_t runProc_prnCmdPara[512];
|
|
||||||
//static uint16_t runProc_pointPrnCmd;
|
|
||||||
|
|
||||||
int sl=strlen(textLine);
|
|
||||||
if (sl>1024) sl=1024;
|
|
||||||
textLine[sl]=0;
|
|
||||||
if (runProc_prnSeqNr==0 && runProc_pointPrnTxt<3)
|
|
||||||
{
|
|
||||||
// then this is the very first text entry
|
|
||||||
// store command to print this buffer
|
|
||||||
runProc_prnCmdSeq[runProc_pointPrnCmd]=1;
|
|
||||||
runProc_prnCmdPara[runProc_pointPrnCmd++]=runProc_prnSeqNr;
|
|
||||||
}
|
|
||||||
if ( (runProc_pointPrnTxt + sl) > 1023)
|
|
||||||
{
|
|
||||||
incTextBuffer();
|
|
||||||
|
|
||||||
}
|
|
||||||
runProc_prnTextSeq[runProc_prnSeqNr].append(textLine);
|
|
||||||
|
|
||||||
//for (nn=0; nn<sl; nn++)
|
|
||||||
//{
|
|
||||||
//runProc_prnTextSeq[runProc_prnSeqNr][runProc_pointPrnTxt+nn]=textLine[nn];
|
|
||||||
//}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// qCritical() << "emitting signal payCancelled";
|
|
||||||
// emit runProc_payCancelled();
|
|
||||||
/*
|
|
||||||
// gabs bei Szeged, jetzt nicht mehr:
|
|
||||||
if (payInProg==8)
|
|
||||||
{
|
|
||||||
// coin checker faulty, cannot start
|
|
||||||
if (hwapi_paymentStarted==1)
|
|
||||||
{
|
|
||||||
hwapi_paymentStarted=90; // stop due to error
|
|
||||||
qCritical() << "emitting signal coinCollectionAborted 1";
|
|
||||||
emit runProc_coinCollectionAborted();
|
|
||||||
//sendFDcmd_set(156, 0,0, 2,0,0,0); // cancel payment
|
|
||||||
}
|
|
||||||
return 10; // error cannot start
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
static uint8_t Sdata_DeviceParameter[64];
|
|
||||||
static uint8_t Sdata_DevParaLen;
|
|
||||||
|
|
||||||
uint8_t T_runProc::epi_store64BdevParameter(uint8_t length, uint8_t *buf)
|
|
||||||
{
|
|
||||||
// HWapi writes data to be stored
|
|
||||||
uint8_t nn;
|
|
||||||
for (nn=0; nn<length; nn++)
|
|
||||||
Sdata_DeviceParameter[nn]=buf[nn];
|
|
||||||
for (nn=length; nn<64; nn++)
|
|
||||||
Sdata_DeviceParameter[nn]=0;
|
|
||||||
|
|
||||||
Sdata_DevParaLen=length;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t T_runProc::epi_restore64BdevParameter(uint8_t *length, uint8_t *buf)
|
|
||||||
{
|
|
||||||
|
|
||||||
for (uint8_t nn=0; nn<Sdata_DevParaLen; nn++)
|
|
||||||
buf[nn]=Sdata_DeviceParameter[nn];
|
|
||||||
*length=Sdata_DevParaLen;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
84
include/dynamic-machine-conditions.h
Normal file
84
include/dynamic-machine-conditions.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#ifndef DYNAMIC_MACHINE_CONDITIONS_H_INCLUDED
|
||||||
|
#define DYNAMIC_MACHINE_CONDITIONS_H_INCLUDED
|
||||||
|
|
||||||
|
struct T_dynamicCondition
|
||||||
|
{
|
||||||
|
char allDoorsDebounced;
|
||||||
|
char openedAuthorized;
|
||||||
|
uint8_t CBinDebounced; // 0:fehlt 1:drin
|
||||||
|
char upperDoor; // 99: undefined 0:closed 1:open
|
||||||
|
char middleDoor; // 99: undefined 0:closed 1:open
|
||||||
|
char lowerDoor; // 99: undefined 0:closed 1:open
|
||||||
|
char coinAttached;
|
||||||
|
char billBox;
|
||||||
|
char modeAbrech;
|
||||||
|
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
||||||
|
char nowCardTest;
|
||||||
|
char nowPayment; // not used, always 0
|
||||||
|
char lastMifCardType;
|
||||||
|
uint8_t lastSDoorState;
|
||||||
|
uint8_t lastVDoorState;
|
||||||
|
uint8_t lastCBstate;
|
||||||
|
char paymentInProgress;
|
||||||
|
// Version Szeged: aug2023
|
||||||
|
// 0: stopped by timeout
|
||||||
|
// 1: running 2: wait4lastCoin
|
||||||
|
// 3: payment stopped manually, coins in Escrow
|
||||||
|
// 4: payment stopped autom, amount collected, coins in Escrow
|
||||||
|
// 5: payment stopped, escrow full, coins in Escrow
|
||||||
|
// 6: coins encashed 7:coins returned
|
||||||
|
// 8: CoinChecker or MDB on Error
|
||||||
|
|
||||||
|
// since Schoenau with bill and changer, nov2023
|
||||||
|
//0 = no payment
|
||||||
|
//will be set to 1 by cash_startCollection()
|
||||||
|
//neu 1: wait for devices getting ready for payment
|
||||||
|
//2 = payment,
|
||||||
|
//3 = wait for last coin/bill
|
||||||
|
//4 = Bezahlvorgang manuell beendet
|
||||||
|
//5 = payment stopped autom, amount collected, coins in Escrow
|
||||||
|
//6 = Bezahlvorgang beendet weil ZK voll
|
||||||
|
//4,5,6: payment done, keep on polling, wait for cash or return command
|
||||||
|
//7 = encash collected money from coin escrow into cash box
|
||||||
|
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
|
||||||
|
//9 = wait for changer result
|
||||||
|
//10= print refund receipt with "amountToReturn"
|
||||||
|
|
||||||
|
char res1;
|
||||||
|
uint16_t U_Batt;
|
||||||
|
uint16_t Temperatur;
|
||||||
|
uint16_t nrCoinsInBox;
|
||||||
|
uint32_t amountInBox;
|
||||||
|
uint32_t totalTransVolume;
|
||||||
|
uint32_t totalNrOfVends;
|
||||||
|
char jsonValid_config;
|
||||||
|
char jsonValid_device;
|
||||||
|
char jsonValid_cash;
|
||||||
|
char jsonValid_print;
|
||||||
|
// 40
|
||||||
|
char jsonValid_serial;
|
||||||
|
char jsonValid_time;
|
||||||
|
char lastFileType;
|
||||||
|
uint8_t MifCardHolder[8];
|
||||||
|
uint8_t resultOfLastTemplPrint;
|
||||||
|
// 0: unknown or printing in progress
|
||||||
|
// 1: OK, doc was printed 2: error, doc was not printed
|
||||||
|
uint8_t lastPrinterStatus;
|
||||||
|
// 0: printer OK
|
||||||
|
// bit0: near paper end bit1: no paper
|
||||||
|
// bit2: temperature error bit3: error head open
|
||||||
|
// bit4: paper jam in cutter
|
||||||
|
// bit6: no response bit7: serial rec. error
|
||||||
|
// bit5: printer not ready
|
||||||
|
uint8_t startupTestIsRunning;
|
||||||
|
|
||||||
|
uint8_t padd01;
|
||||||
|
uint8_t padd02;
|
||||||
|
uint8_t padd03;
|
||||||
|
uint32_t padd04;
|
||||||
|
uint32_t padd05;
|
||||||
|
uint32_t padd06;
|
||||||
|
uint16_t padd07;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DYNAMIC_MACHINE_CONDITIONS_H_INCLUDED
|
@ -2,7 +2,6 @@
|
|||||||
matching interfaces.h:
|
matching interfaces.h:
|
||||||
|
|
||||||
// History
|
// History
|
||||||
|
|
||||||
// 11.10.2021: V1.0 222 functions
|
// 11.10.2021: V1.0 222 functions
|
||||||
// 23.12.2021: V1.1 added block-parameter to function "read mifare data"
|
// 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()
|
// 30.12.2021: V1.2 added function: mif_clearDataBuffer(), mif_isBlockAvailable(uint8_t blkNr) and mif_getAvailableDataBlocks()
|
||||||
@ -15,32 +14,12 @@ matching interfaces.h:
|
|||||||
// V3.2 Bootloader improvement
|
// V3.2 Bootloader improvement
|
||||||
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
||||||
|
|
||||||
|
|
||||||
14.7.23TS: patch for correct printer state in line 3364 in sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
|
||||||
|
|
||||||
8.9.2023 two new functions (end of file) for mifare test. Interface version 4.4 DC4.40...4.43
|
|
||||||
|
|
||||||
14.09.2023: Verriegelung eingebaut, nur noch gültige Abr.Daten zurückgeben, Suchbegriff: <epi_restoreVaultRecord>
|
|
||||||
alle Mifare-Funktionen ueberprueft und ggf verbessert
|
|
||||||
18.09.2023: Signal "Kasse entnommen" und Signale "Tuer auf/zu" ueberprueft
|
|
||||||
|
|
||||||
20.9.2023: in datif die Abfrage der DynMachineData massiv beschleunigt
|
|
||||||
und hier in hwapi die entprellten Werte fuer Tueren und Kasse verwenden.
|
|
||||||
Problem war: Signal "Kasse entnommen" war zu langsam -> manchmal abr nicht gesendet
|
|
||||||
|
|
||||||
14.3.24 new function bool hwapi::cash_isCollectionStarted(void) const
|
|
||||||
padding three struct to 64 byte to avoid stack overflow when using
|
|
||||||
|
|
||||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
//#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.1"
|
||||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
||||||
|
|
||||||
V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
||||||
|
|
||||||
23.5.2024: prn_getHwState() fixed and moved down to runProc with a wrapper in hwapi, current version: 5.5
|
|
||||||
several new functions for "direct ticket print", without the dueway loading jsons to DC and cmd DC to print
|
|
||||||
The same rules as before apply to the json, but it can have any arbitrary length
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -590,10 +569,12 @@ public:
|
|||||||
// read printer condition and settings
|
// read printer condition and settings
|
||||||
|
|
||||||
uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const override;
|
uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const override;
|
||||||
// return value: =prn_hw_state[0]
|
// retval: status byte
|
||||||
// 0:unknown 1: printer OK 100: printer OK but paper near end
|
// byte 0 = 0: prnter OK, >0: error
|
||||||
// 200: not connected 201: printer on error 202: no paper
|
// bit0: paper low 1: no paper 2: temperature error
|
||||||
|
// 3: head open 4: paper jam in cutter
|
||||||
|
// 6: no response 7: bad response from printer
|
||||||
|
// and return struct "Tprn_hw_state"
|
||||||
|
|
||||||
bool prn_isUpAndReady(void) const override;
|
bool prn_isUpAndReady(void) const override;
|
||||||
// true: printer is powered, serial is ok, no error, printer is connected and resonding
|
// true: printer is powered, serial is ok, no error, printer is connected and resonding
|
||||||
@ -622,7 +603,7 @@ public:
|
|||||||
|
|
||||||
void prn_movePaper(uint8_t wayInMm, uint8_t direction) const override;
|
void prn_movePaper(uint8_t wayInMm, uint8_t direction) const override;
|
||||||
//direction: 1=forward 2=backward
|
//direction: 1=forward 2=backward
|
||||||
|
//
|
||||||
void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const override;
|
void prn_setFonts(uint8_t font, uint8_t size, uint8_t width, uint8_t height) const override;
|
||||||
// font = kind of font 5...11 (0..22)
|
// font = kind of font 5...11 (0..22)
|
||||||
// size = 6...20, 9..9: too tiny 10: small ...12 = normal size ...20=huge
|
// size = 6...20, 9..9: too tiny 10: small ...12 = normal size ...20=huge
|
||||||
@ -1052,10 +1033,10 @@ public:
|
|||||||
|
|
||||||
void sys_getDeviceConditions(struct T_moduleCondition *devCond) 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(void *data) const override;
|
||||||
|
|
||||||
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
||||||
|
|
||||||
|
|
||||||
uint32_t cash_getAmountInVault(void) const override;
|
uint32_t cash_getAmountInVault(void) const override;
|
||||||
|
|
||||||
uint16_t cash_getNrCoinsInVault(void) const override;
|
uint16_t cash_getNrCoinsInVault(void) const override;
|
||||||
@ -1376,30 +1357,6 @@ public:
|
|||||||
|
|
||||||
virtual QObject const *getAPI() override;
|
virtual QObject const *getAPI() override;
|
||||||
|
|
||||||
void mod_switchResetline(void) override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 22.5.2024 direct ticket printing
|
|
||||||
|
|
||||||
void prn_translateLocalPrinterJson(QByteArray jsonFile2print) const override;
|
|
||||||
// load, parse, translate and save the file
|
|
||||||
|
|
||||||
void prnStoreDynamics(char *bufferDynPrintVars[], uint8_t nrOfDyns) const override;
|
|
||||||
// store nrOfDyns (up to 16) dynamics before printing
|
|
||||||
// max length = 16 byte per dynamic
|
|
||||||
// 16 strings with up to 16bytes each
|
|
||||||
|
|
||||||
void prn_printTranslatedTicket(void) const override;
|
|
||||||
|
|
||||||
uint8_t prn_waitForDirectTicket(void) const override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void hwapi_reportDCDownloadStatus(QString const&) const override;
|
void hwapi_reportDCDownloadStatus(QString const&) const override;
|
||||||
void hwapi_reportDCDownloadSuccess(QString const&) const override;
|
void hwapi_reportDCDownloadSuccess(QString const&) const override;
|
||||||
@ -1431,8 +1388,6 @@ signals:
|
|||||||
|
|
||||||
void hwapi_coinAttached() const override;
|
void hwapi_coinAttached() const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//void hwapi_slotPrintFinished_OK(void);
|
//void hwapi_slotPrintFinished_OK(void);
|
||||||
//void hwapi_slotPrintFinished_Err(void);
|
//void hwapi_slotPrintFinished_Err(void);
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct T_emp
|
struct T_emp
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -179,64 +177,57 @@ struct T_moduleCondition
|
|||||||
// 50..99 = HINT / Notification
|
// 50..99 = HINT / Notification
|
||||||
// 100..150 = WARNING
|
// 100..150 = WARNING
|
||||||
// 200..250 = ERROR
|
// 200..250 = ERROR
|
||||||
|
|
||||||
uint8_t ram;
|
uint8_t ram;
|
||||||
uint8_t intEe;
|
uint8_t intEe;
|
||||||
uint8_t extEe;
|
uint8_t extEe;
|
||||||
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
||||||
|
|
||||||
uint8_t boardHw;
|
uint8_t boardHw;
|
||||||
uint8_t printer;
|
uint8_t printer;
|
||||||
uint8_t modem;
|
uint8_t modem;
|
||||||
uint8_t signal; // 1...99
|
uint8_t signal; // 1...99
|
||||||
|
|
||||||
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
||||||
uint8_t mdbBus;
|
uint8_t mdbBus;
|
||||||
|
// 10
|
||||||
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
||||||
uint8_t coinEscrow;
|
uint8_t coinEscrow;
|
||||||
|
|
||||||
uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
|
uint8_t mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
|
||||||
uint8_t creditTerm;
|
uint8_t creditTerm;
|
||||||
uint8_t coinReject;
|
uint8_t coinReject;
|
||||||
uint8_t coinSafe;
|
uint8_t coinSafe;
|
||||||
|
|
||||||
uint8_t billSafe;
|
uint8_t billSafe;
|
||||||
uint8_t voltage; // 1:11..14V
|
uint8_t voltage; // 1:11..14V
|
||||||
uint8_t temper;
|
uint8_t temper;
|
||||||
uint8_t poweronTest;
|
uint8_t poweronTest;
|
||||||
|
// 20
|
||||||
uint8_t doorState; // 1: alles zu 200: tuer offen + bit1(S) +bit2(CB) + bit3(CB)
|
uint8_t doorState; // 1: alles zu 200: tuer offen + bit1(S) +bit2(CB) + bit3(CB)
|
||||||
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
||||||
uint8_t changer;
|
uint8_t changer; // can only be tested by usage
|
||||||
uint8_t coinBlocker;
|
uint8_t coinBlocker; // can only be tested by usage
|
||||||
|
uint8_t billReader; // can only be tested by usage
|
||||||
uint8_t billReader;
|
|
||||||
uint8_t ResetReason;
|
uint8_t ResetReason;
|
||||||
uint8_t allModulesChecked;
|
uint8_t allModulesChecked;
|
||||||
uint8_t alarmState;
|
uint8_t alarmState;
|
||||||
|
|
||||||
uint8_t fuses;
|
|
||||||
uint8_t res11;
|
uint8_t res11;
|
||||||
uint8_t res12;
|
uint8_t res12;
|
||||||
|
// 30
|
||||||
uint8_t res13;
|
uint8_t res13;
|
||||||
// 32
|
|
||||||
|
|
||||||
uint8_t padd00;
|
|
||||||
uint8_t padd01;
|
uint8_t padd01;
|
||||||
uint8_t padd02;
|
uint8_t padd02;
|
||||||
uint8_t padd03;
|
uint8_t padd03;
|
||||||
//36
|
|
||||||
uint32_t padd04;
|
uint32_t padd04;
|
||||||
uint32_t padd05;
|
uint32_t padd05;
|
||||||
uint32_t padd06;
|
uint32_t padd06;
|
||||||
uint32_t padd07;
|
uint32_t padd07;
|
||||||
// 52
|
// 50
|
||||||
uint32_t padd08;
|
uint32_t padd08;
|
||||||
uint32_t padd09;
|
uint32_t padd09;
|
||||||
uint32_t padd10;
|
uint32_t padd10;
|
||||||
|
uint16_t padd11;
|
||||||
// 64
|
// 64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ATTENTION: struct length must be 64 exactly!!!
|
||||||
struct T_dynamicCondition
|
struct T_dynamicCondition
|
||||||
{
|
{
|
||||||
char allDoorsDebounced;
|
char allDoorsDebounced;
|
||||||
@ -255,7 +246,7 @@ struct T_dynamicCondition
|
|||||||
char lastMifCardType;
|
char lastMifCardType;
|
||||||
uint8_t lastSDoorState;
|
uint8_t lastSDoorState;
|
||||||
uint8_t lastVDoorState;
|
uint8_t lastVDoorState;
|
||||||
uint8_t lastCBstate; // =0, not used
|
uint8_t lastCBstate;
|
||||||
char paymentInProgress;
|
char paymentInProgress;
|
||||||
// Version Szeged: aug2023
|
// Version Szeged: aug2023
|
||||||
// 0: stopped by timeout
|
// 0: stopped by timeout
|
||||||
@ -298,10 +289,7 @@ struct T_dynamicCondition
|
|||||||
char jsonValid_serial;
|
char jsonValid_serial;
|
||||||
char jsonValid_time;
|
char jsonValid_time;
|
||||||
char lastFileType;
|
char lastFileType;
|
||||||
|
|
||||||
uint8_t MifCardHolder[8];
|
uint8_t MifCardHolder[8];
|
||||||
// 51
|
|
||||||
|
|
||||||
uint8_t resultOfLastTemplPrint;
|
uint8_t resultOfLastTemplPrint;
|
||||||
// 0: unknown or printing in progress
|
// 0: unknown or printing in progress
|
||||||
// 1: OK, doc was printed 2: error, doc was not printed
|
// 1: OK, doc was printed 2: error, doc was not printed
|
||||||
@ -312,36 +300,17 @@ struct T_dynamicCondition
|
|||||||
// bit4: paper jam in cutter
|
// bit4: paper jam in cutter
|
||||||
// bit6: no response bit7: serial rec. error
|
// bit6: no response bit7: serial rec. error
|
||||||
// bit5: printer not ready
|
// bit5: printer not ready
|
||||||
uint8_t startupTestIsRunning; // =0, not used
|
uint8_t startupTestIsRunning;
|
||||||
uint16_t empty; // neu 3.7.24, dieser Platz wird vom Compiler im Ram
|
|
||||||
// freigehalten weil naechster Wert ein Long ist
|
|
||||||
// 56
|
|
||||||
// new since 7.5.24
|
|
||||||
uint32_t totalNrOfCuts;
|
|
||||||
uint16_t nextAccountNumber;
|
|
||||||
uint16_t nrOfBillsInBox;
|
|
||||||
//uint16_t padd07; // raus am 3.7.24
|
|
||||||
// 64
|
|
||||||
|
|
||||||
// rest comes with new cmd:
|
|
||||||
uint32_t amountInBillbox;
|
|
||||||
uint16_t UbatAtLastPrint;
|
|
||||||
uint16_t pad01;
|
|
||||||
uint32_t reserve01;
|
|
||||||
uint32_t reserve02;
|
|
||||||
uint32_t reserve03;
|
|
||||||
uint32_t reserve04;
|
|
||||||
uint32_t reserve05;
|
|
||||||
uint32_t reserve06;
|
|
||||||
uint32_t reserve07;
|
|
||||||
uint32_t reserve08;
|
|
||||||
uint32_t reserve09;
|
|
||||||
uint32_t reserve10;
|
|
||||||
uint32_t reserve11;
|
|
||||||
uint32_t reserve12;
|
|
||||||
uint32_t reserve13;
|
|
||||||
uint32_t reserve14;
|
|
||||||
|
|
||||||
|
uint8_t padd01;
|
||||||
|
uint8_t padd02;
|
||||||
|
uint8_t padd03;
|
||||||
|
//50
|
||||||
|
uint32_t padd04;
|
||||||
|
uint32_t padd05;
|
||||||
|
uint32_t padd06;
|
||||||
|
uint16_t padd07;
|
||||||
|
// 64
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_extTime
|
struct T_extTime
|
||||||
@ -387,37 +356,24 @@ struct T_devices
|
|||||||
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW)
|
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza Csquare (MW)
|
||||||
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
||||||
UCHAR solarPower; // 1:sleep allowed 0: no sleep
|
UCHAR solarPower; // 1:sleep allowed 0: no sleep
|
||||||
|
|
||||||
UCHAR kindOfModem; // 0:off 1:Sunlink
|
UCHAR kindOfModem; // 0:off 1:Sunlink
|
||||||
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
||||||
UCHAR CoinEscrow;
|
UCHAR CoinEscrow;
|
||||||
UCHAR CoinRejectUnit;
|
UCHAR CoinRejectUnit;
|
||||||
|
|
||||||
UCHAR CoinShutter;
|
UCHAR CoinShutter;
|
||||||
UCHAR BillAcceptor;
|
UCHAR BillAcceptor;
|
||||||
// 10
|
// 10
|
||||||
UCHAR usevaultLock;
|
UCHAR usevaultLock;
|
||||||
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
||||||
|
|
||||||
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
||||||
UCHAR printAccReceipt; // 0/1
|
UCHAR printAccReceipt; // 0/1
|
||||||
UCHAR printDoorReceipt;
|
UCHAR printDoorReceipt;
|
||||||
UCHAR printTokenTicket;
|
UCHAR printTokenTicket;
|
||||||
|
|
||||||
UINT VaultFullWarnLevel;
|
UINT VaultFullWarnLevel;
|
||||||
UINT VaultFullErrorLevel;
|
UINT VaultFullErrorLevel;
|
||||||
// 20
|
// 30
|
||||||
UINT BattEmptyWarnLevel;
|
UINT BattEmptyWarnLevel;
|
||||||
UINT BattEmptyErrorLevel;
|
UINT BattEmptyErrorLevel;
|
||||||
|
|
||||||
UCHAR useForeignCharacters;
|
|
||||||
UCHAR printRefundReceipt;
|
|
||||||
UINT BillFullWarnLevel;
|
|
||||||
UINT BillFullErrorLevel;
|
|
||||||
|
|
||||||
UCHAR housing;
|
|
||||||
UCHAR resUc1;
|
|
||||||
// 32
|
|
||||||
uint32_t padd01;
|
uint32_t padd01;
|
||||||
uint32_t padd02;
|
uint32_t padd02;
|
||||||
uint32_t padd03;
|
uint32_t padd03;
|
||||||
@ -425,7 +381,7 @@ struct T_devices
|
|||||||
uint32_t padd05;
|
uint32_t padd05;
|
||||||
uint32_t padd06;
|
uint32_t padd06;
|
||||||
uint32_t padd07;
|
uint32_t padd07;
|
||||||
uint32_t padd08;
|
uint16_t padd08;
|
||||||
// 64
|
// 64
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -459,8 +415,6 @@ struct T_changer
|
|||||||
uint8_t paymentRunning; // 1: coins are accepted
|
uint8_t paymentRunning; // 1: coins are accepted
|
||||||
uint16_t denomination[16];
|
uint16_t denomination[16];
|
||||||
uint16_t availableTubes; //bitwise 0,1 1=av. bit0 = lowest coin value
|
uint16_t availableTubes; //bitwise 0,1 1=av. bit0 = lowest coin value
|
||||||
uint16_t pad;
|
|
||||||
// 64byte
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_bna
|
struct T_bna
|
||||||
@ -469,29 +423,19 @@ struct T_bna
|
|||||||
uint8_t setup; // 0: not 1: got valid parameters from device
|
uint8_t setup; // 0: not 1: got valid parameters from device
|
||||||
uint8_t FeatureLevel;
|
uint8_t FeatureLevel;
|
||||||
uint16_t countryCode; // programmed in EMP
|
uint16_t countryCode; // programmed in EMP
|
||||||
|
|
||||||
uint16_t scalingFactor; // z.B. 5
|
uint16_t scalingFactor; // z.B. 5
|
||||||
uint8_t decimalPlace;
|
uint8_t decimalPlace;
|
||||||
uint8_t pad1;
|
uint8_t pad1;
|
||||||
|
|
||||||
uint16_t stackerCap;
|
uint16_t stackerCap;
|
||||||
uint16_t billSecureLevel;
|
uint16_t billSecureLevel;
|
||||||
// 12
|
|
||||||
uint8_t hasEscrow;
|
uint8_t hasEscrow;
|
||||||
uint8_t accBillTypes[16]; // programmed in EMP z.B. (bit 0..7): 1 2 4 10 20 40 0 0
|
uint8_t accBillTypes[16]; // programmed in EMP z.B. (bit 0..7): 1 2 4 10 20 40 0 0
|
||||||
uint16_t currentStackerLevel; // requested number of notes in billbox
|
uint16_t currentStackerLevel; // requested number of notes in billbox
|
||||||
// 31
|
|
||||||
// settings from Master
|
// settings from Master
|
||||||
uint16_t intendedAccept; // bit 0 =5€
|
uint16_t intendedAccept; // bit 0 =5€
|
||||||
uint16_t pad2;
|
uint16_t pad2;
|
||||||
// 35
|
uint16_t billDenomination[16];
|
||||||
uint16_t billDenomination[8];
|
|
||||||
// 51
|
|
||||||
uint8_t pad3;
|
|
||||||
uint32_t pad4;
|
|
||||||
uint32_t pad5;
|
|
||||||
uint32_t pad6;
|
|
||||||
// 8.5.24 reduced, 3 bytes too much.
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1333,17 +1277,16 @@ public:
|
|||||||
|
|
||||||
// read printer condition and settings
|
// read printer condition and settings
|
||||||
|
|
||||||
virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const
|
virtual uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state) const {
|
||||||
{
|
|
||||||
Q_UNUSED(prn_hw_state);
|
Q_UNUSED(prn_hw_state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// return value: =prn_hw_state[0]
|
// retval: status byte
|
||||||
// 0:unknown 1: printer OK 100: printer OK but paper near end
|
// byte 0 = 0: prnter OK, >0: error
|
||||||
// 200: not connected 201: printer on error 202: no paper
|
// bit0: paper low 1: no paper 2: temperature error
|
||||||
|
// 3: head open 4: paper jam in cutter
|
||||||
|
// 6: no response 7: bad response from printer
|
||||||
|
// and return struct "Tprn_hw_state"
|
||||||
|
|
||||||
virtual bool prn_isUpAndReady(void) const {
|
virtual bool prn_isUpAndReady(void) const {
|
||||||
return false;
|
return false;
|
||||||
@ -1913,8 +1856,7 @@ public:
|
|||||||
Q_UNUSED(devCond);
|
Q_UNUSED(devCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const {
|
virtual void sys_getDynMachineConditions(void *data) const {
|
||||||
Q_UNUSED(leng);
|
|
||||||
Q_UNUSED(data);
|
Q_UNUSED(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2435,40 +2377,6 @@ public:
|
|||||||
|
|
||||||
virtual QObject const *getAPI() { return nullptr; }
|
virtual QObject const *getAPI() { return nullptr; }
|
||||||
|
|
||||||
virtual void mod_switchResetline() { }
|
|
||||||
|
|
||||||
|
|
||||||
// direct ticket printing
|
|
||||||
// new from 22.5.2024, print Json-Printer-Template which
|
|
||||||
// is stored locally here in PTU memory,
|
|
||||||
// rather then loading several jsons to DC and tell it to print (until now)
|
|
||||||
// the local printer-json can have any length using predefined commands
|
|
||||||
// printing a local printer-json happens like this:
|
|
||||||
// 1) select a file to be printed from memory
|
|
||||||
// 2) load, parse, translate and save the file with following function
|
|
||||||
// 3) set dynamics (values from current transaction)
|
|
||||||
// 4) send saved file to printer one or several times
|
|
||||||
// hint: dynamics can be changed at any time without reloading the ticket, just repeat 3) and 4)
|
|
||||||
|
|
||||||
virtual void prn_translateLocalPrinterJson(QByteArray jsonFile2print) const
|
|
||||||
{ Q_UNUSED(jsonFile2print) }
|
|
||||||
// load, parse, translate and save the file
|
|
||||||
|
|
||||||
virtual void prnStoreDynamics(char *bufferDynPrintVars[], uint8_t nrOfDyns) const
|
|
||||||
{ Q_UNUSED(bufferDynPrintVars); Q_UNUSED(nrOfDyns) }
|
|
||||||
// store nrOfDyns (up to 16) dynamics before printing
|
|
||||||
// max length = 16 byte per dynamic
|
|
||||||
// 16 strings with up to 16bytes each
|
|
||||||
|
|
||||||
virtual void prn_printTranslatedTicket(void) const { }
|
|
||||||
|
|
||||||
virtual uint8_t prn_waitForDirectTicket(void) const { return 0; }
|
|
||||||
// return: 0: just printing, wait
|
|
||||||
// 1: OK - last print was succesful
|
|
||||||
// 2: error - not printed
|
|
||||||
// 2: printer error 3: no connection to DC
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/*
|
/*
|
||||||
@ -2511,7 +2419,31 @@ signals:
|
|||||||
|
|
||||||
virtual void hwapi_coinAttached() const = 0;
|
virtual void hwapi_coinAttached() const = 0;
|
||||||
|
|
||||||
|
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||||
|
/* GH Version, bringt Fehler
|
||||||
|
void hwapi_templatePrintFinished_OK() const;
|
||||||
|
void hwapi_templatePrintFinished_Err() const;
|
||||||
|
|
||||||
|
void hwapi_coinCollectionJustStarted() const;
|
||||||
|
void hwapi_coinCollectionAborted() const;
|
||||||
|
|
||||||
|
void hwapi_gotNewCoin() const;
|
||||||
|
void hwapi_payStopByMax() const;
|
||||||
|
void hwapi_payStopByPushbutton() const;
|
||||||
|
|
||||||
|
void hwapi_payStopByEscrow() const;
|
||||||
|
void hwapi_payStopByError() const;
|
||||||
|
void hwapi_payStopByTimeout() const;
|
||||||
|
void hwapi_payCancelled() const;
|
||||||
|
void hwapi_coinProcessJustStopped() const;
|
||||||
|
|
||||||
|
void hwapi_doorServiceDoorOpened() const;
|
||||||
|
void hwapi_doorVaultDoorOpened() const;
|
||||||
|
void hwapi_doorCoinBoxRemoved() const;
|
||||||
|
void hwapi_doorCoinBoxInserted() const;
|
||||||
|
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||||
|
void hwapi_doorAllDoorsClosed() const;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -2576,21 +2508,11 @@ signals:
|
|||||||
// hier von =0 auf {} durch Gerhard
|
// hier von =0 auf {} durch Gerhard
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2"
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.2"
|
||||||
// 7.11.2023: bna functions activated
|
// 7.11.2023: bna functions activated
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.3"
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.3"
|
||||||
// 14.3.24:new function bool hwapi::cash_isCollectionStarted(void) const
|
// 14.3.24:new function bool hwapi::cash_isCollectionStarted(void) const
|
||||||
// padding three struct to 64 byte to avoid stack overflow when using
|
// padding three struct to 64 byte to avoid stack overflow when using
|
||||||
// signal coin attached is much faster now
|
// signal coin attached is much faster now
|
||||||
|
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.4"
|
|
||||||
// 7.may.2024, matches to DC V6, some structs extended
|
|
||||||
// new function: modem reset, dyn. data come with two commands now
|
|
||||||
// released 17.may.2024
|
|
||||||
|
|
||||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/5.5"
|
|
||||||
// started at 21.5.24, integration of ticket interpreter
|
|
||||||
// see change log in hwapi.h
|
|
||||||
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "shared_mem_buffer.h"
|
#include "shared_mem_buffer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class T_runProc : public QObject
|
class T_runProc : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -35,16 +36,6 @@ class T_runProc : public QObject
|
|||||||
|
|
||||||
void restoreDeviceParameter(struct T_devices *deviceSettings);
|
void restoreDeviceParameter(struct T_devices *deviceSettings);
|
||||||
|
|
||||||
void clearPrnFile(void);
|
|
||||||
char subFeedPaper(char *valueStr);
|
|
||||||
bool subGetVariStr(char *valueStr, char *returnStr);
|
|
||||||
//void subAppendNxtTxt(char *textLine);
|
|
||||||
void sub_changeStyle(char *valueStr);
|
|
||||||
void subPrintGrafics(char *valueStr);
|
|
||||||
char prn_directTicket_cycle(void);
|
|
||||||
void runProc_subPerformPrintCmds(uint8_t nextCmd, uint8_t nextPara);
|
|
||||||
uint16_t subStoreTicketText(char *textLine);
|
|
||||||
|
|
||||||
#ifndef THIS_IS_CA_MASTER
|
#ifndef THIS_IS_CA_MASTER
|
||||||
std::atomic_bool m_coinAttached{false};
|
std::atomic_bool m_coinAttached{false};
|
||||||
#endif
|
#endif
|
||||||
@ -62,9 +53,6 @@ public:
|
|||||||
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
||||||
bool doors_supervise(void);
|
bool doors_supervise(void);
|
||||||
uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state);
|
uint8_t prn_getHwState(struct Tprn_hw_state *prn_hw_state);
|
||||||
// byte 0: 0:unknown 1: printer OK 100: printer OK but paper near end
|
|
||||||
// 200: not connected 201: printer on error 202: no paper
|
|
||||||
|
|
||||||
void bl_completeStart(void);
|
void bl_completeStart(void);
|
||||||
void dc_autoRequest(bool on);
|
void dc_autoRequest(bool on);
|
||||||
void bl_rebootDC(void);
|
void bl_rebootDC(void);
|
||||||
@ -72,48 +60,6 @@ public:
|
|||||||
void bl_checkBL(void);
|
void bl_checkBL(void);
|
||||||
bool bl_isUp(void);
|
bool bl_isUp(void);
|
||||||
|
|
||||||
// new from 21.5.24 ..................................................................
|
|
||||||
|
|
||||||
uint16_t sys_getCustomerNumber(void);
|
|
||||||
uint16_t sys_getMachineNumber(void);
|
|
||||||
uint16_t sys_getBoroughNumber(void);
|
|
||||||
uint16_t sys_getZoneNumber(void);
|
|
||||||
uint16_t sys_getMachineAlias(void);
|
|
||||||
void sys_getLocation(char *locStr);
|
|
||||||
void prn_sendText(QByteArray *buf);
|
|
||||||
void prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3);
|
|
||||||
void prn_printBarcode(uint8_t kindOf, uint8_t withText, uint8_t offset, uint8_t rotation, uint8_t dataLeng, uint8_t *data);
|
|
||||||
bool sys_parseFile(QByteArray jsonFile2print);
|
|
||||||
// and copy all keys and values to arrays
|
|
||||||
|
|
||||||
bool sys_translateKeys(void);
|
|
||||||
|
|
||||||
bool sys_interpretPrnCmds(void);
|
|
||||||
|
|
||||||
|
|
||||||
void prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alignment, uint8_t orientation);
|
|
||||||
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
|
||||||
// byte2: density 0....(25)....50
|
|
||||||
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
|
||||||
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
|
||||||
|
|
||||||
void prnStoreDynamics(char *bufferDynPrintVars[], uint8_t nrOfDyns);
|
|
||||||
// store nrOfDyns (up to 16) dynamics before printing
|
|
||||||
// max length = 16 byte per dynamic
|
|
||||||
|
|
||||||
bool prnRestoreDynamic(uint8_t nrOfDyn, char *bufferOneDyn);
|
|
||||||
// nrOfDyn = 0...15
|
|
||||||
// buffer bufferOneDyn[16] needs length of at least 16 byte
|
|
||||||
|
|
||||||
bool prn_isUpAndReady(void);
|
|
||||||
|
|
||||||
void prnStartDirectPrinting(void);
|
|
||||||
|
|
||||||
uint8_t prn_getDirectPrintResult(void);
|
|
||||||
// return: 0: just printing, wait
|
|
||||||
// 1: OK - last print was succesful
|
|
||||||
// 2: error - not printed
|
|
||||||
// 2: printer error 3: no connection to DC
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//void runProc_templatePrintFinished_OK(void) const override;
|
//void runProc_templatePrintFinished_OK(void) const override;
|
||||||
|
2
include/sendWRcmd.h
Executable file → Normal file
2
include/sendWRcmd.h
Executable file → Normal file
@ -14,8 +14,6 @@ uint8_t sendWRcmd_getSendBlock160(uint8_t *leng, uint8_t *buf);
|
|||||||
|
|
||||||
void sendWRcmd_INI(void);
|
void sendWRcmd_INI(void);
|
||||||
|
|
||||||
uint8_t sendWRcmd_getStackSize(void);
|
|
||||||
|
|
||||||
// #define FDCMD_STACKDEPTH 16 / 32
|
// #define FDCMD_STACKDEPTH 16 / 32
|
||||||
// short and long commands are queued into the same stack to guaranty right order
|
// short and long commands are queued into the same stack to guaranty right order
|
||||||
void sendFDcmd_clrStack(void);
|
void sendFDcmd_clrStack(void);
|
||||||
|
12
include/shared_mem_buffer.h
Executable file → Normal file
12
include/shared_mem_buffer.h
Executable file → Normal file
@ -7,6 +7,7 @@
|
|||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include "interfaces.h"
|
||||||
|
|
||||||
bool shdMem_firstUse(void);
|
bool shdMem_firstUse(void);
|
||||||
|
|
||||||
@ -190,8 +191,10 @@ struct SharedMem
|
|||||||
uint8_t store_deviceCondLen;
|
uint8_t store_deviceCondLen;
|
||||||
uint8_t store_deviceCond[66];
|
uint8_t store_deviceCond[66];
|
||||||
|
|
||||||
uint8_t store_machCondLen;
|
// uint8_t store_machCondLen;
|
||||||
uint8_t store_machCond[66];
|
// uint8_t store_machCond[66];
|
||||||
|
|
||||||
|
struct T_dynamicCondition dynMachCond;
|
||||||
|
|
||||||
uint8_t store_DcBackupNrOfAccNr;
|
uint8_t store_DcBackupNrOfAccNr;
|
||||||
uint16_t store_DcBackupAccNr[16]; // z.Z. nur 8
|
uint16_t store_DcBackupAccNr[16]; // z.Z. nur 8
|
||||||
@ -230,9 +233,6 @@ struct SharedMem
|
|||||||
uint8_t store_bnaCollect[8];
|
uint8_t store_bnaCollect[8];
|
||||||
uint8_t store_bnaContent[64];
|
uint8_t store_bnaContent[64];
|
||||||
|
|
||||||
// new, 8.5.24
|
|
||||||
uint8_t store_machCon2len;
|
|
||||||
uint8_t store_machCon2[66];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ struct SharedMem
|
|||||||
// ------------------ Data OUTPUT --------------------------------
|
// ------------------ Data OUTPUT --------------------------------
|
||||||
|
|
||||||
// sendWRcmd.cpp
|
// sendWRcmd.cpp
|
||||||
#define CMDSTACKDEPTH 32
|
#define CMDSTACKDEPTH 16
|
||||||
uint16_t nextAsynchsendCmd0[CMDSTACKDEPTH];
|
uint16_t nextAsynchsendCmd0[CMDSTACKDEPTH];
|
||||||
uint8_t nrOfCmdsInQueue;
|
uint8_t nrOfCmdsInQueue;
|
||||||
|
|
||||||
|
14
include/storeINdata.h
Executable file → Normal file
14
include/storeINdata.h
Executable file → Normal file
@ -488,10 +488,8 @@ void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
|||||||
|
|
||||||
void epi_clearDynMachineConditions(void); // new, 24.6.23
|
void epi_clearDynMachineConditions(void); // new, 24.6.23
|
||||||
|
|
||||||
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
|
void gpi_storeDynMachineConditions(void const *data);
|
||||||
|
void epi_restoreDynMachineConditions(void *data);
|
||||||
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t *data);
|
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t *data);
|
||||||
|
|
||||||
@ -529,7 +527,7 @@ bool epi_areDcDataValid();
|
|||||||
|
|
||||||
void epi_setDcDataValid(void);
|
void epi_setDcDataValid(void);
|
||||||
|
|
||||||
void epi_resetDcDataValid(char reason);
|
void epi_resetDcDataValid(void);
|
||||||
|
|
||||||
|
|
||||||
void epi_clearDynData(void);
|
void epi_clearDynData(void);
|
||||||
@ -626,12 +624,6 @@ void epi_restoreBnaContent(uint8_t *data);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void epi_clearDynMachCond2(void);
|
|
||||||
|
|
||||||
void gpi_storeDynMachCond2(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDynMachCond2(uint8_t *leng, uint8_t *data);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
33
include/tslib.h
Executable file → Normal file
33
include/tslib.h
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
#ifndef TSLIB_H
|
#ifndef TSLIB_H
|
||||||
#define TSLIB_H
|
#define TSLIB_H
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include "stdint.h"
|
|
||||||
|
|
||||||
#define LOWBYTE false
|
#define LOWBYTE false
|
||||||
#define HIGHBYTE true
|
#define HIGHBYTE true
|
||||||
@ -87,37 +87,6 @@ void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destP
|
|||||||
|
|
||||||
bool tslib_strComp(uint8_t *buf, char *compStr);
|
bool tslib_strComp(uint8_t *buf, char *compStr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t tslib_StrLen(char *str);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void tslib_itoa(int n, char *str);
|
|
||||||
// -23456 -> str[0]='-' str[1]='2' ...[5]='6' str[6]=0
|
|
||||||
// 5 -> str[0]='5' str[1..6]=0
|
|
||||||
|
|
||||||
void tslib_uitoa(unsigned int n, char *str);
|
|
||||||
|
|
||||||
void tslib_ltoa(long n, char *str);
|
|
||||||
// -2147483647 -> str[0]='-' str[1]='2' ...[10]='6' str[11]=0
|
|
||||||
|
|
||||||
void tslib_ultoa( long n, char *str);
|
|
||||||
// 0... ->4294967296 str[0]='4' str[1]='2' ...[9]='6' str[10]=0 str[11]=0
|
|
||||||
|
|
||||||
void tslib_uitobin( int decval, char *str);
|
|
||||||
|
|
||||||
long tslib_atol( char *AscString);
|
|
||||||
// change ascii string ( of ascii numbers '0'..'9') to number
|
|
||||||
// AscString must be 0-terminated!
|
|
||||||
// a leading '-' is ignored, a'.' or a ',' stops calculation
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // TSLIB_H
|
#endif // TSLIB_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,3 @@ unix {
|
|||||||
system("mkdir -p $${DESTDIR}")
|
system("mkdir -p $${DESTDIR}")
|
||||||
system("cp ../include/interfaces.h $${DESTDIR}")
|
system("cp ../include/interfaces.h $${DESTDIR}")
|
||||||
}
|
}
|
||||||
|
|
||||||
DISTFILES += \
|
|
||||||
../include/dump.txt
|
|
||||||
|
186
src/datIf.cpp
Executable file → Normal file
186
src/datIf.cpp
Executable file → Normal file
@ -14,6 +14,7 @@ History:
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
|
||||||
|
#include <algorithm> // min/max
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -88,11 +89,9 @@ T_datif::T_datif(QObject *parent) : QObject(parent)
|
|||||||
dif_scanStep=0;
|
dif_scanStep=0;
|
||||||
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
epi_resetDcDataValid(1); // data are not yet valid, no response from DC by now
|
epi_resetDcDataValid(); // data are not yet valid, no response from DC by now
|
||||||
|
|
||||||
datif_noResponseCtr=0;
|
datif_noResponseCtr=0;
|
||||||
datif_nowNewDyns=0;
|
|
||||||
datif_nowNewStats=0;
|
|
||||||
|
|
||||||
datif_repeatCtr=0;
|
datif_repeatCtr=0;
|
||||||
datif_cmdWasPerformed=0; // 0: no response by now
|
datif_cmdWasPerformed=0; // 0: no response by now
|
||||||
@ -131,11 +130,6 @@ void T_datif::resetChain(void)
|
|||||||
dif_scanStep=0;
|
dif_scanStep=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RESPONSEWAITTIME 10
|
|
||||||
// ab 5 keine timeouts mehr
|
|
||||||
#define GOTRESP_SENDGAP 20
|
|
||||||
// Wert egal, muss nur > RESPONSEWAITTIME und <255 sein
|
|
||||||
|
|
||||||
char T_datif::datif_cycleSend()
|
char T_datif::datif_cycleSend()
|
||||||
{
|
{
|
||||||
// cyclic transmission of INPUT-Requests
|
// cyclic transmission of INPUT-Requests
|
||||||
@ -152,25 +146,14 @@ char T_datif::datif_cycleSend()
|
|||||||
if ( !myDCIF->isPortOpen())
|
if ( !myDCIF->isPortOpen())
|
||||||
{
|
{
|
||||||
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
||||||
epi_resetDcDataValid(2); // DC data not valid
|
epi_resetDcDataValid(); // DC data not valid
|
||||||
datif_nowNewDyns=0;
|
|
||||||
datif_nowNewStats=0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// supervise if DC data are valid
|
// supervise if DC data are valid
|
||||||
datif_noResponseCtr++; // inc every 20ms
|
datif_noResponseCtr++; // inc every 20ms
|
||||||
if (datif_noResponseCtr>50) // no life sign from device controller (DC) for about a sec
|
if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s
|
||||||
{
|
epi_resetDcDataValid(); // DC data has not updated for >=5s -> no longer valid!
|
||||||
epi_resetDcDataValid(3); // DC data has not updated for >=5s -> no longer valid!
|
|
||||||
datif_nowNewDyns=0;
|
|
||||||
datif_nowNewStats=0;
|
|
||||||
|
|
||||||
}
|
|
||||||
// 24.7.24 new, data are valid if dynamic machine conditions AND dyn machine states came in
|
|
||||||
if (datif_nowNewDyns && datif_nowNewStats && !epi_areDcDataValid() )
|
|
||||||
epi_setDcDataValid();
|
|
||||||
|
|
||||||
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
|
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
|
||||||
if (gpi_wantToResetSupervision())
|
if (gpi_wantToResetSupervision())
|
||||||
@ -189,7 +172,8 @@ char T_datif::datif_cycleSend()
|
|||||||
// c) gar keine Antwort, Timeout nach 100ms -> 2x wiederholen (nach einer Luecke von 10ms )
|
// c) gar keine Antwort, Timeout nach 100ms -> 2x wiederholen (nach einer Luecke von 10ms )
|
||||||
// cycl_running=0: nichts zu tun 1: Mitteilung: Kommando wurde soeben abgesendet, 2,3,4 = Wiederholung
|
// cycl_running=0: nichts zu tun 1: Mitteilung: Kommando wurde soeben abgesendet, 2,3,4 = Wiederholung
|
||||||
|
|
||||||
if (cycl_running)
|
if (cycl_running) // 21.9.23 doRepeat hier raus sonst gehts warten auch nicht mehr (BL)
|
||||||
|
// if (cycl_running && doRepeat)
|
||||||
{
|
{
|
||||||
// request is still running, wait for response before next sending
|
// request is still running, wait for response before next sending
|
||||||
//qDebug()<< "datif wait for response";
|
//qDebug()<< "datif wait for response";
|
||||||
@ -197,35 +181,28 @@ char T_datif::datif_cycleSend()
|
|||||||
datif_trigger->start(20); // ruft "this" (datif_cycleSend) erneut in 20ms auf
|
datif_trigger->start(20); // ruft "this" (datif_cycleSend) erneut in 20ms auf
|
||||||
// mit 10 kein Unterscheid weil Zykluszeit grösser
|
// mit 10 kein Unterscheid weil Zykluszeit grösser
|
||||||
|
|
||||||
cycl_running++; // inc every 20ms, warte auf Antwort
|
cycl_running++; // inc every 20...30ms // warte max 100ms auf Antwort
|
||||||
|
if (cycl_running >80 && cycl_running <95) // neu 13.9.23 mind. 40 damit Templates
|
||||||
if (cycl_running >= GOTRESP_SENDGAP)
|
// in Folge gedruckt werden koennen
|
||||||
|
// 95: muss nur kleiner sein als die 100 fuer die Luecke
|
||||||
|
// 17.10.23: 50--> 80
|
||||||
{
|
{
|
||||||
// got response, wait just one (this) cycle before next sending
|
// 100ms vergangen, bisher keine Antwort, also Kommando wiederholen
|
||||||
cycl_running=0;
|
qDebug()<< "datif timeout no response for wr/rd cmd "<< keepLastWrCmd << " " << keepLastRdCmd;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (cycl_running >=RESPONSEWAITTIME )
|
|
||||||
{
|
|
||||||
// bisher keine Antwort, also Kommando wiederholen
|
|
||||||
qDebug()<< "datif timeout no response for wr/rd cmd "<< keepLastWrCmd << " " << keepLastRdCmd;
|
|
||||||
cycl_running = 0; // gleich wiederholen weil ja schon ewig nichts mehr reinkam
|
cycl_running = 0; // gleich wiederholen weil ja schon ewig nichts mehr reinkam
|
||||||
datif_cmdWasPerformed=2; // NO :((
|
datif_cmdWasPerformed=2; // NO :((
|
||||||
gpi_storeLastResult(8);
|
gpi_storeLastResult(8);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Unsinn, wird nie durchlaufen
|
if (cycl_running>=101) // 100 + 1
|
||||||
if (cycl_running>=(RESPONSEWAITTIME+6)) // 3.7.24: 101-->110
|
|
||||||
{
|
{
|
||||||
// Antwort ist gekommen, also nach kurzer Luecke naechstes (datif_cmdWasPerformed==1)
|
// Antwort ist gekommen, also nach kurzer Luecke naechstes (datif_cmdWasPerformed==1)
|
||||||
// oder nochmal gleiches (datif_cmdWasPerformed==2) Kommando senden
|
// oder nochmal gleiches (datif_cmdWasPerformed==2) Kommando senden
|
||||||
//qDebug()<< "datif got any response";
|
//qDebug()<< "datif got any response";
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// hier stoppen, weil Antwort des letzten Cmds noch nicht da
|
// hier stoppen, weil Antwort des letzten Cmds noch nicht da
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -247,7 +224,6 @@ char T_datif::datif_cycleSend()
|
|||||||
datif_kindOfCmd=0;
|
datif_kindOfCmd=0;
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
gpi_storeOverallResult(2);
|
gpi_storeOverallResult(2);
|
||||||
qCritical()<<"datif, error no response to wr/rd "<<keepLastWrCmd<<" "<<keepLastRdCmd;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +250,7 @@ char T_datif::datif_cycleSend()
|
|||||||
datif_cmdWasPerformed=0;
|
datif_cmdWasPerformed=0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
qCritical() << "datif: unknown cmd, stop repeating wr/rd:" << keepLastWrCmd << " " << keepLastRdCmd;
|
qDebug() << "datif: unknown cmd, stop repeating wr/rd:" << keepLastWrCmd << " " << keepLastRdCmd;
|
||||||
datif_cmdWasPerformed=0;
|
datif_cmdWasPerformed=0;
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
datif_kindOfCmd=0;
|
datif_kindOfCmd=0;
|
||||||
@ -305,10 +281,8 @@ char T_datif::datif_cycleSend()
|
|||||||
myDCIF->setUserReadData(nextRdCmd);
|
myDCIF->setUserReadData(nextRdCmd);
|
||||||
myDCIF->sendUserData(selectedSlaveAddr);
|
myDCIF->sendUserData(selectedSlaveAddr);
|
||||||
|
|
||||||
qDebug()<<"Datif send long FD cmd (wr/rd): "<<nextWrCmd<< " / " << nextRdCmd << "Dlen:" << length;
|
//qDebug()<<"Datif send long FD cmd (wr/rd): "<<nextWrCmd<< " / " << nextRdCmd
|
||||||
// << " data:" << data[0]<< " " << data[1]<< " " << data[2]<< " " << data[3]
|
// << " " << data[0]<< " " << data[1]<< " " << data[2]<< " " << data[3];
|
||||||
// << " " << data[4]<< " " << data[5]<< " " << data[6]<< " " << data[7]
|
|
||||||
// << " " << data[8]<< " " << data[9]<< " " << data[10]<< " " << data[11];
|
|
||||||
|
|
||||||
cycl_running=1; // 1: start transmission
|
cycl_running=1; // 1: start transmission
|
||||||
datif_kindOfCmd=2;
|
datif_kindOfCmd=2;
|
||||||
@ -335,8 +309,8 @@ char T_datif::datif_cycleSend()
|
|||||||
myDCIF->setUserReadData(nextRdCmd);
|
myDCIF->setUserReadData(nextRdCmd);
|
||||||
myDCIF->sendUserData(selectedSlaveAddr);
|
myDCIF->sendUserData(selectedSlaveAddr);
|
||||||
|
|
||||||
qDebug()<<"Datif send short FD cmd (wr/rd): "<<nextWrCmd<< " / " << nextRdCmd << " ";
|
//qDebug()<<"Datif send short FD cmd (wr/rd): "<<nextWrCmd<< " / " << nextRdCmd << " "
|
||||||
// << blockNum << " " << dat1 << " " << dat2<< " " << dat3<< " " << dat4;
|
// << blockNum << " " << dat1 << " " << dat2<< " " << dat3<< " " << dat4;
|
||||||
|
|
||||||
cycl_running=1; // 1: start transmission
|
cycl_running=1; // 1: start transmission
|
||||||
datif_kindOfCmd=1;
|
datif_kindOfCmd=1;
|
||||||
@ -372,10 +346,7 @@ char T_datif::datif_cycleSend()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dif_scanStep=0; // always start from beginning
|
dif_scanStep=0; // always start from beginning
|
||||||
epi_resetDcDataValid(4);
|
epi_resetDcDataValid();
|
||||||
datif_nowNewDyns=0;
|
|
||||||
datif_nowNewStats=0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
datif_cmdWasPerformed=0; // 0: no response by now
|
datif_cmdWasPerformed=0; // 0: no response by now
|
||||||
@ -393,10 +364,10 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
// 114,0,0,0,0,0,0,0,0,0};
|
// 114,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
// extension 6.12.23, complete list:
|
// extension 6.12.23, complete list:
|
||||||
uint8_t datif_autoRequCommandList[40]={11, 12, 14, 17, 18, 19, 21, 22, 23, 24,
|
uint8_t datif_autoRequCommandList[40]={11, 12, 13, 14, 17, 18, 19, 21, 22, 23,
|
||||||
25, 27, 30, 31, 32, 33, 34, 35, 39, 40,
|
24, 25, 27, 30, 31, 32, 33, 35, 39, 40,
|
||||||
41, 42, 102,103,104,106,107,108,109,110,
|
41, 42, 102,103,104,106,107,108,109,110,
|
||||||
112,113,114,115,116,0, 0, 0, 0, 0};
|
112,113,114,115,116,0, 0, 0, 0, 0};
|
||||||
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
||||||
|
|
||||||
// send quicker while transaction is ongoing:
|
// send quicker while transaction is ongoing:
|
||||||
@ -410,8 +381,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
// 19: get time and date and Extra values. poll occasionally and if needed
|
// 19: get time and date and Extra values. poll occasionally and if needed
|
||||||
// 107, 22: MDB: poll if needed
|
// 107, 22: MDB: poll if needed
|
||||||
|
|
||||||
//doRepeat=true; // 20.9.23 15uhr (after release)
|
doRepeat=true; // 20.9.23 15uhr (after release)
|
||||||
doRepeat=false; // 3.7.24 off, is repeated cyclic anyway
|
|
||||||
|
|
||||||
if (gpi_getNowCoinPay())
|
if (gpi_getNowCoinPay())
|
||||||
{
|
{
|
||||||
@ -509,7 +479,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
if (gpi_getNowIsBootload())
|
if (gpi_getNowIsBootload())
|
||||||
{
|
{
|
||||||
datif_cmdWasPerformed=1;
|
datif_cmdWasPerformed=1;
|
||||||
cycl_running=GOTRESP_SENDGAP; // stop waiting for response and wait 1cycle till next sending
|
cycl_running=100; // stop waiting for response and wait 1cycle till next sending
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,11 +505,11 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
receivedData[12], receivedData[13], receivedData[14], receivedData[15]);
|
receivedData[12], receivedData[13], receivedData[14], receivedData[15]);
|
||||||
*/
|
*/
|
||||||
datif_cmdWasPerformed=2; // NO :((
|
datif_cmdWasPerformed=2; // NO :((
|
||||||
cycl_running=GOTRESP_SENDGAP; // stop waiting for response and wait 1cycle till next sending
|
cycl_running=100; // stop waiting for response and wait 1cycle till next sending
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
datif_cmdWasPerformed=1; // YES :), stop repeating
|
datif_cmdWasPerformed=1; // YES :), stop repeating
|
||||||
cycl_running=GOTRESP_SENDGAP; // stop waiting for response
|
cycl_running=100; // stop waiting for response
|
||||||
|
|
||||||
//qDebug() << "datif: got valid response ";
|
//qDebug() << "datif: got valid response ";
|
||||||
|
|
||||||
@ -577,9 +547,6 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
localStr.append(ctmp);
|
localStr.append(ctmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readSource==0)
|
|
||||||
return 0; // done
|
|
||||||
|
|
||||||
//qDebug() << "got HW version: " << localStr;
|
//qDebug() << "got HW version: " << localStr;
|
||||||
switch (readSource) // = request command
|
switch (readSource) // = request command
|
||||||
{
|
{
|
||||||
@ -958,6 +925,22 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ab hier neu: 12.4.23
|
||||||
|
|
||||||
case CMD2DC_RDBK_DEV_PARA: //14
|
case CMD2DC_RDBK_DEV_PARA: //14
|
||||||
/*
|
/*
|
||||||
buf66[0]=devPara.kindOfPrinter;
|
buf66[0]=devPara.kindOfPrinter;
|
||||||
@ -1008,8 +991,8 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
case 112: // get inserted amount in cent in sum
|
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
|
// byte 0..3: amount just paid 4,5:last coin type 6,7: last coin value
|
||||||
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||||
uitmp=uchar2uint(receivedData[5],receivedData[4]); // type of last coin
|
uitmp=uchar2uint(receivedData[5],receivedData[4]); // last coin type
|
||||||
uit2=uchar2uint(receivedData[7],receivedData[6]); // value of last coin
|
uit2=uchar2uint(receivedData[7],receivedData[6]); // last coin value
|
||||||
//if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern:
|
//if (uitmp>0) // nur 1x bei neuer Münze 6.10.23 aendern:
|
||||||
// beim Wechsler hat die kleinste Muenze immer coin type 0!
|
// beim Wechsler hat die kleinste Muenze immer coin type 0!
|
||||||
if (uitmp>10000 || uit2>10000)
|
if (uitmp>10000 || uit2>10000)
|
||||||
@ -1017,7 +1000,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
uitmp=0;
|
uitmp=0;
|
||||||
uit2=0;
|
uit2=0;
|
||||||
}
|
}
|
||||||
if ((newInsertedAmount != lastInsertedAmount) || uit2>0 )
|
if ((newInsertedAmount != lastInsertedAmount) || uit2>0) // 22.5.2024
|
||||||
{
|
{
|
||||||
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||||
emit datif_gotNewCoin(); // OR BILL if (uitmp & 0x8000)>0
|
emit datif_gotNewCoin(); // OR BILL if (uitmp & 0x8000)>0
|
||||||
@ -1051,24 +1034,46 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
if (RdDleng>28)
|
if (RdDleng>28)
|
||||||
{
|
{
|
||||||
gpi_storeDeviceConditions(RdDleng, receivedData);
|
gpi_storeDeviceConditions(RdDleng, receivedData);
|
||||||
datif_nowNewStats=1; // 24.7.24 new
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
||||||
// first 64 bytes, rest comes with cmd 34
|
if (RdDleng>50)
|
||||||
|
|
||||||
if (RdDleng>60)
|
|
||||||
{
|
{
|
||||||
//epi_setDcDataValid(); // 24.7.24 remove here
|
epi_setDcDataValid(); // DC-Data are valid as DC responded.
|
||||||
datif_nowNewDyns=1; // 24.7.24 new
|
// Could be set to every response but this (31)
|
||||||
|
// is a very common and very important request
|
||||||
|
|
||||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
if (RdDleng > sizeof(struct T_dynamicCondition)) {
|
||||||
|
qCritical() << "!!!WARNING!!! RdDlen too high" << RdDleng;
|
||||||
|
// only use as many bytes as maximally possible
|
||||||
|
char buf[sizeof(struct T_dynamicCondition)];
|
||||||
|
memset(buf, 0, sizeof(buf));
|
||||||
|
memcpy(buf, receivedData, std::min(sizeof(receivedData), sizeof(struct T_dynamicCondition)));
|
||||||
|
gpi_storeDynMachineConditions(buf);
|
||||||
|
} else {
|
||||||
|
gpi_storeDynMachineConditions(receivedData);
|
||||||
|
}
|
||||||
|
|
||||||
gpi_storeDI_CoinAttach(receivedData[6]); // new, 14.2.24 needed for direct coin insertion
|
gpi_storeDI_CoinAttach(((struct T_dynamicCondition *)receivedData)->coinAttached); // new, 14.2.24 needed for direct coin insertion
|
||||||
|
|
||||||
} else
|
}
|
||||||
qDebug()<<"datif received cmd31 with "<<RdDleng<<" bytes only";
|
/* funktioniert, ist aber nicht nötig. Signal wird nach dem shared memory erzeugt
|
||||||
|
prnResult=receivedData[52];
|
||||||
|
if (prnResult != lastResult)
|
||||||
|
{
|
||||||
|
// new result
|
||||||
|
if (prnResult==1)
|
||||||
|
{
|
||||||
|
emit datif_templatePrintFinished_OK();
|
||||||
|
} else
|
||||||
|
if (prnResult==2)
|
||||||
|
{
|
||||||
|
emit datif_templatePrintFinished_Err();
|
||||||
|
}
|
||||||
|
|
||||||
|
lastResult=prnResult;
|
||||||
|
}*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1084,22 +1089,24 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeDCbackupAccNr(RdDleng, receivedData);
|
gpi_storeDCbackupAccNr(RdDleng, receivedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 34: // Get dynamic machine conditions part 2
|
|
||||||
if (RdDleng>5)
|
|
||||||
{
|
|
||||||
gpi_storeDynMachCond2(RdDleng, receivedData);
|
|
||||||
//qDebug()<<"datif rec. cmd34: ";
|
|
||||||
//for (int nn=0; nn<64; nn++)
|
|
||||||
// qDebug() << nn << " : " << receivedData[nn] << " ";
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 35:
|
case 35:
|
||||||
gpi_storeMifCardType(RdDleng, receivedData);
|
gpi_storeMifCardType(RdDleng, receivedData);
|
||||||
break;
|
break;
|
||||||
case 38: // Get stored account record backup
|
case 38: // Get stored account record backup
|
||||||
|
// readAddress, &RdDleng, receivedData
|
||||||
|
//if (RdDleng>50) // 1.8.23 nach Verlängerung des Datensatzes um 20byte falsch!!!
|
||||||
|
//{
|
||||||
gpi_storeVaultRecord(readAddress, receivedData ); // always/max 64byte
|
gpi_storeVaultRecord(readAddress, receivedData ); // always/max 64byte
|
||||||
|
/*
|
||||||
|
qDebug()<<"datif cmd38 got vault data. blockNr: "<<readAddress;
|
||||||
|
if (readAddress==0)
|
||||||
|
for (nn=0; nn<64; nn+=8)
|
||||||
|
{
|
||||||
|
qDebug()<<receivedData[nn]<<" "<<receivedData[nn+1]<<" "<<receivedData[nn+2]<<" "<<receivedData[nn+3]<<" "
|
||||||
|
<<receivedData[nn+4]<<" "<<receivedData[nn+5]<<" "<<receivedData[nn+6]<<" "<<receivedData[nn+7];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 39:
|
case 39:
|
||||||
@ -1145,9 +1152,6 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
qCritical()<<"datif, error received unknown cmd "<< readSource;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
readSource=0; // 17.05.2023: to avoid multiple recording
|
readSource=0; // 17.05.2023: to avoid multiple recording
|
||||||
|
|
||||||
|
189
src/hwapi.cpp
Executable file → Normal file
189
src/hwapi.cpp
Executable file → Normal file
@ -5,7 +5,21 @@
|
|||||||
* This api uses stored data and returns them in the following functions
|
* This api uses stored data and returns them in the following functions
|
||||||
* created: Q1/2020 TS until Q2/21
|
* created: Q1/2020 TS until Q2/21
|
||||||
|
|
||||||
see history in hwapi.h
|
14.7.23TS: patch for correct printer state in line 3364 in sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
||||||
|
|
||||||
|
8.9.2023 two new functions (end of file) for mifare test. Interface version 4.4 DC4.40...4.43
|
||||||
|
|
||||||
|
14.09.2023: Verriegelung eingebaut, nur noch gültige Abr.Daten zurückgeben, Suchbegriff: <epi_restoreVaultRecord>
|
||||||
|
alle Mifare-Funktionen ueberprueft und ggf verbessert
|
||||||
|
18.09.2023: Signal "Kasse entnommen" und Signale "Tuer auf/zu" ueberprueft
|
||||||
|
|
||||||
|
20.9.2023: in datif die Abfrage der DynMachineData massiv beschleunigt
|
||||||
|
und hier in hwapi die entprellten Werte fuer Tueren und Kasse verwenden.
|
||||||
|
Problem war: Signal "Kasse entnommen" war zu langsam -> manchmal abr nicht gesendet
|
||||||
|
|
||||||
|
14.3.24 new function bool hwapi::cash_isCollectionStarted(void) const
|
||||||
|
padding three struct to 64 byte to avoid stack overflow when using
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hwapi.h"
|
#include "hwapi.h"
|
||||||
@ -1756,10 +1770,8 @@ QString hwapi::mif_getCardDataStr(uint8_t blockNumber) const
|
|||||||
|
|
||||||
uint8_t hwapi::prn_getHwState(struct Tprn_hw_state *prn_hw_state) const
|
uint8_t hwapi::prn_getHwState(struct Tprn_hw_state *prn_hw_state) const
|
||||||
{
|
{
|
||||||
// return value:
|
// return printer hardware state: power is on? rs-driver on? rs_switch ok? hw-ready-line ok?
|
||||||
// 0: unknown 1: printer OK
|
// printer on error or ok?
|
||||||
// 100: printer OK but paper near end
|
|
||||||
// 200: not connected 201: printer on error 202: no paper
|
|
||||||
|
|
||||||
return runProcess->prn_getHwState(prn_hw_state);
|
return runProcess->prn_getHwState(prn_hw_state);
|
||||||
|
|
||||||
@ -1767,8 +1779,13 @@ uint8_t hwapi::prn_getHwState(struct Tprn_hw_state *prn_hw_state) const
|
|||||||
|
|
||||||
bool hwapi::prn_isUpAndReady(void) const
|
bool hwapi::prn_isUpAndReady(void) const
|
||||||
{
|
{
|
||||||
// gefixt am 24.5.2024
|
// 25.5.2023: geht nicht richtig :( bringt immer false obwohl Drucker OK
|
||||||
return runProcess->prn_isUpAndReady();
|
struct Tprn_hw_state prnHwNow;
|
||||||
|
|
||||||
|
prn_getHwState(&prnHwNow);
|
||||||
|
if (prnHwNow.inIdle && prnHwNow.rsSwOk && prnHwNow.rsDrvOk && prnHwNow.powerRdBk )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) const
|
void hwapi::prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) const
|
||||||
@ -1792,10 +1809,46 @@ void hwapi::prn_getCurrentFontSetting(struct Tprn_currentSettings *prn_fonts) co
|
|||||||
|
|
||||||
void hwapi::prn_sendText(QByteArray *buf) const
|
void hwapi::prn_sendText(QByteArray *buf) const
|
||||||
{
|
{
|
||||||
runProcess->prn_sendText(buf);
|
uint16_t nn, pp, mm, leng_byt, leng_blk, llb, freeStak;
|
||||||
// 23.5.2024TS: moved function down to runProc in order to have it available there.
|
uint8_t tmp66[66];
|
||||||
// here in hwapi only a wrapper left
|
|
||||||
// ( this also supports the idea to keep hwapi short :)
|
qCritical() << __PRETTY_FUNCTION__ << "RESET DC DATA VALID";
|
||||||
|
|
||||||
|
epi_clearDynMachineConditions(); // 24.6.23
|
||||||
|
gpi_storeDcDataValid(0);
|
||||||
|
|
||||||
|
// komplett aendern 11.9.23
|
||||||
|
memset(tmp66,0,66);
|
||||||
|
leng_byt=buf->size();
|
||||||
|
freeStak=check4freeFDstack();
|
||||||
|
freeStak<<=6;
|
||||||
|
if ( leng_byt > freeStak)
|
||||||
|
{
|
||||||
|
leng_byt=freeStak; // shorten the buffer as we cannot return an error (void function)
|
||||||
|
}
|
||||||
|
llb=leng_byt % 64; // length of last block, >0 if not dividable by 64
|
||||||
|
leng_blk=leng_byt / 64;
|
||||||
|
|
||||||
|
pp=0;
|
||||||
|
for (nn=0; nn<leng_blk; nn++)
|
||||||
|
{
|
||||||
|
for (mm=0; mm<64; mm++)
|
||||||
|
tmp66[mm]=buf->at(pp++);
|
||||||
|
longFDcmd_set(CMD2DC_PRI_PRINT_TXT, 0,0,64, tmp66);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (llb>0)
|
||||||
|
{
|
||||||
|
|
||||||
|
//leng_blk++; // z.B. 200 = 3 volle blocks und ein block mit nur 8byte
|
||||||
|
memset(tmp66,0,66);
|
||||||
|
for (mm=0; mm<llb; mm++)
|
||||||
|
tmp66[mm]=buf->at(pp++);
|
||||||
|
for (mm=llb; mm<64; mm++)
|
||||||
|
tmp66[mm]=0;
|
||||||
|
longFDcmd_set(CMD2DC_PRI_PRINT_TXT, 0,0,64, tmp66);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1804,8 +1857,6 @@ void hwapi::prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) cons
|
|||||||
// send three byte through to printer, see printers manual
|
// send three byte through to printer, see printers manual
|
||||||
//sendWRcmd _setSendCommand8(SENDDIRCMD_PRN_SYS_CMD, para1, para2, 0, para3); hat gar nicht funktioniert
|
//sendWRcmd _setSendCommand8(SENDDIRCMD_PRN_SYS_CMD, para1, para2, 0, para3); hat gar nicht funktioniert
|
||||||
|
|
||||||
runProcess->prn_sendPrnSysCmd(para1, para2, para3);
|
|
||||||
/*
|
|
||||||
uint8_t data[64];
|
uint8_t data[64];
|
||||||
uint32_t ultmp=para3;
|
uint32_t ultmp=para3;
|
||||||
memset(data, 0,64);
|
memset(data, 0,64);
|
||||||
@ -1819,7 +1870,6 @@ void hwapi::prn_sendPrnSysCmd(uint8_t para1, uint8_t para2, uint32_t para3) cons
|
|||||||
data[7]=uint8_t(ultmp);
|
data[7]=uint8_t(ultmp);
|
||||||
|
|
||||||
longFDcmd_set(CMD2DC_PRI_SYS_CMD, 0, 0, 8, data);
|
longFDcmd_set(CMD2DC_PRI_SYS_CMD, 0, 0, 8, data);
|
||||||
*/
|
|
||||||
// getestet auf richtige uebertragung am 11.9.23TS
|
// getestet auf richtige uebertragung am 11.9.23TS
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1837,7 +1887,7 @@ void hwapi::prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alig
|
|||||||
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
||||||
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
||||||
// not batched! don't use twice within 100ms
|
// not batched! don't use twice within 100ms
|
||||||
/*
|
|
||||||
uint8_t buf[10];
|
uint8_t buf[10];
|
||||||
uint16_t uitmp;
|
uint16_t uitmp;
|
||||||
|
|
||||||
@ -1850,8 +1900,7 @@ void hwapi::prn_sendPrnSetup(uint16_t paperSpeed, uint8_t density, uint8_t alig
|
|||||||
buf[4]=orientation;
|
buf[4]=orientation;
|
||||||
buf[5]=0;
|
buf[5]=0;
|
||||||
longFDcmd_set(CMD2DC_PRI_SETUP,0,0,5, buf);
|
longFDcmd_set(CMD2DC_PRI_SETUP,0,0,5, buf);
|
||||||
*/
|
|
||||||
runProcess->prn_sendPrnSetup(paperSpeed, density, alignment, orientation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::prn_movePaper(uint8_t wayInMm, uint8_t direction) const
|
void hwapi::prn_movePaper(uint8_t wayInMm, uint8_t direction) const
|
||||||
@ -2757,7 +2806,6 @@ bool hwapi::rtc_getExtendedTime(struct T_extTime *exTime) const
|
|||||||
epi_restoreExtendedTime(&len, buf);
|
epi_restoreExtendedTime(&len, buf);
|
||||||
// Puffer in struct eintragen:
|
// Puffer in struct eintragen:
|
||||||
LL=sizeof(struct T_extTime);
|
LL=sizeof(struct T_extTime);
|
||||||
if (LL>64) LL=64;
|
|
||||||
start = &(exTime->Hours);
|
start = &(exTime->Hours);
|
||||||
nn=0;
|
nn=0;
|
||||||
do
|
do
|
||||||
@ -3138,11 +3186,10 @@ void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
|||||||
uint8_t *start;
|
uint8_t *start;
|
||||||
uint8_t buf[70], leng;
|
uint8_t buf[70], leng;
|
||||||
|
|
||||||
epi_restoreDeviceConditions(&leng, buf); // leng is less then 64
|
epi_restoreDeviceConditions(&leng, buf);
|
||||||
|
|
||||||
// Puffer in struct eintragen:
|
// Puffer in struct eintragen:
|
||||||
LL=sizeof(struct T_moduleCondition);
|
LL=sizeof(struct T_moduleCondition);
|
||||||
if (LL>64) LL=64;
|
|
||||||
start = &devCond->ram;
|
start = &devCond->ram;
|
||||||
nn=0;
|
nn=0;
|
||||||
do
|
do
|
||||||
@ -3182,30 +3229,14 @@ void hwapi::sys_getDeviceConditions(struct T_moduleCondition *devCond) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void hwapi::sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const
|
void hwapi::sys_getDynMachineConditions(void *data) const
|
||||||
{
|
{
|
||||||
// not complete anymore
|
epi_restoreDynMachineConditions(data);
|
||||||
epi_restoreDynMachineConditions(leng, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hwapi::sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const
|
void hwapi::sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const
|
||||||
{
|
{
|
||||||
uint8_t buf[130], leng;
|
epi_restoreDynMachineConditions(dynMachCond);
|
||||||
|
|
||||||
epi_restoreDynMachineConditions(&leng, buf);
|
|
||||||
memcpy(dynMachCond, buf, sizeof(*dynMachCond)); // copy 64byte to the struct
|
|
||||||
// 3.7.24: stimmt nicht mehr weil struct im Ram die word grenzen einhaelt
|
|
||||||
// also ab hier einzeln uebertragen
|
|
||||||
dynMachCond->totalNrOfCuts = uchar2ulong(buf[57],buf[56],buf[55],buf[54]);
|
|
||||||
dynMachCond->nextAccountNumber = uchar2uint(buf[59], buf[58]);
|
|
||||||
dynMachCond->nrOfBillsInBox = uchar2uint(buf[61], buf[60]);
|
|
||||||
|
|
||||||
// 8.5.24TS, as the DC struct is >64byte now, it comes in two parts:
|
|
||||||
epi_restoreDynMachCond2(&leng, buf);
|
|
||||||
dynMachCond->amountInBillbox = uchar2ulong(buf[3], buf[2],buf[1],buf[0]);
|
|
||||||
dynMachCond->UbatAtLastPrint = uchar2uint(buf[5], buf[4]);
|
|
||||||
memcpy(&dynMachCond->reserve01, &buf[8], 56); // rest reserve
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3242,19 +3273,15 @@ uint8_t hwapi::prn_getCurrentPrinterState() const
|
|||||||
// bit4: paper jam in cutter
|
// bit4: paper jam in cutter
|
||||||
// bit6: no response bit7: serial rec. error
|
// bit6: no response bit7: serial rec. error
|
||||||
// bit5: printer not ready
|
// bit5: printer not ready
|
||||||
|
struct T_dynamicCondition dynCond;
|
||||||
|
memset(&dynCond, 0, sizeof(dynCond));
|
||||||
uint8_t lastPrinterStatus;
|
|
||||||
uint8_t buf[70], leng;
|
|
||||||
|
|
||||||
if (!epi_areDcDataValid()) // was set to 0 with print command
|
if (!epi_areDcDataValid()) // was set to 0 with print command
|
||||||
return 0x40; // no response
|
return 0x40; // no response
|
||||||
|
|
||||||
// 2nd way to get dyn.conditions:
|
// 2nd way to get dyn.conditions:
|
||||||
epi_restoreDynMachineConditions(&leng, buf);
|
epi_restoreDynMachineConditions(&dynCond);
|
||||||
lastPrinterStatus=buf[52];
|
return dynCond.lastPrinterStatus;
|
||||||
|
|
||||||
return lastPrinterStatus;
|
|
||||||
|
|
||||||
// oder mit:
|
// oder mit:
|
||||||
//struct T_dynamicCondition myDynMachCond;
|
//struct T_dynamicCondition myDynMachCond;
|
||||||
@ -3288,11 +3315,14 @@ void hwapi::sys_sendDeviceParameter(struct T_devices *deviceSettings) const
|
|||||||
|
|
||||||
void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const
|
void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const
|
||||||
{
|
{
|
||||||
|
// attention: only applies if function "sys_sendDeviceParameter()" was used to send this settings before
|
||||||
|
// cannot be used to see settings programmed by JsonFile
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
uint8_t LL;
|
uint8_t LL;
|
||||||
tslib_strclr(buf,0,64);
|
tslib_strclr(buf,0,64);
|
||||||
|
|
||||||
epi_restoreRbDeviceSettings(&LL, buf);
|
//runProcess->epi_restore64BdevParameter(&LL, buf); // wozu die???
|
||||||
|
epi_restoreRbDeviceSettings(&LL, buf); // viel besser, stimmt immer
|
||||||
|
|
||||||
Q_STATIC_ASSERT(sizeof(*deviceSettings) <= sizeof(buf));
|
Q_STATIC_ASSERT(sizeof(*deviceSettings) <= sizeof(buf));
|
||||||
|
|
||||||
@ -3367,7 +3397,6 @@ void hwapi::prn_requestCurrentDynData(void) const
|
|||||||
{
|
{
|
||||||
sendFDcmd_set(0,39,0,0,0,0,0); // rd data dynData
|
sendFDcmd_set(0,39,0,0,0,0,0); // rd data dynData
|
||||||
epi_clearDynData();
|
epi_clearDynData();
|
||||||
epi_clearDynMachCond2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const
|
bool hwapi::prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const
|
||||||
@ -4047,8 +4076,8 @@ int8_t hwapi::bl_blockAutoResponse(void) const
|
|||||||
void hwapi::sys_requestJsonVersions(uint8_t jsonNr) const
|
void hwapi::sys_requestJsonVersions(uint8_t jsonNr) const
|
||||||
{
|
{
|
||||||
// send one request for every single version
|
// send one request for every single version
|
||||||
// jsonNr=1...36, 1=config file (cust.Nr) 2=devices 3=cash 4,5=empty
|
// jsonNr=1...36, 1=config file (cust.Nr) 2=devices 3=cash 4=res.
|
||||||
// 6=printer template 1 ..... 37= template 32
|
// 5=printer template 1 ..... 36= template 32
|
||||||
sendFDcmd_set(0, 21, jsonNr,0,0,0,0);
|
sendFDcmd_set(0, 21, jsonNr,0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4253,7 +4282,7 @@ bool hwapi::bna_getAllParameters(struct T_bna *bna) const
|
|||||||
bna->intendedAccept = uchar2uint(buf[31], buf[30]);
|
bna->intendedAccept = uchar2uint(buf[31], buf[30]);
|
||||||
bna->pad2=0;
|
bna->pad2=0;
|
||||||
pp=32;
|
pp=32;
|
||||||
for (nn=0; nn<8; nn++) // was 16!!! // 8.5.24 reduced
|
for (nn=0; nn<16; nn++)
|
||||||
{
|
{
|
||||||
bna->billDenomination[nn] = uchar2uint(buf[pp+1], buf[pp]);
|
bna->billDenomination[nn] = uchar2uint(buf[pp+1], buf[pp]);
|
||||||
pp+=2;
|
pp+=2;
|
||||||
@ -4624,61 +4653,7 @@ bool hwapi::dcDownloadGetRunning() const {
|
|||||||
return data ? data->m_downLoadDC.m_running.load() : 0;
|
return data ? data->m_downLoadDC.m_running.load() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hwapi::dcDownloadGetFinished() const
|
bool hwapi::dcDownloadGetFinished() const {
|
||||||
{
|
|
||||||
SharedMem const *data = SharedMem::getDataConst();
|
SharedMem const *data = SharedMem::getDataConst();
|
||||||
return data ? data->m_downLoadDC.m_running.load() : 0;
|
return data ? data->m_downLoadDC.m_running.load() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//uint16_t dcDownloadGetTotalBlockNumber() const override;
|
|
||||||
//uint16_t dcDownloadGetCurrentBlockNumber() const override;
|
|
||||||
//virtual QObject const *getAPI() override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void hwapi::mod_switchResetline(void)
|
|
||||||
{
|
|
||||||
sendFDcmd_set(171,0,0, 2,0,0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// new from 22.5.2024, print Json-Printer-Template which
|
|
||||||
// is stored locally here in PTU memory,
|
|
||||||
// rather then loading several jsons to DC and tell it to print (until now)
|
|
||||||
// the local printer-json can have any length using predefined commands
|
|
||||||
// printing a local printer-json happens like this:
|
|
||||||
// 1) select a file to be printed from memory
|
|
||||||
// 2) load, parse, translate and save the file with following function
|
|
||||||
// 3) set dynamics (values from current transaction)
|
|
||||||
// 4) send saved file to printer one or several times
|
|
||||||
// hint: dynamics can be changed at any time without reloading the ticket, just repeat 3) and 4)
|
|
||||||
|
|
||||||
void hwapi::prn_translateLocalPrinterJson(QByteArray jsonFile2print) const
|
|
||||||
{
|
|
||||||
runProcess->sys_parseFile( jsonFile2print);
|
|
||||||
runProcess->sys_translateKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
void hwapi::prnStoreDynamics(char *bufferDynPrintVars[], uint8_t nrOfDyns) const
|
|
||||||
{
|
|
||||||
|
|
||||||
runProcess->prnStoreDynamics(bufferDynPrintVars, nrOfDyns);
|
|
||||||
// store nrOfDyns (up to 16) dynamics before printing
|
|
||||||
// max length = 16 byte per dynamic
|
|
||||||
}
|
|
||||||
|
|
||||||
void hwapi::prn_printTranslatedTicket(void) const
|
|
||||||
{
|
|
||||||
runProcess->prnStartDirectPrinting();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t hwapi::prn_waitForDirectTicket(void) const
|
|
||||||
{
|
|
||||||
return runProcess->prn_getDirectPrintResult();
|
|
||||||
// return: 0: just printing, wait
|
|
||||||
// 1: OK - last print was succesful
|
|
||||||
// 2: error - not printed
|
|
||||||
// 2: printer error 3: no connection to DC
|
|
||||||
|
|
||||||
}
|
|
||||||
|
10
src/prot.cpp
Executable file → Normal file
10
src/prot.cpp
Executable file → Normal file
@ -97,22 +97,14 @@ void T_prot::setRecLen(uint16_t ReadCmd)
|
|||||||
|
|
||||||
void T_prot::setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr, uint8_t WrDatLen, uint8_t *data)
|
void T_prot::setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr, uint8_t WrDatLen, uint8_t *data)
|
||||||
{
|
{
|
||||||
int nn;
|
|
||||||
WriteCommand=WriteCmd;
|
WriteCommand=WriteCmd;
|
||||||
WriteAddr=WrAddr;
|
WriteAddr=WrAddr;
|
||||||
WrDataLength=WrDatLen;
|
WrDataLength=WrDatLen;
|
||||||
if (WrDataLength>FRAME_DATALEN)
|
if (WrDataLength>FRAME_DATALEN)
|
||||||
WrDataLength=FRAME_DATALEN;
|
WrDataLength=FRAME_DATALEN;
|
||||||
|
|
||||||
// ui8BLsendData[BL_DATA_LEN];
|
for (int nn=0; nn<WrDataLength; nn++)
|
||||||
|
|
||||||
for (nn=0; nn<WrDataLength; nn++)
|
|
||||||
ui8OutputData[nn]=data[nn];
|
ui8OutputData[nn]=data[nn];
|
||||||
|
|
||||||
// clear the rest. added at 26.6.2024TS. important for printer text
|
|
||||||
for (nn=WrDataLength; nn<FRAME_DATALEN; nn++)
|
|
||||||
ui8OutputData[nn]=0;
|
|
||||||
|
|
||||||
SendDataValid=1; // always set WR first
|
SendDataValid=1; // always set WR first
|
||||||
kindOfData=0; // 0: binaries, 1:text
|
kindOfData=0; // 0: binaries, 1:text
|
||||||
this->setRecLen(100); // default: short response
|
this->setRecLen(100); // default: short response
|
||||||
|
1744
src/runProc.cpp
Executable file → Normal file
1744
src/runProc.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
6
src/sendWRcmd.cpp
Executable file → Normal file
6
src/sendWRcmd.cpp
Executable file → Normal file
@ -19,11 +19,7 @@ void sendWRcmd_INI(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t sendWRcmd_getStackSize(void)
|
// Command Stack for commands without parameters
|
||||||
{
|
|
||||||
return CMDSTACKDEPTH; // defined in shared_mem_buffer.h
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//static uint16_t nextAsynchsendCmd0[CMDSTACKDEPTH];
|
//static uint16_t nextAsynchsendCmd0[CMDSTACKDEPTH];
|
||||||
|
96
src/storeINdata.cpp
Executable file → Normal file
96
src/storeINdata.cpp
Executable file → Normal file
@ -6,10 +6,12 @@
|
|||||||
#include "shared_mem_buffer.h"
|
#include "shared_mem_buffer.h"
|
||||||
#include "datei.h"
|
#include "datei.h"
|
||||||
|
|
||||||
|
#include "interfaces.h" // #include "dynamic-machine-conditions.h"
|
||||||
|
|
||||||
// gpi: grafical access to PI: access from external devices over device controller FOR GUI
|
// gpi: grafical access to PI: access from external devices over device controller FOR GUI
|
||||||
// epi: external access from GUI to PI: FOR external devices (DC)
|
// epi: external access from GUI to PI: FOR external devices (DC)
|
||||||
|
|
||||||
// Change log: 8.5.24TS: clear all oversize buffers (if only 32 of 64bytes are used then fill the rest with 0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1002,8 +1004,6 @@ bool epi_getDI_auxPwr(void)
|
|||||||
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn)
|
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn)
|
||||||
{
|
{
|
||||||
SharedMem::write()->di_gsmPwrOn=di_gsm_PwrOn;
|
SharedMem::write()->di_gsmPwrOn=di_gsm_PwrOn;
|
||||||
//qDebug()<<"store In Data Gsm Pwr = "<< di_gsm_PwrOn;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool epi_getDI_gsmPwr(void)
|
bool epi_getDI_gsmPwr(void)
|
||||||
@ -1543,8 +1543,6 @@ void gpi_storeMdbResponse(uint8_t leng, uint8_t *data)
|
|||||||
//tslib_strcpy(data, SharedMem::write()->Sdata_RecBuff, uint16_t(Sdata_mdbNrOfRecData));
|
//tslib_strcpy(data, SharedMem::write()->Sdata_RecBuff, uint16_t(Sdata_mdbNrOfRecData));
|
||||||
for (nn=0; nn<leng; nn++)
|
for (nn=0; nn<leng; nn++)
|
||||||
SharedMem::write()->Sdata_RecBuff[nn] = data[nn];
|
SharedMem::write()->Sdata_RecBuff[nn] = data[nn];
|
||||||
for (nn=leng; nn<40; nn++)
|
|
||||||
SharedMem::write()->Sdata_RecBuff[nn] = 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1571,8 +1569,6 @@ void gpi_storeEmpSettings(uint8_t leng, uint8_t *data)
|
|||||||
//tslib_strcpy(data, SharedMem::write()->Sdata_emp_settingsBuff, leng);
|
//tslib_strcpy(data, SharedMem::write()->Sdata_emp_settingsBuff, leng);
|
||||||
for (nn=0; nn<leng; nn++)
|
for (nn=0; nn<leng; nn++)
|
||||||
SharedMem::write()->Sdata_emp_settingsBuff[nn] = data[nn];
|
SharedMem::write()->Sdata_emp_settingsBuff[nn] = data[nn];
|
||||||
for (nn=leng; nn<64; nn++)
|
|
||||||
SharedMem::write()->Sdata_emp_settingsBuff[nn] = 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,9 +1674,6 @@ void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data) // getestet am
|
|||||||
//tslib_strcpy(data, SharedMem::write()->Sdata_DeviceSettingBuff, leng);
|
//tslib_strcpy(data, SharedMem::write()->Sdata_DeviceSettingBuff, leng);
|
||||||
for (nn=0; nn<leng; nn++)
|
for (nn=0; nn<leng; nn++)
|
||||||
SharedMem::write()->Sdata_DeviceSettingBuff[nn] = data[nn];
|
SharedMem::write()->Sdata_DeviceSettingBuff[nn] = data[nn];
|
||||||
for (nn=leng; nn<64; nn++)
|
|
||||||
SharedMem::write()->Sdata_DeviceSettingBuff[nn] = 0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1921,10 +1914,6 @@ void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data)
|
|||||||
//tslib_strcpy(data, SharedMem::write()->store_deviceCond, leng);
|
//tslib_strcpy(data, SharedMem::write()->store_deviceCond, leng);
|
||||||
for (nn=0; nn<leng; nn++)
|
for (nn=0; nn<leng; nn++)
|
||||||
SharedMem::write()->store_deviceCond[nn]=data[nn];
|
SharedMem::write()->store_deviceCond[nn]=data[nn];
|
||||||
// clear the rest
|
|
||||||
for (nn=leng; nn<64; nn++)
|
|
||||||
SharedMem::write()->store_deviceCond[nn]=0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data)
|
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data)
|
||||||
@ -1945,34 +1934,17 @@ void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data)
|
|||||||
|
|
||||||
void epi_clearDynMachineConditions(void)
|
void epi_clearDynMachineConditions(void)
|
||||||
{
|
{
|
||||||
uint8_t nn;
|
memset(&SharedMem::write()->dynMachCond, 0, sizeof(struct T_dynamicCondition));
|
||||||
SharedMem::write()->store_machCondLen=0;
|
|
||||||
for (nn=0; nn<64; nn++)
|
|
||||||
SharedMem::write()->store_machCond[nn] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpi_storeDynMachineConditions(void const *data)
|
||||||
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data)
|
|
||||||
{
|
{
|
||||||
uint8_t nn;
|
SharedMem::write()->dynMachCond = *(struct T_dynamicCondition const *)(data);
|
||||||
if (leng>64) leng=64;
|
}
|
||||||
SharedMem::write()->store_machCondLen=leng;
|
|
||||||
// tslib_strcpy(data, SharedMem::write()->store_machCond, leng);
|
|
||||||
for (nn=0; nn<leng; nn++)
|
|
||||||
SharedMem::write()->store_machCond[nn] = data[nn];
|
|
||||||
for (nn=leng; nn<64; nn++)
|
|
||||||
SharedMem::write()->store_machCond[nn] = 0;
|
|
||||||
|
|
||||||
}
|
void epi_restoreDynMachineConditions(void *data)
|
||||||
|
|
||||||
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data)
|
|
||||||
{
|
{
|
||||||
uint8_t nn, LL;
|
*(struct T_dynamicCondition *)(data) = SharedMem::read()->dynMachCond;
|
||||||
LL=SharedMem::read()->store_machCondLen;
|
|
||||||
*leng=LL;
|
|
||||||
//tslib_strcpy(SharedMem::read()->store_machCond, data, SharedMem::read()->store_machCondLen);
|
|
||||||
for (nn=0; nn<LL; nn++)
|
|
||||||
data[nn] = SharedMem::read()->store_machCond[nn];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2113,26 +2085,16 @@ void epi_setDcDataValid(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_resetDcDataValid(char reason)
|
void epi_resetDcDataValid(void)
|
||||||
{
|
{
|
||||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
bool now=SharedMem::read()->store_DcDataAreValid;
|
||||||
if (now==true)
|
if (now==true)
|
||||||
{
|
{
|
||||||
SharedMem::write()->store_DcDataAreValid = false;
|
SharedMem::write()->store_DcDataAreValid = false;
|
||||||
#ifdef THIS_IS_CA_MASTER
|
#ifdef THIS_IS_CA_MASTER
|
||||||
switch (reason)
|
qDebug()<<"master lib RESET DcDataValid";
|
||||||
{
|
|
||||||
case 1: qDebug()<<"master lib RESET DcDataValid startup"; break;
|
|
||||||
case 2: qDebug()<<"master lib RESET DcDataValid port closed"; break;
|
|
||||||
case 3: qDebug()<<"master lib RESET DcDataValid no more data"; break;
|
|
||||||
case 4: qDebug()<<"master lib RESET DcDataValid manuell"; break;
|
|
||||||
default: qDebug()<<"master lib RESET DcDataValid ---"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
qDebug()<<"slave lib RESET DcDataValid";
|
qDebug()<<"slave lib RESET DcDataValid";
|
||||||
Q_UNUSED(reason);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2371,7 +2333,6 @@ void epi_getJsonVersion(uint8_t jsonNr, char *versionString)
|
|||||||
versionString[nn] = SharedMem::read()->store_jsonVersion[nn][lrd];
|
versionString[nn] = SharedMem::read()->store_jsonVersion[nn][lrd];
|
||||||
}
|
}
|
||||||
|
|
||||||
// korrektur 8.5.24: printer versionen auf 6...37 (nicht 5..36)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2478,40 +2439,7 @@ void epi_restoreBnaContent(uint8_t *data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// new, 8.5.24
|
|
||||||
//uint8_t store_machCon2len;
|
|
||||||
//uint8_t store_machCon2[66];
|
|
||||||
|
|
||||||
void epi_clearDynMachCond2(void)
|
|
||||||
{
|
|
||||||
uint8_t nn;
|
|
||||||
SharedMem::write()->store_machCon2len=0;
|
|
||||||
for (nn=0; nn<64; nn++)
|
|
||||||
SharedMem::write()->store_machCon2[nn] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeDynMachCond2(uint8_t leng, uint8_t *data)
|
|
||||||
{
|
|
||||||
uint8_t nn;
|
|
||||||
if (leng>64) leng=64;
|
|
||||||
SharedMem::write()->store_machCon2len=leng;
|
|
||||||
for (nn=0; nn<leng; nn++)
|
|
||||||
SharedMem::write()->store_machCon2[nn] = data[nn];
|
|
||||||
for (nn=leng; nn<64; nn++)
|
|
||||||
SharedMem::write()->store_machCon2[nn] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void epi_restoreDynMachCond2(uint8_t *leng, uint8_t *data)
|
|
||||||
{
|
|
||||||
uint8_t nn, LL;
|
|
||||||
LL=SharedMem::read()->store_machCon2len;
|
|
||||||
*leng=LL;
|
|
||||||
|
|
||||||
for (nn=0; nn<LL; nn++)
|
|
||||||
data[nn] = SharedMem::read()->store_machCon2[nn];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
371
src/tslib.cpp
Executable file → Normal file
371
src/tslib.cpp
Executable file → Normal file
@ -610,374 +610,3 @@ bool tslib_strComp(uint8_t *buf, char *compStr)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char biox_StrComp(char *S1, char *S2, int len)
|
|
||||||
{
|
|
||||||
// retval=1 wenn gleich; ? in S2 =Jokerzeichen
|
|
||||||
|
|
||||||
int ii;
|
|
||||||
|
|
||||||
for (ii=0; ii<len; ii++)
|
|
||||||
{
|
|
||||||
if ((S1[ii] != S2[ii]) && (S2[ii] != '?') )
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************************************
|
|
||||||
|
|
||||||
uint16_t tslib_StrLen(char *str)
|
|
||||||
{
|
|
||||||
uint16_t zz;
|
|
||||||
|
|
||||||
for (zz=0; zz<0xF000; zz++)
|
|
||||||
if (str[zz]==0)
|
|
||||||
return(zz);
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// *****************************************************************************************
|
|
||||||
|
|
||||||
uint16_t biox_StrLenInt(uint16_t *str)
|
|
||||||
{
|
|
||||||
uint16_t zz;
|
|
||||||
|
|
||||||
for (zz=0; zz<0xF000; zz++)
|
|
||||||
if (str[zz]==0)
|
|
||||||
return(zz);
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************************************
|
|
||||||
|
|
||||||
void biox_MemCpy(uint8_t *src, uint8_t *dest, uint16_t Len)
|
|
||||||
{
|
|
||||||
// copy "Len" bytes from target to destination
|
|
||||||
// if Len==0 then copy until first NULL in targ
|
|
||||||
|
|
||||||
uint16_t zz=0;
|
|
||||||
if (Len==0)
|
|
||||||
{
|
|
||||||
while(src[zz]>0)
|
|
||||||
{
|
|
||||||
dest[zz]=src[zz];
|
|
||||||
zz++;
|
|
||||||
}
|
|
||||||
dest[zz]=0; // termination
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// Len>0 --> copy "Len" bytes
|
|
||||||
for (zz=0; zz<Len; zz++)
|
|
||||||
dest[zz]=src[zz];
|
|
||||||
|
|
||||||
dest[zz]=0; // termination
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void tslib_itoa(int n, char *str)
|
|
||||||
{
|
|
||||||
// -23456 -> str[0]='-' str[1]='2' ...[5]='6' str[6]=0
|
|
||||||
// 5 -> str[0]='5' str[1..6]=0
|
|
||||||
|
|
||||||
uint8_t pp, zi[7];
|
|
||||||
int itmp, pi=0;
|
|
||||||
|
|
||||||
for (pp=0;pp<7;pp++)
|
|
||||||
{
|
|
||||||
str[pp]=0;
|
|
||||||
zi[pp]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
itmp=n;
|
|
||||||
pp=0;
|
|
||||||
|
|
||||||
if (itmp==0)
|
|
||||||
str[pp++]=0x30;
|
|
||||||
|
|
||||||
if (itmp<0)
|
|
||||||
{
|
|
||||||
str[pp++]='-';
|
|
||||||
itmp*=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(itmp>0)
|
|
||||||
{
|
|
||||||
zi[pi++]=itmp%10;
|
|
||||||
itmp/=10;
|
|
||||||
}
|
|
||||||
// now: zi[0]=6 zi[1]=5 zi[2]=4 zi[3]=3 zi[4]=2 zi[5]=0 zi[6]=0 pi=4
|
|
||||||
while (pi>0)
|
|
||||||
str[pp++]=zi[--pi]+0x30;
|
|
||||||
|
|
||||||
//str[0]='-'; str[1]='1'; str[3]='3'; // Test
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***********************************************************************************************
|
|
||||||
|
|
||||||
void tslib_uitoa(unsigned int n, char *str)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint8_t pp, zi[6];
|
|
||||||
unsigned int itmp;
|
|
||||||
int pi=0;
|
|
||||||
|
|
||||||
for (pp=0;pp<6;pp++)
|
|
||||||
{
|
|
||||||
str[pp]=0;
|
|
||||||
zi[pp]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
itmp=n;
|
|
||||||
pp=0;
|
|
||||||
|
|
||||||
if (itmp==0)
|
|
||||||
str[pp++]=0x30;
|
|
||||||
|
|
||||||
while(itmp>0)
|
|
||||||
{
|
|
||||||
zi[pi++]=itmp%10;
|
|
||||||
itmp/=10;
|
|
||||||
}
|
|
||||||
// now: zi[0]=6 zi[1]=5 zi[2]=4 zi[3]=3 zi[4]=2 zi[5]=0 pi=4
|
|
||||||
while (pi>0)
|
|
||||||
str[pp++]=zi[--pi]+0x30;
|
|
||||||
|
|
||||||
//str[0]='-'; str[1]='1'; str[3]='3'; // Test
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***********************************************************************************************
|
|
||||||
|
|
||||||
void tslib_ltoa(long n, char *str)
|
|
||||||
{
|
|
||||||
// -2147483647 -> str[0]='-' str[1]='2' ...[10]='6' str[11]=0
|
|
||||||
|
|
||||||
uint8_t pp, zi[12];
|
|
||||||
int pi=0;
|
|
||||||
long ltmp;
|
|
||||||
|
|
||||||
for (pp=0;pp<12;pp++)
|
|
||||||
{
|
|
||||||
str[pp]=0;
|
|
||||||
zi[pp]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ltmp=n;
|
|
||||||
pp=0;
|
|
||||||
|
|
||||||
if (ltmp==0)
|
|
||||||
str[pp++]=0x30;
|
|
||||||
|
|
||||||
if (ltmp<0)
|
|
||||||
{
|
|
||||||
str[pp++]='-';
|
|
||||||
ltmp*=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(ltmp>0)
|
|
||||||
{
|
|
||||||
zi[pi++]=ltmp%10;
|
|
||||||
ltmp/=10;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (pi>0)
|
|
||||||
str[pp++]=zi[--pi]+0x30;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***********************************************************************************************
|
|
||||||
|
|
||||||
void tslib_ultoa(unsigned long n, char *str)
|
|
||||||
{
|
|
||||||
// 0... ->4294967296 str[0]='4' str[1]='2' ...[9]='6' str[10]=0 str[11]=0
|
|
||||||
|
|
||||||
uint8_t pp, zi[12];
|
|
||||||
int pi=0;
|
|
||||||
unsigned long ltmp;
|
|
||||||
|
|
||||||
for (pp=0;pp<12;pp++)
|
|
||||||
{
|
|
||||||
str[pp]=0;
|
|
||||||
zi[pp]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ltmp=n;
|
|
||||||
pp=0;
|
|
||||||
|
|
||||||
if (ltmp==0)
|
|
||||||
str[pp++]=0x30;
|
|
||||||
|
|
||||||
while(ltmp>0)
|
|
||||||
{
|
|
||||||
zi[pi++]=ltmp%10;
|
|
||||||
ltmp/=10;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (pi>0)
|
|
||||||
str[pp++]=zi[--pi]+0x30;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***********************************************************************************************
|
|
||||||
|
|
||||||
void tslib_uitobin(unsigned int decval, char *str)
|
|
||||||
{
|
|
||||||
uint16_t dv, bb;
|
|
||||||
int ll;
|
|
||||||
|
|
||||||
dv=decval;
|
|
||||||
ll=8; // show 8 bit
|
|
||||||
if (dv>255) ll=16; // show 16 bit
|
|
||||||
str[ll--]=0; // terminierung
|
|
||||||
|
|
||||||
bb=0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (dv & (1<<bb) ) str[ll]=0x31; else str[ll]=0x30;
|
|
||||||
bb++; ll--;
|
|
||||||
} while(ll>=0);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***********************************************************************************************
|
|
||||||
|
|
||||||
long tslib_atol( char *AscString)
|
|
||||||
{
|
|
||||||
// change ascii string ( of ascii numbers '0'..'9') to number
|
|
||||||
// AscString must be 0-terminated!
|
|
||||||
// a leading '-' is ignored, a'.' or a ',' stops calculation
|
|
||||||
|
|
||||||
//aufruf mit ("1234")
|
|
||||||
// aus IDE: ucatmp[0]='1' ucatmp[3]='4' ucatmp[4]='0' sl=4
|
|
||||||
|
|
||||||
unsigned long ultmp;
|
|
||||||
unsigned char uctmp1, minus=0;
|
|
||||||
unsigned int sl, zz;
|
|
||||||
|
|
||||||
sl=tslib_StrLen(AscString);
|
|
||||||
if (sl>10) sl=10; // mehr passt im ULONG nicht rein!
|
|
||||||
|
|
||||||
ultmp=0;
|
|
||||||
for (zz=0; zz<sl; zz++)
|
|
||||||
{
|
|
||||||
uctmp1=AscString[zz];
|
|
||||||
if (zz==0 && uctmp1=='-')
|
|
||||||
minus=1;
|
|
||||||
else
|
|
||||||
if (uctmp1>0x2F && uctmp1<0x3A)
|
|
||||||
{
|
|
||||||
ultmp*=10; // nur wenn eine neue Ziffer dazukommt und vor der addition!
|
|
||||||
uctmp1-=0x30;
|
|
||||||
ultmp+=(uint32_t)uctmp1;
|
|
||||||
|
|
||||||
} else
|
|
||||||
if (uctmp1=='.' || uctmp1==',' || uctmp1==0 )
|
|
||||||
{
|
|
||||||
if (minus)
|
|
||||||
ultmp*=(-1);
|
|
||||||
return(ultmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minus)
|
|
||||||
ultmp*=(-1);
|
|
||||||
return(ultmp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************************************
|
|
||||||
|
|
||||||
unsigned long tslib_atoul( char *AscString)
|
|
||||||
{
|
|
||||||
// change ascii string ( of ascii numbers '0'..'9') to number
|
|
||||||
// AscString must be 0-terminated!
|
|
||||||
// a leading '-' is ignored, a'.' or a ',' stops calculation
|
|
||||||
|
|
||||||
//aufruf mit ("1234")
|
|
||||||
// aus IDE: ucatmp[0]='1' ucatmp[3]='4' ucatmp[4]='0' sl=4
|
|
||||||
|
|
||||||
unsigned long ultmp;
|
|
||||||
unsigned char uctmp1;
|
|
||||||
unsigned int sl, zz;
|
|
||||||
|
|
||||||
sl=tslib_StrLen(AscString);
|
|
||||||
if (sl>10) sl=10; // mehr passt im ULONG nicht rein!
|
|
||||||
|
|
||||||
ultmp=0;
|
|
||||||
for (zz=0; zz<sl; zz++)
|
|
||||||
{
|
|
||||||
uctmp1=AscString[zz];
|
|
||||||
if (uctmp1>0x2F && uctmp1<0x3A)
|
|
||||||
{
|
|
||||||
ultmp*=10; // nur wenn eine neue Ziffer dazukommt und vor der addition!
|
|
||||||
uctmp1-=0x30;
|
|
||||||
ultmp+=(uint32_t)uctmp1;
|
|
||||||
|
|
||||||
} else
|
|
||||||
if (uctmp1=='.' || uctmp1==',' || uctmp1==0 )
|
|
||||||
return(ultmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ultmp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************************************************************************************
|
|
||||||
|
|
||||||
unsigned int tslib_ah2ui( char *AscString)
|
|
||||||
{
|
|
||||||
// change hex ascii string ( of ascii numbers '0'..'9', 'A' or 'a' ...'F','f') to number
|
|
||||||
// AscString must be 0-terminated!
|
|
||||||
// Example: "1A0C" = 6668
|
|
||||||
|
|
||||||
//unsigned long ultmp;
|
|
||||||
unsigned char uctmp1;
|
|
||||||
unsigned int sl, zz, uitmp;
|
|
||||||
|
|
||||||
sl=tslib_StrLen(AscString);
|
|
||||||
if (sl>4) sl=4;
|
|
||||||
|
|
||||||
uitmp=0;
|
|
||||||
for (zz=0; zz<sl; zz++)
|
|
||||||
{
|
|
||||||
uctmp1=AscString[zz];
|
|
||||||
|
|
||||||
if (uctmp1>=0x30 && uctmp1<=0x39)
|
|
||||||
{
|
|
||||||
uitmp<<=4; // nur wenn eine neue Ziffer dazukommt und vor der addition!
|
|
||||||
uctmp1-=0x30;
|
|
||||||
uitmp+=(uint16_t)uctmp1;
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (uctmp1>='A' && uctmp1<='F')
|
|
||||||
{
|
|
||||||
uitmp<<=4;
|
|
||||||
uctmp1-=0x37;
|
|
||||||
uitmp+=(uint16_t)uctmp1;
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (uctmp1>='a' && uctmp1<='f')
|
|
||||||
{
|
|
||||||
uitmp<<=4;
|
|
||||||
uctmp1-=0x57;
|
|
||||||
uitmp+=(uint16_t)uctmp1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return(uitmp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user