ATBAPP: Rework for ticket printing
This commit is contained in:
parent
e32142cd62
commit
48d6a34b16
@ -76,8 +76,8 @@ struct Tprn_currentSettings {
|
|||||||
struct T_dynDat {
|
struct T_dynDat {
|
||||||
uint8_t licensePlate[8];
|
uint8_t licensePlate[8];
|
||||||
uint8_t vendingPrice[8];
|
uint8_t vendingPrice[8];
|
||||||
uint8_t parkingEnd[8];
|
uint8_t parkingEndTime[8];
|
||||||
uint8_t currentTime[8];
|
uint8_t parkingEndDate[8];
|
||||||
uint8_t currentDate[8];
|
uint8_t currentDate[8];
|
||||||
uint8_t dynDat5[8];
|
uint8_t dynDat5[8];
|
||||||
uint8_t dynDat6[8];
|
uint8_t dynDat6[8];
|
||||||
|
@ -76,24 +76,46 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
|||||||
struct T_dynDat *dynTicketData = new T_dynDat;
|
struct T_dynDat *dynTicketData = new T_dynDat;
|
||||||
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
||||||
|
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||||
<< " licenseplate = " << printingData["licenseplate"] << endl
|
<< " licenseplate = " << printingData["licenseplate"] << endl
|
||||||
<< " amount = " << printingData["amount"] << endl
|
<< " amount = " << printingData["amount"] << endl
|
||||||
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
||||||
<< " currentTime = " << printingData["currentTime"] << endl
|
<< " currentDateTime = " << printingData["currentDateTime"] << endl;
|
||||||
<< " currentDate = " << printingData["currentDate"] << endl;
|
|
||||||
|
|
||||||
|
QDateTime parkingEndDateTime = QDateTime::fromString(printingData["parkingEnd"].toString(), Qt::ISODate);
|
||||||
|
QDateTime currentDateTime = QDateTime::fromString(printingData["currentDateTime"].toString(), Qt::ISODate);
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------------------
|
||||||
|
* note: the following highly depends on printer template files!
|
||||||
|
* -----------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
// set dynamic printer data:
|
// set dynamic printer data:
|
||||||
memcpy((char*)dynTicketData->licensePlate, codec->fromUnicode(printingData["licenseplate"].toString()).data(), 8);
|
QByteArray ba_licenseplate = codec->fromUnicode(printingData["licenseplate"].toString());
|
||||||
memcpy((char*)dynTicketData->vendingPrice, codec->fromUnicode(printingData["amount"].toString()).data(), 8);
|
memcpy((char*)dynTicketData->licensePlate, ba_licenseplate.data(), std::min(ba_licenseplate.size(),8));
|
||||||
|
|
||||||
QDateTime parkingEndQDateTime = QDateTime::fromString(printingData["parkingEnd"].toString(), Qt::ISODate);
|
QByteArray ba_amount = codec->fromUnicode(printingData["amount"].toString());
|
||||||
QDateTime currentDateTime = QDateTime::fromString(printingData["currentTime"].toString(), Qt::ISODate);
|
memcpy((char*)dynTicketData->vendingPrice, ba_amount.data(), std::min(ba_amount.size(),8));
|
||||||
|
|
||||||
memcpy((char*)dynTicketData->parkingEnd, codec->fromUnicode(parkingEndQDateTime.toString("hh:mm")).data(), 8);
|
QByteArray ba_parkingEndTime = codec->fromUnicode(parkingEndDateTime.toString("hh:mm"));
|
||||||
memcpy((char*)dynTicketData->currentTime, codec->fromUnicode(currentDateTime.toString("hh:mm")).data(), 8);
|
memcpy((char*)dynTicketData->parkingEndTime, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8));
|
||||||
memcpy((char*)dynTicketData->currentDate, codec->fromUnicode(currentDateTime.toString("dd.MM.yy")).data(), 8);
|
|
||||||
|
QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateTime.toString("dd.MM.yy"));
|
||||||
|
memcpy((char*)dynTicketData->parkingEndDate, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_currentDate = codec->fromUnicode(currentDateTime.toString("dd.MM.yy"));
|
||||||
|
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
|
||||||
|
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
/*
|
||||||
|
uint8_t* buf = dynTicketData->licensePlate;
|
||||||
|
int length = 64;
|
||||||
|
for (int i = 0; i < length; ++i) {
|
||||||
|
fprintf(stderr, "%d %02x %c\n", i, buf[i], buf[i]);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
*/
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
||||||
|
Loading…
Reference in New Issue
Block a user