Compare commits
63 Commits
8f7d4a203d
...
pu/coinInt
Author | SHA1 | Date | |
---|---|---|---|
ca5e43e0d7
|
|||
3ac91305d4
|
|||
d0445949d2
|
|||
91d9280a4a
|
|||
48d6a34b16
|
|||
e32142cd62
|
|||
f611e07dcf
|
|||
6478eda581
|
|||
1663d09d3a
|
|||
080c00eda1
|
|||
bbce2b02e3
|
|||
8ff17a2e00
|
|||
c6574280ac
|
|||
f0f0493d19
|
|||
9bf99c5515
|
|||
8ff8faf007
|
|||
09a80498e4
|
|||
21fb07b81c
|
|||
01f8c1e49c
|
|||
3029b8da04
|
|||
2143801900
|
|||
6f6d3b7491
|
|||
4cfb8f1804
|
|||
d992ee3fad | |||
b7d8fabfd0 | |||
7129805f4e | |||
01140c523b | |||
c99d0730ce | |||
81c610c48b | |||
6ae7c06d42 | |||
1eb2ac3a1d | |||
f3adba2f0f | |||
652ad9b43d | |||
c85b090306 | |||
87a6ed0795 | |||
99c88c7825 | |||
712ea0fc6e | |||
86311de486 | |||
cb4412779f | |||
a95e174356 | |||
c724b5b9fb | |||
ef7932102f | |||
a7aa75ae5f | |||
dc00c69b82 | |||
eeb35190e1 | |||
30338e24cc | |||
58fdea45f0 | |||
df760f1a52 | |||
3e3e1efe7d | |||
e5a8cfd1cd | |||
5e6e6017b3 | |||
f3d9c690b7 | |||
3f10469b8f | |||
d92bdbfb3e | |||
60c48588b0 | |||
ef48301dad | |||
5f7d34ef12 | |||
863e4b23a9 | |||
37f0012ce9 | |||
82accc4b1a | |||
c1b945225b | |||
debade9942 | |||
ffbe0dfc2e |
42
.gitignore
vendored
42
.gitignore
vendored
@@ -1 +1,41 @@
|
|||||||
*.user
|
# C++ objects and libs
|
||||||
|
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lai
|
||||||
|
*.so
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Qt-es
|
||||||
|
|
||||||
|
*.pro.user
|
||||||
|
*.pro.user.*
|
||||||
|
moc_*.cpp
|
||||||
|
qrc_*.cpp
|
||||||
|
Makefile
|
||||||
|
Makefile.*
|
||||||
|
*-build-*
|
||||||
|
|
||||||
|
#
|
||||||
|
*.autosave
|
||||||
|
ui_*.h
|
||||||
|
version.h
|
||||||
|
version.txt
|
||||||
|
|
||||||
|
packages/*
|
||||||
|
*.pro.orig
|
||||||
|
Output/setup.exe
|
||||||
|
.directory
|
||||||
|
|
||||||
|
*~
|
||||||
|
resources/icons/*.png
|
||||||
|
resources/icons/*.jpg
|
||||||
|
resources/icons/*.gif
|
||||||
|
resources/style/*.qss
|
||||||
|
text/*.html
|
||||||
|
!text/*_template.html
|
||||||
|
text/*.xml
|
||||||
|
@@ -10,7 +10,8 @@ HEADERS += $${PWD}/include/com.h \
|
|||||||
$${PWD}/include/prot.h \
|
$${PWD}/include/prot.h \
|
||||||
$${PWD}/include/sendWRcmd.h \
|
$${PWD}/include/sendWRcmd.h \
|
||||||
$${PWD}/include/storeINdata.h \
|
$${PWD}/include/storeINdata.h \
|
||||||
$${PWD}/include/tslib.h
|
$${PWD}/include/tslib.h \
|
||||||
|
$${PWD}/include/shared_mem_buffer.h
|
||||||
|
|
||||||
SOURCES += $${PWD}/src/com.cpp \
|
SOURCES += $${PWD}/src/com.cpp \
|
||||||
$${PWD}/src/controlBus.cpp \
|
$${PWD}/src/controlBus.cpp \
|
||||||
@@ -20,4 +21,5 @@ SOURCES += $${PWD}/src/com.cpp \
|
|||||||
$${PWD}/src/prot.cpp \
|
$${PWD}/src/prot.cpp \
|
||||||
$${PWD}/src/sendWRcmd.cpp \
|
$${PWD}/src/sendWRcmd.cpp \
|
||||||
$${PWD}/src/storeINdata.cpp \
|
$${PWD}/src/storeINdata.cpp \
|
||||||
$${PWD}/src/tslib.cpp
|
$${PWD}/src/tslib.cpp \
|
||||||
|
$${PWD}/src/shared_mem_buffer.cpp
|
||||||
|
45
DCPlugin.pro
45
DCPlugin.pro
@@ -14,6 +14,8 @@ 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
|
||||||
@@ -21,33 +23,32 @@ contains( CONFIG, DesktopLinux ) {
|
|||||||
# 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++11
|
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 ) {
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||||
|
PTU5BASEPATH = /opt/devel/ptu5
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
|
|
||||||
# add qmqtt lib
|
# add qmqtt lib
|
||||||
#LIBS += -lQt5Qmqtt
|
#LIBS += -lQt5Qmqtt
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET = CashAgentLib
|
TARGET = ATBDeviceControllerPlugin
|
||||||
DESTDIR = ../plugins
|
#DESTDIR = ../plugins
|
||||||
|
INTERFACE = DeviceController
|
||||||
|
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
|
||||||
@@ -67,3 +68,27 @@ 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 += \
|
||||||
|
generate-version.sh
|
||||||
|
|
||||||
|
|
||||||
|
# Define how to create version.h
|
||||||
|
VERSION_H = $$PWD/include/version.h
|
||||||
|
version.output = $$PWD/include/version.h
|
||||||
|
version.commands = $$PWD/generate-version.sh $${ARCH} $${TARGET} $${INTERFACE} $${INTERFACE_DEFINITION} $${VERSION_H}
|
||||||
|
version.depends = FORCE
|
||||||
|
version.input = VERSION_H
|
||||||
|
version.variable_out = HEADERS
|
||||||
|
QMAKE_EXTRA_COMPILERS += version
|
||||||
|
QMAKE_CLEAN += $${PWD}/include/version.h
|
||||||
|
155
generate-version.sh
Executable file
155
generate-version.sh
Executable file
@@ -0,0 +1,155 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION_STRING=""
|
||||||
|
|
||||||
|
#GIT='/cygdrive/c/Program Files \(x86\)/Git/bin/git'
|
||||||
|
GIT=git
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
parse_git_branch () {
|
||||||
|
$GIT branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ARCH=$1
|
||||||
|
TARGET=$2
|
||||||
|
INTERFACE=$3
|
||||||
|
INTERFACE_DEFINITION=$4
|
||||||
|
VERSION_H=$5
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f $0)
|
||||||
|
SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
OUTPUTDIR=$(pwd)
|
||||||
|
echo " current dir is : " $(pwd)
|
||||||
|
echo $SCRIPT
|
||||||
|
echo $SCRIPTPATH
|
||||||
|
|
||||||
|
echo "changing dir to script path: " $SCRIPTPATH
|
||||||
|
cd $SCRIPTPATH
|
||||||
|
|
||||||
|
# set version string ##################################################################
|
||||||
|
if [ -z $VERSION_STRING ] ; then
|
||||||
|
VERSION_STRING=$(date +%Y%m%d_%H%M)
|
||||||
|
fi
|
||||||
|
GIT_DESCRIBE=$($GIT describe)
|
||||||
|
GIT_BRANCH=$(parse_git_branch)
|
||||||
|
|
||||||
|
# extract path from branchname:
|
||||||
|
IFS='_' read -ra TMP_ARRAY <<< "${GIT_BRANCH}"
|
||||||
|
BRANCH_PATH=${TMP_ARRAY[0]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# detect if we have a development version:
|
||||||
|
if [ ${#TMP_ARRAY[1]} -gt 0 ] ; then
|
||||||
|
DEV_SUFFIX="_dev"
|
||||||
|
else
|
||||||
|
DEV_SUFFIX=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# detect if git status is dirty
|
||||||
|
GIT_DESCRIBE_DIRTY=$($GIT describe --dirty)
|
||||||
|
if [ "${GIT_DESCRIBE_DIRTY:(-6)}" == "-dirty" ] ; then
|
||||||
|
DIRTY_SUFFIX="_dirty"
|
||||||
|
else
|
||||||
|
DIRTY_SUFFIX=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$DIRTY_SUFFIX" ] || [ -n "$DEV_SUFFIX" ] ; then
|
||||||
|
DEVDIRTY=true
|
||||||
|
else
|
||||||
|
DEVDIRTY=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# extract interface definition
|
||||||
|
|
||||||
|
#
|
||||||
|
#Q_DECLARE_INTERFACE(CCInterface,
|
||||||
|
# "eu.atb.ptu.plugin.CCInterface/2.9.0")
|
||||||
|
# -> extract whole string within quotation marks
|
||||||
|
INTERFACE_VERSION=$(grep 'eu.atb.ptu.plugin.' ${INTERFACE_DEFINITION})
|
||||||
|
# get string within quotes:
|
||||||
|
INTERFACE_VERSION=`echo ${INTERFACE_VERSION} | awk -F \" '{print $2}'`
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# write version.h
|
||||||
|
|
||||||
|
|
||||||
|
echo " TARGET is: $TARGET"
|
||||||
|
echo " ARCH is: $ARCH"
|
||||||
|
echo " "
|
||||||
|
echo " PluginName: $TARGET"
|
||||||
|
echo " Interface: $INTERFACE"
|
||||||
|
echo " InterfaceVersion: $INTERFACE_VERSION"
|
||||||
|
echo " "
|
||||||
|
echo " new version is: $VERSION_STRING"
|
||||||
|
echo " git describe is: $GIT_DESCRIBE"
|
||||||
|
echo " git branch is: $GIT_BRANCH"
|
||||||
|
echo " branch-path is: $BRANCH_PATH"
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
echo " dev suffix: $DEV_SUFFIX"
|
||||||
|
echo " dirty suffix: $DIRTY_SUFFIX"
|
||||||
|
|
||||||
|
|
||||||
|
PLUGIN_VERSION=${VERSION_STRING}
|
||||||
|
#ATB_QT_GIT_DESCRIBE=${GIT_DESCRIBE}_${GIT_BRANCH}
|
||||||
|
PLUGIN_GIT_DESCRIBE=${GIT_DESCRIBE}_${BRANCH_PATH}${DEV_SUFFIX}${DIRTY_SUFFIX}
|
||||||
|
|
||||||
|
#TARGET=IngenicoZVT_CCPlugin
|
||||||
|
|
||||||
|
|
||||||
|
# build version.h #####################################################################
|
||||||
|
|
||||||
|
echo " building new version info (version.h) ..."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "#ifndef VERSION_H" > ${VERSION_H}
|
||||||
|
echo "#define VERSION_H" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "#define INTERFACE_VERSION \"${INTERFACE_VERSION}\"" >> ${VERSION_H}
|
||||||
|
echo "#define PLUGIN_VERSION \"${PLUGIN_VERSION}\"" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "#define PLUGIN_GIT_DESCRIBE \"${PLUGIN_GIT_DESCRIBE}\"" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
|
||||||
|
cat <<EOT >> ${VERSION_H}
|
||||||
|
|
||||||
|
const std::string pluginInfoString = R"(
|
||||||
|
{
|
||||||
|
"Interface": "${INTERFACE}",
|
||||||
|
"InterfaceVersion": "${INTERFACE_VERSION}",
|
||||||
|
"PluginName": "${TARGET}",
|
||||||
|
"Version": "${PLUGIN_VERSION}",
|
||||||
|
"git-describe": "${PLUGIN_GIT_DESCRIBE}",
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
if [ ${DEVDIRTY} == "true" ] ; then
|
||||||
|
echo "#define DEVDIRTY" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
fi
|
||||||
|
echo "#define SYSTEM_ARCH \"${ARCH}\"" >> ${VERSION_H}
|
||||||
|
echo "#define ARCH_${ARCH}" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "" >> ${VERSION_H}
|
||||||
|
echo "#endif //VERSION_H" >> ${VERSION_H}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -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);
|
||||||
|
@@ -308,6 +308,8 @@ class T_datif : public QMainWindow
|
|||||||
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();
|
||||||
@@ -324,12 +326,18 @@ public:
|
|||||||
// 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();
|
||||||
//the requested data are stored in peripheral image
|
//the requested data are stored in peripheral image
|
||||||
// can be loaded with epi
|
// can be loaded with epi
|
||||||
|
|
||||||
|
void datif_templatePrintFinished_OK();
|
||||||
|
void datif_templatePrintFinished_Err();
|
||||||
|
|
||||||
|
void datif_gotNewCoin();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CI_H
|
#endif // CI_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
|
519
include/hwapi.h
519
include/hwapi.h
@@ -1,169 +1,43 @@
|
|||||||
/*
|
/*
|
||||||
|
matching interfaces.h:
|
||||||
|
|
||||||
PSA1259 hardware control using the DeviceController DC2
|
// History
|
||||||
|
// 11.10.2021: V1.0 222 functions
|
||||||
covering enclosure (switches and doors) and money devices,
|
// 23.12.2021: V1.1 added block-parameter to function "read mifare data"
|
||||||
controls mifare card to access or program
|
// 30.12.2021: V1.2 added function: mif_clearDataBuffer(), mif_isBlockAvailable(uint8_t blkNr) and mif_getAvailableDataBlocks()
|
||||||
optional it can control printer, modem, bar code reader and credit card
|
// 1.1.2022: V1.3 Mifare extended. ( background: read 16 x 48byte from card to DC, read 12 x 64byte from DC to CA)
|
||||||
|
// new: read full card with 768bytes from HWapi without block borders
|
||||||
* API to the PSA1259 Hardware
|
// added: mif_getNrOfAvailableDataBytes mif_getCardData768byteDec(uint8_t *buf, uint16_t bufferSize)
|
||||||
* All data come in from device controller via serial interface and will be stored
|
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
|
||||||
* in "PI" = peripheral image
|
// mif_getCardDataStr(bool useHexFormat, char seperator)
|
||||||
* PI is updated every 100ms (up to 30ms possible)
|
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
|
||||||
* This api uses stored pi data and returns them in the following functions
|
// V3.2 Bootloader improvement
|
||||||
* created: Q1/2020 TS
|
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
||||||
*
|
|
||||||
|
|
||||||
The devices, connected to device controller2 (DC2) can be controlled in different access levels.
|
|
||||||
Level 1:
|
|
||||||
direct connection to DC2, check versions, state and parameters
|
|
||||||
control serial interfaces
|
|
||||||
digital/analog IO's
|
|
||||||
read and write to connected devices on lowest level, this is a kind of fall-back-level
|
|
||||||
in case higher levels fail or do not support the needed (new) function
|
|
||||||
Example: send a specific printer command, several bytes that need to be conform to
|
|
||||||
printer manual. This command is routed to the printer through the DC2 without
|
|
||||||
any action of the DC. You can write your own device driver that way.
|
|
||||||
Level 1 is flexible but complicated
|
|
||||||
|
|
||||||
Level 2:
|
|
||||||
The DC controls the connected devices containing a device driver. The DC offers
|
|
||||||
usage of the device by simple commands,
|
|
||||||
Example: "Printer on", "set Font size 3" "print "hello world"", "cut"
|
|
||||||
In opposite to level 1 where you had to send a set of numbers and letters.
|
|
||||||
In other words: you "talk" to the device controller, not to the device itself.
|
|
||||||
|
|
||||||
Level 3:
|
|
||||||
start/stop complete processes.
|
|
||||||
Example: 1) print (predefined) document nr 3 with Text, letter size, font set, cut.
|
|
||||||
Also power up/down the printer, check if paper ok and so on.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Another access example: control the coin unit
|
|
||||||
|
|
||||||
Level 1): read digital inputs to detect coin,
|
|
||||||
switch digital output which opens coin slot
|
|
||||||
communicate with coin checker by certain mdb-commands (manual conform)
|
|
||||||
poll coin checker for inserted coins
|
|
||||||
close coin slot after 3seconds by setting DO to 0....
|
|
||||||
|
|
||||||
Level 2): get message of attached coin from DC
|
|
||||||
send command "initialize coin checker" to DC
|
|
||||||
send command "open slot for 3s"
|
|
||||||
poll DC for inserted coins, DC polls coin checker in right way, no need
|
|
||||||
to know the data sheet of the coin checker or mdb-bus
|
|
||||||
command to DC "open coin escrow's return flap for 1s"
|
|
||||||
|
|
||||||
Level 3): send command: "start payment process"
|
|
||||||
all coin devices are started up
|
|
||||||
coin blocker opens for 3s if a coin is attached
|
|
||||||
coin checker summarizes inserted value and reports sum
|
|
||||||
later send command "stop payment process" (puts coins to vault) or
|
|
||||||
send command "cancel payment process" (returns coins to user)
|
|
||||||
|
|
||||||
|
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
||||||
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
|
||||||
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef hwapi_H
|
#ifndef hwapi_H
|
||||||
#define hwapi_H
|
#define hwapi_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QTabWidget>
|
#include <QTimer>
|
||||||
#include <QtPlugin>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <../plugins/interfaces.h>
|
#include "interfaces.h"
|
||||||
#include "datIf.h"
|
#include "datIf.h"
|
||||||
|
|
||||||
|
class QSharedMemory;
|
||||||
|
|
||||||
//public QWidget,
|
|
||||||
|
|
||||||
/*
|
|
||||||
struct Tprn_hw_state
|
|
||||||
{
|
|
||||||
// hardware (IO's)
|
|
||||||
bool powerRdBk; // prn pwr is on
|
|
||||||
bool rsSwOk; // serial switch (printer or modem) is set to printer
|
|
||||||
bool rsDrvOk; // RS232 converter for PTU, Printer and Modem in on
|
|
||||||
|
|
||||||
bool ReadyLine; // HW signal from printer showing ready
|
|
||||||
bool inIdle; // powered and free from errors
|
|
||||||
bool paperNearEnd; // paper roll runs out
|
|
||||||
bool noPaper;
|
|
||||||
bool ErrorTemp;
|
|
||||||
bool HeadOpen;
|
|
||||||
bool cutterJam;
|
|
||||||
bool noResponse; // printer is not connected, cable broken, wrong baudrate
|
|
||||||
bool badResponse;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Tprn_currentSettings
|
|
||||||
{
|
|
||||||
uint8_t currFont;
|
|
||||||
uint8_t currSize;
|
|
||||||
uint8_t currHeigth;
|
|
||||||
uint8_t currWidth;
|
|
||||||
bool nowBold;
|
|
||||||
bool nowInvers;
|
|
||||||
bool nowUnderlined;
|
|
||||||
uint8_t currDensity;
|
|
||||||
uint8_t currSpeed;
|
|
||||||
bool nowAligned;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct T_dynDat
|
|
||||||
{
|
|
||||||
uint8_t licensePlate[8];
|
|
||||||
uint8_t vendingPrice[8];
|
|
||||||
uint8_t parkingEnd[8];
|
|
||||||
uint8_t currentTime[8];
|
|
||||||
uint8_t currentDate[8];
|
|
||||||
uint8_t dynDat5[8];
|
|
||||||
uint8_t dynDat6[8];
|
|
||||||
uint8_t dynDat7[8];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct T_emp
|
|
||||||
{
|
|
||||||
|
|
||||||
// Fixdata from EMP:
|
|
||||||
uint8_t shaft; // = changer level
|
|
||||||
uint16_t countryCode;
|
|
||||||
uint8_t scale;
|
|
||||||
uint8_t decimals;
|
|
||||||
uint8_t coinValues[16];
|
|
||||||
uint16_t routing;
|
|
||||||
|
|
||||||
// Master specs:
|
|
||||||
uint8_t gotSetup; // 1: got specifications from master 0: no specs
|
|
||||||
uint16_t coinAccept; // bit 0 = coin1 bit H=accept
|
|
||||||
uint8_t tokenChannel;
|
|
||||||
uint16_t denomination[16];
|
|
||||||
|
|
||||||
// dynamic:
|
|
||||||
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
|
|
||||||
// 0=Emp & Bus power off, 1=powered, poll off 2=polling on
|
|
||||||
// 3=device responded, requesting status
|
|
||||||
// 4=waiting for status 5=have status,
|
|
||||||
// 6: IDLE, have paramters from master, polling running, ready for payment
|
|
||||||
// Master can stop/start polling and acceptance
|
|
||||||
// 7: end of transaction, polling on, accept off, reporting coins, (wait for last coin)
|
|
||||||
// 8: transaction running, polling on, acceptance on, reporting coins,
|
|
||||||
|
|
||||||
uint8_t pollingRunning;
|
|
||||||
uint8_t paymentRunning;
|
|
||||||
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
void sub_storeSendingText(QByteArray *buf) const;
|
||||||
|
QTimer *hwapi_TimerPayment;
|
||||||
|
|
||||||
DownloadResult sendNextAddress(int bNum) const;
|
DownloadResult sendNextAddress(int bNum) const;
|
||||||
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
|
||||||
@@ -177,11 +51,17 @@ class hwapi : public QObject,
|
|||||||
bool resetDeviceController() const;
|
bool resetDeviceController() const;
|
||||||
QByteArray loadBinaryDCFile(QString filename) const;
|
QByteArray loadBinaryDCFile(QString filename) const;
|
||||||
bool downloadBinaryToDC(QString const &bFile) 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;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Level 0 commands, interface
|
// Level 0 commands, interface
|
||||||
// open, close, change serial interface
|
// open, close, change serial interface
|
||||||
@@ -206,6 +86,16 @@ public:
|
|||||||
bool dc_updateDC(QString binFileName, QString baudrate,
|
bool dc_updateDC(QString binFileName, QString baudrate,
|
||||||
QString comPort) const override;
|
QString comPort) const override;
|
||||||
|
|
||||||
|
bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QVector<QString> fnames,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const override;
|
||||||
|
|
||||||
|
bool dc_printTemplate(enum FileTypeJson type,
|
||||||
|
QVector<int> templateIdx,
|
||||||
|
QString br,
|
||||||
|
QString serial = QString()) const override;
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Level 1, control device-controller (functions of µC)
|
// Level 1, control device-controller (functions of µC)
|
||||||
// check serial connection to deviceController
|
// check serial connection to deviceController
|
||||||
@@ -258,7 +148,6 @@ public:
|
|||||||
|
|
||||||
QString dc_getState(void) const override;
|
QString dc_getState(void) const override;
|
||||||
|
|
||||||
// neu, 25.8.21
|
|
||||||
QString dc_getTxt4RsDiagWin(void) const override;
|
QString dc_getTxt4RsDiagWin(void) const override;
|
||||||
void dc_clrTxt4RsDiagWin(void) const override;
|
void dc_clrTxt4RsDiagWin(void) const override;
|
||||||
QString dc_get2ndTxt4RsDiagWin(void) const override;
|
QString dc_get2ndTxt4RsDiagWin(void) const override;
|
||||||
@@ -983,7 +872,7 @@ public:
|
|||||||
// return true is bl is up and running
|
// return true is bl is up and running
|
||||||
// also initializes "sendFile"
|
// also initializes "sendFile"
|
||||||
|
|
||||||
void bl_sendAddress(u_int16_t blockNumber) const override;
|
void bl_sendAddress(uint16_t blockNumber) const override;
|
||||||
// send start address, nr of 64byte-block, start with 0
|
// send start address, nr of 64byte-block, start with 0
|
||||||
// will be sent only for folling block-numbers:
|
// will be sent only for folling block-numbers:
|
||||||
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
|
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
|
||||||
@@ -993,7 +882,7 @@ public:
|
|||||||
|
|
||||||
void bl_openBinary(void) const override;
|
void bl_openBinary(void) const override;
|
||||||
|
|
||||||
void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override;
|
void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const override;
|
||||||
// send 64 byte from bin file
|
// send 64 byte from bin file
|
||||||
|
|
||||||
void bl_sendLastBlock(void) const override;
|
void bl_sendLastBlock(void) const override;
|
||||||
@@ -1003,105 +892,257 @@ public:
|
|||||||
|
|
||||||
void bl_stopBL(void) const override;
|
void bl_stopBL(void) const override;
|
||||||
|
|
||||||
|
|
||||||
|
// Bootlader, not used or obsolete
|
||||||
//bool bl_isDiagAvailable(void) const override;
|
//bool bl_isDiagAvailable(void) const override;
|
||||||
|
|
||||||
//QString dc_getDiagText(void) const override;
|
//QString dc_getDiagText(void) const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Komplett-schreib Funktion, noch nicht getestet
|
|
||||||
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
|
||||||
|
|
||||||
//void bl_startSending(void) const override;
|
//void bl_startSending(void) const override;
|
||||||
|
|
||||||
//void bl_sendFile(void) const override;
|
//void bl_sendFile(void) const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
// neu, ab 6.4.23
|
||||||
|
// bereits vorhanden, nochmal getestet/verbessert:
|
||||||
|
// void led_switchLedPaper(uint8_t on, uint8_t ton, uint8_t tof) const override;
|
||||||
|
// void alarm_switchSiren(bool on) const override;
|
||||||
|
|
||||||
// neu, 25.8.21
|
// void mif_readerOn(bool on) const override;
|
||||||
QString dc_getTxt4RsDiagWin(void) const override;
|
// bool mif_cardIsAttached(void) const override;
|
||||||
void dc_clrTxt4RsDiagWin(void) const override;
|
|
||||||
QString dc_get2ndTxt4RsDiagWin(void) const override;
|
|
||||||
void dc_clr2ndTxt4RsDiagWin(void) const override;
|
|
||||||
QString dc_getTxt4HsStateLine(void) const override;
|
|
||||||
void dc_clrTxt4HsStateLine(void) const override;
|
|
||||||
QString dc_getTxt4masterStateLine(void) const override;
|
|
||||||
void dc_clrTxt4masterStateLine(void) const override;
|
|
||||||
QString dc_getTxt4resultStateLine(void) const override;
|
|
||||||
void dc_clrTxt4resultStateLine(void) const override;
|
|
||||||
QString dc_getdataStateLine(void) const override;
|
|
||||||
void dc_clrTxt4dataStateLine(void) const override;
|
|
||||||
QString dc_getdatifLine(void) const override;
|
|
||||||
void dc_clrTxt4datifLine(void) const override;
|
|
||||||
|
|
||||||
// using DC2 Bootloader
|
// void shut_move(bool open) const override;
|
||||||
void bl_iniChain(void) const override;
|
// void esc_moveFlaps(uint8_t flap ) const override;
|
||||||
bool bl_importBinFile(QByteArray readBinFile, uint32_t fileSize, char withDispl) const override;
|
// 0: close both 1: open take-flap 2: open return
|
||||||
uint8_t bl_activatBootloader(uint8_t *sendData) const override;
|
// void shut_openOnce(void) const override;
|
||||||
uint8_t bl_startChain(void) const override;
|
// and close automatic after shutter time
|
||||||
uint8_t bl_readBLversion(uint8_t *sendData) const override;
|
// void shut_openForCoin(bool start) const override;
|
||||||
// minimum size of sendData-buffer: 5byte retval: length
|
// open flap if coin is attached
|
||||||
uint8_t bl_readFWversion(uint8_t *sendData) const override;
|
// once process is started it runs until stop command
|
||||||
// minimum size of sendData-buffer: 5byte retval: length
|
// void shut_sendOpeningTime(uint16_t timeIn_ms ) const override;
|
||||||
|
// after this time without retrigger the flap is closed
|
||||||
|
// void esc_takeMoney(void) const override;
|
||||||
|
// and close automatically after escrow time (1s)
|
||||||
|
// void esc_returnMoney(void) const override;
|
||||||
|
// and close automatically after escrow time (1s)
|
||||||
|
|
||||||
uint8_t bl_prepareDC_BLcmd(uint8_t Cmd, uint8_t SendDataLength, uint8_t *sendData, uint8_t *outBuf) const override;
|
// void prn_switchPower(bool on) const override;
|
||||||
// make BL protocol, retval = outbuf length (5...133)
|
// void prn_sendText(QByteArray *buf) const override;
|
||||||
// bring data in correct form: start always with 0x02 finish with 0x03 and append checksum
|
// up to 1280 bytes
|
||||||
// 0x02 Cmd < ...sendData ..> CRC CRC 0x03
|
|
||||||
// Data length = 0...64
|
|
||||||
// special conversion: if data contain 2 or 3 (STX, ETX) then write two bytes: 0x1B (=ESC) and data|0x80
|
|
||||||
// so maxlength = 5 + 2 x 64 (if all data are 2 or 3) without 2,3: maxlength = 5 + 64
|
|
||||||
|
|
||||||
uint8_t bl_exitBL(uint8_t *sendData) const override;
|
// uint8_t rtc_setDateTime(void) const override;
|
||||||
// minimum size of sendData-buffer: 5byte retval: length
|
// send system time
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
//void sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker,
|
||||||
uint8_t emp_getInsertedCoinSignal(void) const override;
|
// uint8_t kindOfMifareReader, uint8_t suppressSleep,
|
||||||
// can be called one time after each coin
|
// uint8_t kindOfModem, uint8_t kindOfCredit ) const override;
|
||||||
// emp_chkIfCoinInserted() must be called before!
|
|
||||||
|
|
||||||
uint16_t emp_getInsertedCoinValue(void) const override;
|
//void sendMachineID(uint16_t customerNr, uint16_t machineNr,
|
||||||
// can be called one time after each coin
|
// uint16_t borough, uint16_t zone,
|
||||||
// emp_chkIfCoinInserted() must be called before!
|
// uint16_t alias, char *location) const override;
|
||||||
|
|
||||||
uint8_t emp_getCoinError(void) const override;
|
|
||||||
// can be called one time after each coin
|
|
||||||
// emp_chkIfCoinInserted() must be called before!
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const override;
|
||||||
void sub_storeSendingText(QByteArray *buf) const;
|
// return true if successful. could fail if more the 8 commands are waiting
|
||||||
|
|
||||||
|
bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
bool rtc_getExtendedTime(struct T_extTime *exTime) const override;
|
||||||
|
|
||||||
|
bool sys_runCompleteTest(void) const override;
|
||||||
|
// warning: lasts 20s in one pace
|
||||||
|
|
||||||
|
bool sys_ready4sending(void) const override;
|
||||||
|
// return true if a Json-file can be sent
|
||||||
|
|
||||||
|
bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const override;
|
||||||
|
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
|
||||||
|
// nrOfTemplate=1...32 if kindOfFile==6
|
||||||
|
// content = content of the Json file, max 800byte ascii signs
|
||||||
|
// file is 0-terminated!
|
||||||
|
// return false if sending is not possible, wait a second
|
||||||
|
|
||||||
|
bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const override;
|
||||||
|
// dynPrnVal = array of 8 Variables with 8 byte each, come as ascii string
|
||||||
|
// like: char prn_dynPrnVal[8][8];
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
bool prn_printTemplate(uint8_t nrOftemplate) const override;
|
||||||
|
// print one of the templates loaded by Json prior
|
||||||
|
// nr = 1..32
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const override;
|
||||||
|
// returns all acc nrs of the backuped vault records
|
||||||
|
// use: uint16_t backupedAccNumbers[8]
|
||||||
|
|
||||||
|
bool log_selectVaultRecord(uint16_t accountNr ) const override;
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
// and trigger transfer
|
||||||
|
|
||||||
|
bool log_chkIfVaultRecordAvailable(void) const override;
|
||||||
|
// return true if completly received
|
||||||
|
|
||||||
|
bool log_getVaultRecord(struct T_vaultRecord *retVR) const override;
|
||||||
|
// which was selected by: log_selectVaultRecord()
|
||||||
|
// to be forwarded to Ismas
|
||||||
|
|
||||||
|
bool prn_printAccountReceipt(void) const override;
|
||||||
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
|
|
||||||
|
bool prn_printTestTicket(void) const override;
|
||||||
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
|
|
||||||
|
bool cash_startPayment(uint32_t amount) const override;
|
||||||
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
|
uint8_t cash_paymentProcessing(void) const override;
|
||||||
|
// run this function periodically while coin payment process to generate necessary signals
|
||||||
|
// return value:
|
||||||
|
// 0: stopped 1: starting up 2: coin collection
|
||||||
|
// 3: finished by User (Push button) 4: finished, Max-Value collected
|
||||||
|
// 5: finished by escrow
|
||||||
|
// 10,11: error cannot start
|
||||||
|
// 12: timeout while payment, coins returned
|
||||||
|
// 13: stopped by unexpected error
|
||||||
|
|
||||||
|
|
||||||
|
bool cash_cancelPayment(void) const override;
|
||||||
|
// and return coins
|
||||||
|
|
||||||
|
bool cash_stopPayment(void) const override;
|
||||||
|
// and keep coins in escrow
|
||||||
|
|
||||||
|
uint32_t getInsertedAmount(void) const override;
|
||||||
|
|
||||||
|
uint16_t getLastInsertedCoin(void) const override;
|
||||||
|
|
||||||
|
bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const override;
|
||||||
|
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert, max 64
|
||||||
|
|
||||||
|
|
||||||
|
// after ticket/goods issue:
|
||||||
|
bool vend_success(void) const override;
|
||||||
|
// conclude payment process, encash all inserted coins to vault. Printing was successful
|
||||||
|
// if possible return change
|
||||||
|
|
||||||
|
bool vend_failed(void) const override;
|
||||||
|
// conclude payment process and return all inserted coins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
uint8_t mif_getCardType(QString *cardholder) const override;
|
||||||
// Modem:
|
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
||||||
|
// cardholder: 7byte Name-String
|
||||||
|
|
||||||
uint8_t mod_power(bool on) const override;
|
uint64_t sys_getWakeSource(void) const override;
|
||||||
uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
|
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||||
uint8_t mod_setCondition(uint16_t chgCmd) const override; // e.g. change to state registered, sleep, open, off....
|
|
||||||
uint16_t mod_getCondition(void) const override; // e.g. now socket open
|
|
||||||
bool mod_sendBufferFree(void) const override; // sending allowed (before writing) and sending finished (after writing)
|
|
||||||
uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
|
|
||||||
void mod_wantReadData(uint16_t nrOfData) const override; // start reading
|
|
||||||
uint16_t mod_gotData(void) const override; // return nr of received bytes
|
|
||||||
uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
|
|
||||||
uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
|
|
||||||
uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
|
|
||||||
|
|
||||||
// Credit Card Terminal:
|
uint8_t sys_getWakeReason(void) const override;
|
||||||
|
// Master was woken by following reason:
|
||||||
|
// 1: MDB Event
|
||||||
|
// 2: Coin Event
|
||||||
|
// ( 3: Master Event) - will not set the wake line
|
||||||
|
// ( 4: 32s pulse) - will not set the wake line
|
||||||
|
// 5: Door Event
|
||||||
|
// ( 6: Diag Event) - will not set the wake line
|
||||||
|
// 7: 30min-Pulse for HB
|
||||||
|
|
||||||
uint8_t cc_power(bool on) const override;
|
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
|
||||||
uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) const override;
|
|
||||||
|
|
||||||
*/
|
void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
|
||||||
|
|
||||||
|
void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const override;
|
||||||
|
void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const override;
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t cash_getAmountInVault(void) const override;
|
||||||
|
|
||||||
|
uint16_t cash_getNrCoinsInVault(void) const override;
|
||||||
|
|
||||||
|
uint8_t prn_getPrintResult() const override;
|
||||||
|
|
||||||
|
uint8_t prn_getCurrentPrinterState() const override;
|
||||||
|
// 0: printer OK
|
||||||
|
// bit0: near paper end bit1: no paper
|
||||||
|
// bit2: temperature error bit3: error head open
|
||||||
|
// bit4: paper jam in cutter
|
||||||
|
// bit6: no response bit7: serial rec. error
|
||||||
|
// bit5: printer not ready
|
||||||
|
|
||||||
|
void sys_sendDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||||
|
|
||||||
|
void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||||
|
|
||||||
|
bool sys_areDCdataValid(void) const override;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------------------------
|
||||||
|
// ------------ supervise all hardware components
|
||||||
|
// ------------ assess the machine state
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
uint8_t sys_superviseSystem(void) const override;
|
||||||
|
// this function proofs if vending is possible depending of doors state
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t sys_getSystemErrors(void) const override;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void hwapi_templatePrintFinished_OK(void) const override;
|
||||||
|
void hwapi_templatePrintFinished_Err(void) const override;
|
||||||
|
|
||||||
|
void hwapi_coinCollectionJustStarted(void) const override;
|
||||||
|
void hwapi_coinCollectionAborted(void) const override;
|
||||||
|
|
||||||
|
void hwapi_gotNewCoin(void) const override;
|
||||||
|
void hwapi_payStopByMax(void) const override;
|
||||||
|
void hwapi_payStopByPushbutton(void) const override;
|
||||||
|
|
||||||
|
void hwapi_payStopByEscrow(void) const override;
|
||||||
|
void hwapi_payStopByError(void) const override;
|
||||||
|
void hwapi_payStopByTimeout(void) const override;
|
||||||
|
void hwapi_payCancelled(void) const override;
|
||||||
|
|
||||||
|
void hwapi_coinProcessJustStopped(void) const override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void hwapi_slotPrintFinished_OK(void);
|
||||||
|
void hwapi_slotPrintFinished_Err(void);
|
||||||
|
void hwapi_slotGotCoin(void);
|
||||||
|
void hwapi_slotPayProc(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1110,8 +1151,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Coin checker and changer mdb4.2 / section 5
|
// Coin checker and changer mdb4.2 / section 5
|
||||||
// Level 2 Commands (predefined device msg acc. mdb manual and auto-poll)
|
// Level 2 Commands (predefined device msg acc. mdb manual and auto-poll)
|
||||||
@@ -1229,3 +1268,23 @@ struct Tcc_hw_state
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// not yet implemented
|
||||||
|
uint8_t mod_power(bool on) const override;
|
||||||
|
uint8_t mod_getHwState(struct Tmod_hw_state *mod_hw_state) const override;
|
||||||
|
uint8_t mod_setCondition(uint16_t chgCmd) const override; // e.g. change to state registered, sleep, open, off....
|
||||||
|
uint16_t mod_getCondition(void) const override; // e.g. now socket open
|
||||||
|
bool mod_sendBufferFree(void) const override; // sending allowed (before writing) and sending finished (after writing)
|
||||||
|
uint8_t mod_sendDataBlk(uint16_t len, uint8_t *buf) const override;
|
||||||
|
void mod_wantReadData(uint16_t nrOfData) const override; // start reading
|
||||||
|
uint16_t mod_gotData(void) const override; // return nr of received bytes
|
||||||
|
uint8_t mod_loadDataBlk(uint16_t len, uint8_t *buf) const override;
|
||||||
|
uint8_t mod_setupSerial(struct TserialParams serialParameter) const override;
|
||||||
|
uint8_t mod_getCurrentSerialSettings(struct TserialParams *serialParameter) const override;
|
||||||
|
|
||||||
|
// Credit Card Terminal:
|
||||||
|
uint8_t cc_power(bool on) const override;
|
||||||
|
uint8_t cc_getHwState(struct Tcc_hw_state *cc_hw_state) 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;
|
||||||
@@ -34,11 +31,9 @@ struct T_emp
|
|||||||
|
|
||||||
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;
|
||||||
@@ -48,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
|
||||||
@@ -66,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;
|
||||||
@@ -80,28 +73,235 @@ struct Tprn_hw_state
|
|||||||
bool nowAligned;
|
bool nowAligned;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 {
|
||||||
|
// Kassenbeleg (Abrechnungsdatensatz = Kassenwechsel-Datensatz)
|
||||||
|
char startbuffer[4]; // Psa> // never move or change this 1st entry
|
||||||
|
uint16_t AccountingNumber;
|
||||||
|
uint16_t CUNU;
|
||||||
|
uint16_t MANU;
|
||||||
|
uint16_t resint1;
|
||||||
|
//uint16_t resint2;
|
||||||
|
|
||||||
|
char label1buffer[4]; // tim>
|
||||||
|
uint8_t year;
|
||||||
|
uint8_t month;
|
||||||
|
uint8_t dom;
|
||||||
|
uint8_t hour;
|
||||||
|
uint8_t min;
|
||||||
|
uint8_t sec;
|
||||||
|
uint8_t DoW;
|
||||||
|
uint8_t reschar3;
|
||||||
|
|
||||||
class hwinf
|
char label2buffer[4]; // abs>
|
||||||
|
uint32_t AbsIncome1;
|
||||||
|
uint32_t AbsReserve;
|
||||||
|
uint32_t AbsNrOfCuts;
|
||||||
|
|
||||||
|
//16
|
||||||
|
char label3buffer[4]; // mw >
|
||||||
|
|
||||||
|
// Verkauf, Tür zu:
|
||||||
|
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
|
||||||
|
//88
|
||||||
|
// Service, Tür offen:
|
||||||
|
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 resint3;
|
||||||
|
uint16_t resint4;
|
||||||
|
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
||||||
|
uint16_t resint5;
|
||||||
|
uint16_t resint6;
|
||||||
|
// 56
|
||||||
|
char label4buffer[4]; // box>
|
||||||
|
uint16_t coinsInVault[16];
|
||||||
|
uint16_t billsInStacker[8];
|
||||||
|
// 48
|
||||||
|
char label5buffer[4]; // val>
|
||||||
|
// actually constant unless exchange rate is changed
|
||||||
|
uint16_t coinDenomination[16]; // 5..50000 (z.B. 2? sind in Ungarn 760Ft)
|
||||||
|
uint16_t billDenom[8];
|
||||||
|
uint16_t tubeDenom[6];
|
||||||
|
uint16_t exchangeRate;
|
||||||
|
uint16_t resint9;
|
||||||
|
// 64
|
||||||
|
char endofblock[4]; // end>
|
||||||
|
// 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_dynamicCondition {
|
||||||
|
char allDoorsDebounced; // 99: undefined, 0=all closed, bit1=upper door open 2=midlle door open 3=lower door open
|
||||||
|
char openedAuthorized;
|
||||||
|
uint8_t CBinDebounced;
|
||||||
|
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; // not used, always 0
|
||||||
|
char billBox;
|
||||||
|
char modeAbrech;
|
||||||
|
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
||||||
|
char nowCardTest;
|
||||||
|
char nowPayment;
|
||||||
|
char lastMifCardType;
|
||||||
|
uint8_t lastSDoorState;
|
||||||
|
uint8_t lastVDoorState;
|
||||||
|
uint8_t lastCBstate; // 99: undefined 0:not there 1:insered
|
||||||
|
char paymentInProgress;
|
||||||
|
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
|
||||||
|
uint8_t MifCardHolder[8];
|
||||||
|
uint8_t resultOfLastTemplPrint;
|
||||||
|
// 0: unknown or printing in progress
|
||||||
|
// 1: OK, doc was printed 2: error, doc was not printed
|
||||||
|
uint8_t lastPrinterStatus;
|
||||||
|
// 0: printer OK
|
||||||
|
// bit0: near paper end bit1: no paper
|
||||||
|
// bit2: temperature error bit3: error head open
|
||||||
|
// bit4: paper jam in cutter
|
||||||
|
// bit6: no response bit7: serial rec. error
|
||||||
|
// bit5: printer not ready
|
||||||
|
uint8_t startupTestIsRunning;
|
||||||
|
//54
|
||||||
|
};
|
||||||
|
|
||||||
|
struct T_extTime {
|
||||||
|
uint8_t Hours;
|
||||||
|
uint8_t Min;
|
||||||
|
uint8_t Sec;
|
||||||
|
uint8_t Year;
|
||||||
|
uint8_t Month;
|
||||||
|
uint8_t Day;
|
||||||
|
uint8_t DOW;
|
||||||
|
uint8_t res1;
|
||||||
|
uint16_t MinOfDay;
|
||||||
|
uint16_t res2;
|
||||||
|
uint32_t SecOfDay;
|
||||||
|
uint8_t isLeapYear;
|
||||||
|
uint8_t nxtLeapYear;
|
||||||
|
uint8_t lastLeapYear;
|
||||||
|
uint8_t hoursOfThisWeek;
|
||||||
|
uint16_t minutesOfThisWeek;
|
||||||
|
uint16_t hoursOfThisMonth;
|
||||||
|
uint16_t daysOfThisYear;
|
||||||
|
uint16_t GetHoursOfYear;
|
||||||
|
uint16_t res3;
|
||||||
|
uint32_t GetMinutesOfYear;
|
||||||
|
uint8_t getWakeIntvSec;
|
||||||
|
uint8_t res4;
|
||||||
|
uint16_t res5;
|
||||||
|
uint32_t MinutesOfMillenium;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef uint8_t UCHAR;
|
||||||
|
typedef uint16_t UINT;
|
||||||
|
|
||||||
|
struct T_devices
|
||||||
{
|
{
|
||||||
|
// set by master, used(1) or notused (0) or type 2....20
|
||||||
|
|
||||||
|
UCHAR kindOfPrinter; // 0:off 1:Gebe
|
||||||
|
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
||||||
|
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
||||||
|
UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
|
||||||
|
|
||||||
|
UCHAR kindOfModem; // 0:off 1:Sunlink
|
||||||
|
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
||||||
|
UCHAR CoinEscrow;
|
||||||
|
UCHAR CoinRejectUnit;
|
||||||
|
|
||||||
|
UCHAR CoinShutter;
|
||||||
|
UCHAR BillAcceptor;
|
||||||
|
UCHAR usevaultLock;
|
||||||
|
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
||||||
|
|
||||||
|
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
||||||
|
UCHAR printAccReceipt; // 0/1
|
||||||
|
UCHAR printDoorReceipt;
|
||||||
|
UCHAR printTokenTicket;
|
||||||
|
|
||||||
|
UINT VaultFullWarnLevel;
|
||||||
|
UINT VaultFullErrorLevel;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class hwinf {
|
||||||
public:
|
public:
|
||||||
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
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
|
||||||
// Sending Output data to DeviceController DC2b
|
// Sending Output data to DeviceController DC2b
|
||||||
@@ -124,6 +324,8 @@ public:
|
|||||||
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual uint8_t test_serialState(void) const =0;
|
virtual uint8_t test_serialState(void) const =0;
|
||||||
// test on-board signals for the serials
|
// test on-board signals for the serials
|
||||||
// serial drv on/off, Serial mux1, Serial mux2
|
// serial drv on/off, Serial mux1, Serial mux2
|
||||||
@@ -135,6 +337,17 @@ public:
|
|||||||
QString comPort) const = 0;
|
QString comPort) const = 0;
|
||||||
// download binary file down into device controller
|
// 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
|
||||||
@@ -150,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"
|
||||||
// plBufSiz<EFBFBD>z=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
|
||||||
@@ -271,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<EFBFBD>C 100=0,0<EFBFBD>C 141=20,5<EFBFBD>C 400=150,0<EFBFBD>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<EFBFBD>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
|
||||||
@@ -429,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<EFBFBD>_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)
|
||||||
@@ -439,11 +652,31 @@ public:
|
|||||||
virtual void request_ReadbackDeviceSettings() const =0;
|
virtual void request_ReadbackDeviceSettings() const =0;
|
||||||
|
|
||||||
virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0;
|
virtual void readback_DeviceSettings(uint8_t *length, uint8_t *data) const =0;
|
||||||
// refer to DC2 manual for exact content
|
/*
|
||||||
// state 5.5.21: byte[0]=kindOfPrinter byte[1]=kindOfCoinChecker
|
buf66[0]=devPara.kindOfPrinter;
|
||||||
// byte[2]=kindOfMifarereadr byte[3]=suppress sleep mode
|
buf66[1]=devPara.kindOfCoinChecker;
|
||||||
// byte[4]=kindOfModem byte[5]=kind of cc terminal
|
buf66[2]=devPara.kindOfMifareReader;
|
||||||
|
buf66[3]=devPara.suppressSleepMode;
|
||||||
|
buf66[4]=devPara.kindOfModem;
|
||||||
|
buf66[5]=devPara.kindOfCreditcard;
|
||||||
|
buf66[6]=devPara.CoinEscrow;
|
||||||
|
buf66[7]=devPara.CoinRejectUnit;
|
||||||
|
buf66[8]=devPara.CoinShutter;
|
||||||
|
buf66[9]=devPara.BillAcceptor;
|
||||||
|
buf66[10]=devPara.usevaultLock;
|
||||||
|
buf66[11]=devPara.autoAlarm;
|
||||||
|
buf66[12]=devPara.autoOpen;
|
||||||
|
buf66[13]=devPara.printAccReceipt;
|
||||||
|
buf66[14]=devPara.printDoorReceipt;
|
||||||
|
buf66[15]=devPara.printTokenTicket;
|
||||||
|
uitmp=devPara.VaultFullWarnLevel;
|
||||||
|
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
uitmp=devPara.VaultFullErrorLevel;
|
||||||
|
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
|
virtual void sendMachineID(uint16_t customerNr, uint16_t machineNr,
|
||||||
uint16_t borough, uint16_t zone,
|
uint16_t borough, uint16_t zone,
|
||||||
@@ -455,8 +688,8 @@ public:
|
|||||||
// state 5.5.21: byte[0,1]=customer number byte[2,3]=machine number
|
// state 5.5.21: byte[0,1]=customer number byte[2,3]=machine number
|
||||||
// byte[4,5]=borough byte[6,7]=zone byte[8,9]=alias name
|
// byte[4,5]=borough byte[6,7]=zone byte[8,9]=alias name
|
||||||
// byte[10...41]=location
|
// byte[10...41]=location
|
||||||
|
// 12.4.23TS still the same
|
||||||
|
|
||||||
// 9
|
|
||||||
|
|
||||||
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||||
// Printer
|
// Printer
|
||||||
@@ -515,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;
|
||||||
@@ -1053,7 +1286,7 @@ public:
|
|||||||
// return true is bl is up and running
|
// return true is bl is up and running
|
||||||
// also initializes "sendFile"
|
// also initializes "sendFile"
|
||||||
|
|
||||||
virtual void bl_sendAddress(u_int16_t blockNumber) const=0;
|
virtual void bl_sendAddress(uint16_t blockNumber) const=0;
|
||||||
// send start address, nr of 64byte-block, start with 0
|
// send start address, nr of 64byte-block, start with 0
|
||||||
// will be sent only for following block-numbers:
|
// will be sent only for following block-numbers:
|
||||||
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
|
// 0, 1024, 2048, 3072 and 4096, so basically every 64kByte
|
||||||
@@ -1065,7 +1298,7 @@ public:
|
|||||||
virtual void bl_openBinary(void) const=0;
|
virtual void bl_openBinary(void) const=0;
|
||||||
// to be used within CashAgent, momentary not processed
|
// to be used within CashAgent, momentary not processed
|
||||||
|
|
||||||
virtual void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const=0;
|
virtual void bl_sendDataBlock(uint8_t length, uint8_t *buffer) const=0;
|
||||||
// send 64 byte from bin file
|
// send 64 byte from bin file
|
||||||
|
|
||||||
virtual void bl_sendLastBlock(void) const=0;
|
virtual void bl_sendLastBlock(void) const=0;
|
||||||
@@ -1083,7 +1316,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Komplett-schreib Funktion, noch nicht getestet
|
// Komplett-schreib Funktion, noch nicht getestet
|
||||||
// Nachteil: keine R<EFBFBD>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;
|
||||||
@@ -1091,6 +1324,370 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------
|
||||||
|
// 6.4.2023: new functions for coin collection and printing
|
||||||
|
// some new system functions
|
||||||
|
// ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
virtual bool rtc_setTimeDateDirect(struct Trtc_DateTime *DateTime) const=0;
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool rtc_getExtendedTime(uint8_t *leng, uint8_t *data) const=0;
|
||||||
|
/*
|
||||||
|
buf[0]=GlobTime.Hours;
|
||||||
|
buf[1]=GlobTime.Min;
|
||||||
|
buf[2]=GlobTime.Sec;
|
||||||
|
buf[3]=GlobTime.Year;
|
||||||
|
buf[4]=GlobTime.Month;
|
||||||
|
buf[5]=GlobTime.Day;
|
||||||
|
buf[6]=GlobTime.DOW;
|
||||||
|
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
||||||
|
uitmp=GlobTime.MinOfDay;
|
||||||
|
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
buf[10]=' ';
|
||||||
|
buf[11]=' ';
|
||||||
|
ultmp=GlobTime.SecOfDay;
|
||||||
|
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
buf[16]=swl_isLeap(GlobTime.Year);
|
||||||
|
buf[17]=swl_getNextLeapYear(GlobTime.Year);
|
||||||
|
buf[18]=swl_getLastLeapYear(GlobTime.Year);
|
||||||
|
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
|
||||||
|
|
||||||
|
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
|
||||||
|
buf[21]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
|
||||||
|
buf[22]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[23]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[24]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[25]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
|
||||||
|
buf[26]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[27]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
|
||||||
|
buf[28]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[29]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
buf[30]=0;
|
||||||
|
buf[31]=0;
|
||||||
|
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
|
||||||
|
GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
buf[36]=rtc_getSqwaveSettings();
|
||||||
|
buf[37]=0;
|
||||||
|
buf[38]=0;
|
||||||
|
buf[39]=0;
|
||||||
|
|
||||||
|
ultmp= 0; // Minutes of the Millenium
|
||||||
|
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
dc2prot_setReadData(44, buf);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual bool rtc_getExtendedTime(struct T_extTime *exTime) const=0;
|
||||||
|
|
||||||
|
virtual bool sys_runCompleteTest(void) const=0;
|
||||||
|
// warning: lasts 20s in one pace
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool sys_ready4sending(void) const=0;
|
||||||
|
// return true if a Json-file can be sent
|
||||||
|
|
||||||
|
virtual bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const=0;
|
||||||
|
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
|
||||||
|
// nrOfTemplate=1...32 if kindOfFile==6
|
||||||
|
// content = content of the Json file, max 800byte ascii signs
|
||||||
|
// file is 0-terminated
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const=0;
|
||||||
|
// dynPrnVal = array of 8 Variables with 8 byte each, come as ascii string
|
||||||
|
// like: char prn_dynPrnVal[8][8];
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool prn_printTemplate(uint8_t nrOftemplate) const=0;
|
||||||
|
// print one of the templates loaded by Json prior
|
||||||
|
// nr = 1..32
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const=0;
|
||||||
|
// returns all acc nrs of the backuped vault records
|
||||||
|
// use: uint16_t backupedAccNumbers[8]
|
||||||
|
|
||||||
|
virtual bool log_selectVaultRecord(uint16_t accountNr ) const=0;
|
||||||
|
// return true if sending, false if cmd-stack is full
|
||||||
|
// and trigger transfer
|
||||||
|
|
||||||
|
virtual bool log_chkIfVaultRecordAvailable(void) const=0;
|
||||||
|
// return true if completly received
|
||||||
|
|
||||||
|
virtual bool log_getVaultRecord(struct T_vaultRecord *retVR) const=0;
|
||||||
|
// which was selected by: log_selectVaultRecord()
|
||||||
|
// to be forwarded to Ismas
|
||||||
|
|
||||||
|
virtual bool prn_printAccountReceipt(void) const=0;
|
||||||
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool prn_printTestTicket(void) const=0;
|
||||||
|
// return true if sending to DC OK, false if cmd-stack is full
|
||||||
|
|
||||||
|
virtual bool cash_startPayment(uint32_t amount) const=0;
|
||||||
|
// 17.4.23TS: extended to 32bit
|
||||||
|
|
||||||
|
virtual uint8_t cash_paymentProcessing(void) const=0;
|
||||||
|
|
||||||
|
virtual uint32_t getInsertedAmount(void) const=0;
|
||||||
|
|
||||||
|
virtual uint16_t getLastInsertedCoin(void) const=0;
|
||||||
|
|
||||||
|
virtual bool getAllInsertedCoins(uint16_t *types, uint16_t *values) const=0;
|
||||||
|
// all inserted coins (max 64) since "cash_startPayment"
|
||||||
|
|
||||||
|
virtual bool cash_cancelPayment(void) const=0;
|
||||||
|
// and return coins
|
||||||
|
|
||||||
|
virtual bool cash_stopPayment(void) const=0;
|
||||||
|
// and keep coins in escrow
|
||||||
|
|
||||||
|
// after ticket/goods issue:
|
||||||
|
virtual bool vend_success(void) const=0;
|
||||||
|
// conclude payment process, encash all inserted coins to vault. Printing was successful
|
||||||
|
// if possible return change
|
||||||
|
|
||||||
|
virtual bool vend_failed(void) const=0;
|
||||||
|
// conclude payment process and return all inserted coins
|
||||||
|
|
||||||
|
|
||||||
|
virtual uint8_t mif_getCardType(QString *cardholder) const=0;
|
||||||
|
// return 1,2,3,4 = upper, lower access card, printer test, coin test
|
||||||
|
// cardholder: 7byte Name-String
|
||||||
|
|
||||||
|
virtual uint64_t sys_getWakeSource(void) const =0;
|
||||||
|
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||||
|
|
||||||
|
virtual uint8_t sys_getWakeReason(void) const=0;
|
||||||
|
// Master was woken by following reason:
|
||||||
|
// 1: MDB Event
|
||||||
|
// 2: Coin Event
|
||||||
|
// ( 3: Master Event) - will not set the wake line
|
||||||
|
// ( 4: 32s pulse) - will not set the wake line
|
||||||
|
// 5: Door Event
|
||||||
|
// ( 6: Diag Event) - will not set the wake line
|
||||||
|
// 7: 30min-Pulse for HB
|
||||||
|
|
||||||
|
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
|
/*
|
||||||
|
|
||||||
|
outBuf[0]=modCond.ram;
|
||||||
|
outBuf[1]=modCond.intEe;
|
||||||
|
outBuf[2]=modCond.extEe;
|
||||||
|
outBuf[3]=modCond.rtc;
|
||||||
|
outBuf[4]=modCond.boardHw;
|
||||||
|
outBuf[5]=modCond.printer;
|
||||||
|
outBuf[6]=modCond.modem;
|
||||||
|
outBuf[7]=modCond.signal;
|
||||||
|
outBuf[8]=modCond.regist;
|
||||||
|
outBuf[9]=modCond.mdbBus;
|
||||||
|
outBuf[10]=modCond.coinChecker;
|
||||||
|
outBuf[11]=modCond.coinEscrow;
|
||||||
|
outBuf[12]=modCond.mifareReader;
|
||||||
|
outBuf[13]=modCond.creditTerm;
|
||||||
|
outBuf[14]=modCond.coinReject;
|
||||||
|
outBuf[15]=modCond.coinSafe;
|
||||||
|
outBuf[16]=modCond.billSafe;
|
||||||
|
outBuf[17]=modCond.voltage;
|
||||||
|
outBuf[18]=modCond.temper;
|
||||||
|
outBuf[19]=modCond.poweronTest;
|
||||||
|
outBuf[20]=modCond.doorState;
|
||||||
|
outBuf[21]=modCond.doorWasOpened;
|
||||||
|
outBuf[22]=modCond.changer;
|
||||||
|
outBuf[23]=modCond.coinBlocker;
|
||||||
|
outBuf[24]=modCond.billReader;
|
||||||
|
outBuf[25]=modCond.ResetReason;
|
||||||
|
outBuf[26]=modCond.allModulesChecked;
|
||||||
|
outBuf[27]=modCond.alarmState;
|
||||||
|
outBuf[28]=0;
|
||||||
|
outBuf[29]=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void sys_getDeviceConditions(struct T_moduleCondition *devCond) const=0;
|
||||||
|
virtual void sys_getDynMachineConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||||
|
/*
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.allDoorsDebounced;
|
||||||
|
outBuf[pBuf++]=dynCond.openedAuthorized;
|
||||||
|
outBuf[pBuf++]=dynCond.CBinDebounced;
|
||||||
|
outBuf[pBuf++]=dynCond.upperDoor;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.middleDoor;
|
||||||
|
outBuf[pBuf++]=dynCond.lowerDoor;
|
||||||
|
outBuf[pBuf++]=dynCond.coinBox;
|
||||||
|
outBuf[pBuf++]=dynCond.billBox;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.modeAbrech;
|
||||||
|
outBuf[pBuf++]=dynCond.onAlarm;
|
||||||
|
outBuf[pBuf++]=dynCond.nowCardTest;
|
||||||
|
outBuf[pBuf++]=dynCond.nowPayment;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.lastMifCardType;
|
||||||
|
outBuf[pBuf++]=dynCond.lastSDoorState;
|
||||||
|
outBuf[pBuf++]=dynCond.lastVDoorState;
|
||||||
|
outBuf[pBuf++]=dynCond.lastCBstate;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.paymentInProgress;
|
||||||
|
outBuf[pBuf++]=0;
|
||||||
|
uitmp=dynCond.U_Batt;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
uitmp=dynCond.Temperatur;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
uitmp=dynCond.nrCoinsInBox; // send seperate also
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.amountInBox; // send seperate also
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.totalTransVolume;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.totalNrOfVends;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
// 36
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_config;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_device;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_cash;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_print;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_serial;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_time;
|
||||||
|
outBuf[pBuf++]=dynCond.lastFileType;
|
||||||
|
outBuf[pBuf++]=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void sys_getDynMachineConditions(struct T_dynamicCondition *dynMachCond) const=0;
|
||||||
|
|
||||||
|
// content of Cashbox
|
||||||
|
virtual uint32_t cash_getAmountInVault(void) const=0;
|
||||||
|
|
||||||
|
virtual uint16_t cash_getNrCoinsInVault(void) const=0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual uint8_t prn_getPrintResult() const=0;
|
||||||
|
|
||||||
|
// in case of print-error get detailed error:
|
||||||
|
virtual uint8_t prn_getCurrentPrinterState() const=0;
|
||||||
|
// 0: printer OK
|
||||||
|
// bit0: near paper end bit1: no paper
|
||||||
|
// bit2: temperature error bit3: error head open
|
||||||
|
// bit4: paper jam in cutter
|
||||||
|
// bit6: no response bit7: serial rec. error
|
||||||
|
// bit5: printer not ready
|
||||||
|
|
||||||
|
virtual void sys_sendDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||||
|
|
||||||
|
virtual void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||||
|
|
||||||
|
virtual bool sys_areDCdataValid(void) const=0;
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------------------------
|
||||||
|
// ------------ supervise all hardware components
|
||||||
|
// ------------ assess the machine state
|
||||||
|
|
||||||
|
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 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 uint8_t sys_superviseSystem(void) const=0;
|
||||||
|
// this function proofs if vending is possible depending of doors state
|
||||||
|
|
||||||
|
virtual uint8_t sys_getSystemErrors(void) const=0;
|
||||||
|
|
||||||
|
|
||||||
|
// retrigger System-Check with:
|
||||||
|
// bool hwapi::sys_runCompleteTest(void) const
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
signals:
|
||||||
|
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||||
|
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_coinCollectionJustStarted(void) const=0;
|
||||||
|
virtual void hwapi_coinCollectionAborted(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_gotNewCoin(void) const=0;
|
||||||
|
virtual void hwapi_payStopByMax(void) const=0;
|
||||||
|
virtual void hwapi_payStopByPushbutton(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_payStopByEscrow(void) const=0;
|
||||||
|
virtual void hwapi_payStopByError(void) const=0;
|
||||||
|
virtual void hwapi_payStopByTimeout(void) const=0;
|
||||||
|
virtual void hwapi_payCancelled(void) const=0;
|
||||||
|
|
||||||
|
virtual void hwapi_coinProcessJustStopped(void) const=0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1104,8 +1701,20 @@ public:
|
|||||||
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
|
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
|
||||||
// mif_getCardDataStr(bool useHexFormat, char seperator)
|
// mif_getCardDataStr(bool useHexFormat, char seperator)
|
||||||
|
|
||||||
|
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
|
||||||
|
// V3.2 Bootloader improvement
|
||||||
|
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
|
||||||
|
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
||||||
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
|
||||||
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
||||||
|
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.4"
|
||||||
|
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.5"
|
||||||
|
|
||||||
|
|
||||||
#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
Q_DECLARE_INTERFACE(hwinf, HWINF_iid)
|
||||||
|
|
||||||
|
@@ -211,6 +211,39 @@ 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
|
||||||
|
void sendFDcmd_clrStack(void);
|
||||||
|
bool sendFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t dat1, uint8_t dat2, uint8_t dat3, uint8_t dat4);
|
||||||
|
// write Command to memory, wait for transport
|
||||||
|
bool sendFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4);
|
||||||
|
|
||||||
|
uint8_t check4FDshortCmd(void);
|
||||||
|
// returns number of waiting command, maxFDCMD_STACKDEPTH
|
||||||
|
|
||||||
|
uint8_t check4freeFDshortCmd(void);
|
||||||
|
// returns number of free places in short-command stack
|
||||||
|
|
||||||
|
#define FDLONG_STACKDEPTH 16
|
||||||
|
void longFDcmd_clrStack(void);
|
||||||
|
bool longFDcmd_set(uint8_t nextWrCmd, uint8_t nextRdCmd, uint8_t blockNum, uint8_t length, uint8_t *data);
|
||||||
|
// write Command to memory, wait for transport
|
||||||
|
// data buffer size always 64! data[64], padded with 0
|
||||||
|
bool longFDcmd_get(uint8_t *nextWrCmd, uint8_t *nextRdCmd, uint8_t *blockNum, uint8_t *length, uint8_t *data);
|
||||||
|
|
||||||
|
uint8_t check4FDlongCmd(void);
|
||||||
|
// returns number of waiting command
|
||||||
|
|
||||||
|
uint8_t check4freeFDlongCmd(void);
|
||||||
|
// returns number of free places in long-command stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf);
|
||||||
|
// HWapi writes data to be stored
|
||||||
|
|
||||||
|
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
296
include/shared_mem_buffer.h
Normal file
296
include/shared_mem_buffer.h
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
#ifndef SHARED_MEM_BUFFER_INCLUDED_H
|
||||||
|
#define SHARED_MEM_BUFFER_INCLUDED_H
|
||||||
|
|
||||||
|
#include <cinttypes>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
#include <QSharedMemory>
|
||||||
|
|
||||||
|
struct SharedMemBuffer {
|
||||||
|
struct rs {
|
||||||
|
char comportName[16]; // z.B. "COM48"
|
||||||
|
char baudStr[16]; // z.B. "19200"
|
||||||
|
int baudNr; // 0...5 oder -1
|
||||||
|
uint8_t connect; // 0,1
|
||||||
|
bool portIsOpen;
|
||||||
|
} rs;
|
||||||
|
|
||||||
|
char AutoEmissionOn; // 1: zyklisch Anfragen zum Slave senden
|
||||||
|
|
||||||
|
struct datif {
|
||||||
|
uint16_t sendingPeriod;
|
||||||
|
bool sendingPer_changed;
|
||||||
|
} datif;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// controlBus.cpp
|
||||||
|
char txt4comStateLine[32];
|
||||||
|
char txt4HsStateLine[32];
|
||||||
|
char txt4masterStateLine[32];
|
||||||
|
char txt4resultStateLine[32];
|
||||||
|
char txt4dataLine[32];
|
||||||
|
char txt4datifReceive[32];
|
||||||
|
char txt4diagWindow[32];
|
||||||
|
char sndTxt4diagWindow[32];
|
||||||
|
bool Sdata_serialTestResult[32];
|
||||||
|
uint8_t Sdata_pProtResultOk[32];
|
||||||
|
uint16_t Sdata_receivedDataLength[32];
|
||||||
|
uint8_t Sdata_receivedDataBlock[64];
|
||||||
|
|
||||||
|
// datif.cpp
|
||||||
|
uint8_t dif_dataStep;
|
||||||
|
uint8_t dif_scanStep;
|
||||||
|
uint8_t RDBLKNR;
|
||||||
|
uint8_t datif_OutCmdpara1;
|
||||||
|
uint8_t datif_OutCmdpara2;
|
||||||
|
uint8_t datif_OutCmdpara3;
|
||||||
|
uint8_t datif_OutCmdpara4;
|
||||||
|
|
||||||
|
uint16_t datif_OutCmdpara5;
|
||||||
|
uint32_t datif_OutCmdpara6;
|
||||||
|
uint8_t cycl_running;
|
||||||
|
|
||||||
|
// dcBL.cpp
|
||||||
|
uint8_t dcBL_LastBLcmd; // stored the last sent cmd in order to analys response
|
||||||
|
uint8_t dcBL_AtbBinFile[300000];
|
||||||
|
uint32_t dcBL_fileSize;
|
||||||
|
uint16_t dcBL_nrOfBlocks;
|
||||||
|
uint16_t dcBL_fileCrc;
|
||||||
|
uint8_t dcBL_myBuf[300000]; // same content like "dcBL_AtbBinFile" but bytewise
|
||||||
|
|
||||||
|
char BlResp[50][32];
|
||||||
|
uint8_t dcBL_step;
|
||||||
|
uint8_t dcBL_state;
|
||||||
|
uint16_t dcBL_BlkCtr;
|
||||||
|
uint16_t dcBL_cyclCtr;
|
||||||
|
uint16_t repeatCtr;
|
||||||
|
uint8_t Sdata_rawData[150];
|
||||||
|
uint8_t Sdata_LengthRawData;
|
||||||
|
|
||||||
|
// hwapi.cpp
|
||||||
|
uint16_t hwapi_shutterTime;
|
||||||
|
char ticketTemplate[1024];
|
||||||
|
|
||||||
|
// sendWRcmd.cpp
|
||||||
|
uint16_t nextAsynchsendCmd0[16];
|
||||||
|
uint8_t nrOfCmdsInQueue;
|
||||||
|
uint16_t nextAsynchsendCmd4[8];
|
||||||
|
uint8_t nextCmd4para1[8];
|
||||||
|
uint8_t nextCmd4para2[8];
|
||||||
|
uint8_t nextCmd4para3[8];
|
||||||
|
uint8_t nextCmd4para4[8];
|
||||||
|
uint8_t nrOfCmds4InQueue;
|
||||||
|
uint16_t nextAsynchsendCmd8[4];
|
||||||
|
uint8_t nextCmd8para1[4];
|
||||||
|
uint8_t nextCmd8para2[4];
|
||||||
|
uint16_t nextCmd8para3[4];
|
||||||
|
uint32_t nextCmd8para4[4];
|
||||||
|
uint8_t nrOfCmds8InQueue;
|
||||||
|
uint8_t sendAsynchDataBuf[160]; // no stack, only ONE buffer
|
||||||
|
uint8_t sendAsyDatLen;
|
||||||
|
uint8_t Sdata_mdbSendBuffer[64];
|
||||||
|
uint8_t Sdata_mdbSendLen;
|
||||||
|
uint8_t prnDataParameters[4];
|
||||||
|
uint8_t prnDataBufferUser;
|
||||||
|
char Sdata_PRN_TEXT[20][64];
|
||||||
|
uint8_t pPrnDataBuff; // points to next PRINTER_BLOCK
|
||||||
|
uint8_t nextFDwrCmd[16];
|
||||||
|
uint8_t nextFDrdCmd[16];
|
||||||
|
uint8_t nextFDblkNr[16];
|
||||||
|
|
||||||
|
uint8_t nextFDpara1[16];
|
||||||
|
uint8_t nextFDpara2[16];
|
||||||
|
uint8_t nextFDpara3[16];
|
||||||
|
uint8_t nextFDpara4[16];
|
||||||
|
uint8_t p_nextFDcmdsInQueue;
|
||||||
|
uint8_t longFDwrCmd[16];
|
||||||
|
uint8_t longFDrdCmd[16];
|
||||||
|
uint8_t longFDblkNr[16];
|
||||||
|
uint8_t longFDlength[16];
|
||||||
|
|
||||||
|
uint8_t longFDpara[16][64];
|
||||||
|
uint8_t p_longFDcmdsInQueue;
|
||||||
|
|
||||||
|
// storeInData.cpp
|
||||||
|
bool indat_savePrnPwr;
|
||||||
|
bool indat_saveMifPwr;
|
||||||
|
bool indat_MdbIsOn;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t ndbs;
|
||||||
|
uint8_t pari;
|
||||||
|
uint8_t nsb;
|
||||||
|
uint8_t br;
|
||||||
|
|
||||||
|
#define MAXNROF_GENSTR 16
|
||||||
|
char genStrings[MAXNROF_GENSTR][64];
|
||||||
|
|
||||||
|
#define MAXNROF_AI 4
|
||||||
|
uint16_t AI_val[MAXNROF_AI];
|
||||||
|
|
||||||
|
struct DigitalInputs {
|
||||||
|
uint8_t doorSwitch;
|
||||||
|
uint8_t vaultSwitch;
|
||||||
|
uint8_t lockSwitch;
|
||||||
|
uint8_t opto;
|
||||||
|
uint8_t aux;
|
||||||
|
bool wakeFromPtu;
|
||||||
|
bool wakeFromMdb;
|
||||||
|
bool wakeFromModem;
|
||||||
|
bool PrnReady;
|
||||||
|
bool CoinAttach;
|
||||||
|
bool CoinEscrowOpen;
|
||||||
|
bool mifCardTap;
|
||||||
|
bool contactPwrOn;
|
||||||
|
bool mifarePwrOn;
|
||||||
|
bool rdbk_mdbTxd;
|
||||||
|
bool AuxPwrOn;
|
||||||
|
bool gsmPwrOn;
|
||||||
|
bool creditPwrOn;
|
||||||
|
bool printerPwrOn;
|
||||||
|
bool mdbPwrOn;
|
||||||
|
bool rejMot_home;
|
||||||
|
uint8_t npe_sensor;
|
||||||
|
} din;
|
||||||
|
|
||||||
|
struct DigitalOutputs {
|
||||||
|
uint8_t mbdRxTst;
|
||||||
|
uint8_t motorBits;
|
||||||
|
uint8_t serialSwitch; // serial drv on/off, Serial mux1, Serial mux2
|
||||||
|
uint8_t ledsAndFan;
|
||||||
|
uint8_t laermUndRelay;
|
||||||
|
uint8_t ptuWake;
|
||||||
|
uint8_t auxPower;
|
||||||
|
uint8_t coinShutter;
|
||||||
|
uint8_t coinEscrow;
|
||||||
|
uint8_t printerPower;
|
||||||
|
} dout;
|
||||||
|
|
||||||
|
struct Sdata {
|
||||||
|
#define NROFMIFSTATEBYTES 40
|
||||||
|
#define PRN_STATE_ARRAY_SIZE 20
|
||||||
|
#define PRN_STATE_FONT_SIZE 20
|
||||||
|
uint8_t MIF_STATE[NROFMIFSTATEBYTES];
|
||||||
|
uint8_t MIF_DATA[12][64];
|
||||||
|
uint8_t PRN_STATE[PRN_STATE_ARRAY_SIZE];
|
||||||
|
uint8_t PRN_FONTS[PRN_STATE_FONT_SIZE];
|
||||||
|
bool mdb_busRdy;
|
||||||
|
bool mdb_V12on;
|
||||||
|
bool mdb_V5on;
|
||||||
|
uint8_t mdbNrOfRecData;
|
||||||
|
uint8_t RecBuff[40];
|
||||||
|
uint8_t empNrOfsettings;
|
||||||
|
uint8_t emp_settingsBuff[66];
|
||||||
|
uint8_t NrOfDeviceSetting;
|
||||||
|
uint8_t DeviceSettingBuff[66];
|
||||||
|
uint8_t NrOfMachineIDSetting;
|
||||||
|
uint8_t NrOfMachineIDBuff[66];
|
||||||
|
uint64_t slaveUID;
|
||||||
|
uint8_t UIDstr[8];
|
||||||
|
#define MAXNROF_MEASURE 4
|
||||||
|
uint32_t measurement[MAXNROF_MEASURE];
|
||||||
|
bool serialTestResult;
|
||||||
|
uint8_t pProtResultOk;
|
||||||
|
uint16_t receivedDataLength;
|
||||||
|
uint8_t receivedDataBlock[64];
|
||||||
|
} Sdata;
|
||||||
|
|
||||||
|
uint8_t mif_cardType;
|
||||||
|
uint8_t mif_cardHolder[8];
|
||||||
|
|
||||||
|
#define MEMDEPTH_GOTCOINS (16)
|
||||||
|
struct T_coin {
|
||||||
|
uint8_t valid;
|
||||||
|
uint8_t signal;
|
||||||
|
uint8_t error;
|
||||||
|
uint8_t pad;
|
||||||
|
uint16_t value;
|
||||||
|
} gotCoin[MEMDEPTH_GOTCOINS];
|
||||||
|
uint8_t ctr_gotCoin;
|
||||||
|
|
||||||
|
struct store {
|
||||||
|
uint32_t insertedAmount;
|
||||||
|
uint16_t lastCoinType[64];
|
||||||
|
uint16_t lastCoinValue[64];
|
||||||
|
uint64_t wakeSrc;
|
||||||
|
uint8_t rbDevParamLen;
|
||||||
|
uint8_t rbDevParams[66];
|
||||||
|
uint8_t deviceCondLen;
|
||||||
|
uint8_t deviceCond[66];
|
||||||
|
uint8_t machCondLen;
|
||||||
|
uint8_t machCond[66];
|
||||||
|
uint8_t DcBackupNrOfAccNr;
|
||||||
|
uint16_t DcBackupAccNr[16]; // z.Z. nur 8
|
||||||
|
uint8_t gotNrBlocksOfVaultRec;
|
||||||
|
uint8_t vaultrecord[360];
|
||||||
|
uint32_t amount;
|
||||||
|
uint16_t nrOfCoins;
|
||||||
|
bool dcDataValid;
|
||||||
|
uint8_t wakeReason;
|
||||||
|
char curPayNewCoin;
|
||||||
|
} store;
|
||||||
|
|
||||||
|
struct T_globTime {
|
||||||
|
// Reihenfolge nicht vertauschen!!!!!
|
||||||
|
uint8_t hour;
|
||||||
|
uint8_t minute;
|
||||||
|
uint8_t second;
|
||||||
|
uint8_t Year;
|
||||||
|
uint8_t Month;
|
||||||
|
uint8_t DayOfMonth;
|
||||||
|
uint8_t DayOfWeek; // 1=monday...7
|
||||||
|
uint8_t reserve1;
|
||||||
|
|
||||||
|
uint16_t MinutesOfToday;
|
||||||
|
uint16_t reserve2;
|
||||||
|
|
||||||
|
uint32_t SecondsOfToday;
|
||||||
|
|
||||||
|
uint8_t IsLeapyear;
|
||||||
|
uint8_t nextLeap;
|
||||||
|
uint8_t lastLeap;
|
||||||
|
uint8_t hoursOfWeek;
|
||||||
|
|
||||||
|
uint16_t minOfWeek;
|
||||||
|
uint16_t hoursOfMonth;
|
||||||
|
uint16_t minOfMonth;
|
||||||
|
uint16_t dayOfYear;
|
||||||
|
uint16_t hoursOfYear;
|
||||||
|
uint16_t reserve3;
|
||||||
|
|
||||||
|
uint32_t minOfYear;
|
||||||
|
|
||||||
|
uint8_t squareOutMode;
|
||||||
|
uint8_t free1;
|
||||||
|
uint16_t reserve4;
|
||||||
|
uint32_t minOfMillenium;
|
||||||
|
// bis hierher 44byts
|
||||||
|
uint32_t free2;
|
||||||
|
uint32_t free3;
|
||||||
|
uint32_t free4;
|
||||||
|
} getGlobalTime;
|
||||||
|
|
||||||
|
static QSharedMemory *getShm(std::size_t s = 0);
|
||||||
|
static SharedMemBuffer *getData() {
|
||||||
|
return (SharedMemBuffer *)getShm()->data();
|
||||||
|
}
|
||||||
|
static SharedMemBuffer const *getDataConst() {
|
||||||
|
return (SharedMemBuffer const *)getShm()->data();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static std::atomic<bool> __sharedMemLocked;
|
||||||
|
|
||||||
|
static bool sharedMemLocked() {
|
||||||
|
return __sharedMemLocked;
|
||||||
|
}
|
||||||
|
static void setSharedMemLocked() {
|
||||||
|
__sharedMemLocked = true;
|
||||||
|
}
|
||||||
|
static void setSharedMemUnlocked() {
|
||||||
|
__sharedMemLocked = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARED_MEM_BUFFER_INCLUDED_H
|
@@ -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,23 +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 *buf8byteUid);
|
void gpi_storeUID(uint8_t const *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();
|
||||||
|
|
||||||
|
|
||||||
@@ -73,7 +63,7 @@ QString epi_getUIDstr();
|
|||||||
uint8_t epi_getSquareMode();
|
uint8_t epi_getSquareMode();
|
||||||
void gpi_backupSquareMode(uint8_t squMode);
|
void gpi_backupSquareMode(uint8_t squMode);
|
||||||
|
|
||||||
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng);
|
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng); // 104, <=8byte
|
||||||
void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss);
|
void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss);
|
||||||
void epi_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd);
|
void epi_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd);
|
||||||
void epi_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday);
|
void epi_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday);
|
||||||
@@ -89,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
|
||||||
|
|
||||||
@@ -138,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
|
||||||
|
|
||||||
@@ -363,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
|
||||||
@@ -401,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
|
||||||
@@ -444,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);
|
||||||
|
|
||||||
@@ -463,25 +360,67 @@ 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 epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t const *data);
|
||||||
void gpi_storeDeviceSettings(uint8_t leng, uint8_t *data);
|
|
||||||
|
|
||||||
void epi_restoreDeviceSettings(uint8_t *leng, uint8_t *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 gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue);
|
||||||
|
|
||||||
|
uint32_t epi_CurrentPaymentGetAmount(void);
|
||||||
|
uint16_t epi_CurrentPaymentGetLastCoin(void);
|
||||||
|
|
||||||
|
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
||||||
|
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
||||||
|
|
||||||
|
void gpi_storeWakeSources(uint8_t const *receivedData);
|
||||||
|
uint64_t epi_getWakeSources(void);
|
||||||
|
uint8_t epi_getWakeReason(void);
|
||||||
|
|
||||||
|
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data);
|
||||||
|
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDeviceConditions(uint8_t leng, uint8_t const *data);
|
||||||
|
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t const *data);
|
||||||
|
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data);
|
||||||
|
|
||||||
|
void gpi_storeDCbackupAccNr(uint8_t leng, uint8_t const *data);
|
||||||
|
void epi_restoreDCbackupAccNr(uint8_t *leng, uint16_t *accNrs);
|
||||||
|
// return accNrs[0..7]
|
||||||
|
|
||||||
|
void epi_iniVRstorage(void);
|
||||||
|
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t const *data);
|
||||||
|
bool epi_checkIfVaultRecordAvailable(void);
|
||||||
|
bool epi_restoreVaultRecord(uint16_t *length, uint8_t *buf);
|
||||||
|
// true if completly received
|
||||||
|
|
||||||
|
void gpi_storeCBlevel(uint32_t amount, uint16_t nrOfCoins);
|
||||||
|
|
||||||
|
uint32_t epi_getCashBoxContent(void);
|
||||||
|
uint16_t epi_getNrOfCoinsInCashBox(void);
|
||||||
|
|
||||||
|
void gpi_storeNewMifareCard(uint8_t typ, uint8_t const *holder);
|
||||||
|
|
||||||
|
uint8_t epi_mifGetCardType(uint8_t const *holder);
|
||||||
|
//holder[8] = name of card holder
|
||||||
|
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
||||||
|
|
||||||
|
void gpi_storeDcDataValid(bool isVal);
|
||||||
|
bool gpi_areDcDataValid();
|
||||||
|
bool epi_areDcDataValid();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -13,6 +13,9 @@ uint32_t uchar2ulong(uint8_t Highbyte, uint8_t MHbyte, uint8_t MLbyte, uint8_t L
|
|||||||
|
|
||||||
uint8_t uint2uchar(uint16_t uival, bool getHighB);
|
uint8_t uint2uchar(uint16_t uival, bool getHighB);
|
||||||
|
|
||||||
|
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr);
|
||||||
|
// getBytNr: 0=LSB 3=MSB
|
||||||
|
|
||||||
|
|
||||||
void delay(uint16_t MilliSec);
|
void delay(uint16_t MilliSec);
|
||||||
|
|
||||||
@@ -59,6 +62,7 @@ void GetShortDateString(uint8_t day, uint8_t month, uint8_t yearlow, uint8_t for
|
|||||||
|
|
||||||
|
|
||||||
uint16_t tslib_strlen(char *buf);
|
uint16_t tslib_strlen(char *buf);
|
||||||
|
uint16_t tslib_strlen(uint8_t *buf);
|
||||||
|
|
||||||
void tslib_strclr(char *buf, char clrsign, uint16_t len);
|
void tslib_strclr(char *buf, char clrsign, uint16_t len);
|
||||||
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
|
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
|
||||||
@@ -79,6 +83,8 @@ int tslib_getMinimum(int val1, int val2);
|
|||||||
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
|
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
|
||||||
// usage: tslib_text2array("my text", ctmp, 50);
|
// usage: tslib_text2array("my text", ctmp, 50);
|
||||||
|
|
||||||
|
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len);
|
||||||
|
// both buffers starting from pos 0
|
||||||
|
|
||||||
|
|
||||||
#endif // TSLIB_H
|
#endif // TSLIB_H
|
||||||
|
1115
plugins/interfaces.h
1115
plugins/interfaces.h
File diff suppressed because it is too large
Load Diff
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
|
@@ -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";
|
||||||
|
@@ -1,141 +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)
|
SharedMemBuffer::getData()->rs.baudNr = BaudNr;
|
||||||
{
|
SharedMemBuffer::getData()->rs.connect = connect;
|
||||||
// qDebug() << "ENTER" << BaudNr << BaudStr << ComName << 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
|
|
||||||
|
|
||||||
// qDebug() << "LEAVE" << rs_baudNr << rs_baudStr << rs_comportName << rs_connect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_closeSerial(void)
|
void epi_closeSerial(void) {
|
||||||
{
|
SharedMemBuffer::getData()->rs.connect = 0;
|
||||||
rs_connect=0;
|
|
||||||
// qDebug() << "ENTER/LEAVE rc_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
|
||||||
//qDebug() << "ENTER/LEAVE rc_connect=2";
|
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)
|
|
||||||
{
|
|
||||||
//qDebug() << "ENTER/LEAVE offen=" << 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
|
||||||
//qDebug() << "ENTER/LEAVE offen=" << rs_portIsOpen;
|
return SharedMemBuffer::getDataConst()->rs.portIsOpen;
|
||||||
return 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=="")
|
||||||
@@ -144,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();
|
||||||
@@ -171,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();
|
||||||
@@ -198,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
|
||||||
@@ -214,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();
|
||||||
@@ -228,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=="")
|
||||||
@@ -256,8 +203,7 @@ void gpi_setTxt4dataStateLine(QString txtline)
|
|||||||
txt4dataLine=txtline;
|
txt4dataLine=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4dataStateLine()
|
void epi_clrTxt4dataStateLine() {
|
||||||
{
|
|
||||||
txt4dataLine.clear();
|
txt4dataLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,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();
|
||||||
@@ -284,8 +225,7 @@ void gpi_setTxt4datifLine(QString txtline)
|
|||||||
txt4datifReceive=txtline;
|
txt4datifReceive=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4datifLine()
|
void epi_clrTxt4datifLine() {
|
||||||
{
|
|
||||||
txt4datifReceive.clear();
|
txt4datifReceive.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,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();
|
||||||
@@ -309,8 +246,7 @@ void gpi_setTxt4RsDiagWin(QString txtline)
|
|||||||
txt4diagWindow=txtline;
|
txt4diagWindow=txtline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epi_clrTxt4RsDiagWin()
|
void epi_clrTxt4RsDiagWin() {
|
||||||
{
|
|
||||||
txt4diagWindow.clear();
|
txt4diagWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,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();
|
||||||
@@ -333,90 +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);
|
strncpy((char *)payLoad,
|
||||||
return Sdata_receivedDataLength;
|
(char const *)(&SharedMemBuffer::getData()->Sdata.receivedDataBlock[0]),
|
||||||
|
ml);
|
||||||
|
|
||||||
|
return SharedMemBuffer::getDataConst()->Sdata.receivedDataLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
592
src/datIf.cpp
592
src/datIf.cpp
@@ -17,6 +17,8 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -46,6 +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);
|
||||||
|
datif_noResponseCtr=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void T_datif::resetChain(void)
|
void T_datif::resetChain(void)
|
||||||
@@ -61,6 +66,15 @@ char T_datif::datif_cycleSend()
|
|||||||
uint8_t dataSendBuf[160], dataBufLen, dbl, who;
|
uint8_t dataSendBuf[160], dataBufLen, dbl, who;
|
||||||
static uint8_t BlockCounter;
|
static uint8_t BlockCounter;
|
||||||
|
|
||||||
|
uint8_t nextWrCmd, nextRdCmd, blockNum, dat1, dat2, dat3, dat4;
|
||||||
|
uint8_t length, data[66];
|
||||||
|
bool b_ret;
|
||||||
|
|
||||||
|
datif_noResponseCtr++; // inc every 10ms fehlt noch in SysCont
|
||||||
|
if (datif_noResponseCtr>500) // seit 5s kein Lebenszeichen von DC2
|
||||||
|
gpi_storeDcDataValid(0); // fehlt in SysCont
|
||||||
|
|
||||||
|
|
||||||
if (cycl_running)
|
if (cycl_running)
|
||||||
{
|
{
|
||||||
// request is still running, wait for response before next sending
|
// request is still running, wait for response before next sending
|
||||||
@@ -77,6 +91,43 @@ char T_datif::datif_cycleSend()
|
|||||||
if (myDCIF->isSerialFree())
|
if (myDCIF->isSerialFree())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
// new, from 11.4.23: direkt access to fastDevice Interface
|
||||||
|
// always use this three functions to send data:
|
||||||
|
//void myDCIF->setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr, uint8_t WrDatLen, uint8_t *data);
|
||||||
|
//void myDCIF->setUserWriteData(uint16_t WriteCmd, uint16_t WrAddr);
|
||||||
|
//void myDCIF->setUserWriteData(uint16_t WriteCmd);
|
||||||
|
//void myDCIF->setUserWrite1DB (uint16_t WriteCmd, uint16_t WrAddr, uint8_t val);
|
||||||
|
//void myDCIF->setUserWrite2DB (uint16_t WriteCmd, uint16_t WrAddr, uint8_t val0, uint8_t val1);
|
||||||
|
|
||||||
|
//void myDCIF->setUserReadData( uint16_t ReadCmd, uint16_t RdAddr, uint16_t reserv);
|
||||||
|
//void myDCIF->setUserReadData( uint16_t ReadCmd, uint16_t RdAddr);
|
||||||
|
//void myDCIF->setUserReadData( uint16_t ReadCmd);
|
||||||
|
|
||||||
|
//void myDCIF->sendUserData(uint16_t slaveAdr);
|
||||||
|
|
||||||
|
if (check4FDshortCmd())
|
||||||
|
{
|
||||||
|
b_ret=sendFDcmd_get(&nextWrCmd, &nextRdCmd, &blockNum, &dat1, &dat2, &dat3, &dat4);
|
||||||
|
if (b_ret)
|
||||||
|
{
|
||||||
|
data[0]=dat1; data[1]=dat2; data[2]=dat3; data[3]=dat4; data[4]=0;
|
||||||
|
myDCIF->setUserWriteData(nextWrCmd, blockNum, 4, data);
|
||||||
|
myDCIF->setUserReadData(nextRdCmd);
|
||||||
|
myDCIF->sendUserData(selectedSlaveAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
if (nxtAsCmd>0)
|
if (nxtAsCmd>0)
|
||||||
@@ -169,7 +220,10 @@ char T_datif::datif_cycleSend()
|
|||||||
sendINrequestsAutomatic(); // sendCyclicCmd(); // request all cyclic data sequential
|
sendINrequestsAutomatic(); // sendCyclicCmd(); // request all cyclic data sequential
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dif_scanStep=0; // always start from beginning
|
dif_scanStep=0; // always start from beginning
|
||||||
|
gpi_storeDcDataValid(0); // fehlt in SysCont
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef USEHANDSHAKES
|
#ifdef USEHANDSHAKES
|
||||||
else
|
else
|
||||||
@@ -180,6 +234,7 @@ char T_datif::datif_cycleSend()
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
||||||
|
gpi_storeDcDataValid(0); // fehlt in SysCont
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -624,62 +679,71 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
{
|
{
|
||||||
//qDebug() << "send IN request " << dif_scanStep;
|
//qDebug() << "send IN request " << dif_scanStep;
|
||||||
|
|
||||||
|
// one time: 105, 11,12,101,18
|
||||||
|
// cyclic: 22,23,24,27, 102,103,104,106,107,108,109,
|
||||||
|
|
||||||
|
// fehlen: 112, 113,14,17, 19, 30,31,32,33,
|
||||||
|
// 38 on request
|
||||||
|
|
||||||
switch (dif_scanStep)
|
switch (dif_scanStep)
|
||||||
{
|
{
|
||||||
// first 5 items are performed only one time after startup as this data never change
|
// first 5 items are performed only one time after startup as this data never change
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetSerialConfig, 0);
|
datif_sendIOrequest(0, CMD2DC_GetSerialConfig, 0); // 105
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkHWversion, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkHWversion, 0); // 11
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkSWversion, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkSWversion, 0); // 12
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkDCstate, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkDCstate, 0); // 101
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkUID, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkUID, 0); // 18
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// repeat cyclic from here:
|
// repeat cyclic from here:
|
||||||
case 5:
|
case 5:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0); // 102
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkTime, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkTime, 0); // 104
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
|
datif_sendIOrequest(0, 112, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkAnalog, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkAnalog, 0); // 106
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
|
datif_sendIOrequest(0, 113, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBkAllOutputs, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBkAllOutputs, 0); // 103
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
|
datif_sendIOrequest(0, 14, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if (indat_isPrinterOn())
|
if (indat_isPrinterOn())
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBk_AllPrnData, 0); // 27
|
||||||
// datif_sendIOrequest(0, CMD2DC_RdBk_PrnState, 0);
|
// datif_sendIOrequest(0, CMD2DC_RdBk_PrnState, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -690,20 +754,21 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
case 14:
|
case 14:
|
||||||
if (indat_isMifareOn())
|
if (indat_isMifareOn())
|
||||||
{
|
{
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0);
|
datif_sendIOrequest(0, CMD2DC_RdBk_MifState, 0); // 109
|
||||||
//qDebug()<<"requesting MIF reader state";
|
//qDebug()<<"requesting MIF reader state";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15:
|
case 15:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
|
datif_sendIOrequest(0, 17, 0);
|
||||||
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
|
||||||
datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1);
|
datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1); // 24
|
||||||
// qDebug()<<"automatically requesting mif card data";
|
// qDebug()<<"automatically requesting mif card data";
|
||||||
if (++RDBLKNR>11)
|
if (++RDBLKNR>11)
|
||||||
RDBLKNR=0;
|
RDBLKNR=0;
|
||||||
@@ -712,23 +777,24 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 17:
|
case 17:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
//datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
||||||
|
datif_sendIOrequest(0, 19, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 18:
|
case 18:
|
||||||
if (indat_isMdbOn())
|
if (indat_isMdbOn())
|
||||||
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0);
|
datif_sendIOrequest(0, CMD2DC_MDB_GET_STATE, 0); // 107
|
||||||
//else
|
//else
|
||||||
// dif_scanStep=24; unsinn
|
// dif_scanStep=24; unsinn
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 19:
|
case 19:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
datif_sendIOrequest(0, 30, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 20:
|
case 20:
|
||||||
//if (indat_isMdbOn())
|
//if (indat_isMdbOn())
|
||||||
datif_sendIOrequest(0, CMD2DC_MDB_GETRESP, 0);
|
datif_sendIOrequest(0, CMD2DC_MDB_GETRESP, 0); // 22
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -738,23 +804,32 @@ char T_datif::sendINrequestsAutomatic(void)
|
|||||||
|
|
||||||
case 22:
|
case 22:
|
||||||
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
|
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
|
||||||
datif_sendIOrequest(0, CMD2DC_EMP_GET_ALL, 0);
|
datif_sendIOrequest(0, CMD2DC_EMP_GET_ALL, 0); // 23
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 23:
|
case 23:
|
||||||
datif_sendIOrequest(0, CMD2DC_GetAllInputs, 0);
|
datif_sendIOrequest(0, 31, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
|
//if (indat_isMdbOn()) // kein eigener Schalter für EMP
|
||||||
datif_sendIOrequest(0, CMD2DC_EMP_GOTCOIN, 0);
|
datif_sendIOrequest(0, CMD2DC_EMP_GOTCOIN, 0); // 108
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 25:
|
||||||
|
datif_sendIOrequest(0, 32, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 26:
|
||||||
|
datif_sendIOrequest(0, 33, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dif_scanStep++;
|
dif_scanStep++;
|
||||||
if (dif_scanStep>=25)
|
if (dif_scanStep>26)
|
||||||
dif_scanStep=0; //dif_scanStep=5;
|
dif_scanStep=5;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -777,6 +852,7 @@ char T_datif::isPortOpen(void)
|
|||||||
|
|
||||||
void T_datif::StoredRecData()
|
void T_datif::StoredRecData()
|
||||||
{
|
{
|
||||||
|
datif_noResponseCtr=0;
|
||||||
//qDebug() << "StoreRecData called";
|
//qDebug() << "StoreRecData called";
|
||||||
// call automatically by T_prot
|
// call automatically by T_prot
|
||||||
//if (myDCIF->ifDataReceived())
|
//if (myDCIF->ifDataReceived())
|
||||||
@@ -792,28 +868,39 @@ void T_datif::StoredRecData()
|
|||||||
char T_datif::loadRecDataFromFrame()
|
char T_datif::loadRecDataFromFrame()
|
||||||
{
|
{
|
||||||
// necessary data in T_prot:
|
// necessary data in T_prot:
|
||||||
uint16_t readSource, uitmp;
|
uint16_t readSource, uitmp,uit2;
|
||||||
uint16_t readAddress;
|
uint16_t readAddress;
|
||||||
//uint8_t pp;
|
//uint8_t pp;
|
||||||
uint8_t SlaveAdr, RdDleng;
|
uint8_t SlaveAdr, RdDleng;
|
||||||
uint8_t receivedData[FRAME_DATALEN];
|
uint8_t receivedData[FRAME_DATALEN];
|
||||||
QString localStr;
|
QString localStr;
|
||||||
//uint32_t ultmp;
|
uint32_t ultmp;
|
||||||
//int portNr;
|
//int portNr;
|
||||||
bool ret;
|
bool ret;
|
||||||
uint8_t uctmp; // maxai
|
uint8_t uctmp; // maxai
|
||||||
|
char ctmp;
|
||||||
|
static uint8_t lastResult;
|
||||||
|
uint8_t prnResult;
|
||||||
|
static uint32_t lastInsertedAmount;
|
||||||
|
uint32_t newInsertedAmount;
|
||||||
|
|
||||||
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 ",
|
||||||
@@ -837,17 +924,18 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
// receivedData[1]='B';
|
// receivedData[1]='B';
|
||||||
// receivedData[2]='1';
|
// receivedData[2]='1';
|
||||||
// receivedData[3]='-';
|
// receivedData[3]='-';
|
||||||
// for (int ii=0; ii<4; ii++) haut hin :)
|
|
||||||
|
|
||||||
for (int ii=0; ii<RdDleng; ii++)
|
for (int ii=0; ii<RdDleng; ii++)
|
||||||
{
|
{
|
||||||
localStr.append(receivedData[ii]);
|
ctmp=receivedData[ii];
|
||||||
|
localStr.append(ctmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << "got HW version: " << localStr;
|
//qDebug() << "got HW version: " << localStr;
|
||||||
switch (readSource) // = request command
|
switch (readSource) // = request command
|
||||||
{
|
{
|
||||||
case CMD2DC_TestSerial: // serial line check
|
case CMD2DC_TestSerial: // serial line check 10
|
||||||
ret=verifyLineTestresponse(RdDleng, receivedData);
|
ret=verifyLineTestresponse(RdDleng, receivedData);
|
||||||
gpi_storeResult_serialTestOK(ret);
|
gpi_storeResult_serialTestOK(ret);
|
||||||
if (ret==true)
|
if (ret==true)
|
||||||
@@ -856,41 +944,41 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_setTxt4datifLine("false");
|
gpi_setTxt4datifLine("false");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_GetSerialConfig: // get slave's RS232 config
|
case CMD2DC_GetSerialConfig: // get slave's RS232 config 105
|
||||||
gpi_storeSlaveSerParams(receivedData[0], receivedData[1], receivedData[2], receivedData[3]);
|
gpi_storeSlaveSerParams(receivedData[0], receivedData[1], receivedData[2], receivedData[3]);
|
||||||
//gpi_storeSlaveBusAddr(SlaveAdr);
|
//gpi_storeSlaveBusAddr(SlaveAdr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkHWversion:
|
case CMD2DC_RdBkHWversion: //11
|
||||||
//qDebug() << "got HW version: " << localStr;
|
//qDebug() << "got HW version: " << localStr;
|
||||||
gpi_storeGenerals(0, localStr);
|
gpi_storeGenerals(0, localStr);
|
||||||
// 0=HW 1=SW 2=State
|
// 0=HW 1=SW 2=State
|
||||||
//gpi_storeSlaveBusAddr(SlaveAdr);
|
//gpi_storeSlaveBusAddr(SlaveAdr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkSWversion:
|
case CMD2DC_RdBkSWversion: //12
|
||||||
//qDebug() << "got SW version: " << localStr;
|
//qDebug() << "got SW version: " << localStr;
|
||||||
gpi_storeGenerals(1, localStr);
|
gpi_storeGenerals(1, localStr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkDCstate:
|
case CMD2DC_RdBkDCstate: //101
|
||||||
//qDebug() << "got DC state " << localStr;
|
//qDebug() << "got DC state " << localStr;
|
||||||
localStr[8]=0;
|
//localStr[8]=0;
|
||||||
gpi_storeGenerals(2, localStr);
|
gpi_storeGenerals(2, localStr);
|
||||||
// 0=HW 1=SW 2=State
|
// 0=HW 1=SW 2=State
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkUID: // getback UID in DB0....7
|
case CMD2DC_RdBkUID: // getback UID in DB0....7 18
|
||||||
gpi_storeUID(receivedData);
|
gpi_storeUID(receivedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkTime: // slave returned RTC time and date
|
case CMD2DC_RdBkTime: // slave returned RTC time and date 104
|
||||||
// new, FastProt: 0=dayOfWeek 1=min 2=sec 3=hours 4=year 5=month 6=dayOfYear
|
// new, FastProt: 0=dayOfWeek 1=min 2=sec 3=hours 4=year 5=month 6=dayOfYear
|
||||||
gpi_backupTime(receivedData, RdDleng); // function reads 20 bytes from the buffer
|
gpi_backupTime(receivedData, RdDleng); // function reads 20 bytes from the buffer
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkAnalog: // get ALL AIs 0...3, 4byte + 2byte each
|
case CMD2DC_RdBkAnalog: // get ALL AIs 0...3, 4byte + 2byte each 106
|
||||||
|
|
||||||
// DB0,1: Value0=Temperature
|
// DB0,1: Value0=Temperature
|
||||||
// DB2,3: Value1=Voltage
|
// DB2,3: Value1=Voltage
|
||||||
@@ -906,7 +994,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeAIs(1, uitmp);
|
gpi_storeAIs(1, uitmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_GetAllInputs:
|
case CMD2DC_GetAllInputs: //102
|
||||||
/*
|
/*
|
||||||
// alle DI's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
|
// alle DI's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
|
||||||
|
|
||||||
@@ -990,7 +1078,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeDI_paperLow(receivedData[5]);
|
gpi_storeDI_paperLow(receivedData[5]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBkAllOutputs:
|
case CMD2DC_RdBkAllOutputs: //103
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// alle DO's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
|
// alle DO's in einen 8byte Puffer zusammenstellen, werden in einen Rutsch zum Master gesendet
|
||||||
@@ -1048,27 +1136,29 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case CMD2DC_RdBk_MifState:
|
case CMD2DC_RdBk_MifState: //109
|
||||||
// get reader status and card type
|
// get reader status and card type
|
||||||
|
|
||||||
gpi_storeMifReaderStateAndCardType(receivedData);
|
//gpi_storeMifReaderStateAndCardType(receivedData);
|
||||||
|
gpi_storeNewMifareCard(receivedData[0], &receivedData[1]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBk_MifData:
|
case CMD2DC_RdBk_MifData: //24
|
||||||
// one block of data (64byte) comes in
|
// one block of data (64byte) comes in
|
||||||
// blkNr 0...11 in "Addr"
|
// blkNr 0...11 in "Addr"
|
||||||
gpi_storeMifCardData(readAddress, receivedData);
|
gpi_storeMifCardData(readAddress, receivedData);
|
||||||
//qDebug()<<"datif storing mif data: (adr/data) "<<readAddress<<receivedData;
|
//qDebug()<<"datif storing mif data: (adr/data) "<<readAddress<<receivedData;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBk_AtbCardType:
|
case CMD2DC_RdBk_AtbCardType: //25
|
||||||
// DC reports the type of mif-card (valid ATB card?)
|
// DC reports the type of mif-card (valid ATB card?)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case CMD2DC_RdBk_PrnState: // 0x2A02
|
case CMD2DC_RdBk_PrnState: // 110
|
||||||
|
|
||||||
// byte 1...6 come right from printer, see printer manual
|
// byte 1...6 come right from printer, see printer manual
|
||||||
// byte 0 = all important infos:
|
// byte 0 = all important infos:
|
||||||
@@ -1080,7 +1170,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
|
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBk_PrnFonts: // 0x2A12
|
case CMD2DC_RdBk_PrnFonts: // 26
|
||||||
//D0: font table/type
|
//D0: font table/type
|
||||||
//D1: size
|
//D1: size
|
||||||
//D2: height
|
//D2: height
|
||||||
@@ -1094,7 +1184,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storePrinterFonts(receivedData); // derzeit 10bytes
|
gpi_storePrinterFonts(receivedData); // derzeit 10bytes
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RdBk_AllPrnData: // 0x2A40
|
case CMD2DC_RdBk_AllPrnData: // 27
|
||||||
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
|
gpi_storePrinterState(receivedData); // derzeit 10bytes ( 0x2A02)
|
||||||
gpi_storePrinterFonts(&receivedData[10]); // derzeit 10bytes
|
gpi_storePrinterFonts(&receivedData[10]); // derzeit 10bytes
|
||||||
/*
|
/*
|
||||||
@@ -1107,7 +1197,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_MDB_GET_STATE:
|
case CMD2DC_MDB_GET_STATE: //107
|
||||||
// DB0: mdb_bus_ready (switched on)
|
// DB0: mdb_bus_ready (switched on)
|
||||||
// DB1: rdBackV12devicePower
|
// DB1: rdBackV12devicePower
|
||||||
// DB2: rdBackV5busPwr
|
// DB2: rdBackV5busPwr
|
||||||
@@ -1116,7 +1206,7 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeMdbState(receivedData[0],receivedData[1],receivedData[2]);
|
gpi_storeMdbState(receivedData[0],receivedData[1],receivedData[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_MDB_GETRESP:
|
case CMD2DC_MDB_GETRESP: //22
|
||||||
// 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
|
||||||
// DB0: mdb Device-Nr
|
// DB0: mdb Device-Nr
|
||||||
@@ -1127,31 +1217,414 @@ char T_datif::loadRecDataFromFrame()
|
|||||||
gpi_storeMdbResponse(receivedData[2]+3, receivedData);
|
gpi_storeMdbResponse(receivedData[2]+3, receivedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_EMP_GET_ALL:
|
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;
|
||||||
|
|
||||||
case CMD2DC_EMP_GOTCOIN:
|
case CMD2DC_EMP_GOTCOIN: //108
|
||||||
// DB0: 1=coin 0xFF=error 0=got nothing
|
// DB0: 1=coin 0xFF=error 0=got nothing
|
||||||
// DB1: last coin signal (value / scale)
|
// DB1: last coin signal (value / scale)
|
||||||
// DB2,3: last coin value
|
// DB2,3: last coin value
|
||||||
// DB4: lastError from Emp
|
// DB4: lastError from Emp
|
||||||
|
|
||||||
|
// 0: nr of stored coins
|
||||||
|
// 1: got 2:type 3:err 4=valL 5=valH
|
||||||
|
|
||||||
|
// qDebug() << "got emp coin "<< " " << receivedData[0] <<" " << receivedData[1]
|
||||||
|
// << " " << receivedData[2]<< " " << receivedData[3]
|
||||||
|
// << " " << receivedData[4]<< " " << receivedData[5]
|
||||||
|
// << " " << receivedData[6]<< " " << receivedData[7];
|
||||||
|
|
||||||
gpi_storeEmpCoinSignal(receivedData[0], &receivedData[1]);
|
gpi_storeEmpCoinSignal(receivedData[0], &receivedData[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RDBK_DEV_PARA:
|
|
||||||
gpi_storeDeviceSettings(RdDleng, receivedData);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ab hier neu: 12.4.23
|
||||||
|
|
||||||
|
case CMD2DC_RDBK_DEV_PARA: //14
|
||||||
|
/*
|
||||||
|
buf66[0]=devPara.kindOfPrinter;
|
||||||
|
buf66[1]=devPara.kindOfCoinChecker;
|
||||||
|
buf66[2]=devPara.kindOfMifareReader;
|
||||||
|
buf66[3]=devPara.suppressSleepMode;
|
||||||
|
buf66[4]=devPara.kindOfModem;
|
||||||
|
buf66[5]=devPara.kindOfCreditcard;
|
||||||
|
buf66[6]=devPara.CoinEscrow;
|
||||||
|
buf66[7]=devPara.CoinRejectUnit;
|
||||||
|
buf66[8]=devPara.CoinShutter;
|
||||||
|
buf66[9]=devPara.BillAcceptor;
|
||||||
|
buf66[10]=devPara.usevaultLock;
|
||||||
|
buf66[11]=devPara.autoAlarm;
|
||||||
|
buf66[12]=devPara.autoOpen;
|
||||||
|
buf66[13]=devPara.printAccReceipt;
|
||||||
|
buf66[14]=devPara.printDoorReceipt;
|
||||||
|
buf66[15]=devPara.printTokenTicket;
|
||||||
|
uitmp=devPara.VaultFullWarnLevel;
|
||||||
|
buf66[16]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
buf66[17]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
uitmp=devPara.VaultFullErrorLevel;
|
||||||
|
buf66[18]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
buf66[19]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
*/
|
||||||
|
gpi_storeRbDeviceSettings(RdDleng, receivedData);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD2DC_RDBK_MACH_ID:
|
// get machine parameters and location
|
||||||
|
case CMD2DC_RDBK_MACH_ID: //15
|
||||||
|
case 17:
|
||||||
|
/*
|
||||||
|
buf66[0]=swl_getOneByteFromUint(machPara.customerNumber, GETLOWBYT);
|
||||||
|
buf66[1]=swl_getOneByteFromUint(machPara.customerNumber, GETHIGHBYT);
|
||||||
|
buf66[2]=swl_getOneByteFromUint(machPara.machineNumber, GETLOWBYT);
|
||||||
|
buf66[3]=swl_getOneByteFromUint(machPara.machineNumber, GETHIGHBYT);
|
||||||
|
buf66[4]=swl_getOneByteFromUint(machPara.borough, GETLOWBYT);
|
||||||
|
buf66[5]=swl_getOneByteFromUint(machPara.borough, GETHIGHBYT);
|
||||||
|
buf66[6]=swl_getOneByteFromUint(machPara.zone, GETLOWBYT);
|
||||||
|
buf66[7]=swl_getOneByteFromUint(machPara.zone, GETHIGHBYT);
|
||||||
|
buf66[8]=swl_getOneByteFromUint(machPara.alias, GETLOWBYT);
|
||||||
|
buf66[9]=swl_getOneByteFromUint(machPara.alias, GETHIGHBYT);
|
||||||
|
for (pp=0; pp<32; pp++)
|
||||||
|
buf66[10+pp]=machPara.location[pp];
|
||||||
|
dc2prot_setReadData(42, buf66);
|
||||||
|
|
||||||
|
*/
|
||||||
gpi_storeMachineIDsettings(RdDleng, receivedData);
|
gpi_storeMachineIDsettings(RdDleng, receivedData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 19: // get time and date and Extra values
|
||||||
|
/*
|
||||||
|
buf[0]=GlobTime.Hours;
|
||||||
|
buf[1]=GlobTime.Min;
|
||||||
|
buf[2]=GlobTime.Sec;
|
||||||
|
buf[3]=GlobTime.Year;
|
||||||
|
buf[4]=GlobTime.Month;
|
||||||
|
buf[5]=GlobTime.Day;
|
||||||
|
buf[6]=GlobTime.DOW;
|
||||||
|
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
||||||
|
uitmp=GlobTime.MinOfDay;
|
||||||
|
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
buf[10]=' ';
|
||||||
|
buf[11]=' ';
|
||||||
|
ultmp=GlobTime.SecOfDay;
|
||||||
|
buf[12]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[13]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[14]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[15]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
buf[16]=swl_isLeap(GlobTime.Year);
|
||||||
|
buf[17]=swl_getNextLeapYear(GlobTime.Year);
|
||||||
|
buf[18]=swl_getLastLeapYear(GlobTime.Year);
|
||||||
|
buf[19]=swl_hoursOfThisWeek(GlobTime.DOW, GlobTime.Hours);
|
||||||
|
|
||||||
|
uitmp=swl_minutesOfThisWeek(GlobTime.DOW, GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[20]=swl_getOneByteFromUint(uitmp, 0); // 0=low byte 1=high byte
|
||||||
|
buf[21]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_hoursOfThisMonth(GlobTime.Day, GlobTime.Hours);
|
||||||
|
buf[22]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[23]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_minutesOfThisMonth(GlobTime.Day, GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[24]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[25]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_GetDaysOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day);
|
||||||
|
buf[26]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[27]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
|
||||||
|
uitmp=swl_GetHoursOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day, GlobTime.Hours);
|
||||||
|
buf[28]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
|
buf[29]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
buf[30]=0;
|
||||||
|
buf[31]=0;
|
||||||
|
ultmp= swl_GetMinutesOfYear(GlobTime.Year, GlobTime.Month, GlobTime.Day,
|
||||||
|
GlobTime.Hours, GlobTime.Min);
|
||||||
|
buf[32]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[33]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[34]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[35]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
buf[36]=rtc_getSqwaveSettings();
|
||||||
|
buf[37]=0;
|
||||||
|
buf[38]=0;
|
||||||
|
buf[39]=0;
|
||||||
|
|
||||||
|
ultmp= 0; // Minutes of the Millenium
|
||||||
|
buf[40]=swl_getOneByteFromUlong(ultmp, 0);
|
||||||
|
buf[41]=swl_getOneByteFromUlong(ultmp, 1);
|
||||||
|
buf[42]=swl_getOneByteFromUlong(ultmp, 2);
|
||||||
|
buf[43]=swl_getOneByteFromUlong(ultmp, 3);
|
||||||
|
|
||||||
|
dc2prot_setReadData(44, buf);
|
||||||
|
|
||||||
|
*/
|
||||||
|
// speicher-fkt fehlt noch, gpi_backupTime ist nur kurz
|
||||||
|
gpi_storeExtendedTime(RdDleng, receivedData);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 111: // get square wafe settings
|
||||||
|
gpi_backupSquareMode(receivedData[0]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 112: // get inserted amount in cent in sum
|
||||||
|
// byte 0..3: amount just paid 4,5:last coin type 6,7: last coin value
|
||||||
|
newInsertedAmount=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||||
|
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||||
|
uit2=uchar2uint(receivedData[7],receivedData[6]);
|
||||||
|
if (uitmp>0) // nur 1x bei neuer Münze
|
||||||
|
{
|
||||||
|
gpi_storeCurrentPayment(newInsertedAmount, uitmp, uit2);
|
||||||
|
//void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
|
||||||
|
if (newInsertedAmount != lastInsertedAmount)
|
||||||
|
{
|
||||||
|
emit datif_gotNewCoin();
|
||||||
|
//qDebug()<<"emit new coin";
|
||||||
|
|
||||||
|
lastInsertedAmount=newInsertedAmount;
|
||||||
}
|
}
|
||||||
|
qDebug()<<" store new coin"<<newInsertedAmount<<" "<<uitmp<<" "<<uit2;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 113: // get wake source, 8byte
|
||||||
|
gpi_storeWakeSources(receivedData);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30: // Get Devices Condition (warnings, errors)
|
||||||
|
/*
|
||||||
|
|
||||||
|
outBuf[0]=modCond.ram;
|
||||||
|
outBuf[1]=modCond.intEe;
|
||||||
|
outBuf[2]=modCond.extEe;
|
||||||
|
outBuf[3]=modCond.rtc;
|
||||||
|
outBuf[4]=modCond.boardHw;
|
||||||
|
outBuf[5]=modCond.printer;
|
||||||
|
outBuf[6]=modCond.modem;
|
||||||
|
outBuf[7]=modCond.signal;
|
||||||
|
outBuf[8]=modCond.regist;
|
||||||
|
outBuf[9]=modCond.mdbBus;
|
||||||
|
outBuf[10]=modCond.coinChecker;
|
||||||
|
outBuf[11]=modCond.coinEscrow;
|
||||||
|
outBuf[12]=modCond.mifareReader;
|
||||||
|
outBuf[13]=modCond.creditTerm;
|
||||||
|
outBuf[14]=modCond.coinReject;
|
||||||
|
outBuf[15]=modCond.coinSafe;
|
||||||
|
outBuf[16]=modCond.billSafe;
|
||||||
|
outBuf[17]=modCond.voltage;
|
||||||
|
outBuf[18]=modCond.temper;
|
||||||
|
outBuf[19]=modCond.poweronTest;
|
||||||
|
outBuf[20]=modCond.doorState;
|
||||||
|
outBuf[21]=modCond.doorWasOpened;
|
||||||
|
outBuf[22]=modCond.changer;
|
||||||
|
outBuf[23]=modCond.coinBlocker;
|
||||||
|
outBuf[24]=modCond.billReader;
|
||||||
|
outBuf[25]=modCond.ResetReason;
|
||||||
|
outBuf[26]=modCond.allModulesChecked;
|
||||||
|
outBuf[27]=modCond.alarmState;
|
||||||
|
outBuf[28]=0;
|
||||||
|
outBuf[29]=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
gpi_storeDeviceConditions(RdDleng, receivedData);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
||||||
|
/*
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.allDoorsDebounced;
|
||||||
|
outBuf[pBuf++]=dynCond.openedAuthorized;
|
||||||
|
outBuf[pBuf++]=dynCond.CBinDebounced;
|
||||||
|
outBuf[pBuf++]=dynCond.upperDoor;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.middleDoor;
|
||||||
|
outBuf[pBuf++]=dynCond.lowerDoor;
|
||||||
|
outBuf[pBuf++]=dynCond.coinBox;
|
||||||
|
outBuf[pBuf++]=dynCond.billBox;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.modeAbrech;
|
||||||
|
outBuf[pBuf++]=dynCond.onAlarm;
|
||||||
|
outBuf[pBuf++]=dynCond.nowCardTest;
|
||||||
|
outBuf[pBuf++]=dynCond.nowPayment;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.lastMifCardType;
|
||||||
|
outBuf[pBuf++]=dynCond.lastSDoorState;
|
||||||
|
outBuf[pBuf++]=dynCond.lastVDoorState;
|
||||||
|
outBuf[pBuf++]=dynCond.lastCBstate;
|
||||||
|
|
||||||
|
outBuf[pBuf++]=dynCond.paymentInProgress;
|
||||||
|
outBuf[pBuf++]=0;
|
||||||
|
uitmp=dynCond.U_Batt;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
uitmp=dynCond.Temperatur;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
uitmp=dynCond.nrCoinsInBox; // send seperate also
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETLOWBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUint(uitmp, GETHIGHBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.amountInBox; // send seperate also
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.totalTransVolume;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
|
||||||
|
ultmp=dynCond.totalNrOfVends;
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWESTBYT);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETLOWMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHMID);
|
||||||
|
outBuf[pBuf++]=swl_getOneByteFromUlong(ultmp, GETHIGHESTBYT);
|
||||||
|
// 36
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_config;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_device;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_cash;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_print;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_serial;
|
||||||
|
outBuf[pBuf++]=dynCond.jsonValid_time;
|
||||||
|
outBuf[pBuf++]=dynCond.lastFileType;
|
||||||
|
outBuf[pBuf++]=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (RdDleng>40)
|
||||||
|
//datif_DCdataValid=1; // das hier sind die wichtigsten Daten, deshalb hierrein!
|
||||||
|
gpi_storeDcDataValid(1);
|
||||||
|
|
||||||
|
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
||||||
|
|
||||||
|
prnResult=receivedData[52];
|
||||||
|
if (prnResult != lastResult)
|
||||||
|
{
|
||||||
|
// new result
|
||||||
|
if (prnResult==1)
|
||||||
|
{
|
||||||
|
emit datif_templatePrintFinished_OK();
|
||||||
|
} else
|
||||||
|
if (prnResult==2)
|
||||||
|
{
|
||||||
|
emit datif_templatePrintFinished_Err();
|
||||||
|
}
|
||||||
|
|
||||||
|
lastResult=prnResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32: // Get current cash level (in vault)
|
||||||
|
// bytes 0..3: amount bytes 4,5=Nr.ofCoins in vault
|
||||||
|
ultmp=uchar2ulong(receivedData[3],receivedData[2],receivedData[1],receivedData[0]);
|
||||||
|
uitmp=uchar2uint(receivedData[5],receivedData[4]);
|
||||||
|
gpi_storeCBlevel(ultmp, uitmp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 33: // Get all backuped acc. Numbers
|
||||||
|
// 8 UINTs with acc-nr
|
||||||
|
gpi_storeDCbackupAccNr(RdDleng, receivedData);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 38: // Get stored account record backup
|
||||||
|
/*
|
||||||
|
|
||||||
|
struct T_vaultRecord
|
||||||
|
{
|
||||||
|
UCHAR startbuffer[4]; // Psa> // never move or change this 1st entry
|
||||||
|
UINT AccountingNumber;
|
||||||
|
UINT CUNU;
|
||||||
|
UINT MANU;
|
||||||
|
UINT resint1;
|
||||||
|
//UINT resint2;
|
||||||
|
|
||||||
|
UCHAR label1buffer[4]; // tim>
|
||||||
|
UCHAR year;
|
||||||
|
UCHAR month;
|
||||||
|
UCHAR dom;
|
||||||
|
UCHAR hour;
|
||||||
|
UCHAR min;
|
||||||
|
UCHAR sec;
|
||||||
|
UCHAR DoW;
|
||||||
|
UCHAR reschar3;
|
||||||
|
|
||||||
|
UCHAR label2buffer[4]; // abs>
|
||||||
|
ULONG AbsIncome1;
|
||||||
|
ULONG AbsReserve;
|
||||||
|
ULONG AbsNrOfCuts;
|
||||||
|
|
||||||
|
//16
|
||||||
|
UCHAR label3buffer[4]; // mw >
|
||||||
|
|
||||||
|
// Verkauf, Tür zu:
|
||||||
|
ULONG VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
|
ULONG VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
|
//88
|
||||||
|
|
||||||
|
// Service, Tür offen:
|
||||||
|
UINT ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
|
UINT ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
|
UINT resint3;
|
||||||
|
UINT resint4;
|
||||||
|
UINT currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
||||||
|
UINT resint5;
|
||||||
|
UINT resint6;
|
||||||
|
// 56
|
||||||
|
|
||||||
|
UCHAR label4buffer[4]; // box>
|
||||||
|
UINT coinsInVault[16];
|
||||||
|
UINT billsInStacker[8];
|
||||||
|
// 48
|
||||||
|
|
||||||
|
UCHAR label5buffer[4]; // val>
|
||||||
|
// actually constant unless exchange rate is changed
|
||||||
|
UINT coinDenomination[16]; // 5..50000 (z.B. 2 sind in Ungarn 760Ft)
|
||||||
|
UINT billDenom[8];
|
||||||
|
UINT tubeDenom[6];
|
||||||
|
UINT exchangeRate;
|
||||||
|
UINT resint9;
|
||||||
|
|
||||||
|
// 64
|
||||||
|
|
||||||
|
UCHAR endofblock[4]; // end>
|
||||||
|
// 316 byte Block im Speicher
|
||||||
|
*/
|
||||||
|
// readAddress, &RdDleng, receivedData
|
||||||
|
gpi_storeVaultRecord(readAddress, receivedData ); // always 64byte
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
readSource=0; // 17.05.2023: to avoid multiple recording
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fehlen: 112, 113,14,17, 19, 30,31,32,33,
|
||||||
|
|
||||||
// subs:
|
// subs:
|
||||||
|
|
||||||
@@ -1246,11 +1719,15 @@ bool T_datif::verifyLineTestresponse(uint8_t RdDlen, uint8_t *receivedData)
|
|||||||
if (RdDlen < 16)
|
if (RdDlen < 16)
|
||||||
return false;
|
return false;
|
||||||
QString myStr;
|
QString myStr;
|
||||||
|
char ctmp;
|
||||||
|
|
||||||
myStr.clear();
|
myStr.clear();
|
||||||
myStr.append("< Slave Response");
|
myStr.append("< Slave Response");
|
||||||
|
|
||||||
for (int nn=0; nn<16; nn++)
|
for (int nn=0; nn<16; nn++)
|
||||||
if (myStr[nn] !=receivedData[nn])
|
{
|
||||||
|
ctmp=receivedData[nn];
|
||||||
|
if (myStr[nn] != ctmp)
|
||||||
{
|
{
|
||||||
//qDebug() << " datif cmd 10: got wrong string ";
|
//qDebug() << " datif cmd 10: got wrong string ";
|
||||||
//qDebug() << myStr;
|
//qDebug() << myStr;
|
||||||
@@ -1258,6 +1735,7 @@ bool T_datif::verifyLineTestresponse(uint8_t RdDlen, uint8_t *receivedData)
|
|||||||
//qDebug() << nn;
|
//qDebug() << nn;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
1296
src/hwapi.cpp
1296
src/hwapi.cpp
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
@@ -13,7 +13,8 @@ void sendWRcmd_INI(void)
|
|||||||
|
|
||||||
sendWRcmd_clrCmdStack();
|
sendWRcmd_clrCmdStack();
|
||||||
sendWRcmd_clrCmd4Stack();
|
sendWRcmd_clrCmd4Stack();
|
||||||
|
sendFDcmd_clrStack();
|
||||||
|
longFDcmd_clrStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command Stack for commands without parameters
|
// Command Stack for commands without parameters
|
||||||
@@ -60,13 +61,19 @@ bool sendWRcmd_setSendCommand0(uint16_t nextCmd)
|
|||||||
uint16_t sendWRcmd_getSendCommand0(void)
|
uint16_t sendWRcmd_getSendCommand0(void)
|
||||||
{
|
{
|
||||||
uint16_t nxtAsynchCmd;
|
uint16_t nxtAsynchCmd;
|
||||||
uint8_t nn;
|
uint8_t nn, ll;
|
||||||
if (nrOfCmdsInQueue==0 || nrOfCmdsInQueue>CMDSTACKDEPTH)
|
if (nrOfCmdsInQueue==0 || nrOfCmdsInQueue>CMDSTACKDEPTH)
|
||||||
return 0; // error
|
return 0; // error
|
||||||
nxtAsynchCmd=nextAsynchsendCmd0[0];
|
nxtAsynchCmd=nextAsynchsendCmd0[0];
|
||||||
|
|
||||||
// move Puffer down by one element
|
// move Puffer down by one element
|
||||||
for (nn=0; nn<CMDSTACKDEPTH; nn++)
|
if (CMDSTACKDEPTH>0)
|
||||||
|
ll=CMDSTACKDEPTH-1;
|
||||||
|
else
|
||||||
|
ll=0;
|
||||||
|
for (nn=0; nn<ll; nn++)
|
||||||
nextAsynchsendCmd0[nn]=nextAsynchsendCmd0[nn+1];
|
nextAsynchsendCmd0[nn]=nextAsynchsendCmd0[nn+1];
|
||||||
|
|
||||||
if (nrOfCmdsInQueue>0)
|
if (nrOfCmdsInQueue>0)
|
||||||
nrOfCmdsInQueue--;
|
nrOfCmdsInQueue--;
|
||||||
//qDebug() << "PI cmd queued:"<< nxtAsynchCmd << ", restored, pp now =" << nrOfCmdsInQueue;
|
//qDebug() << "PI cmd queued:"<< nxtAsynchCmd << ", restored, pp now =" << nrOfCmdsInQueue;
|
||||||
@@ -138,7 +145,7 @@ bool sendWRcmd_setSendCommand4(uint16_t nextCmd, uint8_t dat1, uint8_t dat2, uin
|
|||||||
uint16_t sendWRcmd_getSendCommand4(uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
|
uint16_t sendWRcmd_getSendCommand4(uint8_t *dat1, uint8_t *dat2, uint8_t *dat3, uint8_t *dat4)
|
||||||
{
|
{
|
||||||
uint16_t nxtAsynchCmd;
|
uint16_t nxtAsynchCmd;
|
||||||
uint8_t nn;
|
uint8_t nn, ll;
|
||||||
|
|
||||||
if (nrOfCmds4InQueue==0 || nrOfCmds4InQueue>CMD4STACKDEPTH)
|
if (nrOfCmds4InQueue==0 || nrOfCmds4InQueue>CMD4STACKDEPTH)
|
||||||
return 0; // error
|
return 0; // error
|
||||||
@@ -152,7 +159,11 @@ uint16_t sendWRcmd_getSendCommand4(uint8_t *dat1, uint8_t *dat2, uint8_t *dat3,
|
|||||||
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
|
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
|
||||||
|
|
||||||
// move Puffer down by one element
|
// move Puffer down by one element
|
||||||
for (nn=0; nn<CMD4STACKDEPTH; nn++)
|
if (CMD4STACKDEPTH>0)
|
||||||
|
ll=CMD4STACKDEPTH-1;
|
||||||
|
else
|
||||||
|
ll=0;
|
||||||
|
for (nn=0; nn<ll; nn++)
|
||||||
{
|
{
|
||||||
nextAsynchsendCmd4[nn]=nextAsynchsendCmd4[nn+1];
|
nextAsynchsendCmd4[nn]=nextAsynchsendCmd4[nn+1];
|
||||||
nextCmd4para1[nn]=nextCmd4para1[nn+1];
|
nextCmd4para1[nn]=nextCmd4para1[nn+1];
|
||||||
@@ -211,9 +222,9 @@ bool sendWRcmd_setSendCommand8(uint16_t nextCmd, uint8_t dat1, uint8_t dat2, uin
|
|||||||
uint16_t sendWRcmd_getSendCommand8(uint8_t *dat1, uint8_t *dat2, uint16_t *dat3, uint32_t *dat4)
|
uint16_t sendWRcmd_getSendCommand8(uint8_t *dat1, uint8_t *dat2, uint16_t *dat3, uint32_t *dat4)
|
||||||
{
|
{
|
||||||
uint16_t nxtAsynchCmd;
|
uint16_t nxtAsynchCmd;
|
||||||
uint8_t nn;
|
uint8_t nn, ll;
|
||||||
|
|
||||||
if (nrOfCmds8InQueue==0 || nrOfCmds8InQueue>CMD4STACKDEPTH)
|
if (nrOfCmds8InQueue==0 || nrOfCmds8InQueue>CMD8STACKDEPTH)
|
||||||
return 0; // error
|
return 0; // error
|
||||||
nxtAsynchCmd=nextAsynchsendCmd8[0];
|
nxtAsynchCmd=nextAsynchsendCmd8[0];
|
||||||
*dat1=nextCmd8para1[0];
|
*dat1=nextCmd8para1[0];
|
||||||
@@ -222,7 +233,11 @@ uint16_t sendWRcmd_getSendCommand8(uint8_t *dat1, uint8_t *dat2, uint16_t *dat3,
|
|||||||
*dat4=nextCmd8para4[0];
|
*dat4=nextCmd8para4[0];
|
||||||
|
|
||||||
// move buffer down by one element
|
// move buffer down by one element
|
||||||
for (nn=0; nn<CMD8STACKDEPTH; nn++)
|
if (CMD8STACKDEPTH>0)
|
||||||
|
ll=CMD8STACKDEPTH-1;
|
||||||
|
else
|
||||||
|
ll=0;
|
||||||
|
for (nn=0; nn<ll; nn++)
|
||||||
{
|
{
|
||||||
nextAsynchsendCmd8[nn]=nextAsynchsendCmd8[nn+1];
|
nextAsynchsendCmd8[nn]=nextAsynchsendCmd8[nn+1];
|
||||||
nextCmd8para1[nn]=nextCmd8para1[nn+1];
|
nextCmd8para1[nn]=nextCmd8para1[nn+1];
|
||||||
@@ -433,3 +448,257 @@ uint8_t gpi_chk4remainingText(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
// 11.4.23 neu, Kommando direkt an "FastDevice"-protokoll senden, nicht mehr umsetzen
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// short command, 4 data bytes
|
||||||
|
static uint8_t nextFDwrCmd[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t nextFDrdCmd[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t nextFDblkNr[FDCMD_STACKDEPTH];
|
||||||
|
|
||||||
|
static uint8_t nextFDpara1[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t nextFDpara2[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t nextFDpara3[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t nextFDpara4[FDCMD_STACKDEPTH];
|
||||||
|
static uint8_t p_nextFDcmdsInQueue;
|
||||||
|
/* convention: use simple (not rotating) FIFO Stack:
|
||||||
|
Example: nrOfCmdsInQueue=4 then
|
||||||
|
nextAsynchsendCmd0[0]=cmd1 // was stored as first
|
||||||
|
nextAsynchsendCmd0[1]=cmd2
|
||||||
|
nextAsynchsendCmd0[2]=cmd3
|
||||||
|
nextAsynchsendCmd0[3]=cmd4 // came in as last
|
||||||
|
|
||||||
|
Send: [0] first, then move buffer 1 down:
|
||||||
|
nextAsynchsendCmd0[0]=cmd2
|
||||||
|
nextAsynchsendCmd0[1]=cmd3
|
||||||
|
nextAsynchsendCmd0[2]=cmd4
|
||||||
|
nextAsynchsendCmd0[3]=0;
|
||||||
|
nrOfCmdsInQueue=3 now
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void sendFDcmd_clrStack(void)
|
||||||
|
{
|
||||||
|
uint8_t nn;
|
||||||
|
for (nn=0; 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;
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
// write Command to memory, wait for transport
|
||||||
|
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;
|
||||||
|
nextFDpara1[p_nextFDcmdsInQueue]=dat1;
|
||||||
|
nextFDpara2[p_nextFDcmdsInQueue]=dat2;
|
||||||
|
nextFDpara3[p_nextFDcmdsInQueue]=dat3;
|
||||||
|
nextFDpara4[p_nextFDcmdsInQueue]=dat4;
|
||||||
|
//qDebug() << "data with 4 data byte saved, pp=" << nrOfCmds4InQueue;
|
||||||
|
//qDebug() << " dat1=" << nextCmd4para1[nrOfCmds4InQueue] << " dat2=" << nextCmd4para2[nrOfCmds4InQueue]
|
||||||
|
// << " dat3=" << nextCmd4para3[nrOfCmds4InQueue] << " dat4=" << nextCmd4para4[nrOfCmds4InQueue];
|
||||||
|
p_nextFDcmdsInQueue++;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
uint8_t nn, ll;
|
||||||
|
|
||||||
|
if (p_nextFDcmdsInQueue==0 || p_nextFDcmdsInQueue>FDCMD_STACKDEPTH)
|
||||||
|
return false; // not possible
|
||||||
|
|
||||||
|
*nextWrCmd=nextFDwrCmd[0];
|
||||||
|
*nextRdCmd=nextFDrdCmd[0];
|
||||||
|
*blockNum=nextFDblkNr[0];
|
||||||
|
*dat1=nextFDpara1[0];
|
||||||
|
*dat2=nextFDpara2[0];
|
||||||
|
*dat3=nextFDpara3[0];
|
||||||
|
*dat4=nextFDpara4[0];
|
||||||
|
//qDebug() << "cmd4 restored to send from [0]; pp=" << nrOfCmds4InQueue;
|
||||||
|
//qDebug() << " data1: " << nextCmd4para1[0] << " data2: " << nextCmd4para2[0] <<
|
||||||
|
// " data3: " << nextCmd4para3[0] << " data4: " << nextCmd4para4[0];
|
||||||
|
|
||||||
|
// move Puffer down by one element
|
||||||
|
if (FDCMD_STACKDEPTH>0)
|
||||||
|
ll=FDCMD_STACKDEPTH-1;
|
||||||
|
else
|
||||||
|
ll=0;
|
||||||
|
for (nn=0; nn<ll; nn++)
|
||||||
|
{
|
||||||
|
nextFDwrCmd[nn]=nextFDwrCmd[nn+1];
|
||||||
|
nextFDrdCmd[nn]=nextFDrdCmd[nn+1];
|
||||||
|
nextFDblkNr[nn]=nextFDblkNr[nn+1];
|
||||||
|
nextFDpara1[nn]=nextFDpara1[nn+1];
|
||||||
|
nextFDpara2[nn]=nextFDpara2[nn+1];
|
||||||
|
nextFDpara3[nn]=nextFDpara3[nn+1];
|
||||||
|
nextFDpara4[nn]=nextFDpara4[nn+1];
|
||||||
|
}
|
||||||
|
if (p_nextFDcmdsInQueue>0)
|
||||||
|
p_nextFDcmdsInQueue--;
|
||||||
|
//qDebug() << "cmd4 after push down: pp=" << nrOfCmds4InQueue;
|
||||||
|
return true; // ok, will be sent
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t check4FDshortCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of waiting command, max FDCMD_STACKDEPTH
|
||||||
|
return p_nextFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t check4freeFDshortCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of free places in short-command stack
|
||||||
|
return FDCMD_STACKDEPTH - p_nextFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// long command, 64 data bytes
|
||||||
|
static uint8_t longFDwrCmd[FDLONG_STACKDEPTH];
|
||||||
|
static uint8_t longFDrdCmd[FDLONG_STACKDEPTH];
|
||||||
|
static uint8_t longFDblkNr[FDLONG_STACKDEPTH];
|
||||||
|
static uint8_t longFDlength[FDLONG_STACKDEPTH];
|
||||||
|
|
||||||
|
static uint8_t longFDpara[FDLONG_STACKDEPTH][64];
|
||||||
|
static uint8_t p_longFDcmdsInQueue;
|
||||||
|
|
||||||
|
|
||||||
|
void longFDcmd_clrStack(void)
|
||||||
|
{
|
||||||
|
uint8_t nn, mm;
|
||||||
|
for (nn=0; nn<FDLONG_STACKDEPTH; nn++)
|
||||||
|
{
|
||||||
|
longFDwrCmd[nn]=0;
|
||||||
|
longFDrdCmd[nn]=0;
|
||||||
|
longFDblkNr[nn]=0;
|
||||||
|
longFDlength[nn]=0;
|
||||||
|
for (mm=0; mm<64; mm++)
|
||||||
|
longFDpara[nn][mm]=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)
|
||||||
|
{
|
||||||
|
uint8_t nn, mm, ll;
|
||||||
|
|
||||||
|
if (p_longFDcmdsInQueue==0 || p_longFDcmdsInQueue>FDLONG_STACKDEPTH)
|
||||||
|
return false; // not possible
|
||||||
|
|
||||||
|
*nextWrCmd= longFDwrCmd[0];
|
||||||
|
*nextRdCmd= longFDrdCmd[0];
|
||||||
|
*blockNum = longFDblkNr[0];
|
||||||
|
*length = longFDlength[0];
|
||||||
|
for (mm=0; mm<64; mm++)
|
||||||
|
data[mm] = longFDpara[0][mm];
|
||||||
|
|
||||||
|
// move Puffer down by one element
|
||||||
|
if (FDLONG_STACKDEPTH>0)
|
||||||
|
ll=FDLONG_STACKDEPTH-1;
|
||||||
|
else
|
||||||
|
ll=0;
|
||||||
|
for (nn=0; nn<ll; nn++)
|
||||||
|
{
|
||||||
|
longFDwrCmd[nn] = longFDwrCmd[nn+1];
|
||||||
|
longFDrdCmd[nn] = longFDrdCmd[nn+1];
|
||||||
|
longFDblkNr[nn] = longFDblkNr[nn+1];
|
||||||
|
longFDlength[nn] = longFDlength[nn+1];
|
||||||
|
|
||||||
|
for (mm=0; mm<64; mm++)
|
||||||
|
longFDpara[nn][mm] = longFDpara[nn+1][mm];
|
||||||
|
|
||||||
|
}
|
||||||
|
if (p_longFDcmdsInQueue>0)
|
||||||
|
p_longFDcmdsInQueue--;
|
||||||
|
|
||||||
|
return true; // ok, will be sent
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t check4FDlongCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of waiting command
|
||||||
|
return p_longFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t check4freeFDlongCmd(void)
|
||||||
|
{
|
||||||
|
// returns number of free places in command stack
|
||||||
|
return FDLONG_STACKDEPTH - p_longFDcmdsInQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static uint8_t Sdata_DeviceParameter[64];
|
||||||
|
static uint8_t Sdata_DevParaLen;
|
||||||
|
|
||||||
|
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf)
|
||||||
|
{
|
||||||
|
// HWapi writes data to be stored
|
||||||
|
uint8_t nn;
|
||||||
|
for (nn=0; nn<length; nn++)
|
||||||
|
Sdata_DeviceParameter[nn]=buf[nn];
|
||||||
|
for (nn=length; nn<64; nn++)
|
||||||
|
Sdata_DeviceParameter[nn]=0;
|
||||||
|
|
||||||
|
Sdata_DevParaLen=length;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (uint8_t nn=0; nn<Sdata_DevParaLen; nn++)
|
||||||
|
buf[nn]=Sdata_DeviceParameter[nn];
|
||||||
|
*length=Sdata_DevParaLen;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
39
src/shared_mem_buffer.cpp
Normal file
39
src/shared_mem_buffer.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "shared_mem_buffer.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
#ifdef QT_POSIX_IPC
|
||||||
|
// The POSIX backend can be explicitly selected using the -feature-ipc_posix
|
||||||
|
// option to the Qt configure script. If it is enabled, the QT_POSIX_IPC
|
||||||
|
// macro will be defined. -> we use SystemV shared memory
|
||||||
|
#error "QT_POSIX_IPC defined"
|
||||||
|
#else
|
||||||
|
#include <sys/ipc.h> // ftok
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// std::atomic_bool SharedMemBuffer::__sharedMemLocked{false};
|
||||||
|
|
||||||
|
QSharedMemory *SharedMemBuffer::getShm(std::size_t size) {
|
||||||
|
static QSharedMemory shMem;
|
||||||
|
if (size > 0) {
|
||||||
|
static const long nativeKey = ftok("/etc/os-release", 'H');
|
||||||
|
static const QString fkey = std::to_string(nativeKey).c_str();
|
||||||
|
shMem.setKey(fkey);
|
||||||
|
if (!shMem.isAttached()) {
|
||||||
|
if (shMem.create(size)) {
|
||||||
|
return &shMem;
|
||||||
|
} else {
|
||||||
|
if (shMem.error() == QSharedMemory::AlreadyExists) {
|
||||||
|
if (shMem.attach()) {
|
||||||
|
return &shMem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qCritical() << shMem.nativeKey() << shMem.key() << shMem.data()
|
||||||
|
<< shMem.error() << shMem.errorString();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &shMem;
|
||||||
|
}
|
1470
src/storeINdata.cpp
1470
src/storeINdata.cpp
File diff suppressed because it is too large
Load Diff
@@ -76,6 +76,23 @@ uint8_t uint2uchar(uint16_t uival, bool getHighB)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr)
|
||||||
|
{
|
||||||
|
// getBytNr: 0=LSB 3=MSB
|
||||||
|
uint32_t ultmp=ulval;
|
||||||
|
if (getBytNr==0)
|
||||||
|
return uint8_t(ultmp);
|
||||||
|
ultmp>>=8;
|
||||||
|
if (getBytNr==1)
|
||||||
|
return uint8_t(ultmp);
|
||||||
|
ultmp>>=8;
|
||||||
|
if (getBytNr==2)
|
||||||
|
return uint8_t(ultmp);
|
||||||
|
ultmp>>=8;
|
||||||
|
return uint8_t(ultmp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void delay(uint16_t MilliSec)
|
void delay(uint16_t MilliSec)
|
||||||
{
|
{
|
||||||
QThread::msleep(uint32_t(MilliSec));
|
QThread::msleep(uint32_t(MilliSec));
|
||||||
@@ -344,6 +361,15 @@ uint16_t tslib_strlen(char *buf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t tslib_strlen(uint8_t *buf)
|
||||||
|
{
|
||||||
|
uint16_t nn;
|
||||||
|
|
||||||
|
for (nn=0; nn<0xFFF0; nn++)
|
||||||
|
if (buf[nn]==0)
|
||||||
|
return nn;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void tslib_strclr(char *buf, char clrsign, uint16_t len)
|
void tslib_strclr(char *buf, char clrsign, uint16_t len)
|
||||||
{
|
{
|
||||||
@@ -555,3 +581,18 @@ uint8_t tslib_sendFlashStartAddr2BL(uint32_t startAddr, uint8_t *sendData)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len)
|
||||||
|
{
|
||||||
|
// both buffers starting from pos 0
|
||||||
|
uint16_t xx,yy,zz,ii;
|
||||||
|
|
||||||
|
xx = srcPos;
|
||||||
|
yy = destPos;
|
||||||
|
zz = len;
|
||||||
|
|
||||||
|
for (ii = 0; ii < zz; ++ii)
|
||||||
|
{
|
||||||
|
dest[yy + ii] = src[xx + ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user