Compare commits
101 Commits
f64b3f716d
...
pu/use_cas
Author | SHA1 | Date | |
---|---|---|---|
f5568f6f81
|
|||
98ef7b7b26
|
|||
2717c614e3
|
|||
de1dc88e51
|
|||
50bf7e8b52
|
|||
d8d315cd49
|
|||
84859064a3
|
|||
ff4c52ddc9
|
|||
f4be010e1a
|
|||
75b597586f
|
|||
88cc71e05f
|
|||
6f00d5b356
|
|||
1f9cc3b8c0
|
|||
584e3af035
|
|||
2ac0f5b275
|
|||
a97ef4ea04
|
|||
30d790b84f
|
|||
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 | |||
8f7d4a203d | |||
defe492ec6 | |||
002d58ba7b | |||
76f54cdc0c | |||
591fd89cb5 | |||
e7723f669f | |||
d0e1be11b6 | |||
f63798727f | |||
898f0a4af8 | |||
ed037b99c9 | |||
e4a2f8fce3 | |||
19befc2c58 | |||
7f23e3ea46 | |||
49396c22ee | |||
0b87f44e64 | |||
66b22a4233 | |||
ba5d23d8be | |||
75acd1e3ec | |||
48a0068ebd | |||
f51062010e | |||
a9a5210029 |
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# 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
|
94
DCPlugin.pro
Normal file
94
DCPlugin.pro
Normal file
@@ -0,0 +1,94 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
#CONFIG += c++11 console
|
||||
#CONFIG -= app_bundle
|
||||
#QT += widgets
|
||||
QT -= gui
|
||||
QT += serialport
|
||||
|
||||
INCLUDEPATH += $${PWD}/plugins
|
||||
INCLUDEPATH += $${PWD}/include
|
||||
|
||||
QMAKE_CXXFLAGS += -Wno-deprecated-copy
|
||||
|
||||
# default
|
||||
ARCH = PTU5
|
||||
|
||||
|
||||
contains( CONFIG, DesktopLinux ) {
|
||||
QMAKE_CC = ccache $$QMAKE_CC
|
||||
QMAKE_CXX = ccache $$QMAKE_CXX
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
# QMAKE_CXXFLAGS += -Wno-deprecated-ctor
|
||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||
ARCH = DesktopLinux
|
||||
}
|
||||
|
||||
contains( CONFIG, PTU5 ) {
|
||||
# QMAKE_CC = ccache $$QMAKE_CC
|
||||
# QMAKE_CXX = ccache $$QMAKE_CXX
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||
CONFIG += link_pkgconfig
|
||||
ARCH = PTU5
|
||||
}
|
||||
|
||||
contains( CONFIG, PTU5_YOCTO ) {
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
|
||||
PTU5BASEPATH = /opt/devel/ptu5
|
||||
ARCH = PTU5
|
||||
|
||||
# add qmqtt lib
|
||||
#LIBS += -lQt5Qmqtt
|
||||
}
|
||||
|
||||
TARGET = ATBDeviceControllerPlugin
|
||||
#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
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
|
||||
# Default rules for deployment.
|
||||
#qnx: target.path = /tmp/$${TARGET}/bin
|
||||
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
#!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
# ATBAPP interface
|
||||
HEADERS += \
|
||||
include/interfaces.h \
|
||||
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}
|
||||
|
||||
|
||||
|
||||
|
||||
|
1754
include/interfaces.h
Executable file
1754
include/interfaces.h
Executable file
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
|
453
src/ATBAPP/ATBDeviceControllerPlugin.cpp
Normal file
453
src/ATBAPP/ATBDeviceControllerPlugin.cpp
Normal file
@@ -0,0 +1,453 @@
|
||||
#include "src/ATBAPP/ATBDeviceControllerPlugin.h"
|
||||
#include "src/ATBAPP/ATBHealthEvent.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTextCodec>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QPluginLoader>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject(parent),
|
||||
pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||
{
|
||||
this->pluginInfo = QString::fromUtf8(pluginInfoString.c_str());
|
||||
|
||||
if (!this->private_loadCashAgentLib("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//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_payStopByMax()), this, SLOT(onCashPayStopByMax()));
|
||||
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_payStopByEscrow()), this, SLOT(onCashPayStopByEscrow()));
|
||||
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_payStopByError()), this, SLOT(onCashPayStopByError()));
|
||||
connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_payStopByTimeout()), this, SLOT(onCashPayStopByTimeout()));
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
hw->dc_autoRequest(true);
|
||||
|
||||
// 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());
|
||||
|
||||
if (amountInt == 0) amountInt = UINT_MAX;
|
||||
|
||||
hw->cash_startPayment(amountInt);
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::requestStopCashInput()
|
||||
{
|
||||
hw->cash_stopPayment();
|
||||
|
||||
// we need new cash value in application...
|
||||
QTimer::singleShot(500, this, SLOT(onCashPayStoped()));
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::cashCollect()
|
||||
{
|
||||
hw->vend_success();
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::cashAbort()
|
||||
{
|
||||
hw->vend_failed();
|
||||
}
|
||||
|
||||
// TASKS: Account -------------------------------------------------------------
|
||||
void ATBDeviceControllerPlugin::requestAccount()
|
||||
{
|
||||
qCritical() << "TODO: implement ATBDeviceControllerPlugin::requestAccount()";
|
||||
}
|
||||
|
||||
|
||||
// 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->parkingEnd, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8));
|
||||
|
||||
QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateTime.toString("dd.MM.yy"));
|
||||
memcpy((char*)dynTicketData->currentTime, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8));
|
||||
// ! and yes... 'ParkingEndDate' is 'currentTime'
|
||||
|
||||
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(1000, 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(2000, 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::onCashPayStopByMax()
|
||||
{
|
||||
// DEBUG
|
||||
qCritical() << "ATBDeviceControllerPlugin::onCashVendStopByMax()";
|
||||
|
||||
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||
|
||||
QString amountString = QString::number(amountInt);
|
||||
|
||||
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||
amountString,
|
||||
"",
|
||||
"");
|
||||
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::onCashPayStopByEscrow()
|
||||
{
|
||||
// DEBUG
|
||||
qCritical() << "ATBDeviceControllerPlugin::onCashPayStopByEscrow()";
|
||||
|
||||
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||
|
||||
QString amountString = QString::number(amountInt);
|
||||
|
||||
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||
amountString,
|
||||
"",
|
||||
"");
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::onCashPayStopByError()
|
||||
{
|
||||
// DEBUG
|
||||
qCritical() << "ATBDeviceControllerPlugin::onCashPayStopByError()";
|
||||
|
||||
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||
|
||||
QString amountString = QString::number(amountInt);
|
||||
|
||||
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||
amountString,
|
||||
"",
|
||||
"");
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::onCashPayStopByTimeout()
|
||||
{
|
||||
// DEBUG
|
||||
qCritical() << "ATBDeviceControllerPlugin::onCashPayStopByTimeout()";
|
||||
|
||||
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||
|
||||
QString amountString = QString::number(amountInt);
|
||||
|
||||
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||
amountString,
|
||||
"",
|
||||
"");
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::onCashPayStoped()
|
||||
{
|
||||
// DEBUG
|
||||
qCritical() << "ATBDeviceControllerPlugin::onCashPayStoped()";
|
||||
|
||||
uint32_t amountInt = this->hw->getInsertedAmount();
|
||||
|
||||
QString amountString = QString::number(amountInt);
|
||||
|
||||
emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||
amountString,
|
||||
"",
|
||||
"");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load CashAgentLib
|
||||
* @brief ATBDeviceControllerPlugin::private_loadCashAgentLib
|
||||
* @param pluginName
|
||||
* @return
|
||||
*/
|
||||
bool ATBDeviceControllerPlugin::private_loadCashAgentLib(QString pluginName)
|
||||
{
|
||||
if (pluginName == "") {
|
||||
pluginName = "/usr/lib/libCashAgentLib.so";
|
||||
}
|
||||
|
||||
if (!QLibrary::isLibrary(pluginName)) {
|
||||
qCritical() << "ATBDeviceControllerPlugin: can not load CashAgentLib: " << pluginName;
|
||||
this->errorCode = 5;
|
||||
this->errorDescription = "ERROR: can not load CashAgentLib: " + pluginName;
|
||||
return false;
|
||||
}
|
||||
|
||||
QPluginLoader* pluginLoader = new QPluginLoader();
|
||||
pluginLoader->setFileName(pluginName);
|
||||
|
||||
QObject* plugin = pluginLoader->instance();
|
||||
if (!pluginLoader->isLoaded()) {
|
||||
qCritical() << "ATBDeviceControllerPlugin: can not instantiate CashAgentLib: " << pluginName;
|
||||
this->errorCode = 6;
|
||||
this->errorDescription = "ERROR: can not instantiate CashAgentLib: " + pluginName;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plugin == nullptr) {
|
||||
qCritical() << "ATBDeviceControllerPlugin: plugin is NULL";
|
||||
}
|
||||
|
||||
qCritical() << "ATBDeviceControllerPlugin: instantiate CashAgentLib: " << pluginName;
|
||||
|
||||
this->hw = qobject_cast<hwinf*>(plugin);
|
||||
|
||||
if (this->hw == nullptr) {
|
||||
qCritical() << "ATBDeviceControllerPlugin: hw is NULL";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************************************************************
|
||||
* 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
|
137
src/ATBAPP/ATBDeviceControllerPlugin.h
Normal file
137
src/ATBAPP/ATBDeviceControllerPlugin.h
Normal file
@@ -0,0 +1,137 @@
|
||||
#ifndef ATBDEVICECONTROLLERPLUGIN_H
|
||||
#define ATBDEVICECONTROLLERPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "src/ATBAPP/DeviceControllerInterface.h"
|
||||
#include "src/ATBAPP/ATBAPPplugin.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
||||
#include "interfaces.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);
|
||||
|
||||
// TASKS: Account -------------------------------------------------------------
|
||||
void requestAccount();
|
||||
|
||||
// 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 requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
bool private_loadCashAgentLib(QString pluginName);
|
||||
|
||||
private slots:
|
||||
// printer
|
||||
|
||||
void onPrinterDataPrepared();
|
||||
void onPrinterPrintNextTemplate();
|
||||
|
||||
void onPrintFinishedOK();
|
||||
void onPrintFinishedERR();
|
||||
|
||||
// cash payment
|
||||
void onCashGotCoin();
|
||||
void onCashPayStoped();
|
||||
void onCashPayStopByMax();
|
||||
void onCashPayStopByEscrow();
|
||||
void onCashPayStopByError();
|
||||
void onCashPayStopByTimeout();
|
||||
};
|
||||
|
||||
#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
|
150
src/ATBAPP/DeviceControllerInterface.h
Normal file
150
src/ATBAPP/DeviceControllerInterface.h
Normal file
@@ -0,0 +1,150 @@
|
||||
#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: Account -------------------------------------------------------------
|
||||
|
||||
virtual void requestAccount() = 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 e.g. if service door is opened
|
||||
*/
|
||||
virtual void requestAccountResponse(const QHash<QString, QVariant> & accountData) = 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
|
Reference in New Issue
Block a user