Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7a9f523b59
|
|||
|
9d81e1217e
|
|||
|
feb53f8174
|
|||
|
60f7a79dbe
|
|||
|
238ea71280
|
@@ -28,6 +28,7 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
|||||||
, isMaster(false)
|
, isMaster(false)
|
||||||
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
|
, latestAccountNumber(0)
|
||||||
{
|
{
|
||||||
this->setParent(parent);
|
this->setParent(parent);
|
||||||
|
|
||||||
@@ -48,6 +49,12 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
|||||||
|
|
||||||
this->initTicketTemplateList(&settings);
|
this->initTicketTemplateList(&settings);
|
||||||
|
|
||||||
|
// configurable default printer settings for 'prn_sendText()' used e.g. for bank receipts
|
||||||
|
this->printerDefaultFont.font = settings.value("ATBDeviceControllerPlugin/printerDefaultFont", "8").toUInt();
|
||||||
|
this->printerDefaultFont.size = settings.value("ATBDeviceControllerPlugin/printerDefaultSize", "12").toUInt();
|
||||||
|
this->printerDefaultFont.width = settings.value("ATBDeviceControllerPlugin/printerDefaultWidth", "0").toUInt();
|
||||||
|
this->printerDefaultFont.height = settings.value("ATBDeviceControllerPlugin/printerDefaultHeight", "0").toUInt();
|
||||||
|
|
||||||
this->init_sc_dbus();
|
this->init_sc_dbus();
|
||||||
|
|
||||||
QString persistentDataFile = "/mnt/system_data/dc_persistentData.dat";
|
QString persistentDataFile = "/mnt/system_data/dc_persistentData.dat";
|
||||||
@@ -321,6 +328,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
|
|||||||
this->currentProgramMode = PROGRAM_MODE::OOO;
|
this->currentProgramMode = PROGRAM_MODE::OOO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::requestDiag()
|
||||||
|
{
|
||||||
|
hw->dc_autoRequest(true);
|
||||||
|
this->diag->diagRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TASKS: Cash handling -------------------------------------------------------
|
// TASKS: Cash handling -------------------------------------------------------
|
||||||
void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
|
void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
|
||||||
@@ -487,13 +500,13 @@ void ATBDeviceControllerPlugin::private_startAccount()
|
|||||||
|
|
||||||
qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare );
|
qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare );
|
||||||
|
|
||||||
uint16_t latestAccountNumber = backupedAccNumbers[nrOfVals-1];
|
this->latestAccountNumber = backupedAccNumbers[nrOfVals-1];
|
||||||
|
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << " latestAccountNumber = " << latestAccountNumber;
|
qCritical() << " latestAccountNumber = " << this->latestAccountNumber;
|
||||||
|
|
||||||
hw->log_selectVaultRecord(latestAccountNumber);
|
hw->log_selectVaultRecord(this->latestAccountNumber);
|
||||||
|
|
||||||
this->accountCheckCounter = 0;
|
this->accountCheckCounter = 0;
|
||||||
QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
|
QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
|
||||||
@@ -516,11 +529,25 @@ void ATBDeviceControllerPlugin::private_checkAccountData()
|
|||||||
// cannot get accountData within ~10*500ms
|
// cannot get accountData within ~10*500ms
|
||||||
qCritical() << "checkAccountData() failed";
|
qCritical() << "checkAccountData() failed";
|
||||||
|
|
||||||
// simulate:
|
JSON::setPrettySerialize(false);
|
||||||
this->private_getAccountData();
|
JSON::JsonObject json = JSON::objectBuilder()
|
||||||
|
->set("Error", QString("check account data failed"))
|
||||||
|
->set("AccountNumber", this->latestAccountNumber)
|
||||||
|
->create();
|
||||||
|
QString parameterJsonString = JSON::serialize(json);
|
||||||
|
|
||||||
|
|
||||||
// TODO: create and send an HealthEvent...
|
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
||||||
|
ATBMachineEvent *machineEvent = new ATBMachineEvent(
|
||||||
|
eventId, // id
|
||||||
|
"DC", // device name: PTU/PRINTER/DC/...
|
||||||
|
EVENT_CLASS::STATE, // reason of event: Error/Warning/Alarm
|
||||||
|
"M01000", // eventName
|
||||||
|
1, // state
|
||||||
|
parameterJsonString, // parameter
|
||||||
|
"ACCOUNT" // second level info
|
||||||
|
);
|
||||||
|
QCoreApplication::postEvent(this, machineEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -537,6 +564,14 @@ void ATBDeviceControllerPlugin::private_getAccountData()
|
|||||||
|
|
||||||
QHash<QString, QVariant> accountData;
|
QHash<QString, QVariant> accountData;
|
||||||
|
|
||||||
|
if (this->latestAccountNumber != retVR.AccountingNumber) {
|
||||||
|
// this is the wrong account! -> read again
|
||||||
|
hw->log_selectVaultRecord(this->latestAccountNumber);
|
||||||
|
|
||||||
|
QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
accountData.insert("AccountingNumber", QString::number(retVR.AccountingNumber));
|
accountData.insert("AccountingNumber", QString::number(retVR.AccountingNumber));
|
||||||
|
|
||||||
|
|
||||||
@@ -802,7 +837,10 @@ 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_setFonts(printerDefaultFont.font,
|
||||||
|
printerDefaultFont.size,
|
||||||
|
printerDefaultFont.width,
|
||||||
|
printerDefaultFont.height);
|
||||||
hw->prn_sendText(&ba_receipt);
|
hw->prn_sendText(&ba_receipt);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
|||||||
@@ -34,7 +34,14 @@ enum class PROGRAM_MODE {
|
|||||||
NOT_DEFINED
|
NOT_DEFINED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PrinterDefaultsFont
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
quint8 font;
|
||||||
|
quint8 size;
|
||||||
|
quint8 width;
|
||||||
|
quint8 height;
|
||||||
|
};
|
||||||
|
|
||||||
class ATBDeviceControllerPlugin :
|
class ATBDeviceControllerPlugin :
|
||||||
public DeviceControllerInterface
|
public DeviceControllerInterface
|
||||||
@@ -97,7 +104,7 @@ public slots:
|
|||||||
void reboot();
|
void reboot();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
void requestDiag();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// public Signals are defined in interface
|
// public Signals are defined in interface
|
||||||
@@ -133,6 +140,8 @@ private:
|
|||||||
|
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
|
|
||||||
|
PrinterDefaultsFont printerDefaultFont;
|
||||||
|
|
||||||
bool private_loadCashAgentLib(QString pluginName);
|
bool private_loadCashAgentLib(QString pluginName);
|
||||||
|
|
||||||
quint8 currentSelectedTicketType;
|
quint8 currentSelectedTicketType;
|
||||||
@@ -142,6 +151,8 @@ private:
|
|||||||
// counts failed hw->log_chkIfVaultRecordAvailable()
|
// counts failed hw->log_chkIfVaultRecordAvailable()
|
||||||
int accountCheckCounter;
|
int accountCheckCounter;
|
||||||
|
|
||||||
|
uint16_t latestAccountNumber;
|
||||||
|
|
||||||
// counts faild hw->prn-getPrintResult()
|
// counts faild hw->prn-getPrintResult()
|
||||||
int printResultCheckCounter;
|
int printResultCheckCounter;
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ public slots:
|
|||||||
virtual void reboot() = 0;
|
virtual void reboot() = 0;
|
||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
|
|
||||||
|
virtual void requestDiag() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
@@ -213,7 +216,7 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
||||||
"eu.atb.ptu.plugin.DeviceControllerInterface/1.2.1")
|
"eu.atb.ptu.plugin.DeviceControllerInterface/1.2.2")
|
||||||
|
|
||||||
|
|
||||||
namespace nsDeviceControllerInterface {
|
namespace nsDeviceControllerInterface {
|
||||||
|
|||||||
Reference in New Issue
Block a user