Compare commits
22 Commits
master
...
pu/coinInt
Author | SHA1 | Date | |
---|---|---|---|
ca5e43e0d7 | |||
3ac91305d4 | |||
d0445949d2 | |||
91d9280a4a | |||
48d6a34b16 | |||
e32142cd62 | |||
f611e07dcf | |||
6478eda581 | |||
1663d09d3a | |||
080c00eda1 | |||
bbce2b02e3 | |||
8ff17a2e00 | |||
c6574280ac | |||
f0f0493d19 | |||
9bf99c5515 | |||
8ff8faf007 | |||
09a80498e4 | |||
01f8c1e49c | |||
3029b8da04 | |||
2143801900 | |||
6f6d3b7491 | |||
4cfb8f1804 |
@ -2,7 +2,6 @@ INCLUDEPATH += $${PWD}/include
|
|||||||
DEPENDPATH += $${PWD}
|
DEPENDPATH += $${PWD}
|
||||||
|
|
||||||
HEADERS += $${PWD}/include/com.h \
|
HEADERS += $${PWD}/include/com.h \
|
||||||
$$PWD/include/datei.h \
|
|
||||||
$${PWD}/include/controlBus.h \
|
$${PWD}/include/controlBus.h \
|
||||||
$${PWD}/include/datIf.h \
|
$${PWD}/include/datIf.h \
|
||||||
$${PWD}/include/dcBL.h \
|
$${PWD}/include/dcBL.h \
|
||||||
@ -15,8 +14,6 @@ HEADERS += $${PWD}/include/com.h \
|
|||||||
$${PWD}/include/shared_mem_buffer.h
|
$${PWD}/include/shared_mem_buffer.h
|
||||||
|
|
||||||
SOURCES += $${PWD}/src/com.cpp \
|
SOURCES += $${PWD}/src/com.cpp \
|
||||||
$$PWD/src/datei.cpp \
|
|
||||||
$$PWD/src/main.cpp \
|
|
||||||
$${PWD}/src/controlBus.cpp \
|
$${PWD}/src/controlBus.cpp \
|
||||||
$${PWD}/src/datIf.cpp \
|
$${PWD}/src/datIf.cpp \
|
||||||
$${PWD}/src/dcBL.cpp \
|
$${PWD}/src/dcBL.cpp \
|
||||||
|
30
DCPlugin.pro
30
DCPlugin.pro
@ -14,27 +14,24 @@ QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
|||||||
# default
|
# default
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
|
|
||||||
|
include(DCPlugin.pri)
|
||||||
|
|
||||||
contains( CONFIG, DesktopLinux ) {
|
contains( CONFIG, DesktopLinux ) {
|
||||||
# QMAKE_CC = ccache $$QMAKE_CC
|
QMAKE_CC = ccache $$QMAKE_CC
|
||||||
# QMAKE_CXX = ccache $$QMAKE_CXX
|
QMAKE_CXX = ccache $$QMAKE_CXX
|
||||||
QMAKE_CXXFLAGS += -std=c++17
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
# QMAKE_CXXFLAGS += -Wno-deprecated-ctor
|
# QMAKE_CXXFLAGS += -Wno-deprecated-ctor
|
||||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||||
ARCH = DesktopLinux
|
ARCH = DesktopLinux
|
||||||
include(DCPlugin.pri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contains( CONFIG, PTU5 ) {
|
contains( CONFIG, PTU5 ) {
|
||||||
# QMAKE_CC = ccache $$QMAKE_CC
|
# QMAKE_CC = ccache $$QMAKE_CC
|
||||||
# QMAKE_CXX = ccache $$QMAKE_CXX
|
# QMAKE_CXX = ccache $$QMAKE_CXX
|
||||||
QMAKE_CXXFLAGS += -std=c++17
|
QMAKE_CXXFLAGS += -std=c++11
|
||||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
|
|
||||||
# NOTE: include contents of DCPlugin.pri. Also used by ATBQT.
|
|
||||||
# Add new files in DCPlugin.pri.
|
|
||||||
include(DCPlugin.pri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contains( CONFIG, PTU5_YOCTO ) {
|
contains( CONFIG, PTU5_YOCTO ) {
|
||||||
@ -46,11 +43,12 @@ contains( CONFIG, PTU5_YOCTO ) {
|
|||||||
#LIBS += -lQt5Qmqtt
|
#LIBS += -lQt5Qmqtt
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET = CashAgentLib
|
TARGET = ATBDeviceControllerPlugin
|
||||||
#DESTDIR = ../plugins
|
#DESTDIR = ../plugins
|
||||||
INTERFACE = DeviceController
|
INTERFACE = DeviceController
|
||||||
INTERFACE_DEFINITION = $${PWD}/include/ATBAPP/DeviceControllerInterface.h
|
INTERFACE_DEFINITION = $${PWD}/include/ATBAPP/DeviceControllerInterface.h
|
||||||
|
|
||||||
|
DEFINES += DEVICECONTROLLERPLUGIN_LIBRARY
|
||||||
|
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
# any Qt feature that has been marked deprecated (the exact warnings
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
@ -70,8 +68,16 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
#!isEmpty(target.path): INSTALLS += target
|
#!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
# ATBAPP interface
|
||||||
|
HEADERS += \
|
||||||
|
src/ATBAPP/ATBAPPplugin.h \
|
||||||
|
src/ATBAPP/DeviceControllerInterface.h \
|
||||||
|
src/ATBAPP/ATBHealthEvent.h \
|
||||||
|
src/ATBAPP/ATBDeviceControllerPlugin.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
src/ATBAPP/ATBHealthEvent.cpp \
|
||||||
|
src/ATBAPP/ATBDeviceControllerPlugin.cpp
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
generate-version.sh
|
generate-version.sh
|
||||||
@ -86,5 +92,3 @@ version.input = VERSION_H
|
|||||||
version.variable_out = HEADERS
|
version.variable_out = HEADERS
|
||||||
QMAKE_EXTRA_COMPILERS += version
|
QMAKE_EXTRA_COMPILERS += version
|
||||||
QMAKE_CLEAN += $${PWD}/include/version.h
|
QMAKE_CLEAN += $${PWD}/include/version.h
|
||||||
|
|
||||||
HEADERS +=
|
|
||||||
|
@ -170,7 +170,7 @@ uint8_t epi_getResultOfLastRequest();
|
|||||||
// retval: 0: in progress 1: OK 2: error
|
// retval: 0: in progress 1: OK 2: error
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData);
|
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t const *receivedData);
|
||||||
// stored by Datif
|
// stored by Datif
|
||||||
|
|
||||||
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);
|
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad);
|
||||||
|
@ -303,12 +303,13 @@ class T_datif : public QMainWindow
|
|||||||
// docNr =transmitted in WRITEADDRESS high byte
|
// docNr =transmitted in WRITEADDRESS high byte
|
||||||
// blockNr=transmitted in WRITEADDRESS low byte
|
// blockNr=transmitted in WRITEADDRESS low byte
|
||||||
|
|
||||||
int datif_noResponseCtr;
|
|
||||||
|
|
||||||
T_prot *myDCIF;
|
T_prot *myDCIF;
|
||||||
QTimer *datif_trigger;
|
QTimer *datif_trigger;
|
||||||
uint8_t selectedSlaveAddr;
|
uint8_t selectedSlaveAddr;
|
||||||
|
|
||||||
|
int datif_noResponseCtr;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
char datif_cycleSend();
|
char datif_cycleSend();
|
||||||
void StoredRecData();
|
void StoredRecData();
|
||||||
@ -316,12 +317,16 @@ private slots:
|
|||||||
public:
|
public:
|
||||||
T_datif(QWidget *parent = nullptr);
|
T_datif(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
T_prot *getProt() { return myDCIF; }
|
||||||
|
T_prot const *getProt() const { return myDCIF; }
|
||||||
|
|
||||||
void resetChain(void);
|
void resetChain(void);
|
||||||
char isPortOpen(void);
|
char isPortOpen(void);
|
||||||
void sendWRcommand(uint16_t nxtAsCmd);
|
void sendWRcommand(uint16_t nxtAsCmd);
|
||||||
// Sende Schreibbefehle die bereits vorher asynchron gespeichert wurden
|
// Sende Schreibbefehle die bereits vorher asynchron gespeichert wurden
|
||||||
void send_requests(uint16_t nextWrCmd);
|
void send_requests(uint16_t nextWrCmd);
|
||||||
void sendHighLevel(uint16_t nxtHLCmd);
|
void sendHighLevel(uint16_t nxtHLCmd);
|
||||||
|
bool areDataValid(void);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ResponseRecieved();
|
void ResponseRecieved();
|
||||||
|
202
include/datei.h
202
include/datei.h
@ -1,202 +0,0 @@
|
|||||||
#ifndef DATEI_H
|
|
||||||
#define DATEI_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDebug>
|
|
||||||
#include "tslib.h"
|
|
||||||
#include <QString>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonParseError>
|
|
||||||
|
|
||||||
// create csv file with:
|
|
||||||
#define FILESEPERATOR ','
|
|
||||||
|
|
||||||
// pasre csv with:
|
|
||||||
#define FILESEP1 ','
|
|
||||||
#define FILESEP2 ';'
|
|
||||||
|
|
||||||
#define NEWLINEINFILE '\n'
|
|
||||||
#define MAXNUMBEROFSEQUENCES 200
|
|
||||||
// only for csv files
|
|
||||||
|
|
||||||
|
|
||||||
// all generated files located in sudirectory "dynamic machine data - dmd"
|
|
||||||
|
|
||||||
#define FILENAME_SHAREDDATA "../dmd/DCshare.csv"
|
|
||||||
#define FILENAME_SHARED_UID "../dmd/DC_UID.csv"
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ create csv file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// create array with strings and values (to be written to file)
|
|
||||||
void csv_startCreatingFile(void);
|
|
||||||
void csv_addTextToFile(QString myText);
|
|
||||||
void csv_addIntToFile(int myValue);
|
|
||||||
void csv_addUintToFile(uint myValue);
|
|
||||||
void csv_addLongvalToFile(qlonglong myValue);
|
|
||||||
void csv_addUlongvalToFile(qulonglong myValue);
|
|
||||||
//void csv_addCurrentTimeToFile(void);
|
|
||||||
//void csv_addCurrentDateToFile(void);
|
|
||||||
void csv_addNewlineToFile(void);
|
|
||||||
QByteArray csv_readbackArray(void);
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ parse csv file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// return number of entries in the just read file (entries are seperated by
|
|
||||||
// comma or line-feed)
|
|
||||||
uint32_t csv_nrOfEntriesInFile(QByteArray readFromFile);
|
|
||||||
|
|
||||||
// before: QByteArray sourceFile=datei_readFromFile(filename);
|
|
||||||
|
|
||||||
QByteArray csv_getOneFileSequence(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// not needed, just for test // sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
// get single entries of of the just read file:
|
|
||||||
int csv_getEntryAsInt(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
int32_t csv_getEntryAsLong(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
uint8_t csv_getEntryAsUshort(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
uint16_t csv_getEntryAsUint(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
uint32_t csv_getEntryAsUlong(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
uint64_t csv_getEntryAs2Ulong(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
QString csv_getEntryAsString(QByteArray sourceFile, uint32_t sequNr);
|
|
||||||
// sequNr: 0....(size-1)
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ create Json Record -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void json_startRecord(void);
|
|
||||||
// clear buffer and write opening curly bracket {
|
|
||||||
|
|
||||||
void json_enterIntToRecord(QString attribute, ulong i_value);
|
|
||||||
// example: "parameter":1234567890
|
|
||||||
|
|
||||||
void json_enterTextToRecord(QString attribute, QString txt_value);
|
|
||||||
// example: "parameter":"slow"
|
|
||||||
|
|
||||||
//void json_addCurrentTimeToRecord(QString attribute);
|
|
||||||
// example: if attribute=myTime: "myTime":"hh_mm_ss"
|
|
||||||
|
|
||||||
//void json_addCurrentDateToRecord(QString attribute);
|
|
||||||
// example: if attribute=myDate: "myDate":"dd.mm.yyyy"
|
|
||||||
// also / possible as seperator
|
|
||||||
// further possible forms:
|
|
||||||
// format= 0: dd.mm.yyyy (deutsch)
|
|
||||||
// 1: mm.dd.yyyy (amerika)
|
|
||||||
// 2: yyyy.mm.dd (Iran, Dubai)
|
|
||||||
// 3: dd.yyyy.mm
|
|
||||||
// 4: mm.yyyy.dd
|
|
||||||
// 5: yyyy.dd.mm
|
|
||||||
|
|
||||||
void json_enterArrayToRecord(QString attribute, uint8_t *buf, ulong nrofVals);
|
|
||||||
// add array of numbers with "nrofVals" elements
|
|
||||||
|
|
||||||
void json_enterStructToRecord(QString attribute);
|
|
||||||
// every call must be concluded with an extra "json_finishFile()"
|
|
||||||
// example: "sname":{
|
|
||||||
|
|
||||||
void json_finishStruct(void);
|
|
||||||
|
|
||||||
void json_finishRecord(void);
|
|
||||||
// close curly bracket
|
|
||||||
|
|
||||||
|
|
||||||
QString json_readbackRecordStr(void);
|
|
||||||
|
|
||||||
QByteArray json_readbackRecordBa(void);
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ parse Json file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// first: QByteArray datei_readFromFile(QString filename);
|
|
||||||
|
|
||||||
//void datei_json_readTestFile(QString filename);
|
|
||||||
|
|
||||||
int json_nrOfPairsInFile(QByteArray filename);
|
|
||||||
|
|
||||||
bool json_exists(QByteArray filename, QString searchForKey);
|
|
||||||
// look for "searchForKey" =name of the pair (left of : )
|
|
||||||
// retval true if exists
|
|
||||||
|
|
||||||
bool json_remove(QByteArray filename, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and remove the record from file
|
|
||||||
// retval true if removed
|
|
||||||
|
|
||||||
QString json_searchForStringInFile(QByteArray filename, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
int json_searchForIntInFile(QByteArray filename, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
//.......................
|
|
||||||
|
|
||||||
QJsonObject json_searchForObjectInFile(QByteArray filename, QString searchFor);
|
|
||||||
// return an object from the json file
|
|
||||||
|
|
||||||
int json_nrOfPairsInObject(QJsonObject objname);
|
|
||||||
|
|
||||||
QString json_searchForStringInObject(QJsonObject objname, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
int json_searchForIntInObject(QJsonObject objname, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
//.......................
|
|
||||||
|
|
||||||
QJsonArray json_searchForArrayInFile(QByteArray filename, QString searchFor);
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
int json_nrOfValuesInArray(QJsonArray arrayname);
|
|
||||||
|
|
||||||
bool json_getValuesOfArray(QJsonArray arrayname, int *buf, int MaxBufferSize);
|
|
||||||
// assuming that the array consists of integers
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ read, write, copy files -------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void datei_closeFile(QString filename);
|
|
||||||
|
|
||||||
// read content of an exiting file:
|
|
||||||
QByteArray datei_readFromFile(QString filename);
|
|
||||||
|
|
||||||
bool datei_ifFileExists(QString filename);
|
|
||||||
|
|
||||||
char datei_writeToFile(QString filename, QByteArray content);
|
|
||||||
// retval=0 if successful 1: no write access allowed
|
|
||||||
// 2:cannot open to append 3:cannot create new file
|
|
||||||
|
|
||||||
bool datei_copyFile(QString currentFileName, QString newFileName);
|
|
||||||
// retval=true if successful
|
|
||||||
|
|
||||||
bool datei_clearFile(QString filename);
|
|
||||||
// retval=true if successful
|
|
||||||
|
|
||||||
#endif // DATEI_H
|
|
35
include/hwChk.h
Executable file
35
include/hwChk.h
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
#ifndef hwchk_H
|
||||||
|
#define hwchk_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QObject>
|
||||||
|
#include "interfaces.h"
|
||||||
|
//#include "datIf.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
#include "hwapi.h"
|
||||||
|
|
||||||
|
//class QSharedMemory;
|
||||||
|
class hwChk : public QObject,
|
||||||
|
public hwinf
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
// Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
|
||||||
|
// Q_INTERFACES(hwinf)
|
||||||
|
//private:
|
||||||
|
// QSharedMemory *m_sharedMem;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit hwChk(QWidget *parent = nullptr);
|
||||||
|
virtual ~hwChk();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
hwinf *HWaccess;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
138
include/hwapi.h
138
include/hwapi.h
@ -24,33 +24,46 @@ matching interfaces.h:
|
|||||||
#define hwapi_H
|
#define hwapi_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QTabWidget>
|
|
||||||
#include <QtPlugin>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <../plugins/interfaces.h>
|
#include "interfaces.h"
|
||||||
#include "datIf.h"
|
#include "datIf.h"
|
||||||
|
|
||||||
|
class QSharedMemory;
|
||||||
|
|
||||||
class hwapi : public QObject,
|
class hwapi : public QObject,
|
||||||
public hwinf
|
public hwinf
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
|
|
||||||
Q_INTERFACES(hwinf)
|
Q_INTERFACES(hwinf)
|
||||||
private:
|
private:
|
||||||
void sub_storeSendingText(QByteArray *buf) const;
|
void sub_storeSendingText(QByteArray *buf) const;
|
||||||
QTimer *hwapi_TimerPayment;
|
QTimer *hwapi_TimerPayment;
|
||||||
|
|
||||||
|
DownloadResult sendNextAddress(int bNum) const;
|
||||||
|
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
||||||
|
DownloadResult sendStatus(int ret) const;
|
||||||
|
DownloadResult dc_downloadBinary(QByteArray const &binary) const;
|
||||||
|
|
||||||
|
bool startBootloader() const;
|
||||||
|
bool stopBootloader() const;
|
||||||
|
bool openSerial(int br, QString baudrate, QString comPort) const;
|
||||||
|
bool closeSerial(QString comport) const;
|
||||||
|
bool resetDeviceController() const;
|
||||||
|
QByteArray loadBinaryDCFile(QString filename) const;
|
||||||
|
bool downloadBinaryToDC(QString const &bFile) const;
|
||||||
|
|
||||||
|
QSharedMemory *m_sharedMem;
|
||||||
public:
|
public:
|
||||||
explicit hwapi(QWidget *parent = nullptr);
|
explicit hwapi(QObject *parent = nullptr);
|
||||||
|
virtual ~hwapi();
|
||||||
|
|
||||||
T_datif *myDatif;
|
T_datif *myDatif;
|
||||||
|
|
||||||
|
|
||||||
|
virtual QStringList dc_getStatus() const override;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// commands, interface
|
// Level 0 commands, interface
|
||||||
// open, close, change serial interface
|
// open, close, change serial interface
|
||||||
// actually not neccessary as it is opened automatically on program start
|
// actually not neccessary as it is opened automatically on program start
|
||||||
// start automatic READ requests
|
// start automatic READ requests
|
||||||
@ -62,7 +75,7 @@ public:
|
|||||||
// ComName: for example "COM48"
|
// ComName: for example "COM48"
|
||||||
// connect: 0, 1
|
// connect: 0, 1
|
||||||
|
|
||||||
void dc_closeSerial(void) const override;
|
bool dc_closeSerial(void) const override;
|
||||||
|
|
||||||
bool dc_isPortOpen(void) const override ;
|
bool dc_isPortOpen(void) const override ;
|
||||||
|
|
||||||
@ -70,10 +83,21 @@ public:
|
|||||||
// select if READ-Requests are sent manually one by one or automatically
|
// select if READ-Requests are sent manually one by one or automatically
|
||||||
// automatically request ALL digital and analog sensors, get time/date, get status information
|
// automatically request ALL digital and analog sensors, get time/date, get status information
|
||||||
|
|
||||||
|
bool dc_updateDC(QString binFileName, QString baudrate,
|
||||||
|
QString comPort) const override;
|
||||||
|
|
||||||
|
bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QVector<QString> fnames,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const override;
|
||||||
|
|
||||||
|
bool dc_printTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const override;
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// control device-controller (functions of µC)
|
// Level 1, control device-controller (functions of µC)
|
||||||
// check serial connection to deviceController
|
// check serial connection to deviceController
|
||||||
// read response from DC2 (input data)
|
// read response from DC2 (input data)
|
||||||
// some test function for serial communication
|
// some test function for serial communication
|
||||||
@ -168,7 +192,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// DC2-onboard devices
|
// Level 2 DC2-onboard devices
|
||||||
// WR: set time
|
// WR: set time
|
||||||
// RD. get time, get measure, get test results
|
// RD. get time, get measure, get test results
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
@ -242,7 +266,7 @@ public:
|
|||||||
bool dc_mainFuseIsOk(void) const override;
|
bool dc_mainFuseIsOk(void) const override;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// igital outputs and simple switching of connected devices
|
// Level 3: digital outputs and simple switching of connected devices
|
||||||
// simple processes like flashing a led or open flap for 1s
|
// simple processes like flashing a led or open flap for 1s
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -298,7 +322,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// digital inputs of connected devices
|
// Level 3: digital inputs of connected devices
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool door_isContactPowerOn(void) const override;
|
bool door_isContactPowerOn(void) const override;
|
||||||
@ -660,29 +684,29 @@ public:
|
|||||||
// up to 8 dynamic values can be defined in the template ("print val3 here") and will be sent with printing command
|
// up to 8 dynamic values can be defined in the template ("print val3 here") and will be sent with printing command
|
||||||
// example: print current time at this point (the time of printing not the storage time!!)
|
// example: print current time at this point (the time of printing not the storage time!!)
|
||||||
|
|
||||||
//void pri_startTicketDesign(void) const override;
|
void pri_startTicketDesign(void) const override;
|
||||||
// start for every new printer document, reseting collecting buffer
|
// start for every new printer document, reseting collecting buffer
|
||||||
|
|
||||||
// all further functions write/append text, numbers and command to the ticket-buffer, up to 1278 bytes allowed
|
// all further functions write/append text, numbers and command to the ticket-buffer, up to 1278 bytes allowed
|
||||||
// return val of the appending functions: true=ok false=too long, buffer full
|
// return val of the appending functions: true=ok false=too long, buffer full
|
||||||
|
|
||||||
//int pri_TD_getCurrentSize(void) const override;
|
int pri_TD_getCurrentSize(void) const override;
|
||||||
// retval: 0...1278
|
// retval: 0...1278
|
||||||
|
|
||||||
//bool pri_TD_addText(QByteArray text) const override;
|
bool pri_TD_addText(QByteArray text) const override;
|
||||||
// example: pri_TD_addText("Hello") const override;
|
// example: pri_TD_addText("Hello") const override;
|
||||||
// example: pri_TD_addText(tempStr) const override;
|
// example: pri_TD_addText(tempStr) const override;
|
||||||
// retval: true=ok false=too long, buffer full
|
// retval: true=ok false=too long, buffer full
|
||||||
|
|
||||||
//bool pri_TD_addValue(int val) const override;
|
bool pri_TD_addValue(int val) const override;
|
||||||
// +/- 0...2^(31)
|
// +/- 0...2^(31)
|
||||||
|
|
||||||
//bool pri_TD_addNewLine(void) const override;
|
bool pri_TD_addNewLine(void) const override;
|
||||||
|
|
||||||
//bool pri_TD_addSign(char sign) const override;
|
bool pri_TD_addSign(char sign) const override;
|
||||||
// example: '.' ' ' 0x20 'W' '$'
|
// example: '.' ' ' 0x20 'W' '$'
|
||||||
|
|
||||||
//bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const override;
|
bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const override;
|
||||||
// always add 8 byte to the ticket layout: ESC & group & attribute & parameter1...5
|
// always add 8 byte to the ticket layout: ESC & group & attribute & parameter1...5
|
||||||
/* complete list of possible commands:
|
/* complete list of possible commands:
|
||||||
group 50 : paper
|
group 50 : paper
|
||||||
@ -723,11 +747,11 @@ public:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//char prn_clearDocument(uint8_t documentNumber) const override;
|
char prn_clearDocument(uint8_t documentNumber) const override;
|
||||||
// clear memory buffer for ONE document
|
// clear memory buffer for ONE document
|
||||||
// function takes a second! don't send right before "store doc"
|
// function takes a second! don't send right before "store doc"
|
||||||
|
|
||||||
//bool prn_store_Document(uint8_t documentNumber ) const override;
|
bool prn_store_Document(uint8_t documentNumber ) const override;
|
||||||
|
|
||||||
// send the predefined Layout (generated with above TD functions) to DeviceController to save
|
// send the predefined Layout (generated with above TD functions) to DeviceController to save
|
||||||
// documentNumber=0...15
|
// documentNumber=0...15
|
||||||
@ -739,7 +763,7 @@ public:
|
|||||||
// the place in the ticket layout is predefined (already in DC memory)
|
// the place in the ticket layout is predefined (already in DC memory)
|
||||||
// the dynamics are first calculated at printing time
|
// the dynamics are first calculated at printing time
|
||||||
|
|
||||||
//bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const override;
|
bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -843,7 +867,7 @@ public:
|
|||||||
void bl_rebootDC(void) const override;
|
void bl_rebootDC(void) const override;
|
||||||
|
|
||||||
void bl_startBL(void) const override;
|
void bl_startBL(void) const override;
|
||||||
void bl_checkBL(void) const override;
|
bool bl_checkBL(void) const override;
|
||||||
bool bl_isUp(void) const override;
|
bool bl_isUp(void) const override;
|
||||||
// return true is bl is up and running
|
// return true is bl is up and running
|
||||||
// also initializes "sendFile"
|
// also initializes "sendFile"
|
||||||
@ -920,7 +944,6 @@ public:
|
|||||||
// return true if successful. could fail if more the 8 commands are waiting
|
// return true if successful. could fail if more the 8 commands are waiting
|
||||||
|
|
||||||
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
|
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
|
||||||
bool rtc_getExtendedTime(struct T_extTime *exTime) const override;
|
bool rtc_getExtendedTime(struct T_extTime *exTime) const override;
|
||||||
|
|
||||||
bool sys_runCompleteTest(void) const override;
|
bool sys_runCompleteTest(void) const override;
|
||||||
@ -967,9 +990,6 @@ public:
|
|||||||
bool prn_printTestTicket(void) const override;
|
bool prn_printTestTicket(void) const override;
|
||||||
// return true if sending to DC OK, false if cmd-stack is full
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cash_startPayment(uint32_t amount) const override;
|
bool cash_startPayment(uint32_t amount) const override;
|
||||||
// 17.4.23TS: extended to 32bit
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
@ -1018,21 +1038,20 @@ public:
|
|||||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||||
|
|
||||||
uint8_t sys_getWakeReason(void) const override;
|
uint8_t sys_getWakeReason(void) const override;
|
||||||
// Master was woken by following reason:
|
// Master was woken by following reason:
|
||||||
// 1: MDB Event
|
// 1: MDB Event
|
||||||
// 2: Coin Event
|
// 2: Coin Event
|
||||||
// ( 3: Master Event) - will not set the wake line
|
// ( 3: Master Event) - will not set the wake line
|
||||||
// ( 4: 32s pulse) - will not set the wake line
|
// ( 4: 32s pulse) - will not set the wake line
|
||||||
// 5: Door Event
|
// 5: Door Event
|
||||||
// ( 6: Diag Event) - will not set the wake line
|
// ( 6: Diag Event) - will not set the wake line
|
||||||
// 7: 30min-Pulse for HB
|
// 7: 30min-Pulse for HB
|
||||||
|
|
||||||
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
|
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
|
||||||
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(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
|
||||||
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
||||||
|
|
||||||
|
|
||||||
@ -1050,30 +1069,51 @@ public:
|
|||||||
// bit6: no response bit7: serial rec. error
|
// bit6: no response bit7: serial rec. error
|
||||||
// bit5: printer not ready
|
// bit5: printer not ready
|
||||||
|
|
||||||
|
|
||||||
void sys_sendDeviceParameter(struct T_devices *deviceSettings) const override;
|
void sys_sendDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||||
|
|
||||||
void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const override;
|
void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||||
|
|
||||||
bool sys_areDCdataValid(void) const override;
|
bool sys_areDCdataValid(void) const override;
|
||||||
|
|
||||||
bool sys_sendingTest(void) const override;
|
/* ---------------------------------------------------------------------------------------------
|
||||||
|
// ------------ supervise all hardware components
|
||||||
|
// ------------ assess the machine state
|
||||||
|
|
||||||
void prn_requestCurrentDynData(void) const override;
|
1. check if DC startup test is through, retrigger if not
|
||||||
|
2. get results and find errors
|
||||||
|
3. in case of error check if component is used (e.g. billreader is seldom used)
|
||||||
|
4: check doors
|
||||||
|
5. return value: 0: no response from DC
|
||||||
|
1: no Test results and Test not running. need retrigger!
|
||||||
|
2: state not clear by now, test ongoing, wait
|
||||||
|
3: Service or battery door is open, goto INTRUSION MODE
|
||||||
|
from here: after valid ID-card goto SERVICE MODE
|
||||||
|
4: vault door is open, goto INTRUSION MODE
|
||||||
|
from here: after valid ID-card and vault door closed goto TEST MODE
|
||||||
|
in TEST MODE: complete system check decides if vending mode allowed
|
||||||
|
5: All doors are closed but errors found,
|
||||||
|
goto OOO MODE (out-of-order)
|
||||||
|
from here: run system test until problem is fixed
|
||||||
|
6: All doors are closed, no error, maybe warnings,
|
||||||
|
goto VENDING MODE (normal operation)
|
||||||
|
(priority sinks from 0 to 6)
|
||||||
|
|
||||||
bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const override;
|
--------------------------------------------------------------------------------------------- */
|
||||||
// which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
|
|
||||||
|
|
||||||
bool prn_dynDataAreEqual(uint8_t *buf) const override;
|
uint8_t sys_componentAssessment(void) const override;
|
||||||
|
// this function decides if vending mode is possible, independant from door
|
||||||
|
// return >0 in case of error
|
||||||
|
// is inncluded in sys_superviseSystem
|
||||||
|
|
||||||
bool prn_printKombiticket(uint8_t nrOfKombi) const override;
|
uint8_t sys_superviseSystem(void) const override;
|
||||||
// print four of the templates loaded by Json prior
|
// this function proofs if vending is possible depending of doors state
|
||||||
// nr = 1..8
|
|
||||||
|
|
||||||
void lock_triggerUpperSolenoid(void) const override;
|
|
||||||
|
|
||||||
void lock_triggerLowerSolenoid(void) const override;
|
uint8_t sys_getSystemErrors(void) const override;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void hwapi_templatePrintFinished_OK(void) const override;
|
void hwapi_templatePrintFinished_OK(void) const override;
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
#define INTERFACE_H
|
#define INTERFACE_H
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
struct T_emp {
|
||||||
|
|
||||||
struct T_emp
|
|
||||||
{
|
|
||||||
|
|
||||||
// Fixdata from EMP:
|
// Fixdata from EMP:
|
||||||
uint8_t shaft; // = changer level
|
uint8_t shaft; // = changer level
|
||||||
uint16_t countryCode;
|
uint16_t countryCode;
|
||||||
@ -24,29 +21,19 @@ struct T_emp
|
|||||||
|
|
||||||
// dynamic:
|
// dynamic:
|
||||||
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
||||||
// 0=start command
|
// 0=Emp & Bus power off, 1=powered, poll off 2=polling on
|
||||||
// 1=powered, do emp ini, send reset
|
// 3=device responded, requesting status
|
||||||
// 2=delay
|
// 4=waiting for status 5=have status,
|
||||||
// 3=wait for response, requesting status after response
|
// 6: IDLE, have paramters from master, polling running, ready for payment
|
||||||
// 4,5 through, startup
|
// Master can stop/start polling and acceptance
|
||||||
// 6: wait for status
|
// 7: end of transaction, polling on, accept off, reporting coins, (wait for last coin)
|
||||||
// 7: through, startup
|
// 8: transaction running, polling on, acceptance on, reporting coins,
|
||||||
// 8: IDLE state. EMP is up and ready, polling is running
|
|
||||||
// 9: polling on, payment not yet on
|
|
||||||
// 10: payment, check coins
|
|
||||||
// 11: through
|
|
||||||
// 12: wait 1s for last coin
|
|
||||||
// 90: stop all, 1s delay
|
|
||||||
// 99: off, all stopped
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t pollingRunning;
|
uint8_t pollingRunning;
|
||||||
uint8_t paymentRunning;
|
uint8_t paymentRunning;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Trtc_DateTime
|
struct Trtc_DateTime {
|
||||||
{
|
|
||||||
uint8_t rtc_hour;
|
uint8_t rtc_hour;
|
||||||
uint8_t rtc_min;
|
uint8_t rtc_min;
|
||||||
uint8_t rtc_sec;
|
uint8_t rtc_sec;
|
||||||
@ -56,8 +43,7 @@ struct Trtc_DateTime
|
|||||||
uint8_t rtc_dayOfWeek;
|
uint8_t rtc_dayOfWeek;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tprn_hw_state
|
struct Tprn_hw_state {
|
||||||
{
|
|
||||||
// hardware (IO's)
|
// hardware (IO's)
|
||||||
bool powerRdBk; // prn pwr is on
|
bool powerRdBk; // prn pwr is on
|
||||||
bool rsSwOk; // serial switch (printer or modem) is set to printer
|
bool rsSwOk; // serial switch (printer or modem) is set to printer
|
||||||
@ -74,8 +60,7 @@ struct Tprn_hw_state
|
|||||||
bool badResponse;
|
bool badResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tprn_currentSettings
|
struct Tprn_currentSettings {
|
||||||
{
|
|
||||||
uint8_t currFont;
|
uint8_t currFont;
|
||||||
uint8_t currSize;
|
uint8_t currSize;
|
||||||
uint8_t currHeigth;
|
uint8_t currHeigth;
|
||||||
@ -88,196 +73,166 @@ struct Tprn_hw_state
|
|||||||
bool nowAligned;
|
bool nowAligned;
|
||||||
};
|
};
|
||||||
|
|
||||||
// obsolete
|
struct T_dynDat {
|
||||||
struct T_dynDat
|
|
||||||
{
|
|
||||||
uint8_t licensePlate[8];
|
uint8_t licensePlate[8];
|
||||||
uint8_t vendingPrice[8];
|
uint8_t vendingPrice[8];
|
||||||
uint8_t parkingEnd[8];
|
uint8_t parkingEndTime[8];
|
||||||
uint8_t currentTime[8];
|
uint8_t parkingEndDate[8];
|
||||||
uint8_t currentDate[8];
|
uint8_t currentDate[8];
|
||||||
uint8_t dynDat5[8];
|
uint8_t dynDat5[8];
|
||||||
uint8_t dynDat6[8];
|
uint8_t dynDat6[8];
|
||||||
uint8_t dynDat7[8];
|
uint8_t dynDat7[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct T_vaultRecord {
|
||||||
struct T_vaultRecord
|
|
||||||
{
|
|
||||||
|
|
||||||
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
|
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
|
||||||
char startbuffer[4]; // Psa> // never move or change this 1st entry
|
char startbuffer[4]; // Psa> // never move or change this 1st entry
|
||||||
uint16_t AccountingNumber;
|
uint16_t AccountingNumber;
|
||||||
uint16_t CUNU;
|
uint16_t CUNU;
|
||||||
uint16_t MANU;
|
uint16_t MANU;
|
||||||
uint16_t resint1;
|
uint16_t resint1;
|
||||||
//uint16_t resint2;
|
//uint16_t resint2;
|
||||||
|
|
||||||
char label1buffer[4]; // tim>
|
char label1buffer[4]; // tim>
|
||||||
uint8_t year;
|
uint8_t year;
|
||||||
uint8_t month;
|
uint8_t month;
|
||||||
uint8_t dom;
|
uint8_t dom;
|
||||||
uint8_t hour;
|
uint8_t hour;
|
||||||
uint8_t min;
|
uint8_t min;
|
||||||
uint8_t sec;
|
uint8_t sec;
|
||||||
uint8_t DoW;
|
uint8_t DoW;
|
||||||
uint8_t reschar3;
|
uint8_t reschar3;
|
||||||
|
|
||||||
char label2buffer[4]; // abs>
|
char label2buffer[4]; // abs>
|
||||||
uint32_t AbsIncome1;
|
uint32_t AbsIncome1;
|
||||||
uint32_t AbsReserve;
|
uint32_t AbsReserve;
|
||||||
uint32_t AbsNrOfCuts;
|
uint32_t AbsNrOfCuts;
|
||||||
|
|
||||||
//16
|
//16
|
||||||
char label3buffer[4]; // mw >
|
char label3buffer[4]; // mw >
|
||||||
|
|
||||||
// Verkauf, Tür zu:
|
// Verkauf, Tür zu:
|
||||||
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
//88
|
//88
|
||||||
|
// Service, Tür offen:
|
||||||
// Service, Tür offen:
|
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint16_t resint3;
|
||||||
uint16_t resint3;
|
uint16_t resint4;
|
||||||
uint16_t resint4;
|
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
||||||
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
uint16_t resint5;
|
||||||
uint16_t resint5;
|
uint16_t resint6;
|
||||||
uint16_t resint6;
|
|
||||||
// 56
|
// 56
|
||||||
|
char label4buffer[4]; // box>
|
||||||
char label4buffer[4]; // box>
|
uint16_t coinsInVault[16];
|
||||||
uint16_t coinsInVault[16];
|
uint16_t billsInStacker[8];
|
||||||
uint16_t billsInStacker[8];
|
|
||||||
// 48
|
// 48
|
||||||
|
char label5buffer[4]; // val>
|
||||||
char label5buffer[4]; // val>
|
// actually constant unless exchange rate is changed
|
||||||
// actually constant unless exchange rate is changed
|
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
|
||||||
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
|
uint16_t billDenom[8];
|
||||||
uint16_t billDenom[8];
|
uint16_t tubeDenom[6];
|
||||||
uint16_t tubeDenom[6];
|
uint16_t exchangeRate;
|
||||||
uint16_t exchangeRate;
|
uint16_t resint9;
|
||||||
uint16_t resint9;
|
|
||||||
|
|
||||||
// 64
|
// 64
|
||||||
|
char endofblock[4]; // end>
|
||||||
char endofblock[4]; // end>
|
|
||||||
|
|
||||||
// 316 byte Block im Speicher
|
// 316 byte Block im Speicher
|
||||||
|
};
|
||||||
|
|
||||||
|
struct T_moduleCondition {
|
||||||
|
// store conditon of all system components, hold in RAM
|
||||||
|
// 0 means unknown, not yet tested/used
|
||||||
|
// 1 means OK
|
||||||
|
// 50..99 = HINT / Notification
|
||||||
|
// 100..150 = WARNING
|
||||||
|
// 200..250 = ERROR
|
||||||
|
|
||||||
|
uint8_t ram;
|
||||||
|
uint8_t intEe;
|
||||||
|
uint8_t extEe;
|
||||||
|
|
||||||
|
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
||||||
|
uint8_t boardHw;
|
||||||
|
uint8_t printer;
|
||||||
|
uint8_t modem;
|
||||||
|
|
||||||
|
uint8_t signal; // 1...99
|
||||||
|
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
||||||
|
uint8_t mdbBus;
|
||||||
|
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
||||||
|
|
||||||
|
uint8_t coinEscrow;
|
||||||
|
uint8_t mifareReader;
|
||||||
|
uint8_t creditTerm;
|
||||||
|
uint8_t coinReject;
|
||||||
|
|
||||||
|
uint8_t coinSafe;
|
||||||
|
uint8_t billSafe;
|
||||||
|
uint8_t voltage; // 1:11..14V
|
||||||
|
uint8_t temper;
|
||||||
|
|
||||||
|
uint8_t poweronTest;
|
||||||
|
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
|
||||||
|
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
||||||
|
uint8_t changer; // can only be tested by usage
|
||||||
|
|
||||||
|
uint8_t coinBlocker; // can only be tested by usage
|
||||||
|
uint8_t billReader; // can only be tested by usage
|
||||||
|
uint8_t ResetReason;
|
||||||
|
uint8_t allModulesChecked;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_moduleCondition
|
struct T_dynamicCondition {
|
||||||
{
|
char allDoorsDebounced; // 99: undefined, 0=all closed, bit1=upper door open 2=midlle door open 3=lower door open
|
||||||
// store conditon of all system components, hold in RAM
|
char openedAuthorized;
|
||||||
// 0 means unknown, not yet tested/used
|
uint8_t CBinDebounced;
|
||||||
// 1 means OK
|
char upperDoor; // 99: undefined 0:closed 1:open
|
||||||
// 50..99 = HINT / Notification
|
char middleDoor; // 99: undefined 0:closed 1:open
|
||||||
// 100..150 = WARNING
|
char lowerDoor; // 99: undefined 0:closed 1:open
|
||||||
// 200..250 = ERROR
|
char reserve; // not used, always 0
|
||||||
|
char billBox;
|
||||||
uint8_t ram;
|
char modeAbrech;
|
||||||
uint8_t intEe;
|
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
||||||
uint8_t extEe;
|
char nowCardTest;
|
||||||
|
char nowPayment;
|
||||||
uint8_t rtc; // 1: time/date OK 100: time not plausible 200: hardware error
|
char lastMifCardType;
|
||||||
uint8_t boardHw;
|
uint8_t lastSDoorState;
|
||||||
uint8_t printer;
|
uint8_t lastVDoorState;
|
||||||
uint8_t modem;
|
uint8_t lastCBstate; // 99: undefined 0:not there 1:insered
|
||||||
|
char paymentInProgress;
|
||||||
uint8_t signal; // 1...99
|
char res1;
|
||||||
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
|
uint16_t U_Batt;
|
||||||
uint8_t mdbBus;
|
uint16_t Temperatur;
|
||||||
uint8_t coinChecker; // EMP, OMP or mei-cashflow
|
uint16_t nrCoinsInBox;
|
||||||
|
uint32_t amountInBox;
|
||||||
uint8_t coinEscrow;
|
uint32_t totalTransVolume;
|
||||||
uint8_t mifareReader;
|
uint32_t totalNrOfVends;
|
||||||
uint8_t creditTerm;
|
char jsonValid_config;
|
||||||
uint8_t coinReject;
|
char jsonValid_device;
|
||||||
|
char jsonValid_cash;
|
||||||
uint8_t coinSafe;
|
char jsonValid_print;
|
||||||
uint8_t billSafe;
|
char jsonValid_serial;
|
||||||
uint8_t voltage; // 1:11..14V
|
char jsonValid_time;
|
||||||
uint8_t temper;
|
char lastFileType;
|
||||||
|
|
||||||
uint8_t poweronTest;
|
|
||||||
uint8_t doorState; // 1: alles zu 200: t?r offen + bit1(S) +bit2(CB) + bit3(CB)
|
|
||||||
uint8_t doorWasOpened; // 1: all doors are closed 200: any door was just opened
|
|
||||||
uint8_t changer; // can only be tested by usage
|
|
||||||
|
|
||||||
uint8_t coinBlocker; // can only be tested by usage
|
|
||||||
uint8_t billReader; // can only be tested by usage
|
|
||||||
uint8_t ResetReason;
|
|
||||||
uint8_t allModulesChecked;
|
|
||||||
|
|
||||||
uint8_t alarmState;
|
|
||||||
uint8_t res11;
|
|
||||||
uint8_t res12;
|
|
||||||
uint8_t res13;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct T_dynamicCondition
|
|
||||||
{
|
|
||||||
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 reserve;
|
|
||||||
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;
|
|
||||||
// 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
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
char jsonValid_serial;
|
|
||||||
char jsonValid_time;
|
|
||||||
char lastFileType;
|
|
||||||
// 44
|
// 44
|
||||||
uint8_t MifCardHolder[8];
|
uint8_t MifCardHolder[8];
|
||||||
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
|
||||||
uint8_t lastPrinterStatus;
|
uint8_t lastPrinterStatus;
|
||||||
// 0: printer OK
|
// 0: printer OK
|
||||||
// bit0: near paper end bit1: no paper
|
// bit0: near paper end bit1: no paper
|
||||||
// bit2: temperature error bit3: error head open
|
// bit2: temperature error bit3: error head open
|
||||||
// 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;
|
uint8_t startupTestIsRunning;
|
||||||
|
//54
|
||||||
//54
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct T_extTime
|
struct T_extTime {
|
||||||
{
|
|
||||||
uint8_t Hours;
|
uint8_t Hours;
|
||||||
uint8_t Min;
|
uint8_t Min;
|
||||||
uint8_t Sec;
|
uint8_t Sec;
|
||||||
@ -303,10 +258,8 @@ struct T_extTime
|
|||||||
uint8_t res4;
|
uint8_t res4;
|
||||||
uint16_t res5;
|
uint16_t res5;
|
||||||
uint32_t MinutesOfMillenium;
|
uint32_t MinutesOfMillenium;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef uint8_t UCHAR;
|
typedef uint8_t UCHAR;
|
||||||
typedef uint16_t UINT;
|
typedef uint16_t UINT;
|
||||||
|
|
||||||
@ -315,7 +268,7 @@ struct T_devices
|
|||||||
// set by master, used(1) or notused (0) or type 2....20
|
// set by master, used(1) or notused (0) or type 2....20
|
||||||
|
|
||||||
UCHAR kindOfPrinter; // 0:off 1:Gebe
|
UCHAR kindOfPrinter; // 0:off 1:Gebe
|
||||||
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
||||||
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
||||||
UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
|
UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
|
||||||
|
|
||||||
@ -340,14 +293,14 @@ struct T_devices
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class hwinf {
|
||||||
class hwinf
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||||
|
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER};
|
||||||
|
|
||||||
virtual ~hwinf() {}
|
virtual ~hwinf() {}
|
||||||
|
|
||||||
|
virtual QStringList dc_getStatus() const = 0;
|
||||||
|
|
||||||
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||||
// Use serial interface and protocol stack in Cashagent-Library
|
// Use serial interface and protocol stack in Cashagent-Library
|
||||||
@ -355,20 +308,20 @@ public:
|
|||||||
// Sending input requests to DC2 (single or auto-batch)
|
// Sending input requests to DC2 (single or auto-batch)
|
||||||
// Getting input data as receiver payload
|
// Getting input data as receiver payload
|
||||||
// Furthermore the Cashagent-Library answers with status strings about sending and reading result
|
// Furthermore the Cashagent-Library answers with status strings about sending and reading result
|
||||||
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||||
|
|
||||||
virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const =0;
|
virtual bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const = 0;
|
||||||
// Command: open serial interface
|
// Command: open serial interface
|
||||||
// BaudNr: 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
|
// BaudNr: 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
|
||||||
// BaudStr: for exapmle "19200"
|
// BaudStr: for exapmle "19200"
|
||||||
// ComName: for example "COM48"
|
// ComName: for example "COM48"
|
||||||
// connect: 0, 1
|
// connect: 0, 1
|
||||||
|
|
||||||
virtual void dc_closeSerial(void) const =0;
|
virtual bool dc_closeSerial(void) const = 0;
|
||||||
// Command: close serial interface in order to save power while power down
|
// Command: close serial interface in order to save power while power down
|
||||||
// or if another port must be used
|
// or if another port must be used
|
||||||
|
|
||||||
virtual bool dc_isPortOpen(void) const =0;
|
virtual bool dc_isPortOpen(void) const =0;
|
||||||
// returns true if port open (don't send unless open. Sending to closed port will crash program)
|
// returns true if port open (don't send unless open. Sending to closed port will crash program)
|
||||||
|
|
||||||
|
|
||||||
@ -379,8 +332,22 @@ public:
|
|||||||
|
|
||||||
virtual bool test_serialIsOn(void) const =0;
|
virtual bool test_serialIsOn(void) const =0;
|
||||||
|
|
||||||
|
virtual bool dc_updateDC(QString binFileName,
|
||||||
|
QString baudrate,
|
||||||
|
QString comPort) const = 0;
|
||||||
|
// download binary file down into device controller
|
||||||
|
|
||||||
|
virtual bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QVector<QString> fnames,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const = 0;
|
||||||
|
|
||||||
|
virtual bool dc_printTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const = 0;
|
||||||
|
|
||||||
virtual void dc_autoRequest(bool on) const =0;
|
virtual void dc_autoRequest(bool on) const =0;
|
||||||
// on = true: select that all READ-Requests are sent automatically
|
// on = true: select that all READ-Requests are sent automatically
|
||||||
// on = false: select that all READ-Requests are sent manually one by one
|
// on = false: select that all READ-Requests are sent manually one by one
|
||||||
@ -396,7 +363,7 @@ public:
|
|||||||
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
||||||
// retval = nr of bytes received. If host buffer too small then
|
// retval = nr of bytes received. If host buffer too small then
|
||||||
// only plBufSiz bytes are copied to "payLoad"
|
// only plBufSiz bytes are copied to "payLoad"
|
||||||
// plBufSizz=size of host buffer
|
// plBufSizz=size of host buffer
|
||||||
|
|
||||||
virtual void dc_requTestResponse() const =0;
|
virtual void dc_requTestResponse() const =0;
|
||||||
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
||||||
@ -517,10 +484,10 @@ public:
|
|||||||
|
|
||||||
// Analog values:
|
// Analog values:
|
||||||
virtual uint32_t dc_getTemperature(void) const =0;
|
virtual uint32_t dc_getTemperature(void) const =0;
|
||||||
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
||||||
|
|
||||||
virtual QString dc_getTemperaturStr(void) const =0;
|
virtual QString dc_getTemperaturStr(void) const =0;
|
||||||
// as string like "-12,5°C"
|
// as string like "-12,5°C"
|
||||||
|
|
||||||
virtual uint32_t dc_getVoltage(void) const =0;
|
virtual uint32_t dc_getVoltage(void) const =0;
|
||||||
// as value in mV, 0...65,535V
|
// as value in mV, 0...65,535V
|
||||||
@ -675,7 +642,7 @@ public:
|
|||||||
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
||||||
// enable hardware in device controller:
|
// enable hardware in device controller:
|
||||||
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
||||||
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
||||||
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
||||||
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
||||||
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
||||||
@ -781,7 +748,7 @@ public:
|
|||||||
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
||||||
// byte2: density 0....(25)....50
|
// byte2: density 0....(25)....50
|
||||||
// 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
|
||||||
|
|
||||||
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
||||||
@ -839,36 +806,29 @@ public:
|
|||||||
// up to 8 dynamic values can be defined in the template ("print val3 here") and will be sent with printing command
|
// up to 8 dynamic values can be defined in the template ("print val3 here") and will be sent with printing command
|
||||||
// example: print current time at this point (the time of printing not the storage time!!)
|
// example: print current time at this point (the time of printing not the storage time!!)
|
||||||
|
|
||||||
// obsolete
|
virtual void pri_startTicketDesign(void) const =0;
|
||||||
//virtual void pri_startTicketDesign(void) const =0;
|
|
||||||
// start for every new printer document, reseting collecting buffer
|
// start for every new printer document, reseting collecting buffer
|
||||||
|
|
||||||
// all further functions write/append text, numbers and command to the ticket-buffer, up to 1278 bytes allowed
|
// all further functions write/append text, numbers and command to the ticket-buffer, up to 1278 bytes allowed
|
||||||
// return val of the appending functions: true=ok false=too long, buffer full
|
// return val of the appending functions: true=ok false=too long, buffer full
|
||||||
|
|
||||||
// obsolete
|
virtual int pri_TD_getCurrentSize(void) const =0;
|
||||||
//virtual int pri_TD_getCurrentSize(void) const =0;
|
|
||||||
// retval: 0...1278
|
// retval: 0...1278
|
||||||
|
|
||||||
// obsolete
|
virtual bool pri_TD_addText(QByteArray text) const =0;
|
||||||
//virtual bool pri_TD_addText(QByteArray text) const =0;
|
|
||||||
// example: pri_TD_addText("Hello") const =0;
|
// example: pri_TD_addText("Hello") const =0;
|
||||||
// example: pri_TD_addText(tempStr) const =0;
|
// example: pri_TD_addText(tempStr) const =0;
|
||||||
// retval: true=ok false=too long, buffer full
|
// retval: true=ok false=too long, buffer full
|
||||||
|
|
||||||
// obsolete
|
virtual bool pri_TD_addValue(int val) const =0;
|
||||||
//virtual bool pri_TD_addValue(int val) const =0;
|
|
||||||
// +/- 0...2^(31)
|
// +/- 0...2^(31)
|
||||||
|
|
||||||
// obsolete
|
virtual bool pri_TD_addNewLine(void) const =0;
|
||||||
//virtual bool pri_TD_addNewLine(void) const =0;
|
|
||||||
|
|
||||||
// obsolete
|
virtual bool pri_TD_addSign(char sign) const =0;
|
||||||
//virtual bool pri_TD_addSign(char sign) const =0;
|
|
||||||
// example: '.' ' ' 0x20 'W' '$'
|
// example: '.' ' ' 0x20 'W' '$'
|
||||||
|
|
||||||
// obsolete
|
virtual bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const =0;
|
||||||
//virtual bool pri_TD_addCommand(char group, char attribute, char p1, char p2, char p3, char p4, char p5) const =0;
|
|
||||||
// always add 8 byte to the ticket layout: ESC & group & attribute & parameter1...5
|
// always add 8 byte to the ticket layout: ESC & group & attribute & parameter1...5
|
||||||
/* complete list of possible commands:
|
/* complete list of possible commands:
|
||||||
group 50 : paper
|
group 50 : paper
|
||||||
@ -909,13 +869,11 @@ public:
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// obsolete
|
virtual char prn_clearDocument(uint8_t documentNumber) const =0;
|
||||||
//virtual char prn_clearDocument(uint8_t documentNumber) const =0;
|
|
||||||
// clear memory buffer for ONE document
|
// clear memory buffer for ONE document
|
||||||
// function takes a second! don't send right before "store doc"
|
// function takes a second! don't send right before "store doc"
|
||||||
|
|
||||||
// obsolete
|
virtual bool prn_store_Document(uint8_t documentNumber ) const =0;
|
||||||
//virtual bool prn_store_Document(uint8_t documentNumber ) const =0;
|
|
||||||
// send the predefined Layout (generated with above TD functions) to DeviceController to save
|
// send the predefined Layout (generated with above TD functions) to DeviceController to save
|
||||||
// documentNumber=0...15
|
// documentNumber=0...15
|
||||||
// maximal 1280 bytes each
|
// maximal 1280 bytes each
|
||||||
@ -926,8 +884,7 @@ public:
|
|||||||
// the place in the ticket layout is predefined (already in DC memory)
|
// the place in the ticket layout is predefined (already in DC memory)
|
||||||
// the dynamics are first calculated at printing time
|
// the dynamics are first calculated at printing time
|
||||||
|
|
||||||
// obsolete
|
virtual bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const =0;
|
||||||
//virtual bool prn_printDocument(uint8_t documentNumber, struct T_dynDat *dynTicketData) const =0;
|
|
||||||
|
|
||||||
|
|
||||||
// 36
|
// 36
|
||||||
@ -1319,10 +1276,10 @@ public:
|
|||||||
|
|
||||||
virtual void bl_rebootDC(void) const =0;
|
virtual void bl_rebootDC(void) const =0;
|
||||||
|
|
||||||
virtual void bl_startBL(void) const =0;
|
virtual void bl_startBL(void) const = 0;
|
||||||
// send command within 4s after DC power-on, otherwise bl is left
|
// send command within 4s after DC power-on, otherwise bl is left
|
||||||
|
|
||||||
virtual void bl_checkBL(void) const =0;
|
virtual bool bl_checkBL(void) const = 0;
|
||||||
// send command to verify if bl is up
|
// send command to verify if bl is up
|
||||||
|
|
||||||
virtual bool bl_isUp(void) const =0;
|
virtual bool bl_isUp(void) const =0;
|
||||||
@ -1359,7 +1316,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Komplett-schreib Funktion, noch nicht getestet
|
// Komplett-schreib Funktion, noch nicht getestet
|
||||||
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
||||||
//virtual void bl_startSending(void) const=0;
|
//virtual void bl_startSending(void) const=0;
|
||||||
// call once after BL is working and file is loaded
|
// call once after BL is working and file is loaded
|
||||||
//virtual void bl_sendFile(void) const=0;
|
//virtual void bl_sendFile(void) const=0;
|
||||||
@ -1385,7 +1342,7 @@ public:
|
|||||||
buf[4]=GlobTime.Month;
|
buf[4]=GlobTime.Month;
|
||||||
buf[5]=GlobTime.Day;
|
buf[5]=GlobTime.Day;
|
||||||
buf[6]=GlobTime.DOW;
|
buf[6]=GlobTime.DOW;
|
||||||
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
||||||
uitmp=GlobTime.MinOfDay;
|
uitmp=GlobTime.MinOfDay;
|
||||||
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
@ -1496,15 +1453,6 @@ public:
|
|||||||
// 17.4.23TS: extended to 32bit
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
virtual uint8_t cash_paymentProcessing(void) const=0;
|
virtual uint8_t cash_paymentProcessing(void) const=0;
|
||||||
// run this function periodically while coin payment process to generate necessary signals
|
|
||||||
// return value:
|
|
||||||
// 0: stopped 1: starting up 2: coin collection
|
|
||||||
// 3: finished by User (Push button) 4: finished, Max-Value collected
|
|
||||||
// 5: finished by escrow
|
|
||||||
// 10,11: error cannot start
|
|
||||||
// 12: timeout while payment, coins returned
|
|
||||||
// 13: stopped by unexpected error
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint32_t getInsertedAmount(void) const=0;
|
virtual uint32_t getInsertedAmount(void) const=0;
|
||||||
|
|
||||||
@ -1536,14 +1484,14 @@ public:
|
|||||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||||
|
|
||||||
virtual uint8_t sys_getWakeReason(void) const=0;
|
virtual uint8_t sys_getWakeReason(void) const=0;
|
||||||
// Master was woken by following reason:
|
// Master was woken by following reason:
|
||||||
// 1: MDB Event
|
// 1: MDB Event
|
||||||
// 2: Coin Event
|
// 2: Coin Event
|
||||||
// ( 3: Master Event) - will not set the wake line
|
// ( 3: Master Event) - will not set the wake line
|
||||||
// ( 4: 32s pulse) - will not set the wake line
|
// ( 4: 32s pulse) - will not set the wake line
|
||||||
// 5: Door Event
|
// 5: Door Event
|
||||||
// ( 6: Diag Event) - will not set the wake line
|
// ( 6: Diag Event) - will not set the wake line
|
||||||
// 7: 30min-Pulse for HB
|
// 7: 30min-Pulse for HB
|
||||||
|
|
||||||
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
/*
|
/*
|
||||||
@ -1582,8 +1530,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
|
virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
|
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -1656,10 +1602,8 @@ public:
|
|||||||
|
|
||||||
virtual uint16_t cash_getNrCoinsInVault(void) const=0;
|
virtual uint16_t cash_getNrCoinsInVault(void) const=0;
|
||||||
|
|
||||||
|
|
||||||
virtual uint8_t prn_getPrintResult() const=0;
|
virtual uint8_t prn_getPrintResult() const=0;
|
||||||
// return: 0: unknown
|
|
||||||
// 1: OK - last template was printed succesful
|
|
||||||
// 2: error - last template was not printed
|
|
||||||
|
|
||||||
// in case of print-error get detailed error:
|
// in case of print-error get detailed error:
|
||||||
virtual uint8_t prn_getCurrentPrinterState() const=0;
|
virtual uint8_t prn_getCurrentPrinterState() const=0;
|
||||||
@ -1670,32 +1614,62 @@ public:
|
|||||||
// bit6: no response bit7: serial rec. error
|
// bit6: no response bit7: serial rec. error
|
||||||
// bit5: printer not ready
|
// bit5: printer not ready
|
||||||
|
|
||||||
|
|
||||||
virtual void sys_sendDeviceParameter(struct T_devices *deviceSettings) const=0;
|
virtual void sys_sendDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||||
|
|
||||||
virtual void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const=0;
|
virtual void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||||
|
|
||||||
virtual bool sys_areDCdataValid(void) const=0;
|
virtual bool sys_areDCdataValid(void) const=0;
|
||||||
|
|
||||||
virtual bool sys_sendingTest(void) const =0;
|
/* ---------------------------------------------------------------------------------------------
|
||||||
|
// ------------ supervise all hardware components
|
||||||
|
// ------------ assess the machine state
|
||||||
|
|
||||||
virtual void prn_requestCurrentDynData(void) const =0;
|
1. check if DC startup test is through, retrigger if not
|
||||||
|
2. get results and find errors
|
||||||
|
3. in case of error check if component is used (e.g. billreader is seldom used)
|
||||||
|
4: check doors
|
||||||
|
5. return value: 0: no response from DC
|
||||||
|
1: no Test results and Test not running. need retrigger!
|
||||||
|
2: state not clear by now, test ongoing, wait
|
||||||
|
3: Service or battery door is open, goto INTRUSION MODE
|
||||||
|
from here: after valid ID-card goto SERVICE MODE
|
||||||
|
4: vault door is open, goto INTRUSION MODE
|
||||||
|
from here: after valid ID-card and vault door closed goto TEST MODE
|
||||||
|
in TEST MODE: complete system check decides if vending mode allowed
|
||||||
|
5: All doors are closed but errors found,
|
||||||
|
goto OOO MODE (out-of-order)
|
||||||
|
from here: run system test until problem is fixed
|
||||||
|
6: All doors are closed, no error, maybe warnings,
|
||||||
|
goto VENDING MODE (normal operation)
|
||||||
|
(priority sinks from 0 to 6)
|
||||||
|
|
||||||
virtual bool prn_getCurrentDynamicPrnValuesFromDC(uint8_t *dynPrnVal ) const =0;
|
--------------------------------------------------------------------------------------------- */
|
||||||
// which was sent with: bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
|
|
||||||
|
|
||||||
virtual bool prn_dynDataAreEqual(uint8_t *buf) const =0;
|
virtual uint8_t sys_componentAssessment(void) const=0;
|
||||||
|
// this function decides if vending mode is possible, independant from door
|
||||||
|
// return >0 in case of error
|
||||||
|
// is inncluded in sys_superviseSystem
|
||||||
|
|
||||||
virtual bool prn_printKombiticket(uint8_t nrOfKombi) const=0;
|
virtual uint8_t sys_superviseSystem(void) const=0;
|
||||||
// print four of the templates loaded by Json prior
|
// this function proofs if vending is possible depending of doors state
|
||||||
// nr = 1..8
|
|
||||||
|
virtual uint8_t sys_getSystemErrors(void) const=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void lock_triggerUpperSolenoid(void) const =0;
|
// retrigger System-Check with:
|
||||||
|
// bool hwapi::sys_runCompleteTest(void) const
|
||||||
|
|
||||||
virtual void lock_triggerLowerSolenoid(void) const =0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||||
@ -1733,19 +1707,12 @@ signals:
|
|||||||
// 14.04.2023: V3.4 new features extended: sys_getDynMachineConditions, sys_getDeviceConditions and
|
// 14.04.2023: V3.4 new features extended: sys_getDynMachineConditions, sys_getDeviceConditions and
|
||||||
// rtc_getExtendedTime return struct in addition. New function to select and get VaultRecord
|
// rtc_getExtendedTime return struct in addition. New function to select and get VaultRecord
|
||||||
//
|
//
|
||||||
// 19.04.2023: V3.5 new function: sys_getWakeReason();
|
|
||||||
// 17.05.2023: V3.6 new function: cash_isCollectionActive(), cash_isPayProcessActive()
|
|
||||||
// new signals: hwapi_coinCollectionJustStopped, hwapi_coinCollectionJustStarted
|
|
||||||
// getAllInsertedCoins() fixed, also in datif and storeINdata
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#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"
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
|
||||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.5"
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.5"
|
||||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.6"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,6 +93,9 @@ private slots:
|
|||||||
void analyseRecData(void);
|
void analyseRecData(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
T_com *getSerialPort() { return mySerialPort; }
|
||||||
|
T_com const *getSerialPort() const { return mySerialPort; }
|
||||||
|
|
||||||
T_prot();
|
T_prot();
|
||||||
bool isPortOpen(void);
|
bool isPortOpen(void);
|
||||||
bool isSerialFree(void);
|
bool isSerialFree(void);
|
||||||
|
@ -211,15 +211,8 @@ uint8_t gpi_getUserOfSendingTextBuffer(uint8_t *para1, uint8_t *para2, uint8_t *
|
|||||||
// user=1: Text-Print is using this buffer
|
// user=1: Text-Print is using this buffer
|
||||||
// 2: QR-code-Printer is using this buffer
|
// 2: QR-code-Printer is using this buffer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define FDCMD_STACKDEPTH 16
|
#define FDCMD_STACKDEPTH 16
|
||||||
void sendFDcmd_clrStack(void);
|
void sendFDcmd_clrStack(void);
|
||||||
|
|
||||||
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
|
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
|
||||||
// write Command to memory, wait for transport
|
// write Command to memory, wait for transport
|
||||||
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
|
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
|
||||||
@ -227,35 +220,31 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
|
|||||||
uint8_t check4FDshortCmd(void);
|
uint8_t check4FDshortCmd(void);
|
||||||
// returns number of waiting command, maxFDCMD_STACKDEPTH
|
// returns number of waiting command, maxFDCMD_STACKDEPTH
|
||||||
|
|
||||||
uint8_t checkNextFDcmd(void);
|
|
||||||
// return 0: no command waiting
|
|
||||||
// 1: short cmd
|
|
||||||
// 2: long cmd
|
|
||||||
|
|
||||||
uint8_t check4freeFDshortCmd(void);
|
uint8_t check4freeFDshortCmd(void);
|
||||||
// returns number of free places in short-command stack
|
// returns number of free places in short-command stack
|
||||||
|
|
||||||
//#define FDLONG_STACKDEPTH 16
|
#define FDLONG_STACKDEPTH 16
|
||||||
//void longFDcmd_clrStack(void);
|
void longFDcmd_clrStack(void);
|
||||||
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
|
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
|
||||||
// write Command to memory, wait for transport
|
// write Command to memory, wait for transport
|
||||||
// data buffer size always 64! data[64], padded with 0
|
// data buffer size always 64! data[64], padded with 0
|
||||||
//bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
|
|
||||||
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
|
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
|
||||||
|
|
||||||
//uint8_t check4FDlongCmd(void);
|
uint8_t check4FDlongCmd(void);
|
||||||
// returns number of waiting command
|
// returns number of waiting command
|
||||||
|
|
||||||
//uint8_t check4freeFDlongCmd(void);
|
uint8_t check4freeFDlongCmd(void);
|
||||||
// returns number of free places in long-command stack
|
// returns number of free places in long-command stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf);
|
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf);
|
||||||
// HWapi writes data to be stored
|
// HWapi writes data to be stored
|
||||||
|
|
||||||
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,12 +7,6 @@
|
|||||||
#include <QSharedMemory>
|
#include <QSharedMemory>
|
||||||
|
|
||||||
struct SharedMemBuffer {
|
struct SharedMemBuffer {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct rs {
|
struct rs {
|
||||||
char comportName[16]; // z.B. "COM48"
|
char comportName[16]; // z.B. "COM48"
|
||||||
char baudStr[16]; // z.B. "19200"
|
char baudStr[16]; // z.B. "19200"
|
||||||
@ -204,7 +198,6 @@ struct SharedMemBuffer {
|
|||||||
uint8_t mif_cardType;
|
uint8_t mif_cardType;
|
||||||
uint8_t mif_cardHolder[8];
|
uint8_t mif_cardHolder[8];
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define MEMDEPTH_GOTCOINS (16)
|
#define MEMDEPTH_GOTCOINS (16)
|
||||||
struct T_coin {
|
struct T_coin {
|
||||||
uint8_t valid;
|
uint8_t valid;
|
||||||
@ -214,7 +207,6 @@ struct SharedMemBuffer {
|
|||||||
uint16_t value;
|
uint16_t value;
|
||||||
} gotCoin[MEMDEPTH_GOTCOINS];
|
} gotCoin[MEMDEPTH_GOTCOINS];
|
||||||
uint8_t ctr_gotCoin;
|
uint8_t ctr_gotCoin;
|
||||||
#endif
|
|
||||||
|
|
||||||
struct store {
|
struct store {
|
||||||
uint32_t insertedAmount;
|
uint32_t insertedAmount;
|
||||||
@ -233,6 +225,9 @@ struct SharedMemBuffer {
|
|||||||
uint8_t vaultrecord[360];
|
uint8_t vaultrecord[360];
|
||||||
uint32_t amount;
|
uint32_t amount;
|
||||||
uint16_t nrOfCoins;
|
uint16_t nrOfCoins;
|
||||||
|
bool dcDataValid;
|
||||||
|
uint8_t wakeReason;
|
||||||
|
char curPayNewCoin;
|
||||||
} store;
|
} store;
|
||||||
|
|
||||||
struct T_globTime {
|
struct T_globTime {
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
#define STOREINDATA_H
|
#define STOREINDATA_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "tslib.h"
|
//#include "tslib.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
#define MAXNROF_AO 3
|
#define MAXNROF_AO 3
|
||||||
#define MAXNROF_GENSTR 16
|
//#define MAXNROF_GENSTR 16
|
||||||
#define MAXNROF_CONTR_PORTS 11
|
#define MAXNROF_CONTR_PORTS 11
|
||||||
#define MAXNROF_DIports 2
|
#define MAXNROF_DIports 2
|
||||||
#define MAXNROF_DOports 2
|
#define MAXNROF_DOports 2
|
||||||
@ -32,9 +32,6 @@ bool indat_isMifareOn();
|
|||||||
void indat_storeMDBisOn(bool isOn);
|
void indat_storeMDBisOn(bool isOn);
|
||||||
bool indat_isMdbOn();
|
bool indat_isMdbOn();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
||||||
uint8_t parity, uint8_t NrStopBits);
|
uint8_t parity, uint8_t NrStopBits);
|
||||||
|
|
||||||
@ -43,29 +40,16 @@ void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|||||||
|
|
||||||
QString epi_getSlaveParamSTR();
|
QString epi_getSlaveParamSTR();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeGenerals(uint8_t genNr, QString text);
|
void gpi_storeGenerals(uint8_t genNr, QString text);
|
||||||
// 0=HW 1=SW 2=State
|
// 0=HW 1=SW 2=State
|
||||||
|
|
||||||
QString epi_loadGenerals(uint8_t genNr);
|
QString epi_loadGenerals(uint8_t genNr);
|
||||||
// genNr=0=HW 1=SW 2=State
|
// genNr=0=HW 1=SW 2=State
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeUID(uint8_t const *buf8byteUid);
|
void gpi_storeUID(uint8_t const *buf8byteUid);
|
||||||
//void gpi_storeUID(uint8_t *buf8byteUid);
|
|
||||||
// buffer size: 8 byte
|
// buffer size: 8 byte
|
||||||
|
|
||||||
void epi_getUIDdec(uint8_t *buf8byteUid);
|
void epi_getUIDdec(uint8_t *buf8byteUid);
|
||||||
// buffer size: 8 byte
|
// buffer size: 8 byte
|
||||||
|
|
||||||
QString epi_getUIDstr();
|
QString epi_getUIDstr();
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +79,7 @@ void epi_getSpecialYearTimeDate(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint
|
|||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#define MAXNROF_AI 4
|
// #define MAXNROF_AI 4
|
||||||
|
|
||||||
void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata
|
void gpi_storeAIs(uint8_t aiNr, uint16_t val); // rs -> Sdata
|
||||||
|
|
||||||
@ -144,185 +128,119 @@ void gpi_storeDI_optos(uint8_t indatOpto);
|
|||||||
uint8_t epi_getDI_optos(void);
|
uint8_t epi_getDI_optos(void);
|
||||||
// bit0: opto in 1 1: opto in 2
|
// bit0: opto in 1 1: opto in 2
|
||||||
|
|
||||||
void gpi_storeDI_auxIn(uint8_t indatAuxIn);
|
uint8_t gpi_storeDI_auxIn(uint8_t indatAuxIn); // Aux0...5
|
||||||
// Aux0...5
|
uint8_t epi_getDI_auxIn(void); // bit0: auxin 1 ... 5: auxin 6
|
||||||
|
|
||||||
uint8_t epi_getDI_auxIn(void);
|
|
||||||
// bit0: auxin 1 ... 5: auxin 6
|
|
||||||
|
|
||||||
void gpi_storeDI_ptuWake(uint8_t indat);
|
|
||||||
|
|
||||||
|
bool gpi_storeDI_ptuWake(bool w);
|
||||||
bool epi_getDI_ptuWake(void);
|
bool epi_getDI_ptuWake(void);
|
||||||
|
|
||||||
void gpi_storeDI_mbdWake(uint8_t indat);
|
bool gpi_storeDI_mbdWake(bool w);
|
||||||
|
|
||||||
bool epi_getDI_mdbWake(void);
|
bool epi_getDI_mdbWake(void);
|
||||||
|
|
||||||
void gpi_storeDI_prnReady(uint8_t indat);
|
bool gpi_storeDI_prnReady(bool ready);
|
||||||
|
|
||||||
bool epi_getDI_prnReady(void);
|
bool epi_getDI_prnReady(void);
|
||||||
|
|
||||||
void gpi_storeDI_CoinAttach(uint8_t indat);
|
bool gpi_storeDI_CoinAttach(bool attach);
|
||||||
|
|
||||||
bool epi_getDI_CoinAttach(void);
|
bool epi_getDI_CoinAttach(void);
|
||||||
|
|
||||||
void gpi_storeDI_CoinEscrow(uint8_t indat);
|
bool gpi_storeDI_CoinEscrow(bool ce);
|
||||||
|
|
||||||
bool epi_getDI_CoinEscrow(void);
|
bool epi_getDI_CoinEscrow(void);
|
||||||
|
|
||||||
void gpi_storeDI_mifareCardTapped(uint8_t indat);
|
bool gpi_storeDI_mifareCardTapped(bool tapped);
|
||||||
|
|
||||||
bool epi_getDI_mifareCardTapped(void);
|
bool epi_getDI_mifareCardTapped(void);
|
||||||
|
|
||||||
void gpi_storeDI_modemWake(uint8_t indat);
|
bool gpi_storeDI_modemWake(bool w);
|
||||||
|
|
||||||
bool epi_getDI_modemWake(void);
|
bool epi_getDI_modemWake(void);
|
||||||
|
|
||||||
|
bool gpi_storeDI_contactPowerIsOn(bool on);
|
||||||
void gpi_storeDI_contactPowerIsOn(bool di_contact_PwrOn);
|
|
||||||
|
|
||||||
bool epi_getDI_contactPwr(void);
|
bool epi_getDI_contactPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_MifarePowerIsOn(bool di_mifare_PwrOn);
|
bool gpi_storeDI_MifarePowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_mifarePwr(void);
|
bool epi_getDI_mifarePwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_readbackMdbTxD(bool di_rdbkMdbTxd);
|
bool gpi_storeDI_readbackMdbTxD(bool rdbkMdbTxd);
|
||||||
|
|
||||||
bool epi_getDI_mdbTxd(void);
|
bool epi_getDI_mdbTxd(void);
|
||||||
|
|
||||||
void gpi_storeDI_AuxPowerIsOn(bool di_Aux_PwrOn);
|
bool gpi_storeDI_AuxPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_auxPwr(void);
|
bool epi_getDI_auxPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn);
|
bool gpi_storeDI_GsmPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_gsmPwr(void);
|
bool epi_getDI_gsmPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_CreditPowerIsOn(bool di_credit_PwrOn);
|
bool gpi_storeDI_CreditPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_creditPwr(void);
|
bool epi_getDI_creditPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_PrinterPowerIsOn(bool di_printer_PwrOn);
|
bool gpi_storeDI_PrinterPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_printerPwr(void);
|
bool epi_getDI_printerPwr(void);
|
||||||
|
|
||||||
void gpi_storeDI_MdbPowerIsOn(bool di_mdb_PwrOn);
|
bool gpi_storeDI_MdbPowerIsOn(bool on);
|
||||||
|
|
||||||
bool epi_getDI_mdbPwr(void);
|
bool epi_getDI_mdbPwr(void);
|
||||||
|
|
||||||
|
bool gpi_storeDI_rejMot_home(bool reject);
|
||||||
void gpi_storeDI_rejMot_home(bool di);
|
|
||||||
|
|
||||||
bool epi_getDI_rejectMotor_homepos(void);
|
bool epi_getDI_rejectMotor_homepos(void);
|
||||||
|
|
||||||
void gpi_storeDI_paperLow(uint8_t di);
|
uint8_t gpi_storeDI_paperLow(uint8_t di);
|
||||||
|
|
||||||
uint8_t epi_getDI_npe_sensor(void);
|
uint8_t epi_getDI_npe_sensor(void);
|
||||||
// 0: Sensor sees paper 1: no paper 99: off
|
// 0: Sensor sees paper 1: no paper 99: off
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// readback digital outputs
|
// readback digital outputs
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
|
uint8_t gpi_storeDO_mdbRxTst(uint8_t do_mbdRxTst);
|
||||||
|
|
||||||
bool epi_getDO_mdbRxTestOut(void);
|
bool epi_getDO_mdbRxTestOut(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_motorOutputs(uint8_t Pwr);
|
||||||
void gpi_storeDO_motorOutputs(uint8_t Pwr);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_motorOuts(void);
|
uint8_t epi_getDO_motorOuts(void);
|
||||||
// bit0: upper lock forward bit 1 backward
|
// bit0: upper lock forward bit 1 backward
|
||||||
// bit2: lower lock forward bit 3 backward
|
// bit2: lower lock forward bit 3 backward
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_serialSwitch(uint8_t state);
|
||||||
void gpi_storeDO_serialSwitch(uint8_t state);
|
|
||||||
// serial drv on/off, Serial mux1, Serial mux2
|
// serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
|
||||||
uint8_t epi_getDO_serialSwitch(void);
|
uint8_t epi_getDO_serialSwitch(void);
|
||||||
// serial drv on/off, Serial mux1, Serial mux2
|
// serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
|
||||||
bool epi_getDO_serialDriverIsOn(void);
|
bool epi_getDO_serialDriverIsOn(void);
|
||||||
|
|
||||||
bool epi_getDO_serialMux1isSetToPrinter(void);
|
bool epi_getDO_serialMux1isSetToPrinter(void);
|
||||||
// mux1 off: serial is switched to printer
|
// mux1 off: serial is switched to printer
|
||||||
|
|
||||||
bool epi_getDO_serialMux1isSetToModem(void);
|
bool epi_getDO_serialMux1isSetToModem(void);
|
||||||
// mux1 on: serial is switched to modem
|
// mux1 on: serial is switched to modem
|
||||||
|
|
||||||
bool epi_getDO_serialMux2isSetToCredit(void);
|
bool epi_getDO_serialMux2isSetToCredit(void);
|
||||||
// mux2 off: serial is switched to credit card terminal
|
// mux2 off: serial is switched to credit card terminal
|
||||||
|
|
||||||
bool epi_getDO_serialMux2isSetToMifare(void);
|
bool epi_getDO_serialMux2isSetToMifare(void);
|
||||||
// mux2 on: serial is switched to mifare reader
|
// mux2 on: serial is switched to mifare reader
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_ledsAndFan(uint8_t ledState);
|
||||||
void gpi_storeDO_ledsAndFan(uint8_t ledState);
|
|
||||||
|
|
||||||
bool epi_getDO_led_coin(void);
|
bool epi_getDO_led_coin(void);
|
||||||
|
|
||||||
bool epi_getDO_led_front(void);
|
bool epi_getDO_led_front(void);
|
||||||
|
|
||||||
bool epi_getDO_led_ticket(void);
|
bool epi_getDO_led_ticket(void);
|
||||||
|
|
||||||
bool epi_getDO_led_pin(void);
|
bool epi_getDO_led_pin(void);
|
||||||
|
|
||||||
bool epi_getDO_led_start(void);
|
bool epi_getDO_led_start(void);
|
||||||
|
|
||||||
bool epi_getDO_led_inside(void);
|
bool epi_getDO_led_inside(void);
|
||||||
|
|
||||||
bool epi_getDO_fan(void);
|
bool epi_getDO_fan(void);
|
||||||
|
|
||||||
void gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
|
uint8_t gpi_storeDO_sirenAndRelay(uint8_t sirenRelay);
|
||||||
|
|
||||||
bool epi_getDO_sirene(void);
|
bool epi_getDO_sirene(void);
|
||||||
|
|
||||||
bool epi_getDO_relay(void);
|
bool epi_getDO_relay(void);
|
||||||
|
|
||||||
void gpi_storeDO_ptuWake(uint8_t state);
|
uint8_t gpi_storeDO_ptuWake(uint8_t state);
|
||||||
|
|
||||||
bool epi_getDO_ptuWake(void);
|
bool epi_getDO_ptuWake(void);
|
||||||
|
|
||||||
void gpi_storeDO_auxPower(uint8_t pwr);
|
uint8_t gpi_storeDO_auxPower(uint8_t pwr);
|
||||||
|
|
||||||
bool epi_getDO_auxPower(void);
|
bool epi_getDO_auxPower(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_coinShutter(uint8_t state);
|
||||||
void gpi_storeDO_coinShutter(uint8_t state);
|
|
||||||
|
|
||||||
bool epi_getDO_coinShutterOpen(void);
|
bool epi_getDO_coinShutterOpen(void);
|
||||||
|
|
||||||
bool epi_getDO_coinShutterTest(void);
|
bool epi_getDO_coinShutterTest(void);
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_coinEscrow(uint8_t state);
|
||||||
void gpi_storeDO_coinEscrow(uint8_t state);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_coinEscrow(void);
|
uint8_t epi_getDO_coinEscrow(void);
|
||||||
// retval: 1:return flap is open 2:take flap is open 0:closed
|
// retval: 1:return flap is open 2:take flap is open 0:closed
|
||||||
|
|
||||||
|
uint8_t gpi_storeDO_printerPwrOn(uint8_t state);
|
||||||
void gpi_storeDO_printerPwrOn(uint8_t state);
|
|
||||||
|
|
||||||
uint8_t epi_getDO_printerPwr(void);
|
uint8_t epi_getDO_printerPwr(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------
|
||||||
// counterchecks, make sure that DC-outputs are correct
|
// counterchecks, make sure that DC-outputs are correct
|
||||||
|
|
||||||
@ -369,21 +287,14 @@ bool epi_cntchk_Mot2Fon(void);
|
|||||||
|
|
||||||
uint8_t gpi_storeMdbRecData(uint8_t length, uint8_t *buf);
|
uint8_t gpi_storeMdbRecData(uint8_t length, uint8_t *buf);
|
||||||
// datif store received mdb data
|
// datif store received mdb data
|
||||||
|
|
||||||
uint8_t epi_getMdbResponse(void);
|
uint8_t epi_getMdbResponse(void);
|
||||||
// 0=no response 1=ACK 2=NAK 3=ACK with data
|
// 0=no response 1=ACK 2=NAK 3=ACK with data
|
||||||
|
|
||||||
uint8_t epi_getMdbRecLength(void);
|
uint8_t epi_getMdbRecLength(void);
|
||||||
// 0...31
|
// 0...31
|
||||||
|
|
||||||
uint8_t epi_restoreMdbRecData(uint8_t *buf);
|
uint8_t epi_restoreMdbRecData(uint8_t *buf);
|
||||||
// hwapi reads received mdb data from PI
|
// hwapi reads received mdb data from PI
|
||||||
|
|
||||||
|
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t const *buf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t *buf);
|
|
||||||
|
|
||||||
/* data description:
|
/* data description:
|
||||||
byte 0: current read state: 0=power off 1=reader-fault 2=ready
|
byte 0: current read state: 0=power off 1=reader-fault 2=ready
|
||||||
@ -407,41 +318,24 @@ byte 32: result, always 0
|
|||||||
|
|
||||||
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize);
|
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize);
|
||||||
// retval 0=OK 1=error host buffer too small
|
// retval 0=OK 1=error host buffer too small
|
||||||
|
bool gpi_storeMifCardData(uint8_t blkNr, uint8_t const *receivedData);
|
||||||
void gpi_storeMifCardData(uint8_t blkNr, uint8_t *receivedData);
|
|
||||||
// blkNr=0...11 receivedData[64]
|
// blkNr=0...11 receivedData[64]
|
||||||
|
|
||||||
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
|
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize);
|
||||||
// blkNr=0...11 return buf[64]
|
// blkNr=0...11 return buf[64]
|
||||||
// retval: 1=error 0=OK
|
// retval: 1=error 0=OK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define pi_prnStateArraySize 20
|
|
||||||
#define pi_prnFontArraySize 20
|
|
||||||
|
|
||||||
void epi_restorePrinterState(uint8_t *buf);
|
void epi_restorePrinterState(uint8_t *buf);
|
||||||
|
void gpi_storePrinterState(uint8_t const *buf);
|
||||||
void gpi_storePrinterState(uint8_t *buf);
|
|
||||||
|
|
||||||
void epi_restorePrinterFonts(uint8_t *buf);
|
void epi_restorePrinterFonts(uint8_t *buf);
|
||||||
|
void gpi_storePrinterFonts(uint8_t const *buf);
|
||||||
|
|
||||||
void gpi_storePrinterFonts(uint8_t *buf);
|
bool gpi_storeMdbState(bool busReady, bool V12on, bool V5on);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gpi_storeMdbState(uint8_t busReady, uint8_t V12on, uint8_t V5on );
|
|
||||||
|
|
||||||
bool epi_restoreMdbBusReady(void);
|
bool epi_restoreMdbBusReady(void);
|
||||||
|
|
||||||
bool epi_restoreMdbV12Ready(void);
|
bool epi_restoreMdbV12Ready(void);
|
||||||
|
|
||||||
bool epi_restoreMdbV5Ready(void);
|
bool epi_restoreMdbV5Ready(void);
|
||||||
|
|
||||||
|
void gpi_storeMdbResponse(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeMdbResponse(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
||||||
// last received mdb answer (from mdb device)
|
// last received mdb answer (from mdb device)
|
||||||
// only needed if a special command was sent directly
|
// only needed if a special command was sent directly
|
||||||
@ -450,12 +344,9 @@ void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data);
|
|||||||
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
|
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
|
||||||
// DB3...DB38: rec.data (payload)
|
// DB3...DB38: rec.data (payload)
|
||||||
|
|
||||||
|
void gpi_storeEmpSettings(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeEmpSettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
||||||
|
|
||||||
@ -469,108 +360,68 @@ void epi_restoreEmpCoinSignal(uint8_t *leng, uint8_t *data);
|
|||||||
void epi_clearEmpCoinSignal();
|
void epi_clearEmpCoinSignal();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MEMDEPTH_GOTCOINS 16
|
|
||||||
|
|
||||||
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data);
|
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
uint8_t epi_isNewCoinLeft(void);
|
uint8_t epi_isNewCoinLeft(void);
|
||||||
// retval: 0...16 coins left in FIFO
|
// retval: 0...16 coins left in FIFO
|
||||||
|
|
||||||
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value);
|
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value);
|
||||||
|
|
||||||
|
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
|
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void epi_clearCurrentPayment(void);
|
void epi_clearCurrentPayment(void);
|
||||||
|
|
||||||
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue);
|
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue);
|
||||||
|
|
||||||
uint32_t epi_CurrentPaymentGetAmount(void);
|
uint32_t epi_CurrentPaymentGetAmount(void);
|
||||||
|
|
||||||
uint16_t epi_CurrentPaymentGetLastCoin(void);
|
uint16_t epi_CurrentPaymentGetLastCoin(void);
|
||||||
|
|
||||||
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
||||||
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
||||||
|
|
||||||
|
void gpi_storeWakeSources(uint8_t const *receivedData);
|
||||||
void gpi_storeWakeSources(uint8_t *receivedData);
|
|
||||||
|
|
||||||
uint64_t epi_getWakeSources(void);
|
uint64_t epi_getWakeSources(void);
|
||||||
|
|
||||||
uint8_t epi_getWakeReason(void);
|
uint8_t epi_getWakeReason(void);
|
||||||
|
|
||||||
|
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDeviceConditions(uint8_t leng, uint8_t const *data);
|
||||||
|
|
||||||
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDCbackupAccNr(uint8_t *leng, uint16_t *accNrs);
|
void epi_restoreDCbackupAccNr(uint8_t *leng, uint16_t *accNrs);
|
||||||
// return accNrs[0..7]
|
// return accNrs[0..7]
|
||||||
|
|
||||||
|
|
||||||
void epi_iniVRstorage(void);
|
void epi_iniVRstorage(void);
|
||||||
|
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t const *data);
|
||||||
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data );
|
|
||||||
|
|
||||||
bool epi_checkIfVaultRecordAvailable(void);
|
bool epi_checkIfVaultRecordAvailable(void);
|
||||||
|
bool epi_restoreVaultRecord(uint16_t *length, uint8_t *buf);
|
||||||
bool epi_restoreVaultRecord(uint16_t *length, uint8_t *buf );
|
|
||||||
// true if completly received
|
// true if completly received
|
||||||
|
|
||||||
void gpi_storeCBlevel(uint32_t amount, uint16_t nrOfCoins );
|
void gpi_storeCBlevel(uint32_t amount, uint16_t nrOfCoins);
|
||||||
|
|
||||||
uint32_t epi_getCashBoxContent(void);
|
uint32_t epi_getCashBoxContent(void);
|
||||||
|
|
||||||
uint16_t epi_getNrOfCoinsInCashBox(void);
|
uint16_t epi_getNrOfCoinsInCashBox(void);
|
||||||
|
|
||||||
void gpi_storeNewMifareCard(uint8_t typ, uint8_t *holder );
|
void gpi_storeNewMifareCard(uint8_t typ, uint8_t const *holder);
|
||||||
|
|
||||||
uint8_t epi_mifGetCardType(uint8_t *holder);
|
uint8_t epi_mifGetCardType(uint8_t const *holder);
|
||||||
//holder[8] = name of card holder
|
//holder[8] = name of card holder
|
||||||
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
||||||
|
|
||||||
void gpi_storeDcDataValid(bool isVal);
|
void gpi_storeDcDataValid(bool isVal);
|
||||||
|
bool gpi_areDcDataValid();
|
||||||
bool epi_areDcDataValid();
|
bool epi_areDcDataValid();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void epi_clearDynData(void);
|
|
||||||
|
|
||||||
void gpi_storeDynData(uint8_t *DCdynDat);
|
|
||||||
// buffer size: 64 byte
|
|
||||||
|
|
||||||
bool epi_getDynPrnData(uint8_t *DCdynDat);
|
|
||||||
// buffer size: 64 byte
|
|
||||||
// return true if data are new and valid
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
22
src/ATBAPP/ATBAPPplugin.h
Normal file
22
src/ATBAPP/ATBAPPplugin.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef ATBAPPPLUGIN_H
|
||||||
|
#define ATBAPPPLUGIN_H
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* a simple class with only one method for plugin info
|
||||||
|
*/
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class ATBAPPplugin
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual const QString & getPluginInfo() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_INTERFACE(ATBAPPplugin,
|
||||||
|
"eu.atb.ptu.plugin.ATBAPPplugin/0.9")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ATBAPPPLUGIN_H
|
316
src/ATBAPP/ATBDeviceControllerPlugin.cpp
Normal file
316
src/ATBAPP/ATBDeviceControllerPlugin.cpp
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
#include "src/ATBAPP/ATBDeviceControllerPlugin.h"
|
||||||
|
#include "src/ATBAPP/ATBHealthEvent.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
|
||||||
|
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject(parent),
|
||||||
|
pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
|
{
|
||||||
|
this->pluginInfo = QString::fromUtf8(pluginInfoString.c_str());
|
||||||
|
|
||||||
|
this->hw = new hwapi();
|
||||||
|
|
||||||
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_templatePrintFinished_OK()), this, SLOT(onPrintFinishedOK()));
|
||||||
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_templatePrintFinished_Err()), this, SLOT(onPrintFinishedERR()));
|
||||||
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_gotNewCoin()), this, SLOT(onCashGotCoin()));
|
||||||
|
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_vendStopByMax()), this, SLOT(onCashVendStopByMax()));
|
||||||
|
}
|
||||||
|
|
||||||
|
ATBDeviceControllerPlugin::~ATBDeviceControllerPlugin() {}
|
||||||
|
|
||||||
|
PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *healthEventReceiver, const QSettings & settings)
|
||||||
|
{
|
||||||
|
this->healthEventReceiver = healthEventReceiver;
|
||||||
|
|
||||||
|
// read variables from setting
|
||||||
|
QString serialPort = settings.value("DEVICE_CONTROLLER/serialPort", "ttymxc2").toString();
|
||||||
|
QByteArray printerEncoding = settings.value("DEVICE_CONTROLLER/printerEnconding", "ISO 8859-2").toString().toLatin1();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// open serial port
|
||||||
|
hw->dc_openSerial(5, "115200", serialPort, 1);
|
||||||
|
|
||||||
|
|
||||||
|
// text encoding for printer
|
||||||
|
this->codec = QTextCodec::codecForName(printerEncoding);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this->pluginState = PLUGIN_STATE::INITIALIZED;
|
||||||
|
|
||||||
|
return pluginState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TASKS: Cash handling -------------------------------------------------------
|
||||||
|
void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
|
||||||
|
{
|
||||||
|
qCritical() << "Start Cash vending with amount = " << amount;
|
||||||
|
|
||||||
|
uint32_t amountInt = static_cast<uint32_t>(amount.toUInt());
|
||||||
|
|
||||||
|
hw->cash_startPayment(amountInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::requestStopCashInput()
|
||||||
|
{
|
||||||
|
hw->cash_stopPayment();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::cashCollect()
|
||||||
|
{
|
||||||
|
hw->vend_success();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::cashAbort()
|
||||||
|
{
|
||||||
|
hw->vend_failed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TASKS: printing ------------------------------------------------------------
|
||||||
|
void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant> & printingData)
|
||||||
|
{
|
||||||
|
struct T_dynDat *dynTicketData = new T_dynDat;
|
||||||
|
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
||||||
|
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||||
|
<< " licenseplate = " << printingData["licenseplate"] << endl
|
||||||
|
<< " amount = " << printingData["amount"] << endl
|
||||||
|
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
||||||
|
<< " currentDateTime = " << printingData["currentDateTime"] << endl;
|
||||||
|
|
||||||
|
QDateTime parkingEndDateTime = QDateTime::fromString(printingData["parkingEnd"].toString(), Qt::ISODate);
|
||||||
|
QDateTime currentDateTime = QDateTime::fromString(printingData["currentDateTime"].toString(), Qt::ISODate);
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------------------
|
||||||
|
* note: the following highly depends on printer template files!
|
||||||
|
* -----------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set dynamic printer data:
|
||||||
|
QByteArray ba_licenseplate = codec->fromUnicode(printingData["licenseplate"].toString());
|
||||||
|
memcpy((char*)dynTicketData->licensePlate, ba_licenseplate.data(), std::min(ba_licenseplate.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_amount = codec->fromUnicode(printingData["amount"].toString());
|
||||||
|
memcpy((char*)dynTicketData->vendingPrice, ba_amount.data(), std::min(ba_amount.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_parkingEndTime = codec->fromUnicode(parkingEndDateTime.toString("hh:mm"));
|
||||||
|
memcpy((char*)dynTicketData->parkingEndTime, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateTime.toString("dd.MM.yy"));
|
||||||
|
memcpy((char*)dynTicketData->parkingEndDate, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_currentDate = codec->fromUnicode(currentDateTime.toString("dd.MM.yy"));
|
||||||
|
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
|
||||||
|
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
/*
|
||||||
|
uint8_t* buf = dynTicketData->licensePlate;
|
||||||
|
int length = 64;
|
||||||
|
for (int i = 0; i < length; ++i) {
|
||||||
|
fprintf(stderr, "%d %02x %c\n", i, buf[i], buf[i]);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
*/
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
||||||
|
|
||||||
|
if (!this->hw->dc_isPortOpen()) {
|
||||||
|
qCritical() << " ... serial port is not open!";
|
||||||
|
this->onPrintFinishedERR();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: wird hier nur 'licensePlate' gedruckt?
|
||||||
|
if (!this->hw->prn_sendDynamicPrnValues(dynTicketData->licensePlate)) {
|
||||||
|
this->errorCode = "hwapi::prn_sendDynamicPrnValues";
|
||||||
|
this->errorDescription = "hwapi method 'hwapi::prn_sendDynamicPrnValues' result is false";
|
||||||
|
|
||||||
|
qCritical() << "ERROR:";
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||||
|
<< " licenseplate = " << printingData["licenseplate"] << endl
|
||||||
|
<< " amount = " << printingData["amount"] << endl
|
||||||
|
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
||||||
|
<< " currentTime = " << printingData["currentTime"] << endl
|
||||||
|
<< " currentDate = " << printingData["currentDate"] << endl;
|
||||||
|
|
||||||
|
|
||||||
|
this->onPrintFinishedERR();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimer::singleShot(500, this, SLOT(onPrinterDataPrepared()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::onPrinterDataPrepared()
|
||||||
|
{
|
||||||
|
this->currentTemplate = 1;
|
||||||
|
this->onPrinterPrintNextTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::onPrinterPrintNextTemplate()
|
||||||
|
{
|
||||||
|
qCritical() << " ... print template " << this->currentTemplate;
|
||||||
|
|
||||||
|
if (!this->hw->prn_printTemplate(this->currentTemplate)) {
|
||||||
|
this->errorCode = "hwapi::prn_printTemplate";
|
||||||
|
this->errorDescription = QString("hwapi method 'hwapi::onPrinterPrintNextTemplate(%1)' result is false").arg(this->currentTemplate);
|
||||||
|
this->onPrintFinishedERR();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->currentTemplate >= 3) {
|
||||||
|
// all templates are printed
|
||||||
|
this->currentTemplate = 0;
|
||||||
|
|
||||||
|
// FAKE SIGNAL:
|
||||||
|
QTimer::singleShot(500, this, SLOT(onPrintFinishedOK()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// print next template
|
||||||
|
this->currentTemplate++;
|
||||||
|
QTimer::singleShot(1000, this, SLOT(onPrinterPrintNextTemplate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************************************
|
||||||
|
* private slots, interface to low level hwapi
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ATBDeviceControllerPlugin::onPrintFinishedOK()
|
||||||
|
{
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::onPrintFinishedOK()";
|
||||||
|
|
||||||
|
emit this->printTicketFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
}
|
||||||
|
void ATBDeviceControllerPlugin::onPrintFinishedERR()
|
||||||
|
{
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::onPrintFinishedERR()";
|
||||||
|
|
||||||
|
|
||||||
|
this->errorCode = "PRINTER"; // TODO: get more detailed error code from low level API
|
||||||
|
this->errorDescription = "Printer error"; // TODO: get more detailed error description from low level API
|
||||||
|
|
||||||
|
emit this->printTicketFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||||
|
this->errorCode,
|
||||||
|
this->errorDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************************************
|
||||||
|
* cash payment
|
||||||
|
*/
|
||||||
|
void ATBDeviceControllerPlugin::onCashGotCoin()
|
||||||
|
{
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::onGotCoin()";
|
||||||
|
|
||||||
|
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||||
|
|
||||||
|
QString amountString = QString::number(amountInt);
|
||||||
|
|
||||||
|
|
||||||
|
emit this->cashInputEvent(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||||
|
nsDeviceControllerInterface::CASH_STATE::CACHE_INPUT,
|
||||||
|
amountString,
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::onCashVendStopByMax()
|
||||||
|
{
|
||||||
|
// DEBUG
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::onCashVendStopByMax()";
|
||||||
|
|
||||||
|
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||||
|
|
||||||
|
QString amountString = QString::number(amountInt);
|
||||||
|
|
||||||
|
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||||
|
amountString,
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************************************
|
||||||
|
* Mandatory plugin methods
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
PLUGIN_STATE ATBDeviceControllerPlugin::getState()
|
||||||
|
{
|
||||||
|
return this->pluginState;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString & ATBDeviceControllerPlugin::getLastError()
|
||||||
|
{
|
||||||
|
return this->errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & ATBDeviceControllerPlugin::getLastErrorDescription()
|
||||||
|
{
|
||||||
|
return this->errorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString & ATBDeviceControllerPlugin::getPluginInfo()
|
||||||
|
{
|
||||||
|
return this->pluginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const QString ATBDeviceControllerPlugin::getString(nsDeviceControllerInterface::RESULT_STATE resultState)
|
||||||
|
{
|
||||||
|
QString str;
|
||||||
|
|
||||||
|
switch (resultState) {
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::SUCCESS:
|
||||||
|
str = QString("RESULT_STATE::SUCCESS");
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND:
|
||||||
|
str = QString("RESULT_STATE::ERROR_BACKEND");
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::ERROR_TIMEOUT:
|
||||||
|
str = QString("RESULT_STATE::ERROR_TIMEOUT");
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::ERROR_PROCESS:
|
||||||
|
str = QString("RESULT_STATE::ERROR_PROCESS");
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::ERROR_RETRY:
|
||||||
|
str = QString("RESULT_STATE::ERROR_RETRY");
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::RESULT_STATE::INFO:
|
||||||
|
str = QString("RESULT_STATE::INFO");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************************************
|
||||||
|
* ... end
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
Q_EXPORT_PLUGIN2( ATBDeviceControllerPlugin, ATBDeviceControllerPlugin )
|
||||||
|
#endif
|
125
src/ATBAPP/ATBDeviceControllerPlugin.h
Normal file
125
src/ATBAPP/ATBDeviceControllerPlugin.h
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
#ifndef ATBDEVICECONTROLLERPLUGIN_H
|
||||||
|
#define ATBDEVICECONTROLLERPLUGIN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "src/ATBAPP/DeviceControllerInterface.h"
|
||||||
|
#include "src/ATBAPP/ATBAPPplugin.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "hwapi.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <thread>
|
||||||
|
#include <memory>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
|
||||||
|
|
||||||
|
class QTextCodec;
|
||||||
|
|
||||||
|
|
||||||
|
using namespace nsDeviceControllerInterface;
|
||||||
|
|
||||||
|
class QSettings;
|
||||||
|
|
||||||
|
class ATBDeviceControllerPlugin : public QObject,
|
||||||
|
public DeviceControllerInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(ATBAPPplugin)
|
||||||
|
Q_INTERFACES(DeviceControllerInterface)
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
Q_PLUGIN_METADATA( IID "ATBDeviceControllerPlugin" )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ATBDeviceControllerPlugin(QObject *parent = nullptr);
|
||||||
|
~ATBDeviceControllerPlugin();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// interface:
|
||||||
|
PLUGIN_STATE initDCPlugin(QObject *healthEventReceiver, const QSettings & settings);
|
||||||
|
|
||||||
|
// TASKS: Cash handling -------------------------------------------------------
|
||||||
|
void requestStartCashInput(const QString & amount);
|
||||||
|
void requestStopCashInput();
|
||||||
|
void cashCollect();
|
||||||
|
void cashAbort();
|
||||||
|
|
||||||
|
// TASKS: printing ------------------------------------------------------------
|
||||||
|
void requestPrintTicket(const QHash<QString, QVariant> & printingData);
|
||||||
|
|
||||||
|
// mandantory ATBAPP plugin methods: ------------------------------------------
|
||||||
|
nsDeviceControllerInterface::PLUGIN_STATE getState();
|
||||||
|
QString & getLastError();
|
||||||
|
const QString & getLastErrorDescription();
|
||||||
|
|
||||||
|
const QString & getPluginInfo();
|
||||||
|
|
||||||
|
// helpers e.g. for debug / log
|
||||||
|
const QString getString(nsDeviceControllerInterface::RESULT_STATE resultState);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription);
|
||||||
|
|
||||||
|
void cashInputEvent(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
nsDeviceControllerInterface::CASH_STATE cashState,
|
||||||
|
const QString & newCashValue,
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription);
|
||||||
|
|
||||||
|
void cashInputFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
const QString & newCashValue,
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription);
|
||||||
|
|
||||||
|
void requestServiceMode();
|
||||||
|
|
||||||
|
void Error(
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString errorCode;
|
||||||
|
QString errorDescription;
|
||||||
|
QString pluginInfo;
|
||||||
|
|
||||||
|
int currentTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
bool useDebug;
|
||||||
|
|
||||||
|
PLUGIN_STATE pluginState;
|
||||||
|
|
||||||
|
QObject* healthEventReceiver;
|
||||||
|
|
||||||
|
hwinf* hw;
|
||||||
|
|
||||||
|
QTextCodec *codec;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// printer
|
||||||
|
|
||||||
|
void onPrinterDataPrepared();
|
||||||
|
void onPrinterPrintNextTemplate();
|
||||||
|
|
||||||
|
void onPrintFinishedOK();
|
||||||
|
void onPrintFinishedERR();
|
||||||
|
|
||||||
|
// cash payment
|
||||||
|
void onCashGotCoin();
|
||||||
|
void onCashVendStopByMax();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|
25
src/ATBAPP/ATBHealthEvent.cpp
Normal file
25
src/ATBAPP/ATBHealthEvent.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "src/ATBAPP/ATBHealthEvent.h"
|
||||||
|
|
||||||
|
ATBHealthEvent::ATBHealthEvent(ATB_HEALTH_MODE mode, const QString & errorNumber, const QString & errorDescription) :
|
||||||
|
QEvent(ATB_HEALTH_EVENT),
|
||||||
|
healthMode(mode),
|
||||||
|
errorNumber(errorNumber),
|
||||||
|
errorDescription(errorDescription)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ATBHealthEvent::getErrorNumber()
|
||||||
|
{
|
||||||
|
return this->errorNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ATBHealthEvent::getErrorDescription()
|
||||||
|
{
|
||||||
|
return this->errorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
ATB_HEALTH_MODE ATBHealthEvent::getMode()
|
||||||
|
{
|
||||||
|
return this->healthMode;
|
||||||
|
}
|
44
src/ATBAPP/ATBHealthEvent.h
Normal file
44
src/ATBAPP/ATBHealthEvent.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef ATBHEALTHEVENT_H
|
||||||
|
#define ATBHEALTHEVENT_H
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
enum class ATB_HEALTH_MODE : quint8;
|
||||||
|
|
||||||
|
const QEvent::Type ATB_HEALTH_EVENT = static_cast<QEvent::Type>(QEvent::User + 1);
|
||||||
|
|
||||||
|
|
||||||
|
class ATBHealthEvent : public QEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
ATBHealthEvent(ATB_HEALTH_MODE mode, const QString & errorNumber, const QString & errorDescription);
|
||||||
|
|
||||||
|
QString getErrorNumber();
|
||||||
|
QString getErrorDescription();
|
||||||
|
ATB_HEALTH_MODE getMode();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
ATB_HEALTH_MODE healthMode;
|
||||||
|
QString errorNumber;
|
||||||
|
QString errorDescription;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum class ATB_HEALTH_MODE : quint8 {
|
||||||
|
WARNING,
|
||||||
|
ERROR,
|
||||||
|
WARNING_CORRECTION,
|
||||||
|
ERROR_CORRECTION,
|
||||||
|
DEBUG,
|
||||||
|
STATE,
|
||||||
|
UNSPECIFIED
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ATBHEALTHEVENT_H
|
142
src/ATBAPP/DeviceControllerInterface.h
Normal file
142
src/ATBAPP/DeviceControllerInterface.h
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#ifndef DEVICECONTROLLERINTERFACE_H
|
||||||
|
#define DEVICECONTROLLERINTERFACE_H
|
||||||
|
|
||||||
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "ATBAPPplugin.h"
|
||||||
|
|
||||||
|
namespace nsDeviceControllerInterface {
|
||||||
|
enum class PLUGIN_STATE : quint8;
|
||||||
|
enum class RESULT_STATE : quint8;
|
||||||
|
enum class CASH_STATE : quint8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class DeviceControllerInterface : public ATBAPPplugin
|
||||||
|
{
|
||||||
|
Q_INTERFACES(ATBAPPplugin)
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~DeviceControllerInterface() {}
|
||||||
|
|
||||||
|
virtual nsDeviceControllerInterface::PLUGIN_STATE initDCPlugin(QObject *healthEventReceiver,
|
||||||
|
const QSettings & settings) = 0;
|
||||||
|
|
||||||
|
// TASKS: Cash handling -------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* enables coin input
|
||||||
|
* amount = "0": pay-up
|
||||||
|
* amount > "0": pay-down
|
||||||
|
*/
|
||||||
|
virtual void requestStartCashInput(const QString & amount) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called e.g. on Button "NEXT" in pay-up (direct coin input)
|
||||||
|
*/
|
||||||
|
virtual void requestStopCashInput() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called e.g. on Button "NEXT" in pay-up (direct coin input)
|
||||||
|
*/
|
||||||
|
virtual void cashCollect() = 0;
|
||||||
|
virtual void cashAbort() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TASKS: printing ------------------------------------------------------------
|
||||||
|
virtual void requestPrintTicket(const QHash<QString, QVariant> & printingData) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// mandantory ATBAPP plugin methods:
|
||||||
|
virtual nsDeviceControllerInterface::PLUGIN_STATE getState() = 0;
|
||||||
|
virtual const QString & getLastError() = 0;
|
||||||
|
virtual const QString & getLastErrorDescription() = 0;
|
||||||
|
|
||||||
|
// return a plugin description in JSON or XML
|
||||||
|
// -> ATBAPPplugin::getPluginInfo()
|
||||||
|
|
||||||
|
// helpers e.g. for debug / log
|
||||||
|
virtual const QString getString(nsDeviceControllerInterface::RESULT_STATE resultState) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
virtual void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted on e.g. a coin input
|
||||||
|
*/
|
||||||
|
virtual void cashInputEvent(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
nsDeviceControllerInterface::CASH_STATE cashState,
|
||||||
|
const QString & newCashValue,
|
||||||
|
/* additional variables? */
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted if cashInput has been stopped, e.g. in result to task requestStopCashInput():
|
||||||
|
* -> shutter is blocked
|
||||||
|
* -> no cash input is possible
|
||||||
|
* -> coins are in cache
|
||||||
|
*/
|
||||||
|
virtual void cashInputFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
const QString & newCashValue,
|
||||||
|
/* additional variables? */
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted e.g. if service door is opened
|
||||||
|
*/
|
||||||
|
virtual void requestServiceMode() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted on error
|
||||||
|
* depending on errorCode:
|
||||||
|
* -> interrupt selling process
|
||||||
|
* -> machine can go to state OOO
|
||||||
|
* -> send error event to ISMAS
|
||||||
|
* -> ...
|
||||||
|
*/
|
||||||
|
virtual void Error(
|
||||||
|
/* additional variables? */
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
||||||
|
"eu.atb.ptu.plugin.DeviceControllerInterface/1.0")
|
||||||
|
|
||||||
|
|
||||||
|
namespace nsDeviceControllerInterface {
|
||||||
|
|
||||||
|
enum class PLUGIN_STATE : quint8 {
|
||||||
|
NOT_INITIALIZED = 0,
|
||||||
|
INITIALIZED = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class RESULT_STATE : quint8 {
|
||||||
|
SUCCESS = 1, // operation was successfull
|
||||||
|
ERROR_BACKEND, // error from backend (e.g. backend replies with error)
|
||||||
|
ERROR_TIMEOUT, // the operation timed out
|
||||||
|
ERROR_PROCESS, // internal plugin error, should not occur (this is a bug in implementation)
|
||||||
|
ERROR_RETRY, // retry operation
|
||||||
|
INFO // informational (e.g. display a message, log something etc.)
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CASH_STATE : quint8 {
|
||||||
|
CACHE_EMPTY, // Cache still empty, default state
|
||||||
|
CACHE_INPUT, // Coins are in Cache
|
||||||
|
OVERPAYED,
|
||||||
|
/* t.b.d. */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DEVICECONTROLLERINTERFACE_H
|
36
src/com.cpp
36
src/com.cpp
@ -19,7 +19,7 @@ void T_com::writeToSerial(const QByteArray &data, uint16_t sendLength)
|
|||||||
sendLen=sendLength;
|
sendLen=sendLength;
|
||||||
if (CatSerial->isOpen())
|
if (CatSerial->isOpen())
|
||||||
{
|
{
|
||||||
//qDebug() << "sending..." << sendBuffer;
|
qCritical() << "sending..." << sendBuffer;
|
||||||
CatSerial->write(sendBuffer);
|
CatSerial->write(sendBuffer);
|
||||||
} else
|
} else
|
||||||
qDebug() << "error sending, port is not open";
|
qDebug() << "error sending, port is not open";
|
||||||
@ -93,29 +93,34 @@ T_com::~T_com()
|
|||||||
|
|
||||||
void T_com::ser_ISR100ms()
|
void T_com::ser_ISR100ms()
|
||||||
{
|
{
|
||||||
|
//qDebug() << "~~>LIB" << "ENTER...";
|
||||||
// call every 100ms to check if user(HMI) wants to connect or disconnect
|
// call every 100ms to check if user(HMI) wants to connect or disconnect
|
||||||
|
|
||||||
//qDebug() << "~~>LIB" << "checking connect button... " ;
|
|
||||||
|
|
||||||
uint8_t chkConn = gpi_getSerialConn(); // from global GUI buffer (Sdata)
|
uint8_t chkConn = gpi_getSerialConn(); // from global GUI buffer (Sdata)
|
||||||
|
|
||||||
|
//qDebug() << "~~>LIB" << "checking connect button... " << chkConn;
|
||||||
|
|
||||||
switch (chkConn)
|
switch (chkConn)
|
||||||
{
|
{
|
||||||
case 0: // 0 button "connect" was just released
|
case 0: // 0 button "connect" was just released
|
||||||
|
//qDebug() << "close serial port" << chkConn;
|
||||||
closeSerialPort();
|
closeSerialPort();
|
||||||
gpi_serialChanged(); // set chkConn to 2, thus getting edge
|
gpi_serialChanged(); // set chkConn to 2, thus getting edge
|
||||||
break;
|
break;
|
||||||
case 1: // 1 button "connect" was just pressed
|
case 1: // 1 button "connect" was just pressed
|
||||||
|
//qDebug() << "open serial port" << chkConn;
|
||||||
open_Serial_Port();
|
open_Serial_Port();
|
||||||
gpi_serialChanged(); // set chkConn to 2, thus getting edge
|
gpi_serialChanged(); // set chkConn to 2, thus getting edge
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CatSerial->isOpen())
|
if (CatSerial->isOpen()) {
|
||||||
gpi_serialIsOpen(true);
|
gpi_serialIsOpen(true);
|
||||||
else
|
} else {
|
||||||
gpi_serialIsOpen(false);
|
gpi_serialIsOpen(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//qDebug() << "LEAVE " << chkConn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------
|
||||||
@ -124,17 +129,24 @@ void T_com::ser_ISR100ms()
|
|||||||
|
|
||||||
char T_com::open_Serial_Port()
|
char T_com::open_Serial_Port()
|
||||||
{
|
{
|
||||||
|
//qDebug() << "ENTER";
|
||||||
|
|
||||||
bool ret;
|
bool ret;
|
||||||
QString myString=nullptr, myPortName=nullptr, myBaudStr=nullptr;
|
QString myString=nullptr, myPortName=nullptr, myBaudStr=nullptr;
|
||||||
int myBaudNr;
|
int myBaudNr;
|
||||||
|
|
||||||
if (CatSerial->isOpen())
|
if (CatSerial->isOpen()) {
|
||||||
|
qDebug() << "!!!IS OPEN!!!";
|
||||||
return 0; // opening twice is not allowed
|
return 0; // opening twice is not allowed
|
||||||
|
}
|
||||||
|
|
||||||
//qDebug() << "connecting..." << myPortName;
|
//qDebug() << "connecting..." << myPortName;
|
||||||
myPortName=gpi_getComPortName(); // was selected and stored from GUI
|
myPortName=gpi_getComPortName(); // was selected and stored from GUI
|
||||||
CatSerial->setPortName(myPortName);
|
CatSerial->setPortName(myPortName);
|
||||||
myBaudNr=gpi_getBaudNr(); // was selected and stored from GUI
|
myBaudNr=gpi_getBaudNr(); // was selected and stored from GUI
|
||||||
|
|
||||||
|
//qDebug() << "myPortName" << myPortName << ", myBaudNr" << myBaudNr;
|
||||||
|
|
||||||
switch (myBaudNr)
|
switch (myBaudNr)
|
||||||
{
|
{
|
||||||
// 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
|
// 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200
|
||||||
@ -167,6 +179,9 @@ char T_com::open_Serial_Port()
|
|||||||
myString.append(CatSerial->errorString());
|
myString.append(CatSerial->errorString());
|
||||||
qDebug() << myString;
|
qDebug() << myString;
|
||||||
gpi_setTxt4comStateLine(myString);
|
gpi_setTxt4comStateLine(myString);
|
||||||
|
|
||||||
|
//qDebug() << "LEAVE";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@ -182,11 +197,14 @@ char T_com::open_Serial_Port()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
//qDebug() << "LEAVE";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_com::closeSerialPort()
|
void T_com::closeSerialPort()
|
||||||
{
|
{
|
||||||
|
//qDebug() << "ENTER";
|
||||||
|
|
||||||
if (CatSerial->isOpen())
|
if (CatSerial->isOpen())
|
||||||
{
|
{
|
||||||
qDebug() << "closing connection";
|
qDebug() << "closing connection";
|
||||||
@ -195,6 +213,8 @@ void T_com::closeSerialPort()
|
|||||||
gpi_setTxt4RsDiagWin("closed");
|
gpi_setTxt4RsDiagWin("closed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//qDebug() << "LEAVE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,134 +1,110 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "tslib.h"
|
#include "tslib.h"
|
||||||
//#include "controlBus.h"
|
#include "shared_mem_buffer.h"
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// control serial interface gui <--> serial
|
// control serial interface gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void epi_setSerial(int BaudNr,
|
||||||
|
QString BaudStr,
|
||||||
|
QString ComName,
|
||||||
|
uint8_t connect) {
|
||||||
|
memset(&SharedMemBuffer::getData()->rs.comportName[0], 0x00,
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.comportName));
|
||||||
|
strncpy(SharedMemBuffer::getData()->rs.comportName,
|
||||||
|
ComName.toStdString().c_str(),
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.comportName)-1);
|
||||||
|
|
||||||
static QString rs_comportName; // z.B. "COM48"
|
memset(&SharedMemBuffer::getData()->rs.baudStr[0], 0x00,
|
||||||
static QString rs_baudStr; // z.B. "19200"
|
sizeof(SharedMemBuffer::getData()->rs.baudStr));
|
||||||
static int rs_baudNr; //0...5 oder -1
|
strncpy(SharedMemBuffer::getData()->rs.baudStr,
|
||||||
static uint8_t rs_connect; // 0,1
|
BaudStr.toStdString().c_str(),
|
||||||
|
sizeof(SharedMemBuffer::getData()->rs.baudStr)-1);
|
||||||
void epi_setSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect)
|
|
||||||
{
|
|
||||||
rs_comportName = ComName;
|
|
||||||
rs_baudStr = BaudStr;
|
|
||||||
rs_baudNr = BaudNr; // 0=1200 1=9600 2=19200 3=38400 4=57600 5=115200 oder -1
|
|
||||||
rs_connect = connect; // 0/1
|
|
||||||
|
|
||||||
|
SharedMemBuffer::getData()->rs.baudNr = BaudNr;
|
||||||
|
SharedMemBuffer::getData()->rs.connect = connect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_closeSerial(void)
|
void epi_closeSerial(void) {
|
||||||
{
|
SharedMemBuffer::getData()->rs.connect = 0;
|
||||||
rs_connect=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpi_serialChanged(void) {
|
||||||
void gpi_serialChanged(void)
|
|
||||||
{
|
|
||||||
// serial confirms that port was closed or opened
|
// serial confirms that port was closed or opened
|
||||||
rs_connect=2; // Flanke, nur 1x öffnen/schließen
|
// rs_connect=2; // Flanke, nur 1x öffnen/schließen
|
||||||
|
SharedMemBuffer::getData()->rs.connect = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t gpi_getSerialConn(void)
|
uint8_t gpi_getSerialConn(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->rs.connect;
|
||||||
return rs_connect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gpi_getBaudNr(void) {
|
||||||
int gpi_getBaudNr(void)
|
return SharedMemBuffer::getDataConst()->rs.baudNr;
|
||||||
{
|
|
||||||
return rs_baudNr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gpi_getComPortName(void)
|
QString gpi_getComPortName(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->rs.comportName;
|
||||||
return rs_comportName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rs_portIsOpen;
|
void gpi_serialIsOpen(bool offen) {
|
||||||
|
SharedMemBuffer::getData()->rs.portIsOpen = offen;
|
||||||
void gpi_serialIsOpen(bool offen)
|
|
||||||
{
|
|
||||||
rs_portIsOpen=offen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool epi_isSerialPortOpen()
|
bool epi_isSerialPortOpen() {
|
||||||
{
|
|
||||||
// true: port is open false: port is closed
|
// true: port is open false: port is closed
|
||||||
return rs_portIsOpen;
|
return SharedMemBuffer::getDataConst()->rs.portIsOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Control transfer gui <--> serial
|
// Control transfer gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void epi_startEmmision(char start) {
|
||||||
static char AutoEmissionOn; // 1: zyklisch Anfragen zum Slave senden
|
SharedMemBuffer::getData()->AutoEmissionOn = start;
|
||||||
|
|
||||||
void epi_startEmmision(char start)
|
|
||||||
{
|
|
||||||
AutoEmissionOn=start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gpi_isEmmisionOn(void)
|
bool gpi_isEmmisionOn(void) {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->AutoEmissionOn;
|
||||||
return AutoEmissionOn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
uint16_t gpi_getPeriodicSendTimeVal() {
|
||||||
|
SharedMemBuffer::getData()->datif.sendingPer_changed = 0;
|
||||||
static uint16_t datif_sendingPeriod;
|
if ((SharedMemBuffer::getDataConst()->datif.sendingPeriod < 3) ||
|
||||||
static bool datif_sendingPer_changed;
|
(SharedMemBuffer::getDataConst()->datif.sendingPeriod > 10000)) {
|
||||||
|
|
||||||
uint16_t gpi_getPeriodicSendTimeVal()
|
|
||||||
{
|
|
||||||
datif_sendingPer_changed=0;
|
|
||||||
if (datif_sendingPeriod<3 || datif_sendingPeriod>10000)
|
|
||||||
return 130; // ms, default
|
return 130; // ms, default
|
||||||
else
|
}
|
||||||
return datif_sendingPeriod;
|
return SharedMemBuffer::getDataConst()->datif.sendingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_setPeriodicSendTimeVal(uint16_t val)
|
void epi_setPeriodicSendTimeVal(uint16_t val) {
|
||||||
{
|
if (val>=3 && val<10000) {
|
||||||
if (val>=3 && val<10000)
|
SharedMemBuffer::getData()->datif.sendingPer_changed = 1;
|
||||||
{
|
SharedMemBuffer::getData()->datif.sendingPeriod = val;
|
||||||
datif_sendingPer_changed=1;
|
|
||||||
datif_sendingPeriod=val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gpi_PeriodicSendTimeHasChanged()
|
bool gpi_PeriodicSendTimeHasChanged() {
|
||||||
{
|
return SharedMemBuffer::getDataConst()->datif.sendingPer_changed;
|
||||||
return datif_sendingPer_changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Status Display gui <--> serial
|
// Status Display gui <--> serial
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// linke Spalte, über Connect Button
|
// linke Spalte, über Connect Button
|
||||||
static QString txt4comStateLine;
|
static QString txt4comStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4comStateLine(void)
|
QString epi_getTxt4comStateLine(void) {
|
||||||
{
|
|
||||||
// GUI: get Text for serial Comport-State Line
|
// GUI: get Text for serial Comport-State Line
|
||||||
return txt4comStateLine;
|
return txt4comStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4comStateLine(QString txtline) // gpi
|
void gpi_setTxt4comStateLine(QString txtline) {
|
||||||
{
|
|
||||||
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
||||||
txt4comStateLine.clear();
|
txt4comStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
@ -137,26 +113,20 @@ void gpi_setTxt4comStateLine(QString txtline) // gpi
|
|||||||
txt4comStateLine=txtline;
|
txt4comStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4comStateLine()
|
void epi_clrTxt4comStateLine() {
|
||||||
{
|
|
||||||
txt4comStateLine.clear();
|
txt4comStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// rechte Spalte, oberste Statuszeile
|
// rechte Spalte, oberste Statuszeile
|
||||||
// I) "Handshakes" (serial Control) flow.cpp
|
// I) "Handshakes" (serial Control) flow.cpp
|
||||||
// geht überhaupt was raus? kommt überhaupt was zurück?
|
// geht überhaupt was raus? kommt überhaupt was zurück?
|
||||||
static QString txt4HsStateLine;
|
static QString txt4HsStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4HsStateLine(void)
|
QString epi_getTxt4HsStateLine(void) {
|
||||||
{
|
|
||||||
return txt4HsStateLine;
|
return txt4HsStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4HsStateLine(QString txtline)
|
void gpi_setTxt4HsStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
@ -164,26 +134,19 @@ void gpi_setTxt4HsStateLine(QString txtline)
|
|||||||
txt4HsStateLine=txtline;
|
txt4HsStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4HsStateLine()
|
void epi_clrTxt4HsStateLine() {
|
||||||
{
|
|
||||||
txt4HsStateLine.clear();
|
txt4HsStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// II) Master receive state (empfangenes Telgramm OK? crc? length? )
|
// II) Master receive state (empfangenes Telgramm OK? crc? length? )
|
||||||
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
// Statuszeile Auswertung der SlaveResponse (serial Frame, CRC usw) (prot.cpp)
|
||||||
static QString txt4masterStateLine;
|
static QString txt4masterStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4masterStateLine(void)
|
QString epi_getTxt4masterStateLine(void) {
|
||||||
{
|
|
||||||
return txt4masterStateLine;
|
return txt4masterStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4masterStateLine(QString txtline)
|
void gpi_setTxt4masterStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
@ -191,13 +154,10 @@ void gpi_setTxt4masterStateLine(QString txtline)
|
|||||||
txt4masterStateLine=txtline;
|
txt4masterStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4masterStateLine()
|
void epi_clrTxt4masterStateLine() {
|
||||||
{
|
|
||||||
txt4masterStateLine.clear();
|
txt4masterStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
// III Slave receive (from Master) OK? if then show results, if not then show errors
|
||||||
@ -207,13 +167,11 @@ void epi_clrTxt4masterStateLine()
|
|||||||
|
|
||||||
static QString txt4resultStateLine;
|
static QString txt4resultStateLine;
|
||||||
|
|
||||||
QString epi_getTxt4resultStateLine(void)
|
QString epi_getTxt4resultStateLine(void) {
|
||||||
{
|
|
||||||
return txt4resultStateLine;
|
return txt4resultStateLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4resultStateLine(QString txtline)
|
void gpi_setTxt4resultStateLine(QString txtline) {
|
||||||
{
|
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
@ -221,26 +179,22 @@ void gpi_setTxt4resultStateLine(QString txtline)
|
|||||||
txt4resultStateLine=txtline;
|
txt4resultStateLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4resultStateLine()
|
void epi_clrTxt4resultStateLine() {
|
||||||
{
|
|
||||||
txt4resultStateLine.clear();
|
txt4resultStateLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// IV Statuszeile Empfangsdaten
|
// IV Statuszeile Empfangsdaten
|
||||||
static QString txt4dataLine;
|
static QString txt4dataLine;
|
||||||
|
|
||||||
QString epi_getTxt4dataStateLine(void)
|
QString epi_getTxt4dataStateLine(void) {
|
||||||
{
|
|
||||||
// GUI: get Text for serial Comport-State Line
|
// GUI: get Text for serial Comport-State Line
|
||||||
return txt4dataLine;
|
return txt4dataLine;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4dataStateLine(QString txtline)
|
void gpi_setTxt4dataStateLine(QString txtline) {
|
||||||
{
|
|
||||||
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
// serial: write Text to be displayed in serial Comport-State line (like "connected")
|
||||||
txt4dataLine.clear();
|
txt4dataLine.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
@ -249,8 +203,7 @@ void gpi_setTxt4dataStateLine(QString txtline)
|
|||||||
txt4dataLine=txtline;
|
txt4dataLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4dataStateLine()
|
void epi_clrTxt4dataStateLine() {
|
||||||
{
|
|
||||||
txt4dataLine.clear();
|
txt4dataLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,16 +213,11 @@ void epi_clrTxt4dataStateLine()
|
|||||||
|
|
||||||
static QString txt4datifReceive;
|
static QString txt4datifReceive;
|
||||||
|
|
||||||
QString epi_getTxt4datifLine(void)
|
QString epi_getTxt4datifLine(void) {
|
||||||
{
|
|
||||||
|
|
||||||
return txt4datifReceive;
|
return txt4datifReceive;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4datifLine(QString txtline)
|
void gpi_setTxt4datifLine(QString txtline) {
|
||||||
{
|
|
||||||
|
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
@ -277,8 +225,7 @@ void gpi_setTxt4datifLine(QString txtline)
|
|||||||
txt4datifReceive=txtline;
|
txt4datifReceive=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4datifLine()
|
void epi_clrTxt4datifLine() {
|
||||||
{
|
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,14 +234,11 @@ void epi_clrTxt4datifLine()
|
|||||||
|
|
||||||
static QString txt4diagWindow;
|
static QString txt4diagWindow;
|
||||||
|
|
||||||
QString epi_getTxt4RsDiagWin(void)
|
QString epi_getTxt4RsDiagWin(void) {
|
||||||
{
|
|
||||||
return txt4diagWindow;
|
return txt4diagWindow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_setTxt4RsDiagWin(QString txtline)
|
void gpi_setTxt4RsDiagWin(QString txtline) {
|
||||||
{
|
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
@ -302,8 +246,7 @@ void gpi_setTxt4RsDiagWin(QString txtline)
|
|||||||
txt4diagWindow=txtline;
|
txt4diagWindow=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4RsDiagWin()
|
void epi_clrTxt4RsDiagWin() {
|
||||||
{
|
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,14 +254,11 @@ void epi_clrTxt4RsDiagWin()
|
|||||||
|
|
||||||
static QString sndTxt4diagWindow;
|
static QString sndTxt4diagWindow;
|
||||||
|
|
||||||
QString epi_get2ndTxt4RsDiagWin(void)
|
QString epi_get2ndTxt4RsDiagWin(void) {
|
||||||
{
|
|
||||||
return sndTxt4diagWindow;
|
return sndTxt4diagWindow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_set2ndTxt4RsDiagWin(QString txtline)
|
void gpi_set2ndTxt4RsDiagWin(QString txtline) {
|
||||||
{
|
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
if (txtline=="")
|
if (txtline=="")
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
@ -326,174 +266,61 @@ void gpi_set2ndTxt4RsDiagWin(QString txtline)
|
|||||||
sndTxt4diagWindow=txtline;
|
sndTxt4diagWindow=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clr2ndTxt4RsDiagWin()
|
void epi_clr2ndTxt4RsDiagWin() {
|
||||||
{
|
|
||||||
sndTxt4diagWindow.clear();
|
sndTxt4diagWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Memory for Slave responses, common data
|
// Memory for Slave responses, common data
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void gpi_storeResult_serialTestOK(bool wasOk) {
|
||||||
|
SharedMemBuffer::getData()->Sdata.serialTestResult = wasOk;
|
||||||
static bool Sdata_serialTestResult;
|
|
||||||
|
|
||||||
void gpi_storeResult_serialTestOK(bool wasOk)
|
|
||||||
{
|
|
||||||
Sdata_serialTestResult=wasOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool epi_getResult_serialTestOK()
|
bool epi_getResult_serialTestOK() {
|
||||||
{
|
|
||||||
// retval: true: test was successful, got right response
|
// retval: true: test was successful, got right response
|
||||||
return Sdata_serialTestResult;
|
return SharedMemBuffer::getDataConst()->Sdata.serialTestResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Store received data for hwapi
|
// Store received data for hwapi
|
||||||
// ///////////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void gpi_startNewRequest() {
|
||||||
|
SharedMemBuffer::getData()->Sdata.pProtResultOk = 0;
|
||||||
|
|
||||||
static uint8_t Sdata_pProtResultOk;
|
|
||||||
|
|
||||||
void gpi_startNewRequest()
|
|
||||||
{
|
|
||||||
Sdata_pProtResultOk=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpi_storeResultOfLastRequest(bool answisok)
|
void gpi_storeResultOfLastRequest(bool answisok) {
|
||||||
{
|
SharedMemBuffer::getData()->Sdata.pProtResultOk = answisok ? 1 : 2;
|
||||||
if (answisok)
|
|
||||||
Sdata_pProtResultOk=1;
|
|
||||||
else
|
|
||||||
Sdata_pProtResultOk=2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t epi_getResultOfLastRequest()
|
uint8_t epi_getResultOfLastRequest() {
|
||||||
{
|
|
||||||
// retval: 0: in progress 1: OK 2: error
|
// retval: 0: in progress 1: OK 2: error
|
||||||
return Sdata_pProtResultOk;
|
return SharedMemBuffer::getDataConst()->Sdata.pProtResultOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t const *receivedData) {
|
||||||
|
SharedMemBuffer::getData()->Sdata.receivedDataLength
|
||||||
|
= std::min(RdDlen, (uint8_t)(64));
|
||||||
static uint16_t Sdata_receivedDataLength;
|
memset((char *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
static uint8_t Sdata_receivedDataBlock[64];
|
0x00, sizeof(SharedMemBuffer::getData()->Sdata.receivedDataBlock));
|
||||||
|
strncpy((char *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
void gpi_storeRecPayLoad(uint8_t RdDlen, uint8_t *receivedData)
|
(char const *)receivedData,
|
||||||
{
|
sizeof(SharedMemBuffer::getData()->Sdata.receivedDataBlock)-1);
|
||||||
Sdata_receivedDataLength=uint16_t(RdDlen);
|
|
||||||
if (Sdata_receivedDataLength>64)
|
|
||||||
Sdata_receivedDataLength=64;
|
|
||||||
tslib_strclr(Sdata_receivedDataBlock,0,64);
|
|
||||||
tslib_strcpy(receivedData, Sdata_receivedDataBlock, Sdata_receivedDataLength);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad)
|
uint16_t epi_getLastPayLoad(uint16_t plBufSiz, uint8_t *payLoad) {
|
||||||
{
|
|
||||||
// get data back in *pl, max 64 byte
|
// get data back in *pl, max 64 byte
|
||||||
// retval = nr of bytes received. If host buffer too small then
|
// retval = nr of bytes received. If host buffer too small then
|
||||||
// only plBufSíz bytes are copied to pl
|
// only plBufSíz bytes are copied to pl
|
||||||
// plBufSíz=size of host buffer
|
// plBufSíz=size of host buffer
|
||||||
|
|
||||||
uint16_t ml=plBufSiz;
|
uint16_t ml = std::min(plBufSiz, (uint16_t)(64));
|
||||||
if (ml>64) ml=64;
|
if (SharedMemBuffer::getDataConst()->Sdata.receivedDataLength < ml) {
|
||||||
if (Sdata_receivedDataLength<ml)
|
ml = SharedMemBuffer::getDataConst()->Sdata.receivedDataLength;
|
||||||
ml=Sdata_receivedDataLength;
|
|
||||||
tslib_strcpy(Sdata_receivedDataBlock, payLoad, ml);
|
|
||||||
return Sdata_receivedDataLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static uint8_t ndbs, pari, nsb, br;
|
|
||||||
|
|
||||||
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
|
||||||
uint8_t parity, uint8_t NrStopBits)
|
|
||||||
{
|
|
||||||
// store numbers
|
|
||||||
ndbs=NrDataBits;
|
|
||||||
pari=parity;
|
|
||||||
nsb=NrStopBits;
|
|
||||||
br=slaveBaudRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|
||||||
uint8_t *parity, uint8_t *NrStopBits)
|
|
||||||
{
|
|
||||||
*NrDataBits=ndbs;
|
|
||||||
*parity=pari;
|
|
||||||
*NrStopBits=nsb;
|
|
||||||
*slaveBaudRate=br;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
|
||||||
uint8_t parity, uint8_t NrStopBits) {
|
|
||||||
// store numbers
|
|
||||||
SharedMemBuffer::write()->ndbs = NrDataBits;
|
|
||||||
SharedMemBuffer::write()->pari = parity;
|
|
||||||
SharedMemBuffer::write()->nsb = NrStopBits;
|
|
||||||
SharedMemBuffer::write()->br = slaveBaudRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|
||||||
uint8_t *parity, uint8_t *NrStopBits) {
|
|
||||||
|
|
||||||
*NrDataBits = SharedMemBuffer::read()->ndbs;
|
|
||||||
*parity = SharedMemBuffer::read()->pari;
|
|
||||||
*NrStopBits = SharedMemBuffer::read()->nsb;
|
|
||||||
*slaveBaudRate = SharedMemBuffer::read()->br;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
QString epi_getSlaveParamSTR()
|
|
||||||
{
|
|
||||||
QString mySt;
|
|
||||||
char ctmp;
|
|
||||||
// uint8_t ndbs;
|
|
||||||
// uint8_t pari;
|
|
||||||
// uint8_t nsb;
|
|
||||||
// uint8_t br;
|
|
||||||
|
|
||||||
mySt.clear();
|
|
||||||
// br=SharedMemBuffer::read()->br;
|
|
||||||
// ndbs=SharedMemBuffer::read()->ndbs;
|
|
||||||
// pari =SharedMemBuffer::read()->pari;
|
|
||||||
// nsb=SharedMemBuffer::read()->nsb;
|
|
||||||
|
|
||||||
switch (br)
|
|
||||||
{
|
|
||||||
case 1: mySt="1200 ";break;
|
|
||||||
case 2: mySt="9600 ";break;
|
|
||||||
case 3: mySt="19200 ";break;
|
|
||||||
case 4: mySt="38400 ";break;
|
|
||||||
case 5: mySt="57600 ";break;
|
|
||||||
case 6: mySt="115200 ";break;
|
|
||||||
}
|
}
|
||||||
|
strncpy((char *)payLoad,
|
||||||
|
(char const *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
|
ml);
|
||||||
|
|
||||||
|
return SharedMemBuffer::getDataConst()->Sdata.receivedDataLength;
|
||||||
ctmp=ndbs;
|
|
||||||
ctmp+=0x30;
|
|
||||||
mySt.append(ctmp);
|
|
||||||
ctmp=pari;
|
|
||||||
mySt.append(ctmp);
|
|
||||||
ctmp=nsb;
|
|
||||||
ctmp+=0x30;
|
|
||||||
mySt.append(ctmp);
|
|
||||||
//mySt="Hallo";
|
|
||||||
return mySt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
118
src/datIf.cpp
118
src/datIf.cpp
@ -3,16 +3,13 @@
|
|||||||
#include "controlBus.h"
|
#include "controlBus.h"
|
||||||
#include "storeINdata.h"
|
#include "storeINdata.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <datei.h>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
|
|
||||||
// called from MainWindow()
|
// called from MainWindow()
|
||||||
|
|
||||||
|
|
||||||
#define DATIF_MAXCMDS 16
|
#define DATIF_MAXCMDS 16
|
||||||
static uint8_t dif_dataStep;
|
static uint8_t dif_dataStep;
|
||||||
static uint8_t dif_scanStep; //, RDBLKNR;
|
static uint8_t dif_scanStep, RDBLKNR;
|
||||||
|
|
||||||
|
|
||||||
static uint8_t datif_OutCmdpara1, datif_OutCmdpara2, datif_OutCmdpara3, datif_OutCmdpara4;
|
static uint8_t datif_OutCmdpara1, datif_OutCmdpara2, datif_OutCmdpara3, datif_OutCmdpara4;
|
||||||
@ -20,13 +17,10 @@ static uint16_t datif_OutCmdpara5;
|
|||||||
static uint32_t datif_OutCmdpara6;
|
static uint32_t datif_OutCmdpara6;
|
||||||
static uint8_t cycl_running;
|
static uint8_t cycl_running;
|
||||||
|
|
||||||
|
//static bool datif_DCdataValid;
|
||||||
|
|
||||||
T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
||||||
{
|
{
|
||||||
QByteArray myBA;
|
|
||||||
QDir myDir("../dmd");
|
|
||||||
|
|
||||||
if (!myDir.exists())
|
|
||||||
myDir.mkdir("../dmd");
|
|
||||||
|
|
||||||
myDCIF = new T_prot();
|
myDCIF = new T_prot();
|
||||||
|
|
||||||
@ -40,7 +34,7 @@ T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
|||||||
datif_trigger = new QTimer();
|
datif_trigger = new QTimer();
|
||||||
connect(datif_trigger, SIGNAL(timeout()), this, SLOT(datif_cycleSend()));
|
connect(datif_trigger, SIGNAL(timeout()), this, SLOT(datif_cycleSend()));
|
||||||
datif_trigger->setSingleShot(false);
|
datif_trigger->setSingleShot(false);
|
||||||
datif_trigger->start(10); // in ms,
|
datif_trigger->start(10); // in ms, 80 gut, default 100 50....200
|
||||||
|
|
||||||
// passing Signal through
|
// passing Signal through
|
||||||
//connect(myDCIF, SIGNAL(framerecieved()), this, SLOT( ResponseRecieved() ));
|
//connect(myDCIF, SIGNAL(framerecieved()), this, SLOT( ResponseRecieved() ));
|
||||||
@ -54,30 +48,9 @@ T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
|||||||
dif_scanStep=0;
|
dif_scanStep=0;
|
||||||
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
||||||
cycl_running=0;
|
cycl_running=0;
|
||||||
|
//datif_DCdataValid=0;
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0);
|
||||||
datif_noResponseCtr=0;
|
datif_noResponseCtr=0;
|
||||||
|
|
||||||
|
|
||||||
// neu, 24.5.23: Alle Daten zusätzlich in Datei speichern
|
|
||||||
// if (datei_ifFileExists(FILENAME_SHAREDDATA))
|
|
||||||
// {
|
|
||||||
// myBA.clear();
|
|
||||||
// myBA=datei_readFromFile(FILENAME_SHAREDDATA);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Testfile ereugen:
|
|
||||||
csv_startCreatingFile();
|
|
||||||
csv_addUintToFile(0);
|
|
||||||
csv_addUintToFile(1);
|
|
||||||
csv_addUintToFile(2);
|
|
||||||
csv_addUintToFile(3);
|
|
||||||
csv_addUintToFile(4);
|
|
||||||
csv_addUintToFile(5);
|
|
||||||
myBA=csv_readbackArray();
|
|
||||||
datei_clearFile(FILENAME_SHAREDDATA);
|
|
||||||
datei_writeToFile(FILENAME_SHAREDDATA, myBA);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_datif::resetChain(void)
|
void T_datif::resetChain(void)
|
||||||
@ -99,7 +72,7 @@ char T_datif::datif_cycleSend()
|
|||||||
|
|
||||||
datif_noResponseCtr++; // inc every 10ms fehlt noch in SysCont
|
datif_noResponseCtr++; // inc every 10ms fehlt noch in SysCont
|
||||||
if (datif_noResponseCtr>500) // seit 5s kein Lebenszeichen von DC2
|
if (datif_noResponseCtr>500) // seit 5s kein Lebenszeichen von DC2
|
||||||
gpi_storeDcDataValid(0);
|
gpi_storeDcDataValid(0); // fehlt in SysCont
|
||||||
|
|
||||||
|
|
||||||
if (cycl_running)
|
if (cycl_running)
|
||||||
@ -132,23 +105,7 @@ char T_datif::datif_cycleSend()
|
|||||||
|
|
||||||
//void myDCIF->sendUserData(uint16_t slaveAdr);
|
//void myDCIF->sendUserData(uint16_t slaveAdr);
|
||||||
|
|
||||||
if (checkNextFDcmd()==2)
|
if (check4FDshortCmd())
|
||||||
{
|
|
||||||
b_ret=longFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &length, data);
|
|
||||||
if (b_ret)
|
|
||||||
{
|
|
||||||
myDCIF->setUserWriteData(nextWrCmd, blockNum, length, data);
|
|
||||||
myDCIF->setUserReadData(nextRdCmd);
|
|
||||||
myDCIF->sendUserData(selectedSlaveAddr);
|
|
||||||
//qDebug()<<"Datif send long cmd "<<nextWrCmd<< " " <<nextRdCmd<< " " <<length << " " << data[0]<< " " << data[1]
|
|
||||||
// << " " << data[2]<< " " << data[3]<< " " << data[4]<< " " << data[5]<< " " << data[6]<< " " << data[7]
|
|
||||||
// << " " << data[8]<< " " << data[9]<< " " << data[10]<< " " << data[11]<< " " << data[12];
|
|
||||||
}
|
|
||||||
cycl_running=1;
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (checkNextFDcmd()==1)
|
|
||||||
{
|
{
|
||||||
b_ret=sendFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &dat1, &dat2, &dat3, &dat4);
|
b_ret=sendFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &dat1, &dat2, &dat3, &dat4);
|
||||||
if (b_ret)
|
if (b_ret)
|
||||||
@ -157,18 +114,19 @@ char T_datif::datif_cycleSend()
|
|||||||
myDCIF->setUserWriteData(nextWrCmd, blockNum, 4, data);
|
myDCIF->setUserWriteData(nextWrCmd, blockNum, 4, data);
|
||||||
myDCIF->setUserReadData(nextRdCmd);
|
myDCIF->setUserReadData(nextRdCmd);
|
||||||
myDCIF->sendUserData(selectedSlaveAddr);
|
myDCIF->sendUserData(selectedSlaveAddr);
|
||||||
//qDebug()<<"Datif send short cmd "<<nextWrCmd<< " " <<nextRdCmd;
|
|
||||||
}
|
}
|
||||||
cycl_running=1;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (check4FDlongCmd())
|
||||||
|
{
|
||||||
|
b_ret=longFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &length, data);
|
||||||
|
if (b_ret)
|
||||||
|
{
|
||||||
|
myDCIF->setUserWriteData(nextWrCmd, blockNum, length, data);
|
||||||
|
myDCIF->setUserReadData(nextRdCmd);
|
||||||
|
myDCIF->sendUserData(selectedSlaveAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// direct commands have highest prio (setting OUTPUTS)
|
// direct commands have highest prio (setting OUTPUTS)
|
||||||
nxtAsCmd=sendWRcmd_getSendCommand0(); // command was stored by Gui
|
nxtAsCmd=sendWRcmd_getSendCommand0(); // command was stored by Gui
|
||||||
@ -362,7 +320,6 @@ void T_datif::sendWRcommand(uint16_t nextWrCmd)
|
|||||||
datif_sendIOrequest(CMD2DC_FAN, CMD2DC_RdBkAllOutputs, 1);
|
datif_sendIOrequest(CMD2DC_FAN, CMD2DC_RdBkAllOutputs, 1);
|
||||||
break;
|
break;
|
||||||
case SENDDIRCMD_LAERM:
|
case SENDDIRCMD_LAERM:
|
||||||
//qDebug()<<"datif switch siren";
|
|
||||||
datif_sendIOrequest(CMD2DC_SIREN, CMD2DC_RdBkAllOutputs, 1);
|
datif_sendIOrequest(CMD2DC_SIREN, CMD2DC_RdBkAllOutputs, 1);
|
||||||
break;
|
break;
|
||||||
case SENDDIRCMD_REL1:
|
case SENDDIRCMD_REL1:
|
||||||
@ -785,7 +742,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
//if (indat_isPrinterOn())
|
if (indat_isPrinterOn())
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0); // 27
|
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0); // 27
|
||||||
// datif_sendIOrequest(0, CMD2DC_RdBk_PrnState, 0);
|
// datif_sendIOrequest(0, CMD2DC_RdBk_PrnState, 0);
|
||||||
break;
|
break;
|
||||||
@ -795,7 +752,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
//if (indat_isMifareOn())
|
if (indat_isMifareOn())
|
||||||
{
|
{
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0); // 109
|
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0); // 109
|
||||||
//qDebug()<<"requesting MIF reader state";
|
//qDebug()<<"requesting MIF reader state";
|
||||||
@ -808,7 +765,6 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
/*
|
|
||||||
if (indat_isMifareOn())
|
if (indat_isMifareOn())
|
||||||
{
|
{
|
||||||
datif_OutCmdpara1=0; // data block number 0 contains the Mifare-ID
|
datif_OutCmdpara1=0; // data block number 0 contains the Mifare-ID
|
||||||
@ -818,8 +774,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
RDBLKNR=0;
|
RDBLKNR=0;
|
||||||
datif_OutCmdpara1=RDBLKNR;
|
datif_OutCmdpara1=RDBLKNR;
|
||||||
|
|
||||||
}*/
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case 17:
|
case 17:
|
||||||
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
@ -827,7 +782,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 18:
|
case 18:
|
||||||
//if (indat_isMdbOn())
|
if (indat_isMdbOn())
|
||||||
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0); // 107
|
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0); // 107
|
||||||
//else
|
//else
|
||||||
// dif_scanStep=24; unsinn
|
// dif_scanStep=24; unsinn
|
||||||
@ -874,7 +829,7 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
|
|
||||||
dif_scanStep++;
|
dif_scanStep++;
|
||||||
if (dif_scanStep>26)
|
if (dif_scanStep>26)
|
||||||
dif_scanStep=0; // dif_scanStep=5;
|
dif_scanStep=5;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -907,10 +862,7 @@ void T_datif::StoredRecData()
|
|||||||
// "neu" is the same as "INdataValid"
|
// "neu" is the same as "INdataValid"
|
||||||
loadRecDataFromFrame();
|
loadRecDataFromFrame();
|
||||||
}
|
}
|
||||||
//cycl_running=0; // send next cmd immediately
|
cycl_running=0;
|
||||||
cycl_running=9; // send next cmd after 10ms
|
|
||||||
// wichtig! bei 0 werden Telegramme verschluckt! 24.5.2023
|
|
||||||
// 9 ergibt 16ms Formel: gap = 110ms (Zeile 80) - cycl_running*10ms
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char T_datif::loadRecDataFromFrame()
|
char T_datif::loadRecDataFromFrame()
|
||||||
@ -935,14 +887,20 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
ret=myDCIF->getReceivedInData(&SlaveAdr, &readSource, &readAddress, &RdDleng, receivedData);
|
ret=myDCIF->getReceivedInData(&SlaveAdr, &readSource, &readAddress, &RdDleng, receivedData);
|
||||||
// retval: data valid, only one time true, true if CommandState OK and readState OK
|
// retval: data valid, only one time true, true if CommandState OK and readState OK
|
||||||
gpi_storeResultOfLastRequest(ret);
|
gpi_storeResultOfLastRequest(ret);
|
||||||
|
|
||||||
|
|
||||||
|
qCritical() << "loadRecDataFromFrame() readSource = " << readSource;
|
||||||
|
|
||||||
if (ret==false)
|
if (ret==false)
|
||||||
{
|
{
|
||||||
// qDebug() << "datif: rec data not valid";
|
qCritical() << "datif: rec data not valid";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpi_storeRecPayLoad(RdDleng, receivedData); // save for host (user of hwapi)
|
gpi_storeRecPayLoad(RdDleng, receivedData); // save for host (user of hwapi)
|
||||||
|
|
||||||
|
|
||||||
|
qCritical() << "loadRecDataFromFrame() readSource = " << readSource;
|
||||||
//qDebug() << "\n datif: got valid data, rdsrc:" << readSource << " rdadd:" << readAddress
|
//qDebug() << "\n datif: got valid data, rdsrc:" << readSource << " rdadd:" << readAddress
|
||||||
// << " rdlen:" << RdDleng;
|
// << " rdlen:" << RdDleng;
|
||||||
// qDebug("datif_recData: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d ",
|
// qDebug("datif_recData: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d ",
|
||||||
@ -1084,7 +1042,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
//<< receivedData[3] << " " << receivedData[4] << " " << receivedData[5];
|
//<< receivedData[3] << " " << receivedData[4] << " " << receivedData[5];
|
||||||
|
|
||||||
uctmp=receivedData[0];
|
uctmp=receivedData[0];
|
||||||
//qDebug()<<"datif DOOR bits: "<< (uctmp&1) << (uctmp&2) << (uctmp&4);
|
// qDebug()<<"datif single bits: "<< (uctmp&1) << (uctmp&2) << (uctmp&4);
|
||||||
gpi_storeDI_doorSwitches(uctmp&1, uctmp&2, uctmp&4);
|
gpi_storeDI_doorSwitches(uctmp&1, uctmp&2, uctmp&4);
|
||||||
|
|
||||||
gpi_storeDI_vaultSwitches(uctmp&8, uctmp&16);
|
gpi_storeDI_vaultSwitches(uctmp&8, uctmp&16);
|
||||||
@ -1113,6 +1071,8 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeDI_GsmPowerIsOn(uctmp&16);
|
gpi_storeDI_GsmPowerIsOn(uctmp&16);
|
||||||
gpi_storeDI_CreditPowerIsOn(uctmp&32);
|
gpi_storeDI_CreditPowerIsOn(uctmp&32);
|
||||||
gpi_storeDI_PrinterPowerIsOn(uctmp&64);
|
gpi_storeDI_PrinterPowerIsOn(uctmp&64);
|
||||||
|
|
||||||
|
//gpi_storeMdbState(uctmp&4, uctmp&128, uctmp&4); // hat ein eigenes Cmd weiter unten!
|
||||||
gpi_storeDI_MdbPowerIsOn(uctmp&128);
|
gpi_storeDI_MdbPowerIsOn(uctmp&128);
|
||||||
|
|
||||||
gpi_storeDI_paperLow(receivedData[5]);
|
gpi_storeDI_paperLow(receivedData[5]);
|
||||||
@ -1240,11 +1200,10 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
case CMD2DC_MDB_GET_STATE: //107
|
case CMD2DC_MDB_GET_STATE: //107
|
||||||
// DB0: mdb_bus_ready (switched on)
|
// DB0: mdb_bus_ready (switched on)
|
||||||
// DB1: rdBackV12devicePower
|
// DB1: rdBackV12devicePower
|
||||||
// DB2: rdBackV5busPwr kommt immer mit 1
|
// DB2: rdBackV5busPwr
|
||||||
|
|
||||||
//qDebug() << "got MDB state " << receivedData[0] << " " << receivedData[1] << " " << receivedData[2];
|
//qDebug() << "got MDB state " << receivedData[0] << " " << receivedData[1] << " " << receivedData[2];
|
||||||
gpi_storeMdbState(receivedData[0],receivedData[1],receivedData[2]);
|
gpi_storeMdbState(receivedData[0],receivedData[1],receivedData[2]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_MDB_GETRESP: //22
|
case CMD2DC_MDB_GETRESP: //22
|
||||||
@ -1259,7 +1218,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_EMP_GET_ALL: //23
|
case CMD2DC_EMP_GET_ALL: //23
|
||||||
//qDebug() << "got emp parameters "<< receivedData[1];
|
qCritical() << "got emp parameters "<< receivedData[1];
|
||||||
gpi_storeEmpSettings(64, receivedData);
|
gpi_storeEmpSettings(64, receivedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1445,6 +1404,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
}
|
}
|
||||||
qDebug()<<" store new coin"<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
qDebug()<<" store new coin"<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 113: // get wake source, 8byte
|
case 113: // get wake source, 8byte
|
||||||
@ -1554,6 +1514,7 @@ qDebug()<<" store new coin"<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
|||||||
outBuf[pBuf++]=0;
|
outBuf[pBuf++]=0;
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (RdDleng>40)
|
if (RdDleng>40)
|
||||||
//datif_DCdataValid=1; // das hier sind die wichtigsten Daten, deshalb hierrein!
|
//datif_DCdataValid=1; // das hier sind die wichtigsten Daten, deshalb hierrein!
|
||||||
gpi_storeDcDataValid(1);
|
gpi_storeDcDataValid(1);
|
||||||
@ -1657,11 +1618,6 @@ struct T_vaultRecord
|
|||||||
gpi_storeVaultRecord(readAddress, receivedData ); // always 64byte
|
gpi_storeVaultRecord(readAddress, receivedData ); // always 64byte
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 39:
|
|
||||||
gpi_storeDynData(receivedData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
readSource=0; // 17.05.2023: to avoid multiple recording
|
readSource=0; // 17.05.2023: to avoid multiple recording
|
||||||
|
|
||||||
|
943
src/datei.cpp
943
src/datei.cpp
@ -1,943 +0,0 @@
|
|||||||
// written by Thomas Sax, Jan.2022
|
|
||||||
#include "datei.h"
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ create csv file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QByteArray datei_writeArray, datei_tempArray;
|
|
||||||
|
|
||||||
void csv_startCreatingFile(void)
|
|
||||||
{
|
|
||||||
datei_writeArray.clear();
|
|
||||||
datei_tempArray.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void csv_addTextToFile(QString myText)
|
|
||||||
{
|
|
||||||
datei_writeArray.append(myText.toLatin1());
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void csv_addIntToFile(int myValue)
|
|
||||||
{
|
|
||||||
//qulonglong ullt=12345678901234567890; // max 1,844 x10^19
|
|
||||||
datei_tempArray.setNum(myValue,10); // accepted types: short, ushort, int, uint,
|
|
||||||
// qlonglong, qulonglong, float, double
|
|
||||||
// numerbase can be 2...36(!),10=dec
|
|
||||||
|
|
||||||
datei_writeArray.append(datei_tempArray);
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void csv_addUintToFile(uint myValue)
|
|
||||||
{
|
|
||||||
datei_tempArray.setNum(myValue,10);
|
|
||||||
datei_writeArray.append(datei_tempArray);
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void csv_addLongvalToFile(qlonglong myValue)
|
|
||||||
{
|
|
||||||
datei_tempArray.setNum(myValue,10);
|
|
||||||
datei_writeArray.append(datei_tempArray);
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void csv_addUlongvalToFile(qulonglong myValue)
|
|
||||||
{
|
|
||||||
datei_tempArray.setNum(myValue,10);
|
|
||||||
datei_writeArray.append(datei_tempArray);
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void csv_addCurrentTimeToFile(void)
|
|
||||||
{
|
|
||||||
uint8_t hour, minute, sec, ui8buf[20];
|
|
||||||
char buf[20];
|
|
||||||
|
|
||||||
config_getSysTime(&hour, &minute, &sec);
|
|
||||||
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<20; nn++)
|
|
||||||
buf[nn]=char(ui8buf[nn]);
|
|
||||||
datei_writeArray.append(buf,8); // time string
|
|
||||||
datei_writeArray.append(FILESEPERATOR);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void csv_addCurrentDateToFile(void)
|
|
||||||
{
|
|
||||||
uint16_t year;
|
|
||||||
uint8_t month, day, ui8buf[20];
|
|
||||||
char buf[20];
|
|
||||||
|
|
||||||
config_getSystemDate(&year, &month, &day);
|
|
||||||
//qDebug()<<"date year: "<<year;
|
|
||||||
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<20; nn++)
|
|
||||||
buf[nn]=char(ui8buf[nn]);
|
|
||||||
datei_writeArray.append(buf, 10); // date string
|
|
||||||
datei_writeArray.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void csv_addNewlineToFile(void)
|
|
||||||
{
|
|
||||||
datei_writeArray.chop(1); // Komma weg
|
|
||||||
datei_writeArray.append(NEWLINEINFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray csv_readbackArray(void)
|
|
||||||
{
|
|
||||||
return datei_writeArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
QByteArray csv_writeContent_testValues(void)
|
|
||||||
{
|
|
||||||
QByteArray myBA, tmpBA;
|
|
||||||
uint8_t modCount=5, modAddr=23;
|
|
||||||
uint8_t hour, minute, sec, month, day, ui8buf[20];
|
|
||||||
uint16_t year, modType=45678;
|
|
||||||
char buf[20];
|
|
||||||
uint32_t modNrDIs=1234567890;
|
|
||||||
uint8_t modNrAIs=4, modNrCtr=2, modNrDOs=8;
|
|
||||||
int modNrAOs=-2;
|
|
||||||
|
|
||||||
myBA.clear();
|
|
||||||
tmpBA.clear();
|
|
||||||
myBA.append("scan time");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
|
|
||||||
datei_getSysTime(&hour, &minute, &sec);
|
|
||||||
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<20; nn++)
|
|
||||||
buf[nn]=char(ui8buf[nn]);
|
|
||||||
myBA.append(buf,8); // time string
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
|
|
||||||
datei_getSystemDate(&year, &month, &day);
|
|
||||||
//qDebug()<<"date year: "<<year;
|
|
||||||
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<20; nn++)
|
|
||||||
buf[nn]=char(ui8buf[nn]);
|
|
||||||
myBA.append(buf, 10); // date string
|
|
||||||
myBA.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
myBA.append("number of modules");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modCount,10); //2nd para = number base 2, 8, 10 or 16 (bin, oct, dec, hex)
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
myBA.append("busaddr");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("type");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("NrOfDI");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("NrOfAI");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("NrOfCtrIn");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("NrOfDO");
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
myBA.append("NrOfAO");
|
|
||||||
myBA.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
tmpBA.setNum(modAddr,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modType,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modNrDIs,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modNrAIs,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modNrCtr,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modNrDOs,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(FILESEPERATOR);
|
|
||||||
tmpBA.setNum(modNrAOs,10);
|
|
||||||
myBA.append(tmpBA);
|
|
||||||
myBA.append(NEWLINEINFILE);
|
|
||||||
return myBA;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ parse csv file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// first: QByteArray datei_readFromFile(QString filename);
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t csv_nrOfEntriesInFile(QByteArray readFromFile)
|
|
||||||
{
|
|
||||||
// count sequences between FILESEPERATOR and NEWLINEINFILE
|
|
||||||
uint32_t filSize=0, pp=0;
|
|
||||||
char oneByt=0;
|
|
||||||
|
|
||||||
int filLen=readFromFile.size();
|
|
||||||
if(filLen>1)
|
|
||||||
filSize=uint32_t(filLen);
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// 1) find position of seperators
|
|
||||||
for (uint32_t ii=0; ii<filSize; ii++)
|
|
||||||
{
|
|
||||||
oneByt=readFromFile[ii];
|
|
||||||
if (oneByt==FILESEP1 || oneByt==FILESEP2 || oneByt==NEWLINEINFILE)
|
|
||||||
pp++;
|
|
||||||
}
|
|
||||||
// now: pp = number of seperators
|
|
||||||
// oneByt = last byte in file. If it's not a seperator then
|
|
||||||
// there's one more entry (last entry without termination)
|
|
||||||
if (oneByt !=FILESEP1 && oneByt !=FILESEP2 && oneByt !=NEWLINEINFILE)
|
|
||||||
pp++;
|
|
||||||
//qDebug()<<"csv: nr of sequences="<< pp;
|
|
||||||
return pp;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray csv_getOneFileSequence(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
// seperate file content in single sequences between FILESEPERATOR and NEWLINEINFILE
|
|
||||||
// and return "entryNr" - entry
|
|
||||||
// for this first step leave data type QByteArray
|
|
||||||
// 2nd step can change in numbers and strings
|
|
||||||
QByteArray sequence;
|
|
||||||
uint32_t sepPos[MAXNUMBEROFSEQUENCES];
|
|
||||||
uint32_t filSize=0, pp=0, ii, start=0, ende=0;
|
|
||||||
char oneByt;
|
|
||||||
int filLen, mm;
|
|
||||||
|
|
||||||
filLen=sourceFile.size();
|
|
||||||
//qDebug()<<"fillen="<< filLen;
|
|
||||||
if(filLen<10)
|
|
||||||
return "";
|
|
||||||
filSize=uint32_t(filLen);
|
|
||||||
|
|
||||||
if (sequNr>MAXNUMBEROFSEQUENCES)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
// 1) find position of seperators
|
|
||||||
for (ii=0; ii<filSize; ii++)
|
|
||||||
{
|
|
||||||
oneByt=sourceFile[ii];
|
|
||||||
if (oneByt==FILESEP1 || oneByt==FILESEP2 || oneByt==NEWLINEINFILE)
|
|
||||||
{
|
|
||||||
sepPos[pp++]=ii;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// now: pp = number of entries
|
|
||||||
//qDebug()<<"nr of seperators="<< pp;
|
|
||||||
|
|
||||||
if (sequNr>=pp)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
// 2) get sequence
|
|
||||||
if (sequNr==0)
|
|
||||||
{
|
|
||||||
start=0;
|
|
||||||
ende=sepPos[sequNr];
|
|
||||||
} else
|
|
||||||
if (sequNr>0)
|
|
||||||
{
|
|
||||||
start=sepPos[sequNr-1]+1;
|
|
||||||
ende=sepPos[sequNr];
|
|
||||||
}
|
|
||||||
|
|
||||||
//qDebug()<<"datei getOneFileSequence start/ende: "<<start << " " << ende;
|
|
||||||
if (start>=ende)
|
|
||||||
return "";
|
|
||||||
//return "-err3-";
|
|
||||||
sequence.clear();
|
|
||||||
//batmp.clear();
|
|
||||||
pp=0;
|
|
||||||
for (ii=start; ii<ende; ii++)
|
|
||||||
{
|
|
||||||
mm=int(ii);
|
|
||||||
if (mm>=int(filSize))
|
|
||||||
mm=0;
|
|
||||||
oneByt=sourceFile.at(mm);
|
|
||||||
sequence.append(oneByt);
|
|
||||||
}
|
|
||||||
return sequence;
|
|
||||||
}
|
|
||||||
|
|
||||||
int csv_getEntryAsInt(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA, myVA;
|
|
||||||
int entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
myVA.clear();
|
|
||||||
myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
//qDebug()<<"datei getEntryAsInt, sequence: " << myBA;
|
|
||||||
|
|
||||||
entry=myBA.toInt(&ok,16);
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
//qDebug()<<"datei getEntryAsInt, number: " << entry;
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
//qDebug()<<"datei getEntryAsInt, error " << myBA;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t csv_getEntryAsLong(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
long entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
entry=myBA.toLong(&ok,10);
|
|
||||||
if (ok)
|
|
||||||
return entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t csv_getEntryAsUshort(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
uint8_t entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
entry=uint8_t(myBA.toUShort(&ok,10));
|
|
||||||
if (ok)
|
|
||||||
return entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t csv_getEntryAsUint(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
uint16_t entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
entry=uint16_t(myBA.toUInt(&ok,10));
|
|
||||||
if (ok)
|
|
||||||
return entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t csv_getEntryAsUlong(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
uint32_t entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
entry=myBA.toULong(&ok,10);
|
|
||||||
if (ok)
|
|
||||||
return entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t csv_getEntryAs2Ulong(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
uint64_t entry=0;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
entry=myBA.toULongLong(&ok,10);
|
|
||||||
if (ok)
|
|
||||||
return entry;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString csv_getEntryAsString(QByteArray sourceFile, uint32_t sequNr)
|
|
||||||
{
|
|
||||||
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
|
|
||||||
QString entry;
|
|
||||||
|
|
||||||
//qDebug()<<"datei getEntryAsString, sequence: " << myBA;
|
|
||||||
entry=myBA.toStdString().c_str();
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ create Json file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
example
|
|
||||||
QString str = "{"
|
|
||||||
" \"Herausgeber\": \"Xema\","
|
|
||||||
" \"Nummer\": \"1234-5678-9012-3456\","
|
|
||||||
" \"Deckung\": 2e+6,"
|
|
||||||
" \"Währung\": \"EURO\","
|
|
||||||
" \"Inhaber\": {"
|
|
||||||
" \"Name\": \"Mustermann\","
|
|
||||||
" \"Vorname\": \"Max\","
|
|
||||||
" \"männlich\": true,"
|
|
||||||
" \"Hobbys\": [ \"Reiten\", \"Golfen\", \"Lesen\" ],"
|
|
||||||
" \"Alter\": 42,"
|
|
||||||
" \"Kinder\": [],"
|
|
||||||
" \"Partner\": null"
|
|
||||||
" }"
|
|
||||||
"}";
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
QString myJsonCon;
|
|
||||||
QString tmpStr;
|
|
||||||
|
|
||||||
void json_startRecord(void)
|
|
||||||
{
|
|
||||||
myJsonCon.clear();
|
|
||||||
tmpStr.clear();
|
|
||||||
myJsonCon.append('{');
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_enterIntToRecord(QString attribute, ulong i_value)
|
|
||||||
{
|
|
||||||
tmpStr.clear();
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
tmpStr.setNum(i_value);
|
|
||||||
myJsonCon.append(tmpStr);
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_enterTextToRecord(QString attribute, QString txt_value)
|
|
||||||
{
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(txt_value);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
void json_addCurrentTimeToRecord(QString attribute)
|
|
||||||
{
|
|
||||||
uint8_t hour, minute, sec, ui8buf[20];
|
|
||||||
//char buf[20];
|
|
||||||
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
myJsonCon.append('"');
|
|
||||||
|
|
||||||
datei_getSysTime(&hour, &minute, &sec);
|
|
||||||
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<8; nn++)
|
|
||||||
myJsonCon.append(ui8buf[nn]);
|
|
||||||
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_addCurrentDateToRecord(QString attribute)
|
|
||||||
{
|
|
||||||
uint16_t year;
|
|
||||||
uint8_t month, day, ui8buf[20];
|
|
||||||
//char buf[20];
|
|
||||||
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
myJsonCon.append('"');
|
|
||||||
|
|
||||||
datei_getSystemDate(&year, &month, &day);
|
|
||||||
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
|
|
||||||
for (uint8_t nn=0; nn<10; nn++)
|
|
||||||
myJsonCon.append(ui8buf[nn]);
|
|
||||||
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void json_enterArrayToRecord(QString attribute, uint8_t *buf, ulong nrofVals)
|
|
||||||
{
|
|
||||||
// add array of numbers with "nrofVals" elements
|
|
||||||
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
myJsonCon.append('['); // eckig!!!
|
|
||||||
for (ulong ul=0; ul<nrofVals; ul++)
|
|
||||||
{
|
|
||||||
tmpStr.setNum(buf[ul]);
|
|
||||||
myJsonCon.append(tmpStr);
|
|
||||||
myJsonCon.append(',');
|
|
||||||
}
|
|
||||||
myJsonCon.chop(1); // Komma weg
|
|
||||||
myJsonCon.append(']'); // eckig!!!
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_enterStructToRecord(QString attribute)
|
|
||||||
{
|
|
||||||
// every call must be concluded with "json_finishFile()"
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(attribute);
|
|
||||||
myJsonCon.append('"');
|
|
||||||
myJsonCon.append(':');
|
|
||||||
myJsonCon.append('{'); // geschweift!!
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_finishStruct(void)
|
|
||||||
{
|
|
||||||
myJsonCon.chop(2); // remove , and \r from the end
|
|
||||||
myJsonCon.append('}');
|
|
||||||
myJsonCon.append(',');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void json_finishRecord(void)
|
|
||||||
{
|
|
||||||
myJsonCon.chop(2); // remove , and \r from the end
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
myJsonCon.append('}');
|
|
||||||
myJsonCon.append(NEWLINEINFILE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString json_readbackRecordStr(void)
|
|
||||||
{
|
|
||||||
return myJsonCon;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray json_readbackRecordBa(void)
|
|
||||||
{
|
|
||||||
return myJsonCon.toLatin1();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ parse Json file -------------------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
example Json File:
|
|
||||||
{"temperature":28,
|
|
||||||
"snow":"no",
|
|
||||||
"Zeit":"16_21_45",
|
|
||||||
"sunny":"12h",
|
|
||||||
"humidity":75,
|
|
||||||
"wann ":"24.01.2022",
|
|
||||||
"unterstruktur":{
|
|
||||||
"day of week":"tuesday",
|
|
||||||
"year":22,
|
|
||||||
"month":1,
|
|
||||||
"day":24},
|
|
||||||
"fast am":"Ende",
|
|
||||||
"Puffer":[8,3,9,2,10]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// first: QByteArray datei_readFromFile(QString filename);
|
|
||||||
|
|
||||||
|
|
||||||
int json_nrOfPairsInFile(QByteArray filename)
|
|
||||||
{
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
// key value pair consisting of key (unique string) and value (QJsonValue)
|
|
||||||
int nrOfPairs=jobj.size();
|
|
||||||
|
|
||||||
qDebug() << "my Json file has got: " << nrOfPairs<< "pairs";
|
|
||||||
return nrOfPairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool json_exists(QByteArray filename, QString searchForKey)
|
|
||||||
{
|
|
||||||
// look for "searchForKey" =name of the pair (left of : )
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchForKey))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool json_remove(QByteArray filename, QString searchFor)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and remove the record from file
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchFor))
|
|
||||||
{
|
|
||||||
jobj.remove(searchFor);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString json_searchForStringInFile(QByteArray filename, QString searchFor)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchFor))
|
|
||||||
{
|
|
||||||
return jobj[searchFor].toString(); // toObject(); toArray();
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "pairname not found in Json file";
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int json_searchForIntInFile(QByteArray filename, QString searchFor)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchFor))
|
|
||||||
{
|
|
||||||
return jobj[searchFor].toInt(); // toObject(); toArray();
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "number not found in Json file";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool json_searchForObjectInFile(QByteArray filename, QString searchFor, QJsonObject *oneObject)
|
|
||||||
{
|
|
||||||
// return an object from the json file
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchFor))
|
|
||||||
{
|
|
||||||
*oneObject = jobj[searchFor].toObject();
|
|
||||||
return true;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "Object not found in Json file";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int json_nrOfPairsInObject(QJsonObject objname)
|
|
||||||
{
|
|
||||||
int nrOfPairs=objname.size();
|
|
||||||
qDebug() << "my Json Object has got: " << nrOfPairs<< "pairs";
|
|
||||||
return nrOfPairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString json_searchForStringInObject(QJsonObject objname, QString searchFor)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
if (objname.contains(searchFor))
|
|
||||||
{
|
|
||||||
return objname[searchFor].toString();
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "string not found in Json object";
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int json_searchForIntInObject(QJsonObject objname, QString searchFor)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
|
|
||||||
if (objname.contains(searchFor))
|
|
||||||
{
|
|
||||||
return objname[searchFor].toInt();
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "number not found in Json file";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool json_searchForArrayInFile(QByteArray filename, QString searchFor, QJsonArray *oneArray)
|
|
||||||
{
|
|
||||||
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
|
|
||||||
if (jobj.contains(searchFor))
|
|
||||||
{
|
|
||||||
*oneArray = jobj[searchFor].toArray();
|
|
||||||
return true;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug() << "Array not found in Json file";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int json_nrOfValuesInArray(QJsonArray arrayname)
|
|
||||||
{
|
|
||||||
int nrOfPairs=arrayname.size();
|
|
||||||
qDebug() << "my Json Array has got: " << nrOfPairs<< "values";
|
|
||||||
return nrOfPairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool json_getValuesOfArray(QJsonArray arrayname, int *buf, int MaxBufferSize)
|
|
||||||
{
|
|
||||||
// assuming that the array consists of integers
|
|
||||||
|
|
||||||
/* copy to local buffer:
|
|
||||||
#define MAXNROFARRAYVALUES 100
|
|
||||||
int buf[MAXNROFARRAYVALUES], ii;
|
|
||||||
int nrOfPairs=arrayname.size();
|
|
||||||
|
|
||||||
if (nrOfPairs>MAXNROFARRAYVALUES)
|
|
||||||
nrOfPairs=MAXNROFARRAYVALUES;
|
|
||||||
|
|
||||||
for (ii=0; ii<nrOfPairs; ii++)
|
|
||||||
buf[ii]=arrayname[ii].toInt();
|
|
||||||
*/
|
|
||||||
// copy to host buffer:
|
|
||||||
bool ok=true;
|
|
||||||
int nrOfPairs=arrayname.size();
|
|
||||||
|
|
||||||
if (nrOfPairs>MaxBufferSize)
|
|
||||||
{
|
|
||||||
ok=false; // got not all
|
|
||||||
nrOfPairs=MaxBufferSize;
|
|
||||||
}
|
|
||||||
for (int ii=0; ii<nrOfPairs; ii++)
|
|
||||||
buf[ii]=arrayname[ii].toInt();
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void datei_json_readTestFile(QString filename)
|
|
||||||
{
|
|
||||||
QByteArray my2Ba;
|
|
||||||
QString my2Str;
|
|
||||||
|
|
||||||
my2Str.clear();
|
|
||||||
my2Ba=datei_readFromFile(filename);
|
|
||||||
|
|
||||||
QJsonDocument jdoc = QJsonDocument::fromJson(my2Ba);
|
|
||||||
QJsonObject jobj = jdoc.object();
|
|
||||||
//QJsonParseError jerror;
|
|
||||||
QJsonObject myObj;
|
|
||||||
QJsonArray myArray;
|
|
||||||
|
|
||||||
// key value pair consisting of key (unique string) and value (QJsonValue)
|
|
||||||
int nrOfPairs=jobj.size();
|
|
||||||
qDebug() << "my Json file has got: " << nrOfPairs<< "pairs";
|
|
||||||
|
|
||||||
if (jobj.contains("Zeit"))
|
|
||||||
qDebug() << "my Json file: " << jobj["Zeit"].toString(); // toObject(); toArray();
|
|
||||||
else
|
|
||||||
qDebug() << "my Json file contains no Zeit";
|
|
||||||
|
|
||||||
if (jobj.contains("Humidity"))
|
|
||||||
qDebug() << "my Json file: " << jobj["humidity"].toInt();
|
|
||||||
else
|
|
||||||
qDebug() << "my Json file contains no Humidity";
|
|
||||||
|
|
||||||
if (jobj.contains("month"))
|
|
||||||
qDebug() << "my Json file: " << jobj["month"].toObject(); // anzeige QJsonObject()
|
|
||||||
else
|
|
||||||
qDebug() << "my Json file contains no month";
|
|
||||||
|
|
||||||
|
|
||||||
myObj=jobj["unterstruktur"].toObject();
|
|
||||||
qDebug() << "my unterstruktur: " << myObj["month"].toInt();
|
|
||||||
qDebug() << "my unterstruktur: " << myObj["day of week"].toString();
|
|
||||||
//if (jerror.error == QJsonParseError::NoError)
|
|
||||||
// qDebug() << "no error";
|
|
||||||
|
|
||||||
qDebug() << "my Month: " << myObj["Month"].toInt();
|
|
||||||
//if (myObj["Month"] == QJsonValue::Undefined)
|
|
||||||
// qDebug() << "no found"; geht nicht
|
|
||||||
|
|
||||||
//if (jerror.error != QJsonParseError::NoError)
|
|
||||||
// qDebug() << "no found";
|
|
||||||
|
|
||||||
myArray=jobj["Puffer"].toArray();
|
|
||||||
qDebug() << "my array " <<myArray[2].toInt();
|
|
||||||
//if (jerror.error != QJsonParseError::NoError)
|
|
||||||
// qDebug() << "no found";
|
|
||||||
|
|
||||||
if ( !jobj.contains("Puffer"))
|
|
||||||
qDebug() << "no Puffer found";
|
|
||||||
|
|
||||||
if ( !myArray.contains(20))
|
|
||||||
qDebug() << "no entry found";
|
|
||||||
} */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
// ------------------------------------------------------ read, write, copy files -------------------
|
|
||||||
// -------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void datei_closeFile(QString filename)
|
|
||||||
{
|
|
||||||
QFile file(filename);
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray datei_readFromFile(QString filename)
|
|
||||||
{
|
|
||||||
//QFile file("/own/H2B/dc2.hex");
|
|
||||||
//QFile file(FILENAME_STRUCTURE);
|
|
||||||
QFile file;
|
|
||||||
file.setFileName(filename);
|
|
||||||
QByteArray myBA;
|
|
||||||
|
|
||||||
myBA.clear();
|
|
||||||
if (!file.exists())
|
|
||||||
{
|
|
||||||
qDebug()<<"file not exists";
|
|
||||||
return myBA;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if (!file.open(QIODevice::ReadOnly) )
|
|
||||||
{
|
|
||||||
qDebug()<<"cannot open";
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//qDebug()<<"loading file with " << file.size() <<"byte";
|
|
||||||
myBA = file.readAll();
|
|
||||||
//qDebug()<<"datei read: " << myBA;
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return myBA;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool datei_ifFileExists(QString filename)
|
|
||||||
{
|
|
||||||
|
|
||||||
QFile file;
|
|
||||||
file.setFileName(filename);
|
|
||||||
|
|
||||||
if (file.exists())
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char datei_writeToFile(QString filename, QByteArray content)
|
|
||||||
{
|
|
||||||
// retval=0 if successful 1: no write access allowed 2:cannot open to append 3:cannot create new file
|
|
||||||
QFile file(filename);
|
|
||||||
QFileInfo myFI(filename);
|
|
||||||
|
|
||||||
//if (!myFI.isWritable()) //geht nur bei NTFS, weg.
|
|
||||||
//{
|
|
||||||
//file.setPermissions(filename, QFile::WriteOther); geht nicht :(
|
|
||||||
// qDebug()<<"datei_writeToFile: writing not allowed. set attributes first!";
|
|
||||||
// return 1;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
if (!file.open(QIODevice::Append))
|
|
||||||
{
|
|
||||||
qDebug()<<"datei_writeToFile cannot open to append";
|
|
||||||
return 2;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// add new object to the end of the file
|
|
||||||
file.write(content);
|
|
||||||
file.close();
|
|
||||||
return 0; // OK
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if (!file.open(QIODevice::WriteOnly))
|
|
||||||
{
|
|
||||||
qDebug()<<"datei_writeToFile cannot open new";
|
|
||||||
return 3;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
qDebug()<<"create new file";
|
|
||||||
// write first lines into file
|
|
||||||
file.write(content);
|
|
||||||
file.close();
|
|
||||||
return 0; // OK
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool datei_copyFile(QString currentFileName, QString newFileName)
|
|
||||||
{
|
|
||||||
// retval=true if successful
|
|
||||||
QFile file;
|
|
||||||
file.setFileName(currentFileName);
|
|
||||||
return file.copy(newFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool datei_clearFile(QString filename)
|
|
||||||
{
|
|
||||||
// retval=true if successful
|
|
||||||
QFile file;
|
|
||||||
file.setFileName(filename);
|
|
||||||
|
|
||||||
file.remove(); // 3.2.22 erst ganz löschen wegen Schreibrechten
|
|
||||||
if (!file.open(QIODevice::WriteOnly))
|
|
||||||
{
|
|
||||||
qDebug()<<"datei_clearFile cannot open file to delete";
|
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
file.write(0);
|
|
||||||
file.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
25
src/hwChk.cpp
Executable file
25
src/hwChk.cpp
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "hwChk.h"
|
||||||
|
|
||||||
|
|
||||||
|
hwChk::hwChk(QWidget *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
// myDCIF = new T_prot();
|
||||||
|
// h: T_prot *myDCIF;
|
||||||
|
|
||||||
|
//myDatif = new T_datif();
|
||||||
|
HWaccess = new hwinf();
|
||||||
|
|
||||||
|
struct T_moduleCondition dcModCond;
|
||||||
|
sys_getDeviceConditions(dcModCond);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
hwChk::~hwChk()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
815
src/hwapi.cpp
815
src/hwapi.cpp
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
|||||||
#include <QCoreApplication>
|
|
||||||
#include "tslib.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QCoreApplication a(argc, argv);
|
|
||||||
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
@ -433,7 +433,8 @@ uint8_t recBuffer[FRAME_MAXLEN];
|
|||||||
|
|
||||||
// read from "VCP":
|
// read from "VCP":
|
||||||
mySerialPort->readFromSerial(Indata, recLength);
|
mySerialPort->readFromSerial(Indata, recLength);
|
||||||
//qDebug()<<"prot: got data " << recLength;
|
qCritical()<<"prot: got data " << recLength;
|
||||||
|
qCritical()<<" Indata: " << Indata;
|
||||||
if (recLength>FRAME_MAXLEN)
|
if (recLength>FRAME_MAXLEN)
|
||||||
recLength=FRAME_MAXLEN;
|
recLength=FRAME_MAXLEN;
|
||||||
for (int nn=0; nn<recLength; nn++)
|
for (int nn=0; nn<recLength; nn++)
|
||||||
@ -443,6 +444,9 @@ uint8_t recBuffer[FRAME_MAXLEN];
|
|||||||
tempStr.clear();
|
tempStr.clear();
|
||||||
//uint8_t result=FramecheckInData(recBuffer, recLength); // check input data (response from slave)
|
//uint8_t result=FramecheckInData(recBuffer, recLength); // check input data (response from slave)
|
||||||
uint8_t result=FastCheckInData(recBuffer, recLength); // check input data (response from slave)
|
uint8_t result=FastCheckInData(recBuffer, recLength); // check input data (response from slave)
|
||||||
|
|
||||||
|
qCritical()<<" FastCheckInData() result = " << result;
|
||||||
|
|
||||||
if (result>0)
|
if (result>0)
|
||||||
{
|
{
|
||||||
// dann anzeige
|
// dann anzeige
|
||||||
|
@ -14,7 +14,7 @@ void sendWRcmd_INI(void)
|
|||||||
sendWRcmd_clrCmdStack();
|
sendWRcmd_clrCmdStack();
|
||||||
sendWRcmd_clrCmd4Stack();
|
sendWRcmd_clrCmd4Stack();
|
||||||
sendFDcmd_clrStack();
|
sendFDcmd_clrStack();
|
||||||
|
longFDcmd_clrStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command Stack for commands without parameters
|
// Command Stack for commands without parameters
|
||||||
@ -456,23 +456,18 @@ uint8_t gpi_chk4remainingText(void)
|
|||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
// 11.4.23 neu, Kommando direkt an "FastDevice"-protokoll senden, nicht mehr umsetzen
|
// 11.4.23 neu, Kommando direkt an "FastDevice"-protokoll senden, nicht mehr umsetzen
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
// header
|
|
||||||
|
|
||||||
|
// short command, 4 data bytes
|
||||||
static uint8_t nextFDwrCmd[FDCMD_STACKDEPTH];
|
static uint8_t nextFDwrCmd[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDrdCmd[FDCMD_STACKDEPTH];
|
static uint8_t nextFDrdCmd[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDblkNr[FDCMD_STACKDEPTH];
|
static uint8_t nextFDblkNr[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDshort[FDCMD_STACKDEPTH];
|
|
||||||
|
|
||||||
// short data
|
|
||||||
static uint8_t nextFDpara1[FDCMD_STACKDEPTH];
|
static uint8_t nextFDpara1[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDpara2[FDCMD_STACKDEPTH];
|
static uint8_t nextFDpara2[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDpara3[FDCMD_STACKDEPTH];
|
static uint8_t nextFDpara3[FDCMD_STACKDEPTH];
|
||||||
static uint8_t nextFDpara4[FDCMD_STACKDEPTH];
|
static uint8_t nextFDpara4[FDCMD_STACKDEPTH];
|
||||||
// lon data:
|
|
||||||
static uint8_t longFDlength[FDCMD_STACKDEPTH];
|
|
||||||
static uint8_t longFDpara[FDCMD_STACKDEPTH][64];
|
|
||||||
|
|
||||||
static uint8_t p_nextFDcmdsInQueue;
|
static uint8_t p_nextFDcmdsInQueue;
|
||||||
|
|
||||||
/* convention: use simple (not rotating) FIFO Stack:
|
/* convention: use simple (not rotating) FIFO Stack:
|
||||||
Example: nrOfCmdsInQueue=4 then
|
Example: nrOfCmdsInQueue=4 then
|
||||||
nextAsynchsendCmd0[0]=cmd1 // was stored as first
|
nextAsynchsendCmd0[0]=cmd1 // was stored as first
|
||||||
@ -497,21 +492,16 @@ void sendFDcmd_clrStack(void)
|
|||||||
nextFDwrCmd[nn]=0;
|
nextFDwrCmd[nn]=0;
|
||||||
nextFDrdCmd[nn]=0;
|
nextFDrdCmd[nn]=0;
|
||||||
nextFDblkNr[nn]=0;
|
nextFDblkNr[nn]=0;
|
||||||
nextFDshort[nn]=0;
|
|
||||||
nextFDpara1[nn]=0;
|
nextFDpara1[nn]=0;
|
||||||
nextFDpara2[nn]=0;
|
nextFDpara2[nn]=0;
|
||||||
nextFDpara3[nn]=0;
|
nextFDpara3[nn]=0;
|
||||||
nextFDpara4[nn]=0;
|
nextFDpara4[nn]=0;
|
||||||
longFDlength[nn]=0;
|
|
||||||
memset(&longFDpara[nn][0],0,64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p_nextFDcmdsInQueue=0;
|
p_nextFDcmdsInQueue=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4)
|
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4)
|
||||||
{
|
{
|
||||||
|
|
||||||
// write Command to memory, wait for transport
|
// write Command to memory, wait for transport
|
||||||
if (p_nextFDcmdsInQueue>=FDCMD_STACKDEPTH)
|
if (p_nextFDcmdsInQueue>=FDCMD_STACKDEPTH)
|
||||||
{
|
{
|
||||||
@ -528,68 +518,13 @@ bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8
|
|||||||
//qDebug() << "data with 4 data byte saved, pp=" << nrOfCmds4InQueue;
|
//qDebug() << "data with 4 data byte saved, pp=" << nrOfCmds4InQueue;
|
||||||
//qDebug() << " dat1=" << nextCmd4para1[nrOfCmds4InQueue] << " dat2=" << nextCmd4para2[nrOfCmds4InQueue]
|
//qDebug() << " dat1=" << nextCmd4para1[nrOfCmds4InQueue] << " dat2=" << nextCmd4para2[nrOfCmds4InQueue]
|
||||||
// << " dat3=" << nextCmd4para3[nrOfCmds4InQueue] << " dat4=" << nextCmd4para4[nrOfCmds4InQueue];
|
// << " dat3=" << nextCmd4para3[nrOfCmds4InQueue] << " dat4=" << nextCmd4para4[nrOfCmds4InQueue];
|
||||||
nextFDshort[p_nextFDcmdsInQueue]=1; // 1=short
|
|
||||||
p_nextFDcmdsInQueue++;
|
|
||||||
/*
|
|
||||||
int nn;
|
|
||||||
if (p_nextFDcmdsInQueue==2)
|
|
||||||
{
|
|
||||||
qDebug() << "sendFDcmd_set, stack has 2 elements: " << p_nextFDcmdsInQueue;
|
|
||||||
for (nn=0; nn<16; nn++)
|
|
||||||
{
|
|
||||||
qDebug() << "header: " << nextFDwrCmd[nn] << " / " << nextFDrdCmd[nn] << " / "<< nextFDblkNr[nn] << " / " << nextFDshort[nn];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (p_nextFDcmdsInQueue>15)
|
|
||||||
{
|
|
||||||
qDebug() << "sendFDcmd_set, stack is full now: " << p_nextFDcmdsInQueue;
|
|
||||||
for (nn=0; nn<16; nn++)
|
|
||||||
{
|
|
||||||
qDebug() << "header: " << nextFDwrCmd[nn] << " / " << nextFDrdCmd[nn] << " / "<< nextFDblkNr[nn] << " / " << nextFDpara1[nn] << " / " << nextFDpara2[nn] << " / " << nextFDpara3[nn] << " / " << nextFDpara4[nn];
|
|
||||||
|
|
||||||
qDebug() << " long data: " << nextFDshort[nn] << " / "<< longFDlength[nn] << " / "<< longFDpara[nn][0] << " / "<< longFDpara[nn][1]
|
|
||||||
<< " / "<< longFDpara[nn][2] << " / "<< longFDpara[nn][3] << " / "<< longFDpara[nn][4];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return true; // ok, will be sent
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data)
|
|
||||||
{
|
|
||||||
// write Command to memory, wait for transport
|
|
||||||
// data buffer size always 64! data[64], padded with 0
|
|
||||||
uint8_t nn;
|
|
||||||
if (p_nextFDcmdsInQueue>=FDCMD_STACKDEPTH)
|
|
||||||
{
|
|
||||||
qDebug() << "cannot save cmd because stack is full";
|
|
||||||
return false; // not possible
|
|
||||||
}
|
|
||||||
nextFDwrCmd[p_nextFDcmdsInQueue]=nextWrCmd;
|
|
||||||
nextFDrdCmd[p_nextFDcmdsInQueue]=nextRdCmd;
|
|
||||||
nextFDblkNr[p_nextFDcmdsInQueue]=blockNum;
|
|
||||||
|
|
||||||
longFDlength[p_nextFDcmdsInQueue]=length;
|
|
||||||
|
|
||||||
for (nn=0; nn<64; nn++)
|
|
||||||
longFDpara[p_nextFDcmdsInQueue][nn]=data[nn];
|
|
||||||
|
|
||||||
nextFDshort[p_nextFDcmdsInQueue]=2;
|
|
||||||
|
|
||||||
p_nextFDcmdsInQueue++;
|
p_nextFDcmdsInQueue++;
|
||||||
return true; // ok, will be sent
|
return true; // ok, will be sent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
|
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
|
||||||
{
|
{
|
||||||
uint8_t nn, ll, mm;
|
uint8_t nn, ll;
|
||||||
|
|
||||||
if (p_nextFDcmdsInQueue==0 || p_nextFDcmdsInQueue>FDCMD_STACKDEPTH)
|
if (p_nextFDcmdsInQueue==0 || p_nextFDcmdsInQueue>FDCMD_STACKDEPTH)
|
||||||
return false; // not possible
|
return false; // not possible
|
||||||
@ -601,7 +536,7 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
|
|||||||
*dat2=nextFDpara2[0];
|
*dat2=nextFDpara2[0];
|
||||||
*dat3=nextFDpara3[0];
|
*dat3=nextFDpara3[0];
|
||||||
*dat4=nextFDpara4[0];
|
*dat4=nextFDpara4[0];
|
||||||
//qDebug() << "sendFDcmd_get [0]; pp=" << p_nextFDcmdsInQueue;
|
//qDebug() << "cmd4 restored to send from [0]; pp=" << nrOfCmds4InQueue;
|
||||||
//qDebug() << " data1: " << nextCmd4para1[0] << " data2: " << nextCmd4para2[0] <<
|
//qDebug() << " data1: " << nextCmd4para1[0] << " data2: " << nextCmd4para2[0] <<
|
||||||
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
|
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
|
||||||
|
|
||||||
@ -615,74 +550,17 @@ bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, ui
|
|||||||
nextFDwrCmd[nn]=nextFDwrCmd[nn+1];
|
nextFDwrCmd[nn]=nextFDwrCmd[nn+1];
|
||||||
nextFDrdCmd[nn]=nextFDrdCmd[nn+1];
|
nextFDrdCmd[nn]=nextFDrdCmd[nn+1];
|
||||||
nextFDblkNr[nn]=nextFDblkNr[nn+1];
|
nextFDblkNr[nn]=nextFDblkNr[nn+1];
|
||||||
|
|
||||||
nextFDpara1[nn]=nextFDpara1[nn+1];
|
nextFDpara1[nn]=nextFDpara1[nn+1];
|
||||||
nextFDpara2[nn]=nextFDpara2[nn+1];
|
nextFDpara2[nn]=nextFDpara2[nn+1];
|
||||||
nextFDpara3[nn]=nextFDpara3[nn+1];
|
nextFDpara3[nn]=nextFDpara3[nn+1];
|
||||||
nextFDpara4[nn]=nextFDpara4[nn+1];
|
nextFDpara4[nn]=nextFDpara4[nn+1];
|
||||||
|
|
||||||
nextFDshort[nn] = nextFDshort[nn+1];
|
|
||||||
|
|
||||||
longFDlength[nn] = longFDlength[nn+1];
|
|
||||||
|
|
||||||
for (mm=0; mm<64; mm++)
|
|
||||||
longFDpara[nn][mm] = longFDpara[nn+1][mm];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_nextFDcmdsInQueue>0)
|
if (p_nextFDcmdsInQueue>0)
|
||||||
p_nextFDcmdsInQueue--;
|
p_nextFDcmdsInQueue--;
|
||||||
//qDebug() << "cmd4 after push down: pp=" << nrOfCmds4InQueue;
|
//qDebug() << "cmd4 after push down: pp=" << nrOfCmds4InQueue;
|
||||||
|
|
||||||
// clear released buffer:
|
|
||||||
for (nn=p_nextFDcmdsInQueue; nn<FDCMD_STACKDEPTH; nn++)
|
|
||||||
{
|
|
||||||
nextFDwrCmd[nn]=0;
|
|
||||||
nextFDrdCmd[nn]=0;
|
|
||||||
nextFDblkNr[nn]=0;
|
|
||||||
|
|
||||||
nextFDpara1[nn]=0;
|
|
||||||
nextFDpara2[nn]=0;
|
|
||||||
nextFDpara3[nn]=0;
|
|
||||||
nextFDpara4[nn]=0;
|
|
||||||
|
|
||||||
nextFDshort[nn]=0;
|
|
||||||
|
|
||||||
longFDlength[nn]=0;
|
|
||||||
|
|
||||||
for (mm=0; mm<64; mm++)
|
|
||||||
longFDpara[nn][mm] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
qDebug() << "sendFDcmd_set, stack now: " << p_nextFDcmdsInQueue;
|
|
||||||
for (nn=0; nn<16; nn++)
|
|
||||||
{
|
|
||||||
qDebug() << "header: " << nextFDwrCmd[nn] << " / " << nextFDrdCmd[nn] << " / "<< nextFDblkNr[nn] << " / " << nextFDshort[nn];
|
|
||||||
|
|
||||||
qDebug() << " short data: " << nextFDpara1[nn] << " / "<< nextFDpara2[nn] << " / "<< nextFDpara3[nn]<< " / "<< nextFDpara4[nn];
|
|
||||||
|
|
||||||
qDebug() << " long data: " << longFDlength[nn] << " / "<< longFDpara[nn][0] << " / "<< longFDpara[nn][1]
|
|
||||||
<< " / "<< longFDpara[nn][2] << " / "<< longFDpara[nn][3] << " / "<< longFDpara[nn][4];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return true; // ok, will be sent
|
return true; // ok, will be sent
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t checkNextFDcmd(void)
|
|
||||||
{
|
|
||||||
// return 0: no command waiting
|
|
||||||
// 1: short cmd
|
|
||||||
// 2: long cmd
|
|
||||||
//qDebug() << "chk nxt fd cmd: "<<p_nextFDcmdsInQueue<<" "<<nextFDshort[0]<<" "<<nextFDshort[1]<<" "<<nextFDshort[2]<<" "<<nextFDshort[3];
|
|
||||||
if (p_nextFDcmdsInQueue==0)
|
|
||||||
return 0;
|
|
||||||
if (nextFDshort[0]==1)
|
|
||||||
return 1;
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t check4FDshortCmd(void)
|
uint8_t check4FDshortCmd(void)
|
||||||
{
|
{
|
||||||
// returns number of waiting command, max FDCMD_STACKDEPTH
|
// returns number of waiting command, max FDCMD_STACKDEPTH
|
||||||
@ -698,15 +576,15 @@ uint8_t check4freeFDshortCmd(void)
|
|||||||
|
|
||||||
|
|
||||||
// long command, 64 data bytes
|
// long command, 64 data bytes
|
||||||
//static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
|
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
|
||||||
//static uint8_t longFDrdCmd[FDLONG_STACKDEPTH];
|
static uint8_t longFDrdCmd[FDLONG_STACKDEPTH];
|
||||||
//static uint8_t longFDblkNr[FDLONG_STACKDEPTH];
|
static uint8_t longFDblkNr[FDLONG_STACKDEPTH];
|
||||||
//static uint8_t longFDlength[FDLONG_STACKDEPTH];
|
static uint8_t longFDlength[FDLONG_STACKDEPTH];
|
||||||
|
|
||||||
|
static uint8_t longFDpara[FDLONG_STACKDEPTH][64];
|
||||||
|
static uint8_t p_longFDcmdsInQueue;
|
||||||
|
|
||||||
//static uint8_t longFDpara[FDLONG_STACKDEPTH][64];
|
|
||||||
//static uint8_t p_longFDcmdsInQueue;
|
|
||||||
|
|
||||||
/*
|
|
||||||
void longFDcmd_clrStack(void)
|
void longFDcmd_clrStack(void)
|
||||||
{
|
{
|
||||||
uint8_t nn, mm;
|
uint8_t nn, mm;
|
||||||
@ -720,74 +598,66 @@ void longFDcmd_clrStack(void)
|
|||||||
longFDpara[nn][mm]=0;
|
longFDpara[nn][mm]=0;
|
||||||
}
|
}
|
||||||
p_longFDcmdsInQueue=0;
|
p_longFDcmdsInQueue=0;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data)
|
||||||
|
{
|
||||||
|
// write Command to memory, wait for transport
|
||||||
|
// data buffer size always 64! data[64], padded with 0
|
||||||
|
uint8_t nn;
|
||||||
|
if (p_longFDcmdsInQueue>=FDLONG_STACKDEPTH)
|
||||||
|
{
|
||||||
|
qDebug() << "cannot save cmd because stack is full";
|
||||||
|
return false; // not possible
|
||||||
|
}
|
||||||
|
longFDwrCmd[p_longFDcmdsInQueue]=nextWrCmd;
|
||||||
|
longFDrdCmd[p_longFDcmdsInQueue]=nextRdCmd;
|
||||||
|
longFDblkNr[p_longFDcmdsInQueue]=blockNum;
|
||||||
|
longFDlength[p_longFDcmdsInQueue]=length;
|
||||||
|
for (nn=0; nn<64; nn++)
|
||||||
|
longFDpara[p_longFDcmdsInQueue][nn]=data[nn];
|
||||||
|
|
||||||
|
p_longFDcmdsInQueue++;
|
||||||
|
return true; // ok, will be sent
|
||||||
|
}
|
||||||
|
|
||||||
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data)
|
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data)
|
||||||
{
|
{
|
||||||
uint8_t nn, mm, ll;
|
uint8_t nn, mm, ll;
|
||||||
//p_nextFDcmdsInQueue; nn<FDCMD_STACKDEPTH
|
|
||||||
if (p_nextFDcmdsInQueue==0 || p_nextFDcmdsInQueue>FDCMD_STACKDEPTH)
|
if (p_longFDcmdsInQueue==0 || p_longFDcmdsInQueue>FDLONG_STACKDEPTH)
|
||||||
return false; // not possible
|
return false; // not possible
|
||||||
|
|
||||||
*nextWrCmd=nextFDwrCmd[0];
|
*nextWrCmd= longFDwrCmd[0];
|
||||||
*nextRdCmd=nextFDrdCmd[0];
|
*nextRdCmd= longFDrdCmd[0];
|
||||||
*blockNum=nextFDblkNr[0];
|
*blockNum = longFDblkNr[0];
|
||||||
|
|
||||||
*length = longFDlength[0];
|
*length = longFDlength[0];
|
||||||
for (mm=0; mm<64; mm++)
|
for (mm=0; mm<64; mm++)
|
||||||
data[mm] = longFDpara[0][mm];
|
data[mm] = longFDpara[0][mm];
|
||||||
|
|
||||||
// move Puffer down by one element
|
// move Puffer down by one element
|
||||||
if (FDCMD_STACKDEPTH>0)
|
if (FDLONG_STACKDEPTH>0)
|
||||||
ll=FDCMD_STACKDEPTH-1;
|
ll=FDLONG_STACKDEPTH-1;
|
||||||
else
|
else
|
||||||
ll=0;
|
ll=0;
|
||||||
for (nn=0; nn<ll; nn++)
|
for (nn=0; nn<ll; nn++)
|
||||||
{
|
{
|
||||||
nextFDwrCmd[nn]=nextFDwrCmd[nn+1];
|
longFDwrCmd[nn] = longFDwrCmd[nn+1];
|
||||||
nextFDrdCmd[nn]=nextFDrdCmd[nn+1];
|
longFDrdCmd[nn] = longFDrdCmd[nn+1];
|
||||||
nextFDblkNr[nn]=nextFDblkNr[nn+1];
|
longFDblkNr[nn] = longFDblkNr[nn+1];
|
||||||
|
|
||||||
nextFDpara1[nn]=nextFDpara1[nn+1];
|
|
||||||
nextFDpara2[nn]=nextFDpara2[nn+1];
|
|
||||||
nextFDpara3[nn]=nextFDpara3[nn+1];
|
|
||||||
nextFDpara4[nn]=nextFDpara4[nn+1];
|
|
||||||
|
|
||||||
nextFDshort[nn] = nextFDshort[nn+1];
|
|
||||||
|
|
||||||
longFDlength[nn] = longFDlength[nn+1];
|
longFDlength[nn] = longFDlength[nn+1];
|
||||||
|
|
||||||
for (mm=0; mm<64; mm++)
|
for (mm=0; mm<64; mm++)
|
||||||
longFDpara[nn][mm] = longFDpara[nn+1][mm];
|
longFDpara[nn][mm] = longFDpara[nn+1][mm];
|
||||||
|
|
||||||
}
|
}
|
||||||
if (p_nextFDcmdsInQueue>0)
|
if (p_longFDcmdsInQueue>0)
|
||||||
p_nextFDcmdsInQueue--;
|
p_longFDcmdsInQueue--;
|
||||||
|
|
||||||
// clear released buffer:
|
|
||||||
for (nn=p_nextFDcmdsInQueue; nn<FDCMD_STACKDEPTH; nn++)
|
|
||||||
{
|
|
||||||
nextFDwrCmd[nn]=0;
|
|
||||||
nextFDrdCmd[nn]=0;
|
|
||||||
nextFDblkNr[nn]=0;
|
|
||||||
|
|
||||||
nextFDpara1[nn]=0;
|
|
||||||
nextFDpara2[nn]=0;
|
|
||||||
nextFDpara3[nn]=0;
|
|
||||||
nextFDpara4[nn]=0;
|
|
||||||
|
|
||||||
nextFDshort[nn]=0;
|
|
||||||
|
|
||||||
longFDlength[nn]=0;
|
|
||||||
for (mm=0; mm<64; mm++)
|
|
||||||
longFDpara[nn][mm] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true; // ok, will be sent
|
return true; // ok, will be sent
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
uint8_t check4FDlongCmd(void)
|
uint8_t check4FDlongCmd(void)
|
||||||
{
|
{
|
||||||
// returns number of waiting command
|
// returns number of waiting command
|
||||||
@ -799,7 +669,7 @@ uint8_t check4freeFDlongCmd(void)
|
|||||||
// returns number of free places in command stack
|
// returns number of free places in command stack
|
||||||
return FDLONG_STACKDEPTH - p_longFDcmdsInQueue;
|
return FDLONG_STACKDEPTH - p_longFDcmdsInQueue;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -829,3 +699,6 @@ uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,23 +9,16 @@
|
|||||||
// macro will be defined. -> we use SystemV shared memory
|
// macro will be defined. -> we use SystemV shared memory
|
||||||
#error "QT_POSIX_IPC defined"
|
#error "QT_POSIX_IPC defined"
|
||||||
#else
|
#else
|
||||||
#ifdef __linux__
|
|
||||||
#include <sys/ipc.h> // ftok
|
#include <sys/ipc.h> // ftok
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// std::atomic_bool SharedMemBuffer::__sharedMemLocked{false};
|
// std::atomic_bool SharedMemBuffer::__sharedMemLocked{false};
|
||||||
|
|
||||||
QSharedMemory *SharedMemBuffer::getShm(std::size_t size) {
|
QSharedMemory *SharedMemBuffer::getShm(std::size_t size) {
|
||||||
static QSharedMemory shMem;
|
static QSharedMemory shMem;
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
#ifdef __linux__
|
|
||||||
static const long nativeKey = ftok("/etc/os-release", 'H');
|
static const long nativeKey = ftok("/etc/os-release", 'H');
|
||||||
static const QString fkey = std::to_string(nativeKey).c_str();
|
static const QString fkey = std::to_string(nativeKey).c_str();
|
||||||
#else
|
|
||||||
static const QString fkey = "0123456?000=9";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
shMem.setKey(fkey);
|
shMem.setKey(fkey);
|
||||||
if (!shMem.isAttached()) {
|
if (!shMem.isAttached()) {
|
||||||
if (shMem.create(size)) {
|
if (shMem.create(size)) {
|
||||||
|
1739
src/storeINdata.cpp
1739
src/storeINdata.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user