Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
28a916bf92
|
|||
|
b8648338fd
|
|||
|
eb33c4e920
|
|||
|
26c2120743
|
|||
|
2452499073
|
|||
|
420ca94f41
|
|||
|
5fef45ba3e
|
@@ -48,6 +48,12 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
||||
|
||||
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();
|
||||
|
||||
QString persistentDataFile = "/mnt/system_data/dc_persistentData.dat";
|
||||
@@ -798,11 +804,39 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QHash<QString, QVarian
|
||||
|
||||
void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingString)
|
||||
{
|
||||
// DEBUG --------------------------------------------------
|
||||
QByteArray ba = printingString.toUtf8();
|
||||
QString hexStrOrigin;
|
||||
for (int i = 0; i < ba.size(); ++i) {
|
||||
if (i > 0) hexStrOrigin += ":";
|
||||
hexStrOrigin += QString("%1").arg((unsigned char)ba[i], 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
qCritical() << "-------------- printString as UTF-8 -------------";
|
||||
qCritical() << hexStrOrigin;
|
||||
qCritical() << "-------------------------------------------------";
|
||||
|
||||
|
||||
QByteArray ba_receipt = this->codec->fromUnicode(printingString);
|
||||
|
||||
|
||||
// DEBUG --------------------------------------------------
|
||||
QString hexStringConverted;
|
||||
for (int i = 0; i < ba_receipt.size(); ++i) {
|
||||
if (i > 0) hexStringConverted += ":";
|
||||
hexStringConverted += QString("%1").arg((unsigned char)ba_receipt[i], 2, 16, QChar('0')).toUpper();
|
||||
}
|
||||
qCritical() << "------------------" << this->codec->name() << "-----------------";
|
||||
qCritical() << hexStringConverted;
|
||||
qCritical() << "-------------------------------------------------";
|
||||
|
||||
|
||||
|
||||
//QByteArray ba = printingString.toUtf8();
|
||||
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);
|
||||
|
||||
// DEBUG
|
||||
@@ -1909,8 +1943,17 @@ int ATBDeviceControllerPlugin::init_sc_dbus()
|
||||
|
||||
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
||||
{
|
||||
if (source == 0x01 || source == 0xFE) {
|
||||
// woke up from device controller
|
||||
/* PTU5 wakeup sources:
|
||||
* 0x01 - on wakeup from DeviceController
|
||||
* 0x02 - on wakeup from WakeupButton
|
||||
* 0x03 - on wakeup from ResetKey
|
||||
* 0x04 - on wakeup from rtc
|
||||
* 0xFE - signal emitted by timer (on mains powered machines)
|
||||
* 0xFF - unknown wakeup source
|
||||
*/
|
||||
|
||||
if (source == 0x01 || source == 0x03 || source == 0xFE) {
|
||||
// woke up from device controller, rtc or timer
|
||||
hw->dc_autoRequest(true);
|
||||
this->diag->diagRequest();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,14 @@ enum class PROGRAM_MODE {
|
||||
NOT_DEFINED
|
||||
};
|
||||
|
||||
|
||||
class PrinterDefaultsFont
|
||||
{
|
||||
public:
|
||||
quint8 font;
|
||||
quint8 size;
|
||||
quint8 width;
|
||||
quint8 height;
|
||||
};
|
||||
|
||||
class ATBDeviceControllerPlugin :
|
||||
public DeviceControllerInterface
|
||||
@@ -133,6 +140,8 @@ private:
|
||||
|
||||
QTextCodec *codec;
|
||||
|
||||
PrinterDefaultsFont printerDefaultFont;
|
||||
|
||||
bool private_loadCashAgentLib(QString pluginName);
|
||||
|
||||
quint8 currentSelectedTicketType;
|
||||
|
||||
@@ -113,8 +113,8 @@ void DeviceControllerDiag::private_startDiag()
|
||||
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
||||
if (!this->previousMachineEventSet.contains(E255Event)) {
|
||||
machineEventSet.insert(E255Event);
|
||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||
this->private_setDiagEvent(DeviceController::State::E255);
|
||||
this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||
}
|
||||
if (this->E255counter > 5) {
|
||||
this->restartCArun();
|
||||
@@ -132,9 +132,9 @@ void DeviceControllerDiag::private_startDiag()
|
||||
* - diag is called again in ModeOOO wokeup()
|
||||
*/
|
||||
}
|
||||
this->diagRequestTimeoutTimer->stop();
|
||||
this->isRequestRunning = false;
|
||||
this->flagInterruptDiag = false;
|
||||
|
||||
this->private_finishDiag(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,15 +178,16 @@ void DeviceControllerDiag::sys_superviseSystem()
|
||||
// send
|
||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
||||
if (!this->previousMachineEventSet.contains(E255Event)) {
|
||||
machineEventSet.insert(E255Event);
|
||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||
this->private_setDiagEvent(DeviceController::State::E255);
|
||||
this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||
}
|
||||
if (this->E255counter > 5) { this->restartCArun(); }
|
||||
else { this->E255counter++; }
|
||||
|
||||
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
||||
this->diagRequestTimeoutTimer->stop();
|
||||
this->isRequestRunning = false;
|
||||
this->flagInterruptDiag = false;
|
||||
|
||||
this->private_finishDiag(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -196,16 +197,14 @@ void DeviceControllerDiag::sys_superviseSystem()
|
||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
||||
hw->dc_autoRequest(true);
|
||||
|
||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
|
||||
previousMachineEventSet.insert(E255Event);
|
||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||
DCMachineEvent M0254Event = DCMachineEvent(DeviceController::State::M0254);
|
||||
this->private_setDiagEvent(DeviceController::State::M0254);
|
||||
this->private_sendDiagEvent(M0254Event, DeviceController::Action::SET);
|
||||
|
||||
if (this->E255counter > 5) { this->restartCArun(); }
|
||||
else { this->E255counter++; }
|
||||
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
||||
this->diagRequestTimeoutTimer->stop();
|
||||
this->isRequestRunning = false;
|
||||
this->flagInterruptDiag = false;
|
||||
this->private_finishDiag(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -477,7 +476,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
||||
|
||||
|
||||
// finish diag
|
||||
this->private_finishDiag();
|
||||
this->private_finishDiag(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,14 +485,20 @@ void DeviceControllerDiag::sub_componentAssessment()
|
||||
* Single point to finish a diag process:
|
||||
* -
|
||||
*/
|
||||
void DeviceControllerDiag::private_finishDiag()
|
||||
void DeviceControllerDiag::private_finishDiag(bool dataValid)
|
||||
{
|
||||
this->diagRequestTimeoutTimer->stop();
|
||||
this->isRequestRunning = false;
|
||||
this->flagInterruptDiag = false;
|
||||
|
||||
this->previousMachineEventSet.unite(machineEventSet); // add new elements from machineEventSet
|
||||
this->previousMachineEventSet.intersect(machineEventSet); // remove elements not in machineEventSet
|
||||
// add new elements from machineEventSet
|
||||
this->previousMachineEventSet.unite(machineEventSet);
|
||||
|
||||
if (dataValid) {
|
||||
// remove elements not in machineEventSet
|
||||
// ... only if data is valid
|
||||
this->previousMachineEventSet.intersect(machineEventSet);
|
||||
}
|
||||
|
||||
if (this->isDiagBackgroundTask) {
|
||||
this->isDiagBackgroundTask = false;
|
||||
|
||||
@@ -170,7 +170,7 @@ private slots:
|
||||
void private_setDiagEvent(DeviceController::State result);
|
||||
void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action);
|
||||
|
||||
void private_finishDiag();
|
||||
void private_finishDiag(bool dataValid = false);
|
||||
|
||||
void sys_superviseSystem();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user