e settings instead of config-pointer.

This commit is contained in:
Gerhard Hoffmann 2023-11-13 13:49:22 +01:00
parent 74cf8f136c
commit 5f37646b4a

View File

@ -26,7 +26,8 @@ VMC::VMC(QObject *appControl, QSettings const *settings,
connect(receiveBuffer, SIGNAL(ReceiveResponse(quint8)), sendBuffer, SLOT(onReceiveResponse(quint8)));
com_interface->open(config->getComPortName(), config->getComBaudRate());
com_interface->open(settings->value("VMC/serialPort", "ttymxc2").toString(),
settings->value("VMC/baudrate", "115200").toInt());
connect(receiveBuffer, SIGNAL(ReceiveError(RECEIVE_ERROR)), this, SLOT(onReceiveError(RECEIVE_ERROR)), Qt::QueuedConnection);
connect(sendBuffer, SIGNAL(sendError(SEND_ERROR)), this, SLOT(onSendError(SEND_ERROR)));
@ -948,12 +949,12 @@ quint8 VMC::parseTextCommand(QByteArray &cmd)
if (size > cmd.size() - 7) { size = cmd.size() - 7; }
QTextCodec *codec = QTextCodec::codecForName(config->getDefaultCharacterSet());
QTextCodec *codec = QTextCodec::codecForName(m_settings->value("CharacterSet", "ISO 8859-15").toByteArray());
QString text = codec->toUnicode(cmd.mid(6,size));
qDebug() << "VMC::parseTextCommand() screennr = " << QString::number(screennr, 16);
qDebug() << "VMC::parseTextCommand() textnr = " << QString::number(textnr, 16);
qDebug() << "VMC::parseTextCommand() lang = " << QString::number(lang, 16);
//qDebug() << "VMC::parseTextCommand() size = " << QString::number(size, 16);
//qDebug() << "VMC::parseTextCommand() text = " << text;
@ -1069,7 +1070,7 @@ quint8 VMC::parseDataDisplayCommand(QByteArray &cmd)
QString text = codec->toUnicode(data.constData(), data.size(), &state);
if (state.invalidChars > 0) {
// Not a UTF-8 text
QTextCodec *defaultCodec = QTextCodec::codecForName(config->getDefaultCharacterSet());
QTextCodec *defaultCodec = QTextCodec::codecForName(m_settings->value("CharacterSet", "ISO 8859-15").toByteArray());
text = defaultCodec->toUnicode(data);
}
@ -1122,8 +1123,7 @@ quint8 VMC::parseDataDisplayCommand(QByteArray &cmd)
// set vendingData
emit setVendingData("DATETIME_PARKEND", endTime.toString("yyyy-MM-dd HH:mm:ss").toLatin1());
if (config->hasFeatureShowParkingTime()) {
if (m_settings->value("FeatureShowParkingTime", "false").toBool()) {
// calculate time difference to current time:
int secondsTo = QDateTime::currentDateTime().secsTo(endTime);
@ -1291,7 +1291,7 @@ QString & VMC::privateHandleDataCommand_AmountToPay(quint8 data, QString & dataS
// append currency symbol
dataString.append(" ");
dataString.append(this->config->getPaymentCurrencySymbol());
dataString.append(m_settings->value("currencySymbol", "").toString());
}
else
if(QRegExp(pattern2).exactMatch(dataString)) {
@ -1312,7 +1312,7 @@ QString & VMC::privateHandleDataCommand_AmountToPay(quint8 data, QString & dataS
// add currency symbol
dataString.append(" ");
dataString.append(this->config->getPaymentCurrencySymbol());
dataString.append(m_settings->value("currencySymbol", "").toString());
}
else
if(QRegExp(pattern3).exactMatch(dataString)) {
@ -1611,7 +1611,8 @@ void VMC::onSendError(SEND_ERROR error)
emit resetBusy();
break;
case SEND_ERROR::MULTIPLE_RESPONSE_TIMER_TIMEOUT:
if ( config->hasFeatureSelfOOO() ) {
// TODO: add feature to settings
if (m_settings->value("FeatureSelf000", "false").toBool()) {
// Handling on ERROR_RESPONSE_TIMER_TIMEOUT:
// -> compare to receive a screen command from vmc to set the ooo-screen:
}