Compare commits
42 Commits
365b02a9c9
...
master
Author | SHA1 | Date | |
---|---|---|---|
4b38e2e46e | |||
9fa37d125d | |||
00dbf4485a | |||
88670c1079 | |||
2efdbe2d68 | |||
38994ac192 | |||
f6238e5a36 | |||
f0762e272f | |||
46ab0ec80f | |||
1d8eb2a808 | |||
22fb039172 | |||
cf8dd83a48 | |||
1a08f8ee3a | |||
94b51b5794 | |||
f833d9d13d | |||
aa4cc78380 | |||
83e282b7fc | |||
444b2f09e3 | |||
ce08b4b334 | |||
5f73704020 | |||
df9078de98 | |||
a139fdb58f | |||
6491646243 | |||
af351ee092 | |||
8490ba8a3a | |||
f9680105ab | |||
c8c19e8cfc | |||
c5654509a3 | |||
be98f7e178 | |||
909d1355a0 | |||
35f3c5f0a1 | |||
1c2ac9f4da | |||
078dd94e60 | |||
ed8505c177 | |||
63b4d7577d | |||
fc70115079 | |||
f96ac85a18 | |||
028792143a | |||
d15d15b55a | |||
5f7fc7f168 | |||
0f6e666124 | |||
27bc4afd51 |
@@ -5,12 +5,8 @@ QT += serialport
|
|||||||
|
|
||||||
|
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_
|
INCLUDEPATH+=$$_PRO_FILE_PWD_
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/support
|
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/plugins
|
INCLUDEPATH+=$$_PRO_FILE_PWD_/plugins
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/include
|
INCLUDEPATH+=$$_PRO_FILE_PWD_/include
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/HMI
|
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/HMI/screens
|
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/HMI/support
|
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/src
|
INCLUDEPATH+=$$_PRO_FILE_PWD_/src
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/src/ATBAPP
|
INCLUDEPATH+=$$_PRO_FILE_PWD_/src/ATBAPP
|
||||||
INCLUDEPATH+=$$_PRO_FILE_PWD_/src/ATBAPP/support
|
INCLUDEPATH+=$$_PRO_FILE_PWD_/src/ATBAPP/support
|
||||||
@@ -21,12 +17,11 @@ QMAKE_CXXFLAGS += -Wno-deprecated-copy -O
|
|||||||
# default
|
# default
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
|
|
||||||
DEFINES+=ATB_QT_VERSION=\\\"5.11\\\"
|
|
||||||
|
|
||||||
contains( CONFIG, DesktopLinux ) {
|
contains( CONFIG, DesktopLinux ) {
|
||||||
QMAKE_CC = ccache $$QMAKE_CC
|
QMAKE_CC = ccache $$QMAKE_CC
|
||||||
QMAKE_CXX = ccache $$QMAKE_CXX
|
QMAKE_CXX = ccache $$QMAKE_CXX
|
||||||
QMAKE_CXXFLAGS += -std=c++11
|
QMAKE_CXXFLAGS += -std=c++17
|
||||||
# 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
|
||||||
@@ -35,7 +30,7 @@ contains( CONFIG, DesktopLinux ) {
|
|||||||
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++17
|
||||||
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
linux-clang { QMAKE_CXXFLAGS += -Qunused-arguments }
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
ARCH = PTU5
|
ARCH = PTU5
|
||||||
@@ -51,12 +46,44 @@ contains( CONFIG, PTU5_YOCTO ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TARGET = ATBVMCPlugin
|
TARGET = ATBVMCPlugin
|
||||||
#DESTDIR = ../plugins
|
VERSION = "0.8.0"
|
||||||
INTERFACE = VMCInterface
|
INTERFACE = VMCInterface
|
||||||
INTERFACE_DEFINITION = $${PWD}/src/ATBAPP/VMCInterface.h
|
INTERFACE_DEFINITION = $${PWD}/src/ATBAPP/VMCInterface.h
|
||||||
|
|
||||||
DEFINES += VMCPLUGIN_LIBRARY
|
DEFINES += VMCPLUGIN_LIBRARY
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
BUILD_DATE=$$system("date /t")
|
||||||
|
BUILD_TIME=$$system("time /t")
|
||||||
|
} else {
|
||||||
|
BUILD_DATE=$$system("date +%d%m%y")
|
||||||
|
BUILD_TIME=$$system("date +%H%M")
|
||||||
|
}
|
||||||
|
|
||||||
|
GIT_COMMIT=$$system("git log -n 1 --format=oneline | cut -d' ' -f1")
|
||||||
|
GIT_BRANCH=$$system("git branch --no-color 2> /dev/null | cut -d' ' -f2")
|
||||||
|
GIT_DESCRIBE=$$system("git describe --dirty --always | tr '-' '_'")
|
||||||
|
|
||||||
|
DEV_SUFFIX=""
|
||||||
|
count(GIT_BRANCH, 2) {
|
||||||
|
DEV_SUFFIX="_dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
|
||||||
|
|
||||||
|
CONFIG += c++17
|
||||||
|
|
||||||
|
DEFINES+=ATB_QT_VERSION=\\\"$${QT_VERSION}\\\"
|
||||||
|
DEFINES+=PLUGIN_BUILD_DATE=\\\"$${BUILD_DATE}\\\"
|
||||||
|
DEFINES+=PLUGIN_BUILD_TIME=\\\"$${BUILD_TIME}\\\"
|
||||||
|
DEFINES+=PLUGIN_EXTENDED_VERSION=\\\"$${EXTENDED_VERSION}\\\"
|
||||||
|
|
||||||
|
DEFINES+=INTERFACE=\\\"VMCInterface\\\"
|
||||||
|
DEFINES+=INTERFACE_VERSION=\\\"eu.atb.ptu.plugin.VMCInterface/1.0\\\"
|
||||||
|
DEFINES+=PLUGIN_NAME=\\\"ATBVMCPlugin\\\"
|
||||||
|
DEFINES+=PLUGIN_VERSION=\\\"$${BUILD_DATE}_$${BUILD_TIME}\\\"
|
||||||
|
DEFINES+=PLUGIN_GIT_DESCRIBE=\\\"$${GIT_DESCRIBE}_$${GIT_BRANCH}$${DEV_SUFFIX}\\\"
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
#qnx: target.path = /tmp/$${TARGET}/bin
|
#qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
@@ -64,9 +91,9 @@ DEFINES += VMCPLUGIN_LIBRARY
|
|||||||
|
|
||||||
# ATBAPP interface
|
# ATBAPP interface
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
include/interfaces.h \
|
|
||||||
src/ATBAPP/VMCInterface.h \
|
src/ATBAPP/VMCInterface.h \
|
||||||
src/ATBAPP/ATBVMCPlugin.h \
|
src/ATBAPP/ATBVMCPlugin.h \
|
||||||
|
src/ATBAPP/ATBAPPplugin.h \
|
||||||
src/ATBAPP/UnifiedDCVMCInterface.h \
|
src/ATBAPP/UnifiedDCVMCInterface.h \
|
||||||
src/ATBAPP/support/VMC/com_interface.h \
|
src/ATBAPP/support/VMC/com_interface.h \
|
||||||
src/ATBAPP/support/VMC/ReceiveBuffer.h \
|
src/ATBAPP/support/VMC/ReceiveBuffer.h \
|
||||||
@@ -81,17 +108,3 @@ SOURCES += \
|
|||||||
src/ATBAPP/support/VMC/SendBuffer.cpp \
|
src/ATBAPP/support/VMC/SendBuffer.cpp \
|
||||||
src/ATBAPP/support/VMC/vmc.cpp \
|
src/ATBAPP/support/VMC/vmc.cpp \
|
||||||
src/ATBAPP/support/VendingData.cpp
|
src/ATBAPP/support/VendingData.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
|
|
||||||
|
@@ -1,157 +0,0 @@
|
|||||||
#!/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 --always)
|
|
||||||
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")
|
|
||||||
#Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
|
||||||
# "eu.atb.ptu.plugin.DeviceControllerInterface/1.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}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1468
include/interfaces.h
1468
include/interfaces.h
File diff suppressed because it is too large
Load Diff
@@ -5,13 +5,66 @@
|
|||||||
* a simple class with only one method for plugin info
|
* a simple class with only one method for plugin info
|
||||||
*/
|
*/
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QStringList>
|
||||||
|
|
||||||
class ATBAPPplugin {
|
class UnifiedDCVMCInterface;
|
||||||
public:
|
|
||||||
virtual const QString & getPluginInfo() = 0;
|
template <typename T>
|
||||||
|
struct ATBAPPplugin {
|
||||||
|
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_NETWORK,
|
||||||
|
ERROR_TIMEOUT, // the operation timed out
|
||||||
|
ERROR_PROCESS, // internal plugin error, should not occur (this is a bug in implementation)
|
||||||
|
ERROR_BUSY,
|
||||||
|
ERROR_STATE,
|
||||||
|
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. */
|
||||||
|
};
|
||||||
|
enum class TICKET_VARIANT : quint8 {
|
||||||
|
PARKING_TICKET,
|
||||||
|
RECEIPT,
|
||||||
|
ERROR_RECEIPT,
|
||||||
|
START_RECEIPT, // e.g. Szeged Start
|
||||||
|
STOP_RECEIPT, // e.g. Szeged Stop
|
||||||
|
};
|
||||||
|
enum class STEP : quint8 {
|
||||||
|
UP = 1,
|
||||||
|
DOWN = 2
|
||||||
|
};
|
||||||
|
enum class TERMINAL_STATE : quint8 {
|
||||||
|
NOT_AVAILABLE = 1,
|
||||||
|
AVAILABLE,
|
||||||
|
PREPARED_FOR_VENDING,
|
||||||
|
BUSY,
|
||||||
|
NEEDS_MAINTENANCE
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual const QString &getPluginInfo() = 0;
|
||||||
|
virtual QStringList getPluginInfoList() {
|
||||||
|
return QStringList(QString());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(ATBAPPplugin, "eu.atb.ptu.plugin.ATBAPPplugin/0.9")
|
using PLUGIN_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::PLUGIN_STATE;
|
||||||
|
using RESULT_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::RESULT_STATE;
|
||||||
|
using CASH_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::CASH_STATE;
|
||||||
|
using TICKET_VARIANT = ATBAPPplugin<UnifiedDCVMCInterface>::TICKET_VARIANT;
|
||||||
|
using STEP = ATBAPPplugin<UnifiedDCVMCInterface>::STEP;
|
||||||
|
using TERMINAL_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::TERMINAL_STATE;
|
||||||
|
|
||||||
|
//Q_DECLARE_INTERFACE(ATBAPPplugin,
|
||||||
|
// "eu.atb.ptu.plugin.ATBAPPplugin/0.9")
|
||||||
|
|
||||||
#endif // ATBAPPPLUGIN_H
|
#endif // ATBAPPPLUGIN_H
|
||||||
|
@@ -17,11 +17,20 @@ ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
|
|||||||
: VMCInterface(parent)
|
: VMCInterface(parent)
|
||||||
, m_errorCode("")
|
, m_errorCode("")
|
||||||
, m_errorDescription("")
|
, m_errorDescription("")
|
||||||
, m_pluginInfo("")
|
|
||||||
, m_serialPortName("")
|
, m_serialPortName("")
|
||||||
, m_useDebug(false)
|
, m_useDebug(false)
|
||||||
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, m_vmc(nullptr) {
|
, m_vmc(nullptr) {
|
||||||
|
|
||||||
|
m_pluginInfoList.clear();
|
||||||
|
m_pluginInfoList << QString(" Interface: ") + INTERFACE;
|
||||||
|
m_pluginInfoList << QString("Interface Version: ") + INTERFACE_VERSION;
|
||||||
|
m_pluginInfoList << QString(" PluginName: ") + PLUGIN_NAME;
|
||||||
|
m_pluginInfoList << QString(" Version: ") + PLUGIN_VERSION;
|
||||||
|
m_pluginInfoList << QString(" git-describe: ") + PLUGIN_GIT_DESCRIBE;
|
||||||
|
m_pluginInfoList << QString(" Extended version: ") + PLUGIN_EXTENDED_VERSION;
|
||||||
|
|
||||||
|
m_pluginInfo = m_pluginInfoList.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
ATBVMCPlugin::~ATBVMCPlugin() {
|
ATBVMCPlugin::~ATBVMCPlugin() {
|
||||||
@@ -31,14 +40,39 @@ ATBVMCPlugin::~ATBVMCPlugin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList ATBVMCPlugin::getPluginInfoList() {
|
||||||
|
return m_pluginInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString const &ATBVMCPlugin::getPluginInfo() {
|
||||||
|
return m_pluginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// interface:
|
// interface:
|
||||||
|
PLUGIN_STATE ATBVMCPlugin::initDCPlugin(QObject *eventReceiver, const QSettings & settings) {
|
||||||
|
Q_UNUSED(eventReceiver);
|
||||||
|
Q_UNUSED(settings);
|
||||||
|
|
||||||
|
return PLUGIN_STATE::NOT_INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLUGIN_STATE ATBVMCPlugin::initPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) {
|
||||||
|
return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
PLUGIN_STATE ATBVMCPlugin::initPlugin(QObject *eventReceiver, QSettings const &settings) {
|
||||||
|
Q_UNUSED(eventReceiver);
|
||||||
|
Q_UNUSED(settings);
|
||||||
|
|
||||||
|
return PLUGIN_STATE::NOT_INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
||||||
QObject *atbSystem,
|
QObject *atbSystem,
|
||||||
QObject *hmiConfig,
|
QObject *hmiConfig,
|
||||||
QSettings const &settings) {
|
QSettings const &settings) {
|
||||||
|
if (appControl && atbSystem && hmiConfig) {
|
||||||
m_vmc = new VMC(appControl, &settings);
|
m_vmc = new VMC(appControl, &settings);
|
||||||
|
|
||||||
// -------------------- connect vmc --------------------------------------------
|
// -------------------- connect vmc --------------------------------------------
|
||||||
@@ -57,32 +91,64 @@ PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
|||||||
connect(m_vmc, SIGNAL(setMachineNr(QString)), hmiConfig, SLOT(setMachineNr(QString)), Qt::QueuedConnection);
|
connect(m_vmc, SIGNAL(setMachineNr(QString)), hmiConfig, SLOT(setMachineNr(QString)), Qt::QueuedConnection);
|
||||||
connect(m_vmc, SIGNAL(setDefaultLanguage(quint8)), hmiConfig, SLOT(setDefaultLanguage(quint8)), Qt::QueuedConnection);
|
connect(m_vmc, SIGNAL(setDefaultLanguage(quint8)), hmiConfig, SLOT(setDefaultLanguage(quint8)), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(m_vmc, SIGNAL(wakeVMC()), m_vmc, SLOT(onWakeVMC()), Qt::QueuedConnection);
|
||||||
|
|
||||||
return PLUGIN_STATE::INITIALIZED;
|
return PLUGIN_STATE::INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PLUGIN_STATE::NOT_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mandantory ATBAPP plugin methods: ------------------------------------------
|
// mandantory ATBAPP plugin methods: ------------------------------------------
|
||||||
PLUGIN_STATE ATBVMCPlugin::getState() {
|
PLUGIN_STATE ATBVMCPlugin::getState() {
|
||||||
return PLUGIN_STATE::NOT_INITIALIZED;
|
return m_pluginState;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ATBVMCPlugin::getLastError() {
|
QString const &ATBVMCPlugin::getLastError() {
|
||||||
return "";
|
return m_errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ATBVMCPlugin::getLastErrorDescription() {
|
QString const &ATBVMCPlugin::getLastErrorDescription() {
|
||||||
return "";
|
return m_errorDescription;
|
||||||
}
|
|
||||||
|
|
||||||
QString const &ATBVMCPlugin::getPluginInfo() {
|
|
||||||
static QString info;
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// helpers e.g. for debug / log
|
// helpers e.g. for debug / log
|
||||||
QString ATBVMCPlugin::getString(RESULT_STATE /*resultState*/) {
|
QString const &ATBVMCPlugin::getString(RESULT_STATE resultState) {
|
||||||
return "";
|
static QString str;
|
||||||
|
|
||||||
|
switch (resultState) {
|
||||||
|
case RESULT_STATE::SUCCESS:
|
||||||
|
str = QString("RESULT_STATE::SUCCESS");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_BACKEND:
|
||||||
|
str = QString("RESULT_STATE::ERROR_BACKEND");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_TIMEOUT:
|
||||||
|
str = QString("RESULT_STATE::ERROR_TIMEOUT");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_PROCESS:
|
||||||
|
str = QString("RESULT_STATE::ERROR_PROCESS");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_RETRY:
|
||||||
|
str = QString("RESULT_STATE::ERROR_RETRY");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::INFO:
|
||||||
|
str = QString("RESULT_STATE::INFO");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_NETWORK:
|
||||||
|
str = QString("RESULT_STATE::ERROR_NETWORK");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_BUSY:
|
||||||
|
str = QString("RESULT_STATE::ERROR_BUSY");
|
||||||
|
break;
|
||||||
|
case RESULT_STATE::ERROR_STATE:
|
||||||
|
str = QString("RESULT_STATE::ERROR_STATE");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ATBVMCPlugin::onChangedProgramModeToSELL() {
|
void ATBVMCPlugin::onChangedProgramModeToSELL() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -114,3 +180,20 @@ void ATBVMCPlugin::reboot() {
|
|||||||
void ATBVMCPlugin::reset() {
|
void ATBVMCPlugin::reset() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList ATBVMCPlugin::interfaces() const {
|
||||||
|
QStringList result;
|
||||||
|
int const count = this->metaObject()->classInfoCount();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
QString const name(QString::fromLatin1(this->metaObject()->classInfo(i).name()));
|
||||||
|
QString const value(QString::fromLatin1(this->metaObject()->classInfo(i).value()));
|
||||||
|
if (name == "Interface") {
|
||||||
|
result << value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050000
|
||||||
|
Q_EXPORT_PLUGIN2(ATBVMCPlugin, ATBVMCPlugin)
|
||||||
|
#endif
|
||||||
|
@@ -3,43 +3,47 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QtPlugin>
|
||||||
|
|
||||||
#include "src/ATBAPP/VMCInterface.h"
|
|
||||||
#include "src/ATBAPP/ATBAPPplugin.h"
|
#include "src/ATBAPP/ATBAPPplugin.h"
|
||||||
|
#include "src/ATBAPP/VMCInterface.h"
|
||||||
|
#include "src/ATBAPP/UnifiedDCVMCInterface.h"
|
||||||
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#include "include/interfaces.h"
|
|
||||||
#include "vmc.h"
|
#include "vmc.h"
|
||||||
|
|
||||||
class ATBVMCPlugin : public VMCInterface {
|
class ATBVMCPlugin : public VMCInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(ATBAPPplugin)
|
|
||||||
Q_INTERFACES(UnifiedDCVMCInterface)
|
Q_INTERFACES(VMCInterface)
|
||||||
#if QT_VERSION >= 0x050000
|
Q_CLASSINFO("Interface", "VMCInterface")
|
||||||
Q_PLUGIN_METADATA( IID "ATBVMCPlugin" )
|
|
||||||
#endif
|
#if QT_VERSION >= 0x050000
|
||||||
|
Q_PLUGIN_METADATA(IID "eu.atb.ptu.plugin.ATBVMCPlugin")
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ATBVMCPlugin(QObject *parent = nullptr);
|
explicit ATBVMCPlugin(QObject *parent = nullptr);
|
||||||
~ATBVMCPlugin();
|
virtual ~ATBVMCPlugin();
|
||||||
|
|
||||||
|
virtual QStringList getPluginInfoList() override;
|
||||||
|
virtual const QString &getPluginInfo() override;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// interface:
|
// interface:
|
||||||
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
|
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) override;
|
||||||
QObject *atbSystem,
|
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) override;
|
||||||
QObject *hmiConfig,
|
virtual PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings) override;
|
||||||
QSettings const &settings) override;
|
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) override;
|
||||||
|
|
||||||
// mandantory ATBAPP plugin methods: ------------------------------------------
|
// mandantory ATBAPP plugin methods: ------------------------------------------
|
||||||
PLUGIN_STATE getState() override;
|
PLUGIN_STATE getState() override;
|
||||||
QString getLastError() override;
|
QString const &getLastError() override;
|
||||||
QString getLastErrorDescription() override;
|
QString const &getLastErrorDescription() override;
|
||||||
|
|
||||||
virtual const QString & getPluginInfo() override;
|
|
||||||
|
|
||||||
// helpers e.g. for debug / log
|
// helpers e.g. for debug / log
|
||||||
virtual QString getString(RESULT_STATE resultState) override;
|
virtual QString const &getString(RESULT_STATE resultState) override;
|
||||||
|
|
||||||
|
QStringList interfaces() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onChangedProgramModeToSELL() override;
|
virtual void onChangedProgramModeToSELL() override;
|
||||||
@@ -55,6 +59,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
QString m_errorCode;
|
QString m_errorCode;
|
||||||
QString m_errorDescription;
|
QString m_errorDescription;
|
||||||
|
QStringList m_pluginInfoList;
|
||||||
QString m_pluginInfo;
|
QString m_pluginInfo;
|
||||||
QString m_serialPortName;
|
QString m_serialPortName;
|
||||||
bool m_useDebug;
|
bool m_useDebug;
|
||||||
|
@@ -11,58 +11,41 @@
|
|||||||
|
|
||||||
#include "ATBAPPplugin.h"
|
#include "ATBAPPplugin.h"
|
||||||
|
|
||||||
class ATBHMIconfig;
|
|
||||||
class AppControl;
|
|
||||||
class ATBSystem;
|
|
||||||
|
|
||||||
class UnifiedDCVMCInterface : public QObject, public ATBAPPplugin {
|
class UnifiedDCVMCInterface : public ATBAPPplugin<UnifiedDCVMCInterface> {
|
||||||
|
//Q_INTERFACES(ATBAPPplugin)
|
||||||
Q_OBJECT
|
//Q_CLASSINFO("Interface", "ATBAPPplugin")
|
||||||
Q_INTERFACES(ATBAPPplugin)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class PLUGIN_STATE : quint8 {
|
explicit UnifiedDCVMCInterface() = default;
|
||||||
NOT_INITIALIZED = 0,
|
virtual ~UnifiedDCVMCInterface() = default;
|
||||||
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. */
|
|
||||||
};
|
|
||||||
enum class TICKET_VARIANT : quint8 {
|
|
||||||
PARKING_TICKET,
|
|
||||||
RECEIPT,
|
|
||||||
ERROR_RECEIPT,
|
|
||||||
START_RECEIPT, // e.g. Szeged Start
|
|
||||||
STOP_RECEIPT, // e.g. Szeged Stop
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit UnifiedDCVMCInterface(QObject *parent = nullptr) : QObject(parent) {}
|
virtual QStringList getPluginInfoList() = 0;
|
||||||
virtual ~UnifiedDCVMCInterface() {}
|
virtual const QString &getPluginInfo() = 0;
|
||||||
|
|
||||||
|
// mandantory ATBAPP plugin methods:
|
||||||
|
virtual PLUGIN_STATE getState() = 0;
|
||||||
|
virtual QString const &getLastError() = 0;
|
||||||
|
virtual QString const &getLastErrorDescription() = 0;
|
||||||
|
|
||||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver,
|
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver,
|
||||||
QObject *atbSystem,
|
QObject *atbSystem,
|
||||||
QObject *hmiConfig,
|
QObject *hmiConfig,
|
||||||
QSettings const &settings) = 0;
|
QSettings const &settings) = 0;
|
||||||
|
|
||||||
// mandantory ATBAPP plugin methods:
|
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) = 0;
|
||||||
virtual PLUGIN_STATE getState() = 0;
|
|
||||||
virtual QString getLastError() = 0;
|
|
||||||
virtual QString getLastErrorDescription() = 0;
|
|
||||||
|
|
||||||
virtual QString getString(RESULT_STATE resultState) = 0;
|
virtual PLUGIN_STATE initDCPlugin(QObject *eventReceiver,
|
||||||
|
const QSettings & settings) = 0;
|
||||||
|
|
||||||
public slots:
|
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
|
||||||
|
QObject *atbSystem, QObject *hmiConfig,
|
||||||
|
const QSettings & settings) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual QString const &getString(RESULT_STATE resultState) = 0;
|
||||||
|
|
||||||
|
//public slots:
|
||||||
virtual void onChangedProgramModeToSELL() = 0;
|
virtual void onChangedProgramModeToSELL() = 0;
|
||||||
virtual void onChangedProgramModeToSERVICE() = 0;
|
virtual void onChangedProgramModeToSERVICE() = 0;
|
||||||
virtual void onChangedProgramModeToIDLE() = 0;
|
virtual void onChangedProgramModeToIDLE() = 0;
|
||||||
@@ -72,79 +55,9 @@ public slots:
|
|||||||
virtual void stopPhysicalLayer() = 0;
|
virtual void stopPhysicalLayer() = 0;
|
||||||
virtual void reboot() = 0;
|
virtual void reboot() = 0;
|
||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
|
|
||||||
signals:
|
|
||||||
void printTicketFinished(RESULT_STATE resultState,
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
void printReceiptFinished(RESULT_STATE resultState,
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted on e.g. a coin input
|
|
||||||
*/
|
|
||||||
void cashInputEvent(RESULT_STATE resultState,
|
|
||||||
CASH_STATE cashState,
|
|
||||||
const QString & newCashValue,
|
|
||||||
/* additional variables? */
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
void cashInputFinished(RESULT_STATE resultState,
|
|
||||||
const QString & newCashValue,
|
|
||||||
/* additional variables? */
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted e.g. if service door is opened
|
|
||||||
*/
|
|
||||||
void requestModeSERVICE();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted e.g. if doors are closed
|
|
||||||
*/
|
|
||||||
void requestModeIDLE();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted e.g. on severe errors
|
|
||||||
*/
|
|
||||||
void requestModeOOO();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted e.g. if service door is opened
|
|
||||||
*/
|
|
||||||
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* emitted on error
|
|
||||||
* depending on errorCode:
|
|
||||||
* -> interrupt selling process
|
|
||||||
* -> machine can go to state OOO
|
|
||||||
* -> send error event to ISMAS
|
|
||||||
* -> ...
|
|
||||||
*/
|
|
||||||
void Error(
|
|
||||||
/* additional variables? */
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(UnifiedDCVMCInterface,
|
//Q_DECLARE_INTERFACE(UnifiedDCVMCInterface,
|
||||||
"eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0")
|
// "eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0")
|
||||||
|
|
||||||
using PLUGIN_STATE = UnifiedDCVMCInterface::PLUGIN_STATE;
|
|
||||||
using RESULT_STATE = UnifiedDCVMCInterface::RESULT_STATE;
|
|
||||||
using CASH_STATE = UnifiedDCVMCInterface::CASH_STATE;
|
|
||||||
using TICKET_VARIANT = UnifiedDCVMCInterface::TICKET_VARIANT;
|
|
||||||
|
|
||||||
#endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED
|
#endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED
|
||||||
|
@@ -17,26 +17,29 @@ namespace nsVMCInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class VMCInterface : public UnifiedDCVMCInterface {
|
class VMCInterface : public QObject, public UnifiedDCVMCInterface {
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(ATBAPPplugin)
|
//Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
|
||||||
Q_INTERFACES(UnifiedDCVMCInterface)
|
//Q_INTERFACES(UnifiedDCVMCInterface)
|
||||||
|
//Q_CLASSINFO("Interface", "ATBAPPplugin")
|
||||||
|
//Q_CLASSINFO("Interface", "UnifiedDCVMCInterface")
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit VMCInterface(QObject *parent = nullptr)
|
explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {}
|
||||||
: UnifiedDCVMCInterface(parent) {}
|
virtual ~VMCInterface() = default;
|
||||||
|
|
||||||
|
virtual QStringList getPluginInfoList() = 0;
|
||||||
|
virtual const QString &getPluginInfo() = 0;
|
||||||
|
virtual QString const &getString(RESULT_STATE resultState) = 0;
|
||||||
|
|
||||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem,
|
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem,
|
||||||
QObject *hmiConfig, QSettings const &settings) override {
|
QObject *hmiConfig, QSettings const &settings) override {
|
||||||
return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings);
|
return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~VMCInterface() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief initDCPlugin
|
* @brief initVMCPlugin
|
||||||
* @param eventReceiver - QObject to receive ATBMachineEvents or HealthEvents
|
* @param eventReceiver - QObject to receive ATBMachineEvents or HealthEvents
|
||||||
* @param settings
|
* @param settings
|
||||||
* @return
|
* @return
|
||||||
@@ -46,4 +49,7 @@ public:
|
|||||||
const QSettings & settings) = 0;
|
const QSettings & settings) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_INTERFACE(VMCInterface,
|
||||||
|
"eu.atb.ptu.plugin.VMCInterface/1.0")
|
||||||
|
|
||||||
#endif // VMCINTERFACE_H
|
#endif // VMCINTERFACE_H
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
#include "SendBuffer.h"
|
#include "SendBuffer.h"
|
||||||
#include "vmc.h"
|
#include "vmc.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
SendBuffer::SendBuffer(COM_interface *cinterface, QObject *parent) :
|
SendBuffer::SendBuffer(COM_interface *cinterface, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include "vmc.h"
|
#include "vmc.h"
|
||||||
#include "version.h"
|
|
||||||
#include "ATBAPP.h"
|
#include "ATBAPP.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -14,6 +13,13 @@
|
|||||||
VMC::VMC(QObject *appControl, QSettings const *settings,
|
VMC::VMC(QObject *appControl, QSettings const *settings,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
: QObject(parent) {
|
: QObject(parent) {
|
||||||
|
|
||||||
|
this->REMOTE_OUT_gpio_outstream = nullptr;
|
||||||
|
this->REMOTE_OUT_gpio = nullptr;
|
||||||
|
this->sendBuffer = nullptr;
|
||||||
|
this->receiveBuffer = nullptr;
|
||||||
|
this->com_interface = nullptr;
|
||||||
|
|
||||||
this->flag_blockVMCScreen = 0;
|
this->flag_blockVMCScreen = 0;
|
||||||
this->currentCachedScreen = VMC_CMD_SCREEN_START;
|
this->currentCachedScreen = VMC_CMD_SCREEN_START;
|
||||||
|
|
||||||
@@ -24,6 +30,8 @@ VMC::VMC(QObject *appControl, QSettings const *settings,
|
|||||||
this->receiveBuffer = new ReceiveBuffer(com_interface, this);
|
this->receiveBuffer = new ReceiveBuffer(com_interface, this);
|
||||||
this->sendBuffer = new SendBuffer(com_interface, this);
|
this->sendBuffer = new SendBuffer(com_interface, this);
|
||||||
|
|
||||||
|
this->privateInit_REMOTE_OUT();
|
||||||
|
|
||||||
connect(receiveBuffer, SIGNAL(ReceiveResponse(quint8)), sendBuffer, SLOT(onReceiveResponse(quint8)));
|
connect(receiveBuffer, SIGNAL(ReceiveResponse(quint8)), sendBuffer, SLOT(onReceiveResponse(quint8)));
|
||||||
|
|
||||||
com_interface->open(settings->value("VMC/serialPort", "ttymxc2").toString(),
|
com_interface->open(settings->value("VMC/serialPort", "ttymxc2").toString(),
|
||||||
@@ -42,11 +50,59 @@ VMC::VMC(QObject *appControl, QSettings const *settings,
|
|||||||
|
|
||||||
|
|
||||||
VMC::~VMC() {
|
VMC::~VMC() {
|
||||||
|
if (this->REMOTE_OUT_gpio_outstream) {
|
||||||
|
delete(this->REMOTE_OUT_gpio_outstream);
|
||||||
|
}
|
||||||
|
if (this->REMOTE_OUT_gpio) {
|
||||||
|
delete(this->REMOTE_OUT_gpio);
|
||||||
|
}
|
||||||
|
if (this->sendBuffer) {
|
||||||
delete(this->sendBuffer);
|
delete(this->sendBuffer);
|
||||||
|
}
|
||||||
|
if (this->receiveBuffer) {
|
||||||
delete(this->receiveBuffer);
|
delete(this->receiveBuffer);
|
||||||
|
}
|
||||||
|
if (this->com_interface) {
|
||||||
delete(this->com_interface);
|
delete(this->com_interface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* functions for wake vmc
|
||||||
|
*/
|
||||||
|
|
||||||
|
void VMC::onWakeVMC() {
|
||||||
|
this->privateWakeVMC();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VMC::privateWakeVMC() {
|
||||||
|
QTimer::singleShot (100, this, SLOT(privateSuspendVMC()));
|
||||||
|
this->privateSet_REMOTE_OUT(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VMC::privateSuspendVMC() {
|
||||||
|
this->privateSet_REMOTE_OUT(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VMC::privateSet_REMOTE_OUT(bool state) {
|
||||||
|
if (state) { *(this->REMOTE_OUT_gpio_outstream) << "1"; }
|
||||||
|
else { *(this->REMOTE_OUT_gpio_outstream) << "0"; }
|
||||||
|
|
||||||
|
this->REMOTE_OUT_gpio_outstream->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VMC::privateInit_REMOTE_OUT() {
|
||||||
|
QString sysfs_remout_out("/sys/class/leds/REMOTE_OUT/brightness");
|
||||||
|
|
||||||
|
this->REMOTE_OUT_gpio = new QFile(sysfs_remout_out);
|
||||||
|
if (!REMOTE_OUT_gpio->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
qDebug() << "ATB_system::privateInit_REMOTE_OUT() cannot open file: " << sysfs_remout_out;
|
||||||
|
qDebug() << " file.errorString() = " << REMOTE_OUT_gpio->errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->REMOTE_OUT_gpio_outstream = new QTextStream(this->REMOTE_OUT_gpio);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* S E N D M E S S A G E S t o V M C
|
* S E N D M E S S A G E S t o V M C
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include "version.h"
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
|
||||||
#define VMC_RECEIVE_TIMEOUT 1000
|
#define VMC_RECEIVE_TIMEOUT 1000
|
||||||
@@ -148,11 +149,8 @@ class SendBuffer;
|
|||||||
using FormatedStringList = QList<QByteArray>;
|
using FormatedStringList = QList<QByteArray>;
|
||||||
|
|
||||||
|
|
||||||
class VMC : public QObject
|
class VMC : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QObject *m_appControl;
|
QObject *m_appControl;
|
||||||
COM_interface *com_interface;
|
COM_interface *com_interface;
|
||||||
@@ -160,6 +158,9 @@ private:
|
|||||||
SendBuffer *sendBuffer;
|
SendBuffer *sendBuffer;
|
||||||
QSettings const *m_settings;
|
QSettings const *m_settings;
|
||||||
|
|
||||||
|
QFile *REMOTE_OUT_gpio;
|
||||||
|
QTextStream *REMOTE_OUT_gpio_outstream;
|
||||||
|
|
||||||
// internal: write a ByteArray to com-port:
|
// internal: write a ByteArray to com-port:
|
||||||
int SendMessage(QByteArray ba, bool enqueue = false);
|
int SendMessage(QByteArray ba, bool enqueue = false);
|
||||||
|
|
||||||
@@ -186,10 +187,14 @@ private:
|
|||||||
quint8 flag_blockVMCScreen;
|
quint8 flag_blockVMCScreen;
|
||||||
quint16 currentCachedScreen;
|
quint16 currentCachedScreen;
|
||||||
|
|
||||||
|
void privateInit_REMOTE_OUT();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDelayedMessageTimerTimeout();
|
void onDelayedMessageTimerTimeout();
|
||||||
|
|
||||||
void skipDiscount();
|
void skipDiscount();
|
||||||
|
void privateSet_REMOTE_OUT(bool state);
|
||||||
|
void privateWakeVMC();
|
||||||
|
void privateSuspendVMC();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VMC(QObject *eventReceiver, QSettings const *settings,
|
explicit VMC(QObject *eventReceiver, QSettings const *settings,
|
||||||
@@ -388,6 +393,8 @@ public slots:
|
|||||||
void ccStartTransactionRequest(); // called to start/restart a CC transaction
|
void ccStartTransactionRequest(); // called to start/restart a CC transaction
|
||||||
void ccStartConfirmTransaction(); // called to start confirmation
|
void ccStartConfirmTransaction(); // called to start confirmation
|
||||||
void ccPrintReceipt(QString receipt); // called to send receipt to vmc
|
void ccPrintReceipt(QString receipt); // called to send receipt to vmc
|
||||||
|
|
||||||
|
void onWakeVMC();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VMC_H
|
#endif // VMC_H
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#include "VendingData.h"
|
#include "VendingData.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "ATBAPP.h"
|
#include "ATBAPP.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
VendingData::VendingData(QObject *parent) : QObject(parent)
|
VendingData::VendingData(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user