Fixed printing od ticket: dc_printTemplate(). First send dynamic data, then use prn_sendDynamicPrnValues()

This commit is contained in:
Gerhard Hoffmann 2023-05-03 08:59:17 +02:00
parent ceedf72b34
commit 6765bb13e5

View File

@ -573,10 +573,25 @@ bool hwapi::dc_printTemplate(enum FileTypeJson type,
}
bool ret = true;
struct T_dynDat dynTicketData;
memset (&dynTicketData, 0x00, sizeof(dynTicketData));
// lassen sich auch veraendern
memcpy(&dynTicketData.licensePlate[0], "WEN1230", 8);
memcpy(&dynTicketData.vendingPrice[0], "1234", 8);
memcpy(&dynTicketData.parkingEnd[0], "12:00:00", 8);
memcpy(&dynTicketData.currentTime[0], "14:15:00", 8);
memcpy(&dynTicketData.currentDate[0], "01.01.2023", 8);
for (int i = 0; i < templateIdx.size(); ++i) {
if (prn_printTemplate(templateIdx[i])) {
qDebug() << "printing template" << templateIdx[i];
std::this_thread::sleep_for(std::chrono::seconds(3));
// dynamische Daten werden gespeichert
if (prn_sendDynamicPrnValues(&dynTicketData.licensePlate[0])) {
// angabe welches template beim drucken benutzt werden soll
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
if (prn_printTemplate(templateIdx[i])) {
qDebug() << "printing template" << templateIdx[i];
std::this_thread::sleep_for(std::chrono::seconds(3));
}
} else {
ret = false;
continue;