Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
5590cabfc1
|
1585
include/interfaces.h
1585
include/interfaces.h
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
||||||
: isMaster(false)
|
: pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
|
||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
{
|
{
|
||||||
this->setParent(parent);
|
this->setParent(parent);
|
||||||
@@ -77,11 +76,10 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
|||||||
this->serialPortName = settings.value("DEVICE_CONTROLLER/serialPort", "ttymxc2").toString();
|
this->serialPortName = settings.value("DEVICE_CONTROLLER/serialPort", "ttymxc2").toString();
|
||||||
QByteArray printerEncoding = settings.value("DEVICE_CONTROLLER/printerEnconding", "ISO 8859-2").toString().toLatin1();
|
QByteArray printerEncoding = settings.value("DEVICE_CONTROLLER/printerEnconding", "ISO 8859-2").toString().toLatin1();
|
||||||
|
|
||||||
if (this->isMaster) {
|
|
||||||
// open serial port
|
// open serial port
|
||||||
hw->dc_openSerial(5, "115200", this->serialPortName, 1);
|
hw->dc_openSerial(5, "115200", this->serialPortName, 1);
|
||||||
|
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
}
|
|
||||||
|
|
||||||
hw->dc_setNewCustomerNumber(PTUSystem::readCustomerNumber());
|
hw->dc_setNewCustomerNumber(PTUSystem::readCustomerNumber());
|
||||||
hw->dc_setNewMachineNumber(PTUSystem::readMachineNumber());
|
hw->dc_setNewMachineNumber(PTUSystem::readMachineNumber());
|
||||||
@@ -107,8 +105,6 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::startPhysicalLayer()
|
void ATBDeviceControllerPlugin::startPhysicalLayer()
|
||||||
{
|
{
|
||||||
if (!this->isMaster) return;
|
|
||||||
|
|
||||||
if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED)
|
if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
{
|
{
|
||||||
qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized";
|
qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized";
|
||||||
@@ -123,8 +119,6 @@ void ATBDeviceControllerPlugin::startPhysicalLayer()
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::stopPhysicalLayer()
|
void ATBDeviceControllerPlugin::stopPhysicalLayer()
|
||||||
{
|
{
|
||||||
if (!this->isMaster) return;
|
|
||||||
|
|
||||||
if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED)
|
if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
{
|
{
|
||||||
qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized";
|
qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized";
|
||||||
@@ -368,7 +362,7 @@ void ATBDeviceControllerPlugin::onVaultDoorOpened()
|
|||||||
// this is started here because we want to keep ptu awake in order to get
|
// this is started here because we want to keep ptu awake in order to get
|
||||||
// coin box removed / inserted etc.
|
// coin box removed / inserted etc.
|
||||||
// BackgroundTask("ACCOUNT") is finished, if account message is sent to ISMAS!
|
// BackgroundTask("ACCOUNT") is finished, if account message is sent to ISMAS!
|
||||||
this->dbus->startBackgroundTask("DOOR_OPEN");
|
this->dbus->startBackgroundTask("ACCOUNT");
|
||||||
|
|
||||||
// do not: emit this->requestModeSERVICE();
|
// do not: emit this->requestModeSERVICE();
|
||||||
}
|
}
|
||||||
@@ -377,9 +371,6 @@ void ATBDeviceControllerPlugin::onCoinBoxRemoved()
|
|||||||
{
|
{
|
||||||
qCritical() << "ATBDeviceControllerPlugin::onCoinBoxRemoved()";
|
qCritical() << "ATBDeviceControllerPlugin::onCoinBoxRemoved()";
|
||||||
|
|
||||||
// BackgroundTask("ACCOUNT") is finished, if account message is sent to ISMAS!
|
|
||||||
this->dbus->startBackgroundTask("ACCOUNT");
|
|
||||||
|
|
||||||
QTimer::singleShot(4000, this, SLOT(private_startAccount()));
|
QTimer::singleShot(4000, this, SLOT(private_startAccount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,31 +379,19 @@ void ATBDeviceControllerPlugin::onCoinBoxInserted()
|
|||||||
qCritical() << "ATBDeviceControllerPlugin::onCoinBoxInserted()";
|
qCritical() << "ATBDeviceControllerPlugin::onCoinBoxInserted()";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is called, when all CoinBox is inserted and all doors
|
|
||||||
* are closed.
|
|
||||||
*/
|
|
||||||
void ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed()
|
void ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed()
|
||||||
{
|
{
|
||||||
qCritical() << "ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed()";
|
qCritical() << "ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed()";
|
||||||
|
|
||||||
QTimer::singleShot(2000, this, SIGNAL(requestModeIDLE()));
|
QTimer::singleShot(2000, this, SIGNAL(requestModeIDLE()));
|
||||||
|
|
||||||
this->dbus->finishedBackgroundTask("DOOR_OPEN");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is called, when all no coinbox is inserted and all doors are
|
|
||||||
* closed.
|
|
||||||
*/
|
|
||||||
void ATBDeviceControllerPlugin::onAllDoorsClosed()
|
void ATBDeviceControllerPlugin::onAllDoorsClosed()
|
||||||
{
|
{
|
||||||
qCritical() << "ATBDeviceControllerPlugin::onAllDoorsClosed()";
|
qCritical() << "ATBDeviceControllerPlugin::onAllDoorsClosed()";
|
||||||
|
|
||||||
emit this->requestModeIDLE();
|
emit this->requestModeIDLE();
|
||||||
this->dbus->finishedBackgroundTask("DOOR_OPEN");
|
|
||||||
|
|
||||||
// TODO: check for errors and create a machine event
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onNewVoltage(uint32_t voltage)
|
void ATBDeviceControllerPlugin::onNewVoltage(uint32_t voltage)
|
||||||
@@ -562,6 +541,7 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
|
|||||||
{
|
{
|
||||||
QByteArray ba = printingString.toUtf8();
|
QByteArray ba = printingString.toUtf8();
|
||||||
hw->prn_switchPower(true);
|
hw->prn_switchPower(true);
|
||||||
|
hw->prn_setFonts(8,12,0,0);
|
||||||
hw->prn_sendText(&ba);
|
hw->prn_sendText(&ba);
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
||||||
|
|
||||||
@@ -933,8 +913,7 @@ bool ATBDeviceControllerPlugin::private_loadCashAgentLib(QString pluginName)
|
|||||||
|
|
||||||
// search list for plugin (.so) file:
|
// search list for plugin (.so) file:
|
||||||
QStringList pluginNameList;
|
QStringList pluginNameList;
|
||||||
pluginNameList << "/usr/lib/libCAslave.so"
|
pluginNameList << "/usr/lib/libCAmaster.so"
|
||||||
<< "/usr/lib/libCAmaster.so"
|
|
||||||
<< "/usr/lib/libCashAgentLib.so";
|
<< "/usr/lib/libCashAgentLib.so";
|
||||||
// using C++11 range based loop:
|
// using C++11 range based loop:
|
||||||
for (const auto& filename : pluginNameList) {
|
for (const auto& filename : pluginNameList) {
|
||||||
@@ -960,14 +939,6 @@ bool ATBDeviceControllerPlugin::private_loadCashAgentLib(QString pluginName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginName.contains("slave", Qt::CaseInsensitive)) {
|
|
||||||
this->isMaster = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (pluginName.contains("master", Qt::CaseInsensitive)) {
|
|
||||||
this->isMaster = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPluginLoader* pluginLoader = new QPluginLoader();
|
QPluginLoader* pluginLoader = new QPluginLoader();
|
||||||
pluginLoader->setFileName(pluginName);
|
pluginLoader->setFileName(pluginName);
|
||||||
|
|
||||||
|
@@ -95,8 +95,6 @@ private:
|
|||||||
|
|
||||||
bool useDebug;
|
bool useDebug;
|
||||||
|
|
||||||
bool isMaster;
|
|
||||||
|
|
||||||
PLUGIN_STATE pluginState;
|
PLUGIN_STATE pluginState;
|
||||||
|
|
||||||
QObject* eventReceiver;
|
QObject* eventReceiver;
|
||||||
|
Reference in New Issue
Block a user