Add files from 13.November 2023.

This commit is contained in:
Gerhard Hoffmann 2023-11-14 09:32:56 +01:00
commit 3648b3d129
64 changed files with 16325 additions and 0 deletions

85
APservice.pro Executable file
View File

@ -0,0 +1,85 @@
QT += core gui
QT +=widgets serialport
QT +=network
# for TCP-IP
TARGET = APservice
#LIBS = -L../plugins
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
QMAKE_CXXFLAGS += -Wno-deprecated-copy
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
globVars.cpp \
keypad.cpp \
lib_template.cpp \
main.cpp \
mainwindow.cpp \
tslib.cpp \
win01_com.cpp \
win02_home.cpp \
win03_time.cpp \
win04_stat.cpp \
win05_doors.cpp \
win06_prn.cpp \
win07_coin.cpp \
win08_mif.cpp \
win09_gsm.cpp \
win10_pay.cpp \
win11_abr.cpp \
win12_BL.cpp \
win13_json.cpp \
win14_mw.cpp \
win15_bna.cpp \
win16.cpp \
win17.cpp \
win18.cpp \
win19.cpp \
win20.cpp \
win_template.cpp \
datei.cpp
HEADERS += \
globVars.h \
guidefs.h \
keypad.h \
lib_template.h \
mainwindow.h \
stepList.h \
tslib.h \
versionHistory.txt \
win01_com.h \
win02_home.h \
win03_time.h \
win04_stat.h \
win05_doors.h \
win06_prn.h \
win07_coin.h \
win08_mif.h \
win09_gsm.h \
win10_pay.h \
win11_abr.h \
win12_BL.h \
win13_json.h \
win14_mw.h \
win15_bna.h \
win16.h \
win17.h \
win18.h \
win19.h \
win20.h \
win_template.h \
datei.h \
plugin.h \
interfaces.h
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

944
datei.cpp Executable file
View File

@ -0,0 +1,944 @@
// written by Thomas Sax, Jan.2022
#include "datei.h"
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create csv file -------------------------------
// -------------------------------------------------------------------------------------------------
QByteArray datei_writeArray, datei_tempArray;
void csv_startCreatingFile(void)
{
datei_writeArray.clear();
datei_tempArray.clear();
}
void csv_addTextToFile(QString myText)
{
datei_writeArray.append(myText.toLatin1());
datei_writeArray.append(FILESEPERATOR);
}
void csv_addIntToFile(int myValue)
{
//qulonglong ullt=12345678901234567890; // max 1,844 x10^19
datei_tempArray.setNum(myValue,10); // accepted types: short, ushort, int, uint,
// qlonglong, qulonglong, float, double
// numerbase can be 2...36(!),10=dec
datei_writeArray.append(datei_tempArray);
datei_writeArray.append(FILESEPERATOR);
}
void csv_addUintToFile(uint myValue)
{
datei_tempArray.setNum(myValue,10);
datei_writeArray.append(datei_tempArray);
datei_writeArray.append(FILESEPERATOR);
}
void csv_addLongvalToFile(qlonglong myValue)
{
datei_tempArray.setNum(myValue,10);
datei_writeArray.append(datei_tempArray);
datei_writeArray.append(FILESEPERATOR);
}
void csv_addUlongvalToFile(qulonglong myValue)
{
datei_tempArray.setNum(myValue,10);
datei_writeArray.append(datei_tempArray);
datei_writeArray.append(FILESEPERATOR);
}
/*
void csv_addCurrentTimeToFile(void)
{
uint8_t hour, minute, sec, ui8buf[20];
char buf[20];
config_getSysTime(&hour, &minute, &sec);
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
for (uint8_t nn=0; nn<20; nn++)
buf[nn]=char(ui8buf[nn]);
datei_writeArray.append(buf,8); // time string
datei_writeArray.append(FILESEPERATOR);
}
void csv_addCurrentDateToFile(void)
{
uint16_t year;
uint8_t month, day, ui8buf[20];
char buf[20];
config_getSystemDate(&year, &month, &day);
//qDebug()<<"date year: "<<year;
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
for (uint8_t nn=0; nn<20; nn++)
buf[nn]=char(ui8buf[nn]);
datei_writeArray.append(buf, 10); // date string
datei_writeArray.append(NEWLINEINFILE);
}
*/
void csv_addNewlineToFile(void)
{
datei_writeArray.chop(1); // Komma weg
datei_writeArray.append(NEWLINEINFILE);
}
QByteArray csv_readbackArray(void)
{
return datei_writeArray;
}
/*
QByteArray csv_writeContent_testValues(void)
{
QByteArray myBA, tmpBA;
uint8_t modCount=5, modAddr=23;
uint8_t hour, minute, sec, month, day, ui8buf[20];
uint16_t year, modType=45678;
char buf[20];
uint32_t modNrDIs=1234567890;
uint8_t modNrAIs=4, modNrCtr=2, modNrDOs=8;
int modNrAOs=-2;
myBA.clear();
tmpBA.clear();
myBA.append("scan time");
myBA.append(FILESEPERATOR);
datei_getSysTime(&hour, &minute, &sec);
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
for (uint8_t nn=0; nn<20; nn++)
buf[nn]=char(ui8buf[nn]);
myBA.append(buf,8); // time string
myBA.append(FILESEPERATOR);
datei_getSystemDate(&year, &month, &day);
//qDebug()<<"date year: "<<year;
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
for (uint8_t nn=0; nn<20; nn++)
buf[nn]=char(ui8buf[nn]);
myBA.append(buf, 10); // date string
myBA.append(NEWLINEINFILE);
myBA.append("number of modules");
myBA.append(FILESEPERATOR);
tmpBA.setNum(modCount,10); //2nd para = number base 2, 8, 10 or 16 (bin, oct, dec, hex)
myBA.append(tmpBA);
myBA.append(NEWLINEINFILE);
myBA.append("busaddr");
myBA.append(FILESEPERATOR);
myBA.append("type");
myBA.append(FILESEPERATOR);
myBA.append("NrOfDI");
myBA.append(FILESEPERATOR);
myBA.append("NrOfAI");
myBA.append(FILESEPERATOR);
myBA.append("NrOfCtrIn");
myBA.append(FILESEPERATOR);
myBA.append("NrOfDO");
myBA.append(FILESEPERATOR);
myBA.append("NrOfAO");
myBA.append(NEWLINEINFILE);
tmpBA.setNum(modAddr,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modType,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modNrDIs,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modNrAIs,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modNrCtr,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modNrDOs,10);
myBA.append(tmpBA);
myBA.append(FILESEPERATOR);
tmpBA.setNum(modNrAOs,10);
myBA.append(tmpBA);
myBA.append(NEWLINEINFILE);
return myBA;
}
*/
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse csv file -------------------------------
// -------------------------------------------------------------------------------------------------
// first: QByteArray datei_readFromFile(QString filename);
uint32_t csv_nrOfEntriesInFile(QByteArray readFromFile)
{
// count sequences between FILESEPERATOR and NEWLINEINFILE
uint32_t filSize=0, pp=0;
char oneByt=0;
int filLen=readFromFile.size();
if(filLen>1)
filSize=uint32_t(filLen);
else
return 0;
// 1) find position of seperators
for (uint32_t ii=0; ii<filSize; ii++)
{
oneByt=readFromFile[ii];
if (oneByt==FILESEP1 || oneByt==FILESEP2 || oneByt==NEWLINEINFILE)
pp++;
}
// now: pp = number of seperators
// oneByt = last byte in file. If it's not a seperator then
// there's one more entry (last entry without termination)
if (oneByt !=FILESEP1 && oneByt !=FILESEP2 && oneByt !=NEWLINEINFILE)
pp++;
//qDebug()<<"csv: nr of sequences="<< pp;
return pp;
}
QByteArray csv_getOneFileSequence(QByteArray sourceFile, uint32_t sequNr)
{
// seperate file content in single sequences between FILESEPERATOR and NEWLINEINFILE
// and return "entryNr" - entry
// for this first step leave data type QByteArray
// 2nd step can change in numbers and strings
QByteArray sequence;
uint32_t sepPos[MAXNUMBEROFSEQUENCES];
uint32_t filSize=0, pp=0, ii, start=0, ende=0;
char oneByt;
int filLen, mm;
filLen=sourceFile.size();
//qDebug()<<"fillen="<< filLen;
if(filLen<10)
return "";
filSize=uint32_t(filLen);
if (sequNr>MAXNUMBEROFSEQUENCES)
return "";
// 1) find position of seperators
for (ii=0; ii<filSize; ii++)
{
oneByt=sourceFile[ii];
if (oneByt==FILESEP1 || oneByt==FILESEP2 || oneByt==NEWLINEINFILE)
{
sepPos[pp++]=ii;
}
}
// now: pp = number of entries
//qDebug()<<"nr of seperators="<< pp;
if (sequNr>=pp)
return "";
// 2) get sequence
if (sequNr==0)
{
start=0;
ende=sepPos[sequNr];
} else
if (sequNr>0)
{
start=sepPos[sequNr-1]+1;
ende=sepPos[sequNr];
}
//qDebug()<<"datei getOneFileSequence start/ende: "<<start << " " << ende;
if (start>=ende)
return "";
//return "-err3-";
sequence.clear();
//batmp.clear();
pp=0;
for (ii=start; ii<ende; ii++)
{
mm=int(ii);
if (mm>=int(filSize))
mm=0;
oneByt=sourceFile.at(mm);
sequence.append(oneByt);
}
return sequence;
}
int csv_getEntryAsInt(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA, myVA;
int entry=0;
bool ok;
myVA.clear();
myBA = csv_getOneFileSequence(sourceFile, sequNr);
//qDebug()<<"datei getEntryAsInt, sequence: " << myBA;
entry=myBA.toInt(&ok,16);
if (ok)
{
//qDebug()<<"datei getEntryAsInt, number: " << entry;
return entry;
}
//qDebug()<<"datei getEntryAsInt, error " << myBA;
return 0;
}
int32_t csv_getEntryAsLong(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
long entry=0;
bool ok;
entry=myBA.toLong(&ok,10);
if (ok)
return entry;
return 0;
}
uint8_t csv_getEntryAsUshort(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
uint8_t entry=0;
bool ok;
entry=uint8_t(myBA.toUShort(&ok,10));
if (ok)
return entry;
return 0;
}
uint16_t csv_getEntryAsUint(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
uint16_t entry=0;
bool ok;
entry=uint16_t(myBA.toUInt(&ok,10));
if (ok)
return entry;
return 0;
}
uint32_t csv_getEntryAsUlong(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
uint32_t entry=0;
bool ok;
entry=myBA.toULong(&ok,10);
if (ok)
return entry;
return 0;
}
uint64_t csv_getEntryAs2Ulong(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
uint64_t entry=0;
bool ok;
entry=myBA.toULongLong(&ok,10);
if (ok)
return entry;
return 0;
}
QString csv_getEntryAsString(QByteArray sourceFile, uint32_t sequNr)
{
QByteArray myBA = csv_getOneFileSequence(sourceFile, sequNr);
QString entry;
//qDebug()<<"datei getEntryAsString, sequence: " << myBA;
entry=myBA.toStdString().c_str();
return entry;
}
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create Json file -------------------------------
// -------------------------------------------------------------------------------------------------
/*
example
QString str = "{"
" \"Herausgeber\": \"Xema\","
" \"Nummer\": \"1234-5678-9012-3456\","
" \"Deckung\": 2e+6,"
" \"Währung\": \"EURO\","
" \"Inhaber\": {"
" \"Name\": \"Mustermann\","
" \"Vorname\": \"Max\","
" \"männlich\": true,"
" \"Hobbys\": [ \"Reiten\", \"Golfen\", \"Lesen\" ],"
" \"Alter\": 42,"
" \"Kinder\": [],"
" \"Partner\": null"
" }"
"}";
*/
QString myJsonCon;
QString tmpStr;
void json_startRecord(void)
{
myJsonCon.clear();
tmpStr.clear();
myJsonCon.append('{');
}
void json_enterIntToRecord(QString attribute, ulong i_value)
{
tmpStr.clear();
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
tmpStr.setNum(i_value);
myJsonCon.append(tmpStr);
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
void json_enterTextToRecord(QString attribute, QString txt_value)
{
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
myJsonCon.append('"');
myJsonCon.append(txt_value);
myJsonCon.append('"');
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
/*
void json_addCurrentTimeToRecord(QString attribute)
{
uint8_t hour, minute, sec, ui8buf[20];
//char buf[20];
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
myJsonCon.append('"');
datei_getSysTime(&hour, &minute, &sec);
GetTimeString(hour, minute, sec, 0, 1, ui8buf);
for (uint8_t nn=0; nn<8; nn++)
myJsonCon.append(ui8buf[nn]);
myJsonCon.append('"');
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
void json_addCurrentDateToRecord(QString attribute)
{
uint16_t year;
uint8_t month, day, ui8buf[20];
//char buf[20];
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
myJsonCon.append('"');
datei_getSystemDate(&year, &month, &day);
GetDateString(day, month, 0x20, uint8_t(year%100), 0, 0, ui8buf);
for (uint8_t nn=0; nn<10; nn++)
myJsonCon.append(ui8buf[nn]);
myJsonCon.append('"');
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
*/
void json_enterArrayToRecord(QString attribute, uint8_t *buf, ulong nrofVals)
{
// add array of numbers with "nrofVals" elements
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
myJsonCon.append('['); // eckig!!!
for (ulong ul=0; ul<nrofVals; ul++)
{
tmpStr.setNum(buf[ul]);
myJsonCon.append(tmpStr);
myJsonCon.append(',');
}
myJsonCon.chop(1); // Komma weg
myJsonCon.append(']'); // eckig!!!
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
void json_enterStructToRecord(QString attribute)
{
// every call must be concluded with "json_finishFile()"
myJsonCon.append('"');
myJsonCon.append(attribute);
myJsonCon.append('"');
myJsonCon.append(':');
myJsonCon.append('{'); // geschweift!!
myJsonCon.append(NEWLINEINFILE);
}
void json_finishStruct(void)
{
myJsonCon.chop(2); // remove , and \r from the end
myJsonCon.append('}');
myJsonCon.append(',');
myJsonCon.append(NEWLINEINFILE);
}
void json_finishRecord(void)
{
myJsonCon.chop(2); // remove , and \r from the end
myJsonCon.append(NEWLINEINFILE);
myJsonCon.append('}');
myJsonCon.append(NEWLINEINFILE);
}
QString json_readbackRecordStr(void)
{
return myJsonCon;
}
QByteArray json_readbackRecordBa(void)
{
return myJsonCon.toLatin1();
}
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse Json file -------------------------------
// -------------------------------------------------------------------------------------------------
/*
example Json File:
{"temperature":28,
"snow":"no",
"Zeit":"16_21_45",
"sunny":"12h",
"humidity":75,
"wann ":"24.01.2022",
"unterstruktur":{
"day of week":"tuesday",
"year":22,
"month":1,
"day":24},
"fast am":"Ende",
"Puffer":[8,3,9,2,10]
}
*/
// first: QByteArray datei_readFromFile(QString filename);
int json_nrOfPairsInFile(QByteArray filename)
{
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
// key value pair consisting of key (unique string) and value (QJsonValue)
int nrOfPairs=jobj.size();
qDebug() << "my Json file has got: " << nrOfPairs<< "pairs";
return nrOfPairs;
}
bool json_exists(QByteArray filename, QString searchForKey)
{
// look for "searchForKey" =name of the pair (left of : )
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchForKey))
return true;
return false;
}
bool json_remove(QByteArray filename, QString searchFor)
{
// look for "searchFor" =name of the pair (left of : ) and remove the record from file
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchFor))
{
jobj.remove(searchFor);
return true;
}
return false;
}
QString json_searchForStringInFile(QByteArray filename, QString searchFor)
{
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchFor))
{
return jobj[searchFor].toString(); // toObject(); toArray();
} else
{
//qDebug() << "pairname not found in Json file";
return "";
}
}
int json_searchForIntInFile(QByteArray filename, QString searchFor)
{
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchFor))
{
return jobj[searchFor].toInt(); // toObject(); toArray();
} else
{
//qDebug() << "number not found in Json file";
return 0;
}
}
bool json_searchForObjectInFile(QByteArray filename, QString searchFor, QJsonObject *oneObject)
{
// return an object from the json file
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchFor))
{
*oneObject = jobj[searchFor].toObject();
return true;
} else
{
//qDebug() << "Object not found in Json file";
return false;
}
}
int json_nrOfPairsInObject(QJsonObject objname)
{
int nrOfPairs=objname.size();
qDebug() << "my Json Object has got: " << nrOfPairs<< "pairs";
return nrOfPairs;
}
QString json_searchForStringInObject(QJsonObject objname, QString searchFor)
{
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
if (objname.contains(searchFor))
{
return objname[searchFor].toString();
} else
{
//qDebug() << "string not found in Json object";
return "";
}
}
int json_searchForIntInObject(QJsonObject objname, QString searchFor)
{
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
if (objname.contains(searchFor))
{
return objname[searchFor].toInt();
} else
{
//qDebug() << "number not found in Json file";
return 0;
}
}
bool json_searchForArrayInFile(QByteArray filename, QString searchFor, QJsonArray *oneArray)
{
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
QJsonDocument jdoc = QJsonDocument::fromJson(filename);
QJsonObject jobj = jdoc.object();
if (jobj.contains(searchFor))
{
*oneArray = jobj[searchFor].toArray();
return true;
} else
{
//qDebug() << "Array not found in Json file";
return false;
}
}
int json_nrOfValuesInArray(QJsonArray arrayname)
{
int nrOfPairs=arrayname.size();
qDebug() << "my Json Array has got: " << nrOfPairs<< "values";
return nrOfPairs;
}
bool json_getValuesOfArray(QJsonArray arrayname, int *buf, int MaxBufferSize)
{
// assuming that the array consists of integers
/* copy to local buffer:
#define MAXNROFARRAYVALUES 100
int buf[MAXNROFARRAYVALUES], ii;
int nrOfPairs=arrayname.size();
if (nrOfPairs>MAXNROFARRAYVALUES)
nrOfPairs=MAXNROFARRAYVALUES;
for (ii=0; ii<nrOfPairs; ii++)
buf[ii]=arrayname[ii].toInt();
*/
// copy to host buffer:
bool ok=true;
int nrOfPairs=arrayname.size();
if (nrOfPairs>MaxBufferSize)
{
ok=false; // got not all
nrOfPairs=MaxBufferSize;
}
for (int ii=0; ii<nrOfPairs; ii++)
buf[ii]=arrayname[ii].toInt();
return ok;
}
/*
void datei_json_readTestFile(QString filename)
{
QByteArray my2Ba;
QString my2Str;
my2Str.clear();
my2Ba=datei_readFromFile(filename);
QJsonDocument jdoc = QJsonDocument::fromJson(my2Ba);
QJsonObject jobj = jdoc.object();
//QJsonParseError jerror;
QJsonObject myObj;
QJsonArray myArray;
// key value pair consisting of key (unique string) and value (QJsonValue)
int nrOfPairs=jobj.size();
qDebug() << "my Json file has got: " << nrOfPairs<< "pairs";
if (jobj.contains("Zeit"))
qDebug() << "my Json file: " << jobj["Zeit"].toString(); // toObject(); toArray();
else
qDebug() << "my Json file contains no Zeit";
if (jobj.contains("Humidity"))
qDebug() << "my Json file: " << jobj["humidity"].toInt();
else
qDebug() << "my Json file contains no Humidity";
if (jobj.contains("month"))
qDebug() << "my Json file: " << jobj["month"].toObject(); // anzeige QJsonObject()
else
qDebug() << "my Json file contains no month";
myObj=jobj["unterstruktur"].toObject();
qDebug() << "my unterstruktur: " << myObj["month"].toInt();
qDebug() << "my unterstruktur: " << myObj["day of week"].toString();
//if (jerror.error == QJsonParseError::NoError)
// qDebug() << "no error";
qDebug() << "my Month: " << myObj["Month"].toInt();
//if (myObj["Month"] == QJsonValue::Undefined)
// qDebug() << "no found"; geht nicht
//if (jerror.error != QJsonParseError::NoError)
// qDebug() << "no found";
myArray=jobj["Puffer"].toArray();
qDebug() << "my array " <<myArray[2].toInt();
//if (jerror.error != QJsonParseError::NoError)
// qDebug() << "no found";
if ( !jobj.contains("Puffer"))
qDebug() << "no Puffer found";
if ( !myArray.contains(20))
qDebug() << "no entry found";
} */
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ read, write, copy files -------------------
// -------------------------------------------------------------------------------------------------
void datei_closeFile(QString filename)
{
QFile file(filename);
file.close();
}
QByteArray datei_readFromFile(QString filename)
{
//QFile file("/own/H2B/dc2.hex");
//QFile file(FILENAME_STRUCTURE);
QFile file;
file.setFileName(filename);
QByteArray myBA;
myBA.clear();
if (!file.exists())
{
qDebug()<<"file not exists";
return myBA;
} else
{
if (!file.open(QIODevice::ReadOnly) )
{
qDebug()<<"cannot open";
} else
{
//qDebug()<<"loading file with " << file.size() <<"byte";
myBA = file.readAll();
//qDebug()<<"datei read: " << myBA;
file.close();
}
}
return myBA;
}
bool datei_ifFileExists(QString filename)
{
QFile file;
file.setFileName(filename);
if (file.exists())
return true;
return false;
}
char datei_writeToFile(QString filename, QByteArray content)
{
// retval=0 if successful 1: no write access allowed 2:cannot open to append 3:cannot create new file
QFile file(filename);
QFileInfo myFI(filename);
//if (!myFI.isWritable()) //geht nur bei NTFS, weg.
//{
//file.setPermissions(filename, QFile::WriteOther); geht nicht :(
// qDebug()<<"datei_writeToFile: writing not allowed. set attributes first!";
// return 1;
//}
if (file.exists())
{
if (!file.open(QIODevice::Append))
{
qDebug()<<"datei_writeToFile cannot open to append";
return 2;
} else
{
// add new object to the end of the file
file.write(content);
file.close();
return 0; // OK
}
} else
{
if (!file.open(QIODevice::WriteOnly))
{
qDebug()<<"datei_writeToFile cannot open new";
return 3;
} else
{
qDebug()<<"create new file";
// write first lines into file
file.write(content);
file.close();
return 0; // OK
}
}
return 0;
}
bool datei_copyFile(QString currentFileName, QString newFileName)
{
// retval=true if successful
QFile file;
file.setFileName(currentFileName);
return file.copy(newFileName);
}
bool datei_clearFile(QString filename)
{
// retval=true if successful
QFile file;
file.setFileName(filename);
file.remove(); // 3.2.22 erst ganz löschen wegen Schreibrechten
if (!file.open(QIODevice::WriteOnly))
{
qDebug()<<"datei_clearFile cannot open file to delete";
return false;
} else
{
file.write(0);
file.close();
return true;
}
}

209
datei.h Executable file
View File

@ -0,0 +1,209 @@
#ifndef DATEI_H
#define DATEI_H
#include <stdint.h>
#include <QFile>
#include <QFileInfo>
#include <QDebug>
#include "tslib.h"
#include <QString>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonParseError>
// create csv file with:
#define FILESEPERATOR ','
// pasre csv with:
#define FILESEP1 ','
#define FILESEP2 ';'
#define NEWLINEINFILE '\n'
#define MAXNUMBEROFSEQUENCES 200
// only for csv files
// all seting-files located in sudirectory "static machine data - smd"
// all generated files located in sudirectory "dynamic machine data - dmd"
#define FILENAME_COMPORT "../comport.csv"
#define FILENAME_CONFIG "/own/work2023/PSA1256ptu5/smd/DC2C_conf.json"
#define FILENAME_DEVICE "/own/work2023/PSA1256ptu5/smd/DC2C_device.json"
#define FILENAME_CASH "/own/work2023/PSA1256ptu5/smd/DC2C_cash.json"
#define FILENAME_PRINT "/own/work2023/PSA1256ptu5/smd/DC2C_print32.json"
#define FILENAME_APSERVCONF "../APserviceConfig.csv"
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create csv file -------------------------------
// -------------------------------------------------------------------------------------------------
// create array with strings and values (to be written to file)
void csv_startCreatingFile(void);
void csv_addTextToFile(QString myText);
void csv_addIntToFile(int myValue);
void csv_addUintToFile(uint myValue);
void csv_addLongvalToFile(qlonglong myValue);
void csv_addUlongvalToFile(qulonglong myValue);
//void csv_addCurrentTimeToFile(void);
//void csv_addCurrentDateToFile(void);
void csv_addNewlineToFile(void);
QByteArray csv_readbackArray(void);
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse csv file -------------------------------
// -------------------------------------------------------------------------------------------------
// return number of entries in the just read file (entries are seperated by
// comma or line-feed)
uint32_t csv_nrOfEntriesInFile(QByteArray readFromFile);
// before: QByteArray sourceFile=datei_readFromFile(filename);
QByteArray csv_getOneFileSequence(QByteArray sourceFile, uint32_t sequNr);
// not needed, just for test // sequNr: 0....(size-1)
// get single entries of of the just read fie:
int csv_getEntryAsInt(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
int32_t csv_getEntryAsLong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint8_t csv_getEntryAsUshort(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint16_t csv_getEntryAsUint(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint32_t csv_getEntryAsUlong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
uint64_t csv_getEntryAs2Ulong(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
QString csv_getEntryAsString(QByteArray sourceFile, uint32_t sequNr);
// sequNr: 0....(size-1)
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ create Json Record -------------------------------
// -------------------------------------------------------------------------------------------------
void json_startRecord(void);
// clear buffer and write opening curly bracket {
void json_enterIntToRecord(QString attribute, ulong i_value);
// example: "parameter":1234567890
void json_enterTextToRecord(QString attribute, QString txt_value);
// example: "parameter":"slow"
//void json_addCurrentTimeToRecord(QString attribute);
// example: if attribute=myTime: "myTime":"hh_mm_ss"
//void json_addCurrentDateToRecord(QString attribute);
// example: if attribute=myDate: "myDate":"dd.mm.yyyy"
// also / possible as seperator
// further possible forms:
// format= 0: dd.mm.yyyy (deutsch)
// 1: mm.dd.yyyy (amerika)
// 2: yyyy.mm.dd (Iran, Dubai)
// 3: dd.yyyy.mm
// 4: mm.yyyy.dd
// 5: yyyy.dd.mm
void json_enterArrayToRecord(QString attribute, uint8_t *buf, ulong nrofVals);
// add array of numbers with "nrofVals" elements
void json_enterStructToRecord(QString attribute);
// every call must be concluded with an extra "json_finishFile()"
// example: "sname":{
void json_finishStruct(void);
void json_finishRecord(void);
// close curly bracket
QString json_readbackRecordStr(void);
QByteArray json_readbackRecordBa(void);
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ parse Json file -------------------------------
// -------------------------------------------------------------------------------------------------
// first: QByteArray datei_readFromFile(QString filename);
//void datei_json_readTestFile(QString filename);
int json_nrOfPairsInFile(QByteArray filename);
bool json_exists(QByteArray filename, QString searchForKey);
// look for "searchForKey" =name of the pair (left of : )
// retval true if exists
bool json_remove(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and remove the record from file
// retval true if removed
QString json_searchForStringInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_searchForIntInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
//.......................
QJsonObject json_searchForObjectInFile(QByteArray filename, QString searchFor);
// return an object from the json file
int json_nrOfPairsInObject(QJsonObject objname);
QString json_searchForStringInObject(QJsonObject objname, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_searchForIntInObject(QJsonObject objname, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
//.......................
QJsonArray json_searchForArrayInFile(QByteArray filename, QString searchFor);
// look for "searchFor" =name of the pair (left of : ) and return value of this pair (right of : ) as String
int json_nrOfValuesInArray(QJsonArray arrayname);
bool json_getValuesOfArray(QJsonArray arrayname, int *buf, int MaxBufferSize);
// assuming that the array consists of integers
// -------------------------------------------------------------------------------------------------
// ------------------------------------------------------ read, write, copy files -------------------
// -------------------------------------------------------------------------------------------------
void datei_closeFile(QString filename);
// read content of an exiting file:
QByteArray datei_readFromFile(QString filename);
bool datei_ifFileExists(QString filename);
char datei_writeToFile(QString filename, QByteArray content);
// retval=0 if successful 1: no write access allowed
// 2:cannot open to append 3:cannot create new file
bool datei_copyFile(QString currentFileName, QString newFileName);
// retval=true if successful
bool datei_clearFile(QString filename);
// retval=true if successful
#endif // DATEI_H

25
globVars.cpp Executable file
View File

@ -0,0 +1,25 @@
#include "globVars.h"
static int CoinCheckerType;
void globVar_SetCoinChecker(int checkerTyp)
{
CoinCheckerType=checkerTyp;
}
int globVar_GetCoinChecker(void)
{
return CoinCheckerType;
}
static int billReaderType;
void globVar_SetBna(int bnaTyp)
{
billReaderType=bnaTyp;
}
int globVar_GetBna(void)
{
return billReaderType;
}

11
globVars.h Executable file
View File

@ -0,0 +1,11 @@
#ifndef GLOBVARS_H
#define GLOBVARS_H
void globVar_SetCoinChecker(int checkerTyp);
int globVar_GetCoinChecker(void);
void globVar_SetBna(int bnaTyp);
int globVar_GetBna(void);
#endif

24
guidefs.h Executable file
View File

@ -0,0 +1,24 @@
#ifndef GUIDEFS_H
#define GUIDEFS_H
#define PIXELSIZE_BUTTONS 18
#define PIXELSIZE_LABEL 18
#define PIXELSIZE_DATA 16
#define PIXELSIZE_BIGFONT 22
#define PIXELSIZE_SMALLFONT 14
#define BUTTONCOLOR "background-color: rgb(150,250,150)"
#define COLORGREEN "background-color: rgb(160,250,190)"
#define COLOR_RED "background-color: rgb(150,0,0)"
#define COLOR_LIGHTRED "background-color: rgb(250,150,150)"
//#define COLORGREY "background-color: rgb(160,250,190)"
#define COLORGREY "background-color: grey"
#define COLORYELLOW "background-color: yellow"
#define COLORWHITE "background-color: white"
// "background-color: lightgrey"
#endif

1700
interfaces.h Executable file

File diff suppressed because it is too large Load Diff

345
keypad.cpp Executable file
View File

@ -0,0 +1,345 @@
#include "keypad.h"
#define numPadKeyWidth 40
static bool keypad_NumberIsVisible;
static bool keypad_visiKeyAllowed;
T_keypad::T_keypad(QWidget *parent) : QWidget(parent)
{
QFont myTabFont;
myTabFont.setPixelSize(20);
myMainLay = new QVBoxLayout;
mySubLayout = new QGridLayout;
valueDisplay = new QLabel();
valueDisplay->setStyleSheet("background-color: white");
valueDisplay->setLineWidth(5);
valueDisplay->setFont(myTabFont);
myMainLay->addWidget(valueDisplay);
myMainLay->addLayout(mySubLayout);
// number Pad Popup for Value entry:
numPad = new QGroupBox(" ");
numPad->setStyleSheet("background-color: grey");
numPad->setLayout(myMainLay);
QPushButton *key1 = new QPushButton("1");
mySubLayout->addWidget(key1,0,0);
key1->setMaximumWidth(numPadKeyWidth);
key1->setFont(myTabFont);
connect(key1, SIGNAL(clicked()), this, SLOT(key1Clicked()));
QPushButton *key2 = new QPushButton("2");
mySubLayout->addWidget(key2,0,1);
key2->setMaximumWidth(numPadKeyWidth);
key2->setFont(myTabFont);
connect(key2, SIGNAL(clicked()), this, SLOT(key2Clicked()));
QPushButton *key3 = new QPushButton("3");
mySubLayout->addWidget(key3,0,2);
key3->setMaximumWidth(numPadKeyWidth);
key3->setFont(myTabFont);
connect(key3, SIGNAL(clicked()), this, SLOT(key3Clicked()));
QPushButton *key4 = new QPushButton("4");
mySubLayout->addWidget(key4,1,0);
key4->setMaximumWidth(numPadKeyWidth);
key4->setFont(myTabFont);
connect(key4, SIGNAL(clicked()), this, SLOT(key4Clicked()));
QPushButton *key5 = new QPushButton("5");
mySubLayout->addWidget(key5,1,1);
key5->setMaximumWidth(numPadKeyWidth);
key5->setFont(myTabFont);
connect(key5, SIGNAL(clicked()), this, SLOT(key5Clicked()));
QPushButton *key6 = new QPushButton("6");
mySubLayout->addWidget(key6,1,2);
key6->setMaximumWidth(numPadKeyWidth);
key6->setFont(myTabFont);
connect(key6, SIGNAL(clicked()), this, SLOT(key6Clicked()));
QPushButton *key7 = new QPushButton("7");
mySubLayout->addWidget(key7,2,0);
key7->setMaximumWidth(numPadKeyWidth);
key7->setFont(myTabFont);
connect(key7, SIGNAL(clicked()), this, SLOT(key7Clicked()));
QPushButton *key8 = new QPushButton("8");
mySubLayout->addWidget(key8,2,1);
key8->setMaximumWidth(numPadKeyWidth);
key8->setFont(myTabFont);
connect(key8, SIGNAL(clicked()), this, SLOT(key8Clicked()));
QPushButton *key9 = new QPushButton("9");
mySubLayout->addWidget(key9,2,2);
key9->setMaximumWidth(numPadKeyWidth);
key9->setFont(myTabFont);
connect(key9, SIGNAL(clicked()), this, SLOT(key9Clicked()));
QPushButton *keyAc = new QPushButton("AC");
mySubLayout->addWidget(keyAc,3,0);
keyAc->setMaximumWidth(numPadKeyWidth);
keyAc->setFont(myTabFont);
connect(keyAc, SIGNAL(clicked()), this, SLOT(keyAcClicked()));
QPushButton *key0 = new QPushButton("0");
mySubLayout->addWidget(key0,3,1);
key0->setMaximumWidth(numPadKeyWidth);
key0->setFont(myTabFont);
connect(key0, SIGNAL(clicked()), this, SLOT(key0Clicked()));
QPushButton *keyBs = new QPushButton("<<");
mySubLayout->addWidget(keyBs,3,2);
keyBs->setMaximumWidth(numPadKeyWidth);
keyBs->setFont(myTabFont);
connect(keyBs, SIGNAL(clicked()), this, SLOT(keyBsClicked()));
QPushButton *keyC = new QPushButton("Esc");
mySubLayout->addWidget(keyC,4,0);
keyC->setMaximumWidth(numPadKeyWidth);
keyC->setFont(myTabFont);
connect(keyC, SIGNAL(clicked()), this, SLOT(keyCancelClicked()));
QPushButton *keySee = new QPushButton("see");
mySubLayout->addWidget(keySee,4,1);
keySee->setMaximumWidth(numPadKeyWidth);
keySee->setFont(myTabFont);
connect(keySee, SIGNAL(clicked()), this, SLOT(keySeeEntryClicked()));
QPushButton *keyOK = new QPushButton("OK");
mySubLayout->addWidget(keyOK,4,2);
keyOK->setMaximumWidth(numPadKeyWidth);
keyOK->setFont(myTabFont);
connect(keyOK, SIGNAL(clicked()), this, SLOT(keyOkClicked()));
numPad->hide();
myValueString.clear();
valueDisplay->clear();
myReturnString.clear();
keypad_visiKeyAllowed=true;
keypad_NumberIsVisible=true;
}
T_keypad::~T_keypad()
{
}
void T_keypad::show(void)
{
numPad->show();
numPad->setFocus();
numPad->setEnabled(true);
numPad->raise();
myValueString.clear();
valueDisplay->clear();
myReturnString.clear();
}
void T_keypad::hide(void)
{
numPad->hide();
}
void T_keypad::keysVisible(uint8_t visib)
{
// visib=0: show * 1:show numbers 2: show * but allow visi-key
if (visib==0)
{
keypad_NumberIsVisible=false;
keypad_visiKeyAllowed=false;
} else
if (visib==1)
{
keypad_NumberIsVisible=true;
keypad_visiKeyAllowed=false;
} else
if (visib==2)
{
keypad_NumberIsVisible=false;
keypad_visiKeyAllowed=true;
}
}
QString T_keypad::getValueString(void)
{
return myReturnString;
}
int32_t T_keypad::getValueDecimal(void)
{
return myReturnString.toULong();
}
void T_keypad::key0Clicked(void)
{
myReturnString.append("0");
if (keypad_NumberIsVisible)
{
myValueString.append("0");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key1Clicked(void)
{
myReturnString.append("1");
if (keypad_NumberIsVisible)
{
myValueString.append("1");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key2Clicked(void)
{
myReturnString.append("2");
if (keypad_NumberIsVisible)
{
myValueString.append("2");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key3Clicked(void)
{
myReturnString.append("3");
if (keypad_NumberIsVisible)
{
myValueString.append("3");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key4Clicked(void)
{
myReturnString.append("4");
if (keypad_NumberIsVisible)
{
myValueString.append("4");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key5Clicked(void)
{
myReturnString.append("5");
if (keypad_NumberIsVisible)
{
myValueString.append("5");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key6Clicked(void)
{
myReturnString.append("6");
if (keypad_NumberIsVisible)
{
myValueString.append("6");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key7Clicked(void)
{
myReturnString.append("7");
if (keypad_NumberIsVisible)
{
myValueString.append("7");
} else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key8Clicked(void)
{
myReturnString.append("8");
if (keypad_NumberIsVisible)
myValueString.append("8");
else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::key9Clicked(void)
{
myReturnString.append("9");
if (keypad_NumberIsVisible)
myValueString.append("9");
else
myValueString.append("*");
valueDisplay->setText(myValueString);
}
void T_keypad::keyOkClicked(void)
{
numPad->hide();
emit keyEntryFinished();
}
void T_keypad::keyCancelClicked(void)
{
myValueString.clear();
myReturnString.clear();
valueDisplay->clear();
numPad->hide();
emit keyEntryFinished();
}
void T_keypad::keySeeEntryClicked(void)
{
if (keypad_visiKeyAllowed)
{
if (keypad_NumberIsVisible)
{
// dont want to see the entry, so overwrite number(s) with asteriks
int len=myValueString.length();
myValueString.clear();
for (int nn=0; nn<len; nn++)
myValueString.append('*');
keypad_NumberIsVisible=false;
} else
{
// wanna see entry from now
// by now we have only *'s in myValueString
// numbers are saved in "myReturnString"
myValueString=myReturnString;
keypad_NumberIsVisible=true;
}
}
valueDisplay->setText(myValueString);
}
void T_keypad::keyAcClicked(void)
{
myValueString.clear();
myReturnString.clear();
valueDisplay->clear();
}
void T_keypad::keyBsClicked(void)
{
myValueString.chop(1);
myReturnString.chop(1);
valueDisplay->setText(myValueString);
}

71
keypad.h Executable file
View File

@ -0,0 +1,71 @@
#ifndef KEYPAD_USED
#define KEYPAD_USED
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QWidget>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include <QGroupBox>
#include <QPushButton>
#include <QGridLayout>
#include <QLineEdit>
#include <QLabel>
#include <QVBoxLayout>
#include <QGridLayout>
class T_keypad : public QWidget
{
Q_OBJECT
QGroupBox *numPad;
QLabel *valueDisplay;
QString myValueString; // used to display the entry in upper line
QString myReturnString; // used to return the value
QVBoxLayout *myMainLay;
QGridLayout *mySubLayout;
public:
explicit T_keypad(QWidget *parent = nullptr);
~T_keypad();
void show(void);
void hide();
void keysVisible(uint8_t visib);
// visib=0: show * 1:show numbers 2: show * but allow visi-key
QString getValueString(void);
int32_t getValueDecimal(void);
private slots:
void key0Clicked(void);
void key1Clicked(void);
void key2Clicked(void);
void key3Clicked(void);
void key4Clicked(void);
void key5Clicked(void);
void key6Clicked(void);
void key7Clicked(void);
void key8Clicked(void);
void key9Clicked(void);
void keyAcClicked(void);
void keyBsClicked(void);
void keyOkClicked(void);
void keyCancelClicked(void);
void keySeeEntryClicked(void);
signals:
void keyEntryFinished(void);
};
#endif

25
lib_template.cpp Executable file
View File

@ -0,0 +1,25 @@
#include "lib_template.h"
T_lib_template::T_lib_template(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
}
T_lib_template::~T_lib_template()
{
}
bool T_lib_template::working(void)
{
// is called cyclic
return false;
}

28
lib_template.h Executable file
View File

@ -0,0 +1,28 @@
#ifndef LIB_TEMPLATE_H
#define LIB_TEMPLATE_H
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QWidget>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
class T_lib_template : public QWidget
{
Q_OBJECT
hwinf *HWaccess;
public:
explicit T_lib_template(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool working (void);
~T_lib_template();
};
#endif

41
main.cpp Executable file
View File

@ -0,0 +1,41 @@
#include "mainwindow.h"
//#include "message_handler.h"
#include <QApplication>
int thisisglobal;
int main(int argc, char *argv[])
{
int ret;
QApplication myapp(argc, argv);
/*
if (!messageHandlerInstalled()) { // change internal qt-QDebug-handling
atbInstallMessageHandler(atbDebugOutput);
setDebugLevel(QtMsgType::QtDebugMsg);
//setDebugLevel(QtMsgType::QtDebugMsg);
}
*/
MainWindow myMainWin;
QSize myMainSize={800, 480}; // breite, höhe, PTU: 800x440
myMainWin.setMinimumSize(myMainSize);
myMainWin.setMaximumSize(myMainSize);
myMainWin.setWindowTitle("PSA Service Tool V4.1");
myMainWin.show();
//myMainWin.showFullScreen();
ret=myapp.exec();
return ret;
}
//QApplication a(argc, argv);
//MainWindow CatMW;
//QSize myMainSize={800, 480}; // breite, höhe
//CatMW.setMinimumSize(myMainSize);
//CatMW.setMaximumSize(myMainSize);
//CatMW.setWindowTitle("ATB CashAgent V2.0");
// QPalette mainPal;
// mainPal.setColor(QPalette::Window, Qt::red );
// CatMW.setPalette(mainPal); sieht man nicht mehr

1259
mainwindow.cpp Executable file

File diff suppressed because it is too large Load Diff

160
mainwindow.h Executable file
View File

@ -0,0 +1,160 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QGroupBox>
#include <QStyle>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLabel>
#include <QDebug>
#include <QPushButton>
#include <QDialog>
#include <QWidget>
#include <QApplication>
#include <QObject>
#include <QDateTime>
#include <QDate>
#include <QTime>
#include <QPluginLoader>
#include <QDir>
#include "plugin.h"
//#include "stepList.h" // define all working chain steps here
#include "win01_com.h"
#include "win02_home.h"
#include "win03_time.h"
#include "win04_stat.h"
#include "win05_doors.h"
#include "win06_prn.h"
#include "win07_coin.h"
#include "win08_mif.h"
#include "win09_gsm.h"
#include "win10_pay.h"
#include "win11_abr.h"
#include "win12_BL.h"
#include "win13_json.h"
#include "win14_mw.h"
#include "win15_bna.h"
#include "win16.h"
#include "win17.h"
#include "win18.h"
#include "win19.h"
#include "win20.h"
//#include "win21.h"
//#include "win22.h"
//#include "win23.h"
//#include "lib_mifare.h"
//#include "lib_diary.h"
//#include "lib_config.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
QPushButton *pBback;
QPushButton *pBhome;
QPushButton *pBforward;
QGroupBox *bigGroupbox;
// QVBoxLayout *bigLayout;
QHBoxLayout *bigLayout;
QTimer *timerChainCtrl;
QTimer *timerVendingTimeout;
QGroupBox *frame01;
QGroupBox *frame02;
QGroupBox *frame03;
QGroupBox *frame04;
QGroupBox *frame05;
QGroupBox *frame06;
QGroupBox *frame07;
QGroupBox *frame08;
QGroupBox *frame09;
QGroupBox *frame10;
QGroupBox *frame11;
QGroupBox *frame12;
QGroupBox *frame13;
QGroupBox *frame14;
QGroupBox *frame15;
QGroupBox *frame16;
QGroupBox *frame17;
QGroupBox *frame18;
QGroupBox *frame19;
QGroupBox *frame20;
QGroupBox *frame21;
QGroupBox *frame22;
QGroupBox *frame23;
QGroupBox *frame24;
QGroupBox *frame25;
QGroupBox *frame26;
QGroupBox *frame27;
QGroupBox *frame28;
QGroupBox *frame29;
QGroupBox *frame30;
//T_winComPort *myFenster01;
T_win02 *myFenster02;
T_win03 *myFenster03;
T_win04 *myFenster04;
T_win05 *myFenster05;
T_win06 *myFenster06;
T_win07 *myFenster07;
T_win08 *myFenster08;
T_win09 *myFenster09;
T_win10 *myFenster10;
T_win11 *myFenster11;
T_win12 *myFenster12;
T_win13 *myFenster13;
T_win14 *myFenster14;
T_win15 *myFenster15;
T_win16 *myFenster16;
T_win17 *myFenster17;
T_win18 *myFenster18;
T_win19 *myFenster19;
T_win20 *myFenster20;
/*
T_win21 *myFenster21;
T_win22 *myFenster22;
T_win23 *myFenster23;
*/
void HideAllWindows();
void switchScreen(uint16_t winNr);
char loadPlugIn(char lade1_entlade2);
QDir plugInDir;
void chainIni(void);
//T_Mifare *mifCard;
//T_lib_diary *diary;
//T_lib_config *conf;
public:
hwinf *HWaccess=nullptr; // global pointer to plugin-class
MainWindow(QWidget *parent = nullptr);
~MainWindow();
#define BACKBUTTON 1
#define HOMEBUTTON 2
#define FORWBUTTON 3
void enableNaviButtons(uint8_t buttonNr, bool enabled);
void enableNaviButtons(uint8_t switchBitwise);
private slots:
void chainControl();
void vendingTimeout();
};
#endif // MAINWINDOW_H

5
plugin.h Executable file
View File

@ -0,0 +1,5 @@
#ifndef PLUGIN_H
#define PLUGIN_H
#include "interfaces.h"
#endif

211
stepList.h Executable file
View File

@ -0,0 +1,211 @@
#ifndef STEPLIST_H
#define STEPLIST_H
// define all working chain steps
// every FSM-Step get's a frame in MainWindow with the same number and a self-designed GUI
// labels are used for switchScreen( label=nr );
// numbers are important: e.g. number 3 calls frame3 and frame3 includes subClass "T_fenster03"
// so best solution: label = same name like class (in example: Fenster03). Label is fixed bound to number, never change!
// numbers are fixed assosiated with the function (e.g. ComPort), can't be changed.
// but screen order can be called in step chain randomly
// Windownumbers for certain function, never change
#define PAGE_COMPORT 1
#define PAGE_SERVICEMAIN 2
#define PAGE_TIMEDATEVERSION 3
#define PAGE_MACHINESTATUS 4
#define PAGE_CHECKDOORS 5
#define PAGE_PRINTER 6
#define PAGE_COINMECHANIC 7
#define PAGE_MIFARE 8
#define PAGE_MODEM 9
#define PAGE_COINPAYMENT 10
#define PAGE_VAULTRECORD 11
#define PAGE_BOOTLOADER 12
#define PAGE_PROG_JSON 13
#define PAGE_COINCHANGER 14
#define PAGE_BILLREADER 15
#define PAGE_NEXT16 16
#define PAGE_NEXT17 17
#define PAGE_NEXT18 18
#define PAGE_NEXT19 19
#define PAGE_NEXT20 20
// fix: customize:
//#define WCS_STARTSCREEN PAGE_COMPORT // if APservice uses masterLib
#define WCS_STARTSCREEN PAGE_SERVICEMAIN // if APservice uses slaveLib
// PAGE_COMPORT:
#define WCS_WIN01BAK PAGE_COMPORT
#define WCS_WIN01MID PAGE_SERVICEMAIN
#define WCS_WIN01FWD PAGE_SERVICEMAIN
// PAGE_SERVICEMAIN:
#define WCS_WIN02BAK PAGE_COMPORT
#define WCS_WIN02MID PAGE_SERVICEMAIN
#define WCS_WIN02FWD PAGE_TIMEDATEVERSION
// PAGE_TIMEDATEVERSION:
#define WCS_WIN03BAK PAGE_SERVICEMAIN
#define WCS_WIN03MID PAGE_SERVICEMAIN
#define WCS_WIN03FWD PAGE_MACHINESTATUS
// PAGE_MACHINESTATUS:
#define WCS_WIN04BAK PAGE_TIMEDATEVERSION
#define WCS_WIN04MID PAGE_SERVICEMAIN
#define WCS_WIN04FWD PAGE_CHECKDOORS
// PAGE_CHECKDOORS:
#define WCS_WIN05BAK PAGE_MACHINESTATUS
#define WCS_WIN05MID PAGE_SERVICEMAIN
#define WCS_WIN05FWD PAGE_COINMECHANIC
// PAGE_COINMECHANIC:
#define WCS_WIN07BAK PAGE_CHECKDOORS
#define WCS_WIN07MID PAGE_SERVICEMAIN
#define WCS_WIN07FWD PAGE_COINPAYMENT
// PAGE_COINPAYMENT:
#define WCS_WIN10BAK PAGE_COINMECHANIC
#define WCS_WIN10MID PAGE_SERVICEMAIN
#define WCS_WIN10FWD PAGE_COINCHANGER
// PAGE_COINCHANGER:
#define WCS_WIN14BAK PAGE_COINPAYMENT
#define WCS_WIN14MID PAGE_SERVICEMAIN
#define WCS_WIN14FWD PAGE_BILLREADER
// PAGE_BILLREADER:
#define WCS_WIN15BAK PAGE_COINCHANGER
#define WCS_WIN15MID PAGE_SERVICEMAIN
#define WCS_WIN15FWD PAGE_PRINTER
// PAGE_PRINTER:
#define WCS_WIN06BAK PAGE_BILLREADER
#define WCS_WIN06MID PAGE_SERVICEMAIN
#define WCS_WIN06FWD PAGE_MIFARE
// PAGE_MIFARE:
#define WCS_WIN08BAK PAGE_PRINTER
#define WCS_WIN08MID PAGE_SERVICEMAIN
#define WCS_WIN08FWD PAGE_MODEM
// PAGE_MODEM:
#define WCS_WIN09BAK PAGE_MIFARE
#define WCS_WIN09MID PAGE_SERVICEMAIN
#define WCS_WIN09FWD PAGE_VAULTRECORD
// PAGE_VAULTRECORD:
#define WCS_WIN11BAK PAGE_MODEM
#define WCS_WIN11MID PAGE_SERVICEMAIN
#define WCS_WIN11FWD PAGE_PROG_JSON
// PAGE_PROG_JSON:
#define WCS_WIN13BAK PAGE_VAULTRECORD
#define WCS_WIN13MID PAGE_SERVICEMAIN
#define WCS_WIN13FWD PAGE_BOOTLOADER
// PAGE_BOOTLOADER:
#define WCS_WIN12BAK PAGE_PROG_JSON
#define WCS_WIN12MID PAGE_SERVICEMAIN
#define WCS_WIN12FWD PAGE_NEXT16
// PAGE_NEXT16
#define WCS_WIN16BAK PAGE_BOOTLOADER
#define WCS_WIN16MID PAGE_SERVICEMAIN
#define WCS_WIN16FWD PAGE_NEXT17
// PAGE_NEXT17
#define WCS_WIN17BAK PAGE_NEXT16
#define WCS_WIN17MID PAGE_SERVICEMAIN
#define WCS_WIN17FWD PAGE_NEXT18
// PAGE_NEXT18
#define WCS_WIN18BAK PAGE_NEXT17
#define WCS_WIN18MID PAGE_SERVICEMAIN
#define WCS_WIN18FWD PAGE_NEXT19
// PAGE_NEXT19
#define WCS_WIN19BAK PAGE_NEXT18
#define WCS_WIN19MID PAGE_SERVICEMAIN
#define WCS_WIN19FWD PAGE_NEXT20
// PAGE_NEXT20
#define WCS_WIN20BAK PAGE_NEXT19
#define WCS_WIN20MID PAGE_SERVICEMAIN
#define WCS_WIN20FWD PAGE_SERVICEMAIN
// just for Template
#define WCS_WIN99BAK PAGE_SERVICEMAIN
#define WCS_WIN99MID PAGE_SERVICEMAIN
#define WCS_WIN99FWD PAGE_SERVICEMAIN
#define WIN02_LABEL_SHORT01 " Status"
#define WCS_WIN02SHORT01 PAGE_MACHINESTATUS
#define WIN02_LABEL_SHORT02 " Doors "
#define WCS_WIN02SHORT02 PAGE_CHECKDOORS
#define WIN02_LABEL_SHORT03 "Coin mech"
#define WCS_WIN02SHORT03 PAGE_COINMECHANIC
#define WIN02_LABEL_SHORT04 "Payment"
#define WCS_WIN02SHORT04 PAGE_COINPAYMENT
#define WIN02_LABEL_SHORT05 "Changer"
#define WCS_WIN02SHORT05 PAGE_COINCHANGER
#define WIN02_LABEL_SHORT06 " Bill "
#define WCS_WIN02SHORT06 PAGE_BILLREADER
#define WIN02_LABEL_SHORT07 "Printer"
#define WCS_WIN02SHORT07 PAGE_PRINTER
#define WIN02_LABEL_SHORT08 "Accounting"
#define WCS_WIN02SHORT08 PAGE_VAULTRECORD
#define WIN02_LABEL_SHORT09 "Program"
#define WCS_WIN02SHORT09 PAGE_PROG_JSON
#define WIN02_LABEL_SHORT10 " "
#define WCS_WIN02SHORT10 PAGE_SERVICEMAIN
// set needed navigation buttons, use | to combine more then one:
#define SWITCH_NEXT_ON 1
#define SWITCH_NEXT_OFF 2
#define SWITCH_HOME_ON 4
#define SWITCH_HOME_OFF 8
#define SWITCH_BACK_ON 16
#define SWITCH_BACK_OFF 32
// example: *useNavi=SWITCH_BACK_ON; // change only this one, or set all:
// *useNavi=SWITCH_BACK_OFF | SWITCH_HOME_OFF | SWITCH_NEXT_ON;
// some defines for Widget design:
#define TS_VALUEBOX_FRAMESTYLE 0x0032
#define TS_VALUEBOX_LINEWIDTH 3
//genDatPort->setFrameStyle(QFrame::Panel | QFrame::Sunken ); funktioniert aber gibt unverständliche Warnung
// QFrame::Panel = 0x0002 QFrame::Sunken=0x0030
//genDatPort->setFrameStyle(0x0032); // funktioniert und gibt keine Warnung
//genDatPort->setFrameStyle(TS_VALUEBOX_FRAMESTYLE); // funktioniert und gibt keine Warnung
#define TS_LED_FRAMESTYLE 0x0031
// QFrame::Box | QFrame::Sunken
#endif // STEPLIST_H

267
subwindows.cpp Executable file
View File

@ -0,0 +1,267 @@
#include "subwindows.h"
/*
// %%%%%%%%%%%%%%%%%%%% TabChanger
T_fenster12::T_fenster12(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Coin Changer");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster12::updateGui(void)
{
}
// %%%%%%%%%%%%%%%%%%%% TabBill
T_fenster13::T_fenster13(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Bank note acceptor");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster13::updateGui(void)
{
}
T_fenster14::T_fenster14(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 14");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster14::updateGui(void)
{
}
T_fenster15::T_fenster15(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 15");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster15::updateGui(void)
{
}
T_fenster16::T_fenster16(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 16");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster16::updateGui(void)
{
}
T_fenster17::T_fenster17(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 17");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster17::updateGui(void)
{
}
T_fenster18::T_fenster18(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 18");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster18::updateGui(void)
{
}
T_fenster19::T_fenster19(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 19");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster19::updateGui(void)
{
}
T_fenster20::T_fenster20(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 20");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster20::updateGui(void)
{
}
T_fenster21::T_fenster21(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 21");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster21::updateGui(void)
{
}
T_fenster22::T_fenster22(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 22");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster22::updateGui(void)
{
}
T_fenster23::T_fenster23(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 23");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster23::updateGui(void)
{
}
T_fenster24::T_fenster24(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 24");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster24::updateGui(void)
{
}
T_fenster25::T_fenster25(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 25");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster25::updateGui(void)
{
}
T_fenster26::T_fenster26(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 26");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster26::updateGui(void)
{
}
T_fenster27::T_fenster27(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 27");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster27::updateGui(void)
{
}
T_fenster28::T_fenster28(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 28");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster28::updateGui(void)
{
}
T_fenster29::T_fenster29(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 29");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster29::updateGui(void)
{
}
T_fenster30::T_fenster30(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
QGridLayout *myLayout = new QGridLayout();
QLabel *Lab1 = new QLabel("Dialog 30");
myLayout->addWidget(Lab1,1,1);
setLayout(myLayout);
}
void T_fenster30::updateGui(void)
{
}
*/

161
subwindows.h Executable file
View File

@ -0,0 +1,161 @@
#ifndef SUBWINDOWS_H
#define SUBWINDOWS_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h" // define all working chain steps here
#include "../plugins/interfaces.h"
class T_fenster12 : public QWidget // TabChanger
{
public:
explicit T_fenster12(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster13 : public QWidget // TabBill
{
public:
explicit T_fenster13(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster14 : public QWidget
{
public:
explicit T_fenster14(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster15 : public QWidget
{
public:
explicit T_fenster15(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster16 : public QWidget
{
public:
explicit T_fenster16(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster17 : public QWidget
{
public:
explicit T_fenster17(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster18 : public QWidget
{
public:
explicit T_fenster18(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster19 : public QWidget
{
public:
explicit T_fenster19(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster20 : public QWidget
{
public:
explicit T_fenster20(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster21 : public QWidget
{
public:
explicit T_fenster21(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster22 : public QWidget
{
public:
explicit T_fenster22(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster23 : public QWidget
{
public:
explicit T_fenster23(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster24 : public QWidget
{
public:
explicit T_fenster24(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster25 : public QWidget
{
public:
explicit T_fenster25(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster26 : public QWidget
{
public:
explicit T_fenster26(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster27 : public QWidget
{
public:
explicit T_fenster27(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster28 : public QWidget
{
public:
explicit T_fenster28(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster29 : public QWidget
{
public:
explicit T_fenster29(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
class T_fenster30 : public QWidget
{
public:
explicit T_fenster30(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
void updateGui(void);
};
#endif

1016
tslib.cpp Executable file

File diff suppressed because it is too large Load Diff

168
tslib.h Executable file
View File

@ -0,0 +1,168 @@
#ifndef TSLIB_H
#define TSLIB_H
#include <stdint.h>
#include <QByteArray>
typedef uint8_t UCHAR;
typedef uint16_t UINT;
typedef uint32_t ULONG;
#define LOWBYTE false
#define HIGHBYTE true
uint16_t uchar2uint(char Highbyte, char Lowbyte);
uint16_t uchar2uint(uint8_t Highbyte, uint8_t Lowbyte);
uint32_t uchar2ulong(uint8_t Highbyte, uint8_t MHbyte, uint8_t MLbyte, uint8_t Lowbyte);
uint8_t uint2uchar(uint16_t uival, bool getHighB);
void delay(uint16_t MilliSec);
#define MITSEK 1
#define OHNESEK 0
#define HourSys12h 1
#define HourSys24h 0
void GetTimeString(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t System12h, uint8_t ShowSec, uint8_t *buf);
// generate time as ascii string from integers hours/minutes/seconds
// System12h=0: 24h system =1: 12h System
// ShowSec=0: String has 5 digits (hh:mm) =1: String has 8 digits (hh:mm:ss)
// return String in *buf // 12 byte für buf!
#define DateFormatDeutsch 0
#define DateFormatAmerica 1
#define UsePointSeperator 0
#define UseSlashSeperator 1
void GetDateString(uint8_t day, uint8_t month, uint8_t yearhigh, uint8_t yearlow, uint8_t format, uint8_t sep, uint8_t *buf);
// generate date as ascii string from integers day/month/year
// yearhigh in europe always 20 (not in arabia)
// format= 0: dd.mm.yyyy (deutsch)
// 1: mm.dd.yyyy (amerika)
// 2: yyyy.mm.dd (Iran, Dubai)
// 3: dd.yyyy.mm
// 4: mm.yyyy.dd
// 5: yyyy.dd.mm
// sep: 0: use . as seperator 1: use / as seperator
// return String in *buf // 11 byte für buf!
void GetShortDateString(uint8_t day, uint8_t month, uint8_t yearlow, uint8_t format, uint8_t sep, uint8_t *buf);
// generate date as ascii string from integers day/month/year
// format= 0: dd.mm.yy (deutsch)
// 1: mm.dd.yy (amerika)
// 2: yy.mm.dd (Iran, Dubai)
// 3: dd.yy.mm
// 4: mm.yy.dd
// 5: yy.dd.mm
// sep: 0: use . as seperator 1: use / as seperator
// return String in *buf // 11byte für buf!
uint16_t tslib_strlen(char *buf);
void tslib_strclr(char *buf, char clrsign, uint16_t len);
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
void tslib_strcpy(char *srcbuf, char *destbuf, uint16_t len);
void tslib_strcpy(char *srcbuf, uint8_t *destbuf, uint16_t len);
void tslib_strcpy(uint8_t *srcbuf, uint8_t *destbuf, uint16_t len);
uint16_t tslib_calcCrcCcitt(uint16_t BufLength, uint8_t *buf);
bool tslib_isDecAsciiNumber(char sign);
bool tslib_isHexAsciiNumber(char sign);
int tslib_getMinimum(int val1, int val2);
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
// usage: tslib_text2array("my text", ctmp, 50);
bool tslib_strComp(uint8_t *buf, char *compStr);
bool tslib_plausiChkTime(uint8_t hour, uint8_t min, uint8_t sec );
// retval: true: time is OK
bool tslib_plausiChkDate(uint8_t year, uint8_t month, uint8_t dom );
// retval: true: time is OK
UCHAR swl_LengthCurrentMonth(UCHAR month, UCHAR year);
// return nr of days for this month, respecting leap years
UINT swl_GetDaysOfaCompleteYear(UCHAR year);
// year: 0=2000 4=2004 99=2099
// retval: 365 or 366 (leap year)
UINT swl_GetDaysOfYear(UCHAR year, UCHAR month, UCHAR day);
// number of days of momentary year from 1. Jan until
// (inclusive) given date with respect to leap years
// year: 0..99 month=1..12 day=1..31
unsigned long swl_getNrOfDaysSince2000Jan1(UCHAR thisYear, UCHAR thisMonth, UCHAR thisDay);
// till today
unsigned long swl_getNrOfHoursSince_Midnight2000Jan1(UCHAR thisYear, UCHAR thisMonth, UCHAR thisDay, UCHAR hoursNow);
unsigned long swl_getNrOfMinutesSince_Midnight2000Jan1(UCHAR thisYear, \
UCHAR thisMonth, UCHAR thisDay, UCHAR hoursNow, UCHAR minuteNow);
unsigned long swl_getNrOfSecondsSince_Midnight2000Jan1(UCHAR thisYear, \
UCHAR thisMonth, UCHAR thisDay, UCHAR hoursNow, UCHAR minuteNow, UCHAR secondNow);
char swl_isLeap(UCHAR year);
UCHAR swl_getNextLeapYear(UCHAR year);
UCHAR swl_getLastLeapYear(UCHAR year);
UCHAR swl_hoursOfThisWeek(UCHAR dow, UCHAR hoursNow);
// always calculate from monday 0 o'clock
// dow: 1=monday 7=sunday
UINT swl_minutesOfThisWeek(UCHAR dow, UCHAR hoursNow, UCHAR minutesNow);
// always calculate from monday 0 o'clock
// dow: 1=monday 7=sunday
UINT swl_hoursOfThisMonth(UCHAR thisDay, UCHAR hoursNow);
UINT swl_minutesOfThisMonth(UCHAR thisDay, UCHAR hoursNow, UCHAR minutesNow);
UINT swl_GetHoursOfYear(UCHAR year, UCHAR month, UCHAR day, UCHAR hourNow);
ULONG swl_GetMinutesOfYear(UCHAR year, UCHAR month, UCHAR day, UCHAR hourNow, UCHAR minutesNow);
UCHAR swl_weekday(UCHAR year, UCHAR month, UCHAR dayOfMonth);
// return 1...7 = monday...sunday, starting from 1.1.2000
QString swl_int2str(int val);
QString swl_hex2str(double val);
void swl_text2ui8buf(QString text, uint8_t *outbuf, uint16_t length);
// copy text byte-by-byte to outbuf
QString swl_ulong2str(uint32_t val);
QString swl_long2str(long val);
uint16_t swl_str2uint(QString myIntStr);
uint32_t swl_str2ulong(QString myIntStr);
QString swl_labelAndValToStr(QString label, uint32_t val);
QString swl_8valInaRowToStr(QString label, uint8_t val[8]);
QString swl_8valInaRowToStr(QString label, uint16_t val[8]);
QString swl_8intsInaRowToStr(QString label, int val[8]);
QString swl_centToEuroString(uint32_t amount_in_cent);
#endif // TSLIB_H
// qDebug << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) << QByteArray((const char*)dataSendBuf,dataBufLen).toHex(':');

13
versionHistory.txt Executable file
View File

@ -0,0 +1,13 @@
#ifndef VERSIONHISTORY_H
#define VERSIONHISTORY_H
APservice3.0 bis September2023 fuer DBM, Szeged
APservice3.2 12.10.23
screen Abfolge komplett mit defines aufgebaut, kann jetzt in "stepList.h" veraendert werden
Neuen Screen Muenzwechsler und Banknote
passend zu CashAgent-Plugin: "Atb.Psa1256ptu5.software.HWapi/5.0"
Farben und Schriftgroessen vereinheitlichen (guidefs.h)
#endif

6
win01_com.cpp Executable file
View File

@ -0,0 +1,6 @@
#include "win01_com.h"
#include "stepList.h" // define all working chain steps here
#include "datei.h"
#include "globVars.h"

5
win01_com.h Executable file
View File

@ -0,0 +1,5 @@
#ifndef WINCOMPORT_H
#define WINCOMPORT_H
#endif

471
win02_home.cpp Executable file
View File

@ -0,0 +1,471 @@
#include "win02_home.h"
#include "globVars.h"
//#define BUTTONCOLOR "background-color: rgb(150,250,150)"
#define zeile1PB 10
#define zeile2PB 11
#define BUTTON_HEIGHT 50
extern void exitServiceModule(void);
T_win02::T_win02(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab1 =new QLabel(tr("Service Main"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
QLabel *lab2 =new QLabel(tr("MachineNr:"));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
QLabel *lab3 =new QLabel(tr("Borough,zone:"));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
QLabel *lab4 =new QLabel(tr("Location:"));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,4,0);
QLabel *lab16 =new QLabel("DC Unique ID:");
lab16->setFont(myTabFont);
myLayout->addWidget(lab16,5,0);
// Anzeige: DC-connection
labState =new QLabel(tr("------------")); // datenverkehr läuft
labState->setFont(myTabFont);
labState->setFrameStyle(1);
myLayout->addWidget(labState,1,4);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labMaNu1 =new QLabel(tr(" --- "));
labMaNu1->setFont(myTabFont);
myLayout->addWidget(labMaNu1,2,1);
labMaNu2 =new QLabel(tr(" --- "));
labMaNu2->setFont(myTabFont);
myLayout->addWidget(labMaNu2,2,2);
labBez =new QLabel(tr("-"));
labBez->setFont(myTabFont);
myLayout->addWidget(labBez,3,1);
labZone =new QLabel(tr("-"));
labZone->setFont(myTabFont);
myLayout->addWidget(labZone,3,2);
labLoc1 =new QLabel(tr("-"));
labLoc1->setFont(myTabFont);
myLayout->addWidget(labLoc1,4,1);
labLoc2 =new QLabel(tr("-"));
labLoc2->setFont(myTabFont);
myLayout->addWidget(labLoc2,4,2);
// pt_loc = new QPlainTextEdit();
// pt_loc->setFont(myTabFont);
// myLayout->addWidget(pt_loc,4,1);
labUID =new QLabel("-");
labUID->setFont(myTabFont);
myLayout->addWidget(labUID,5,1);
/*
movingTest = new QLabel();
movingTest->setFont(myTabFont);
myLayout->addWidget(movingTest,5,3);
//
*/
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb1 = new QPushButton(WIN02_LABEL_SHORT01);
pb1->setCheckable(false); // true = toggle button
pb1->setAutoDefault(false); // beim start aus
pb1->setMinimumHeight(BUTTON_HEIGHT);
pb1->setFont(myTabFont);
pb1->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb1,zeile1PB,0);
connect(pb1, SIGNAL(clicked()), this, SLOT(ButtonPb1Clicked()));
pb2 = new QPushButton(WIN02_LABEL_SHORT02);
pb2->setCheckable(false); // true = toggle button
pb2->setAutoDefault(false); // beim start aus
pb2->setMinimumHeight(BUTTON_HEIGHT);
pb2->setFont(myTabFont);
pb2->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb2,zeile1PB,1);
connect(pb2, SIGNAL(clicked()), this, SLOT(ButtonPb2Clicked()));
pb3 = new QPushButton(WIN02_LABEL_SHORT03);
pb3->setCheckable(false); // true = toggle button
pb3->setAutoDefault(false); // beim start aus
pb3->setMinimumHeight(BUTTON_HEIGHT);
pb3->setFont(myTabFont);
pb3->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb3,zeile1PB,2);
connect(pb3, SIGNAL(clicked()), this, SLOT(ButtonPb3Clicked()));
pb4 = new QPushButton(WIN02_LABEL_SHORT04);
pb4->setCheckable(false); // true = toggle button
pb4->setAutoDefault(false); // beim start aus
pb4->setMinimumHeight(BUTTON_HEIGHT);
pb4->setFont(myTabFont);
pb4->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb4,zeile1PB,3);
connect(pb4, SIGNAL(clicked()), this, SLOT(ButtonPb4Clicked()));
pb5 = new QPushButton(WIN02_LABEL_SHORT05);
pb5->setCheckable(false); // true = toggle button
pb5->setAutoDefault(false); // beim start aus
pb5->setMinimumHeight(BUTTON_HEIGHT);
pb5->setFont(myTabFont);
pb5->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb5,zeile1PB,4);
connect(pb5, SIGNAL(clicked()), this, SLOT(ButtonPb5Clicked()));
pb6 = new QPushButton(WIN02_LABEL_SHORT06);
pb6->setCheckable(false); // true = toggle button
pb6->setAutoDefault(false); // beim start aus
pb6->setMinimumHeight(BUTTON_HEIGHT);
pb6->setFont(myTabFont);
pb6->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb6,zeile2PB,0);
connect(pb6, SIGNAL(clicked()), this, SLOT(ButtonPb6Clicked()));
pb7 = new QPushButton(WIN02_LABEL_SHORT07);
pb7->setCheckable(false); // true = toggle button
pb7->setAutoDefault(false); // beim start aus
pb7->setMinimumHeight(BUTTON_HEIGHT);
pb7->setFont(myTabFont);
pb7->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb7,zeile2PB,1);
connect(pb7, SIGNAL(clicked()), this, SLOT(ButtonPb7Clicked()));
pb8 = new QPushButton(WIN02_LABEL_SHORT08);
pb8->setCheckable(false); // true = toggle button
pb8->setAutoDefault(false); // beim start aus
pb8->setMinimumHeight(BUTTON_HEIGHT);
pb8->setFont(myTabFont);
pb8->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb8,zeile2PB,2);
connect(pb8, SIGNAL(clicked()), this, SLOT(ButtonPb8Clicked()));
pb9 = new QPushButton(WIN02_LABEL_SHORT09);
pb9->setCheckable(false); // true = toggle button
pb9->setAutoDefault(false); // beim start aus
pb9->setMinimumHeight(BUTTON_HEIGHT);
pb9->setFont(myTabFont);
pb9->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb9,zeile2PB,3);
connect(pb9, SIGNAL(clicked()), this, SLOT(ButtonPb9Clicked()));
pb10 = new QPushButton(WIN02_LABEL_SHORT10);
pb10->setCheckable(false); // true = toggle button
pb10->setAutoDefault(false); // beim start aus
pb10->setMinimumHeight(BUTTON_HEIGHT);
pb10->setFont(myTabFont);
pb10->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb10,zeile2PB,4);
connect(pb10, SIGNAL(clicked()), this, SLOT(ButtonPb10Clicked()));
pb11 = new QPushButton("Exit Service");
pb11->setCheckable(false); // true = toggle button
pb11->setAutoDefault(false); // beim start aus
pb11->setMinimumHeight(BUTTON_HEIGHT);
pb11->setFont(myTabFont);
pb11->setStyleSheet(BUTTONCOLOR);
myLayout->addWidget(pb11,5,4);
connect(pb11, SIGNAL(clicked()), this, SLOT(ButtonPb11Clicked()));
QLabel *lab5 =new QLabel(tr(" "));
lab5->setFont(myTabFont);
myLayout->addWidget(lab5,6,0);
// Autosend:
AutSendButton = new QPushButton(tr("&Automatic\n reading")); // &A --> also keycode Alt-A possible
myLayout->addWidget(AutSendButton,3,4);
AutSendButton->setCheckable(true); // true = toggle button
AutSendButton->setAutoDefault(true); // beim start aus
AutSendButton->setMinimumHeight(50);
connect(AutSendButton, SIGNAL(clicked()), this, SLOT(callAutoSend()));
systTime = new QTime();
systDate = new QDate();
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
/*
moveTestStr.clear();
moveTestStr.append("1234567890abcdefgh");
movingTest->setText(moveTestStr);
*/
// lese Datei ../APserviceConfig.csv und speichere die Parameter global ab
QByteArray myBA;
int cchk, br;
myBA=datei_readFromFile(FILENAME_APSERVCONF);
cchk=csv_getEntryAsInt(myBA,1); // 2. entry = kind of coin checker
br=csv_getEntryAsInt(myBA,2); // 2. entry = kind of coin checker
globVar_SetCoinChecker(cchk);
globVar_SetBna(br);
// Test:
//int itmp=globVar_GetCoinChecker();
//if (itmp==3)
// pb10->setText("Changer");
//else
// pb10->setText(" EMP ");
}
T_win02::~T_win02()
{
close();
}
void T_win02::Nav_back(void)
{
//myNextStep=WCS_WIN02BAK;
}
void T_win02::Nav_home(void)
{
// already here
myNextStep=WCS_WIN02MID;
}
void T_win02::Nav_next(void)
{
myNextStep=WCS_WIN02FWD;
}
void T_win02::ButtonPb1Clicked(void)
{
myNextStep=WCS_WIN02SHORT01;
}
void T_win02::ButtonPb2Clicked(void)
{
myNextStep=WCS_WIN02SHORT02;
}
void T_win02::ButtonPb3Clicked(void)
{
myNextStep=WCS_WIN02SHORT03;
}
void T_win02::ButtonPb4Clicked(void)
{
myNextStep=WCS_WIN02SHORT04;
}
void T_win02::ButtonPb5Clicked(void)
{
myNextStep=WCS_WIN02SHORT05;
}
void T_win02::ButtonPb6Clicked(void)
{
myNextStep=WCS_WIN02SHORT06;
}
void T_win02::ButtonPb7Clicked(void)
{
myNextStep=WCS_WIN02SHORT07;
}
void T_win02::ButtonPb8Clicked(void)
{
myNextStep=WCS_WIN02SHORT08;
}
void T_win02::ButtonPb9Clicked(void)
{
myNextStep=WCS_WIN02SHORT09;
}
void T_win02::ButtonPb10Clicked(void)
{
myNextStep=WCS_WIN02SHORT10;
}
void T_win02::ButtonPb11Clicked(void) // Leave app (quit)
{
emit quitMyApp();
}
void T_win02::callAutoSend()
{
if (AutSendButton->isChecked())
{
HWaccess->dc_autoRequest(1);
} else
{
HWaccess->dc_autoRequest(0);
}
}
bool T_win02::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
//*useNavi=SWITCH_BACK_ON | SWITCH_HOME_OFF | SWITCH_NEXT_ON; just for master
*useNavi=SWITCH_BACK_OFF | SWITCH_HOME_OFF | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win02::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
uint8_t len, buf[64]; //, locBuf[32];
uint16_t cunu, manu, borough, zone, alias; //, uitmp;
QString myStr, tmpStr, locationStr;
//static int ctr;
uint8_t nn, uctmp; //, yl, yh;
//static int cyclCtr;
QByteArray myBA;
*nextScreen=0; // 0=no change
*useNavi=0;
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=myNextStep;
myNextStep=0;
return false;
}
tmpStr.clear();
// update values:
if (HWaccess->sys_areDCdataValid())
{
labState->setText(" DC2 connected "); // datenverkehr läuft
labState->setStyleSheet(COLORGREEN);
} else
{
labState->setText(" no connection\n to DC ");
labState->setStyleSheet(COLORYELLOW);
}
HWaccess->readback_machineIDdata(&len, buf);
cunu=uchar2uint(buf[1], buf[0]); // binary, decimal
manu=uchar2uint(buf[3], buf[2]);
borough=uchar2uint(buf[5], buf[4]);
zone=uchar2uint(buf[7], buf[6]);
alias=uchar2uint(buf[9], buf[8]);
myStr.clear();
for (nn=0; nn<16; nn++)
{
uctmp=buf[nn+10];
if (uctmp>=32)
myStr+=QChar(uctmp);
}
labLoc1->setText(myStr);
myStr.clear();
for (nn=0; nn<16; nn++)
{
uctmp=buf[nn+26];
if (uctmp>=32)
myStr+=QChar(uctmp);
}
labLoc2->setText(myStr);
if (cunu>0 && manu>0)
{
myStr.clear();
myStr.append(QString::number(cunu));
myStr.append("-");
myStr.append(QString::number(manu));
labMaNu1->setText(myStr);
myStr.clear();
myStr.append(QString::number(alias));
labMaNu2->setText(myStr);
}
labUID->setText( HWaccess->dc_getUIDstr());
if (borough>0 || zone>0) // at least one
{
myStr.clear();
myStr.append(QString::number(borough));
labBez->setText(myStr);
myStr.clear();
myStr.append(QString::number(zone));
labZone->setText(myStr);
}
if (HWaccess->dc_isAutoRequestOn())
{
AutSendButton->setStyleSheet(COLORGREEN);
} else
AutSendButton->setStyleSheet(COLORWHITE);
/* just a test:
if (++cyclCtr>10)
{
cyclCtr=0;
int LL=moveTestStr.length()-1;
moveTestStr=moveTestStr.right(LL); // move left by one
moveTestStr.append("-");
movingTest->clear();
movingTest->setText(moveTestStr);
myBA.truncate(1);
}
*/
return false;
}

123
win02_home.h Executable file
View File

@ -0,0 +1,123 @@
#ifndef WIN02_HOME_H
#define WIN02_HOME_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include <QTime>
#include <QDate>
#include "guidefs.h"
#include "datei.h"
#include "globVars.h"
class T_win02 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
void updateGui(void);
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *labMaNu1, *labMaNu2;
QLabel *lab3;
QTimer *myTO;
QLabel *labState;
QLabel *labLoc1, *labLoc2;
QLabel *labTimeDate;
QLabel *labZone, *labBez;
QPushButton *pb1;
QPushButton *pb2;
QPushButton *pb3;
QPushButton *pb4;
QPushButton *pb5;
QPushButton *pb6;
QPushButton *pb7;
QPushButton *pb8;
QPushButton *pb9;
QPushButton *pb10;
QPushButton *pb11;
QPushButton *AutSendButton;
void SysDiag(void);
void sysPowerOnDiag_ISR(void);
uint8_t sub_componentAssessment(void);
uint8_t sys_superviseSystem(void);
uint8_t sys_getSystemErrors(void);
QTimer *systemStartUpTimer;
QTimer *systemSupervisionTimer;
int sysStartupStep;
int sysVendingNow;
QTime *systTime;
QDate *systDate;
QLabel *labUID;
//QLabel *movingTest;
//QString moveTestStr;
QPlainTextEdit *pt_loc;
public:
explicit T_win02(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win02();
private slots:
// void sysSuper_ISR(void);
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void ButtonPb1Clicked(void);
void ButtonPb2Clicked(void);
void ButtonPb3Clicked(void);
void ButtonPb4Clicked(void);
void ButtonPb5Clicked(void);
void ButtonPb6Clicked(void);
void ButtonPb7Clicked(void);
void ButtonPb8Clicked(void);
void ButtonPb9Clicked(void);
void ButtonPb10Clicked(void);
void ButtonPb11Clicked(void);
void callAutoSend(void);
signals:
void quitMyApp(void);
};
#endif

82
win02cpp Executable file
View File

@ -0,0 +1,82 @@
#include "win02.h"
T_win02::T_win02(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
//setStyleSheet("background-color: yellow"); // geht aber schaut bescheiden aus
this->HWaccess=HWaccess;
// headline
QGridLayout *GeneralLayout = new QGridLayout();
QLabel *fileName1 = new QLabel(tr("win02"));
//GeneralLayout->addWidget(fileName1, 0, 0, 2, 0, Qt::AlignLeft); // Left Right HCenter Justify
// Top Bottm VCenter Baseline
GeneralLayout->addWidget(fileName1, 0, 0);
setLayout(GeneralLayout);
// HWaccess = new hwinf();
//HWaccess->dc_getTemperaturStr(); // just to see if access is allowed
myNextStep=0;
}
void T_win02::Nav_back(void)
{
myNextStep=1;
}
void T_win02::Nav_home(void)
{
}
void T_win02::Nav_next(void)
{
}
bool T_win02::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
*nextScreen=0; // needed 0=no change
*useNavi=0; // bit1,2,3: use buttons next, home, back
myNextStep=0;
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_OFF | SWITCH_NEXT_OFF;
return false;
}
bool T_win02::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// this->updateGui();
*nextScreen=0; // 0=no change
*useNavi=0; // bit1,2,3: use buttons next, home, back
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=WCS_SERVICE_MAIN;
myNextStep=0;
}
return true;
}
T_win02::~T_win02()
{
this->close();
}
void T_win02::updateGui(void)
{
}

350
win03_time.cpp Executable file
View File

@ -0,0 +1,350 @@
#include "win03_time.h"
struct Trtc_DateTime localTime;
/*
{
uint8_t rtc_hour;
uint8_t rtc_min;
uint8_t rtc_sec;
uint8_t rtc_dayOfMonth;
uint8_t rtc_month;
uint8_t rtc_year;
uint8_t rtc_dayOfWeek;
};
*/
T_win03::T_win03(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Date / Time"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab4 =new QLabel(tr("DeviceController"));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,4,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labDate =new QLabel(tr("-"));
labDate->setFont(myTabFont);
myLayout->addWidget(labDate,4,1);
labTime =new QLabel(tr("-"));
labTime->setFont(myTabFont);
myLayout->addWidget(labTime,4,2);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
butSetSysTime = new QPushButton("-->PTU");
butSetSysTime->setFont(myTabFont);
myLayout->addWidget(butSetSysTime,4,3);
connect(butSetSysTime, SIGNAL(clicked()), this, SLOT(ButtonTime2sysClicked()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab10 =new QLabel(" ");
myLayout->addWidget(lab10,5,0);
QLabel *lab6 =new QLabel(tr("PTU5 / System"));
lab6->setFont(myTabFont);
myLayout->addWidget(lab6,6,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labSysDate =new QLabel(tr("-"));
labSysDate->setFont(myTabFont);
myLayout->addWidget(labSysDate,6,1);
labSysTime =new QLabel(tr("-"));
labSysTime->setFont(myTabFont);
myLayout->addWidget(labSysTime,6,2);
systTime = new QTime();
systDate = new QDate();
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
butSetDCTime = new QPushButton("-->DC");
butSetDCTime->setFont(myTabFont);
myLayout->addWidget(butSetDCTime,6,3);
connect(butSetDCTime, SIGNAL(clicked()), this, SLOT(ButtonTime2dcClicked()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab11 =new QLabel(" ");
myLayout->addWidget(lab11,7,0);
QLabel *lab14 =new QLabel("set date/time");
lab14->setFont(myTabFont);
myLayout->addWidget(lab14,8,0);
myTabFont.setPixelSize(22);
chgDate = new QDateEdit();
chgDate->setFont(myTabFont);
chgDate->setMinimumHeight(50);
myLayout->addWidget(chgDate,8,1);
chgTime = new QTimeEdit();
chgTime->setFont(myTabFont);
chgTime->setDisplayFormat("HH:mm:ss");
chgTime->setMinimumHeight(50);
myLayout->addWidget(chgTime,8,2);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
butSetManual = new QPushButton("-->DC");
butSetManual->setFont(myTabFont);
myLayout->addWidget(butSetManual,8,3);
connect(butSetManual, SIGNAL(clicked()), this, SLOT(ButtonSetTimeClicked()));
QLabel *lab12 =new QLabel(" ");
myLayout->addWidget(lab12,9,0);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab16 =new QLabel("DC HW Version:");
lab16->setFont(myTabFont);
myLayout->addWidget(lab16,12,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
hwVersion1 =new QLabel(" ");
hwVersion1->setFont(myTabFont);
myLayout->addWidget(hwVersion1,12,1);
hwVersion2 =new QLabel(" ");
hwVersion2->setFont(myTabFont);
myLayout->addWidget(hwVersion2,12,2);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab17 =new QLabel("DC SW Version:");
lab17->setFont(myTabFont);
myLayout->addWidget(lab17,13,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
swVersion =new QLabel(" ");
swVersion->setFont(myTabFont);
myLayout->addWidget(swVersion,13,1);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab7 =new QLabel(tr("Battery:"));
lab7->setFont(myTabFont);
myLayout->addWidget(lab7,20,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labVolt =new QLabel(tr("-"));
labVolt->setFont(myTabFont);
myLayout->addWidget(labVolt,20,1);
labCelsius =new QLabel(tr("-"));
labCelsius->setFont(myTabFont);
myLayout->addWidget(labCelsius,20,2);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win03::~T_win03()
{
close();
}
void T_win03::Nav_back(void)
{
myNextStep=WCS_WIN03BAK;
}
void T_win03::Nav_home(void)
{
myNextStep=WCS_WIN03MID;
}
void T_win03::Nav_next(void)
{
myNextStep=WCS_WIN03FWD;
// qDebug()<<"fenster1 nav next pressed "<< myNextStep;
}
void T_win03::ButtonTime2sysClicked(void)
{
HWaccess->rtc_getDateTime(&localTime);
if (tslib_plausiChkTime(localTime.rtc_hour, localTime.rtc_min, localTime.rtc_sec) &&
tslib_plausiChkDate(localTime.rtc_year, localTime.rtc_month, localTime.rtc_dayOfMonth))
{
QTime(localTime.rtc_hour, localTime.rtc_min, localTime.rtc_sec);
QDate(localTime.rtc_year, localTime.rtc_month, localTime.rtc_dayOfMonth);
//qDebug()<<"send date/time to PTU ";
//qDebug()<<"date: " << localTime.rtc_year << localTime.rtc_month << localTime.rtc_dayOfMonth << localTime.rtc_dayOfWeek ;
//qDebug()<<"time: " << localTime.rtc_hour << localTime.rtc_min << localTime.rtc_sec;
}
}
void T_win03::ButtonTime2dcClicked(void)
{
localTime.rtc_hour = systTime->currentTime().hour();
localTime.rtc_min = systTime->currentTime().minute();
localTime.rtc_sec = systTime->currentTime().second();
localTime.rtc_year = uint8_t(systDate->currentDate().year()%100);
localTime.rtc_month= systDate->currentDate().month();
localTime.rtc_dayOfMonth= systDate->currentDate().day();
//localTime.rtc_dayOfWeek = swl_weekday(systDate->currentDate().year(), systDate->currentDate().month(), systDate->currentDate().day());
localTime.rtc_dayOfWeek = systDate->currentDate().dayOfWeek(); // oder so
HWaccess->rtc_setTimeDateDirect(&localTime);
//qDebug()<<"send date/time to DC ";
//qDebug()<<"date: " << localTime.rtc_year << localTime.rtc_month << localTime.rtc_dayOfMonth << localTime.rtc_dayOfWeek ;
//qDebug()<<"time: " << localTime.rtc_hour << localTime.rtc_min << localTime.rtc_sec;
}
void T_win03::ButtonSetTimeClicked(void)
{
QDate myDate;
QTime myTime;
myDate=chgDate->date();
myTime=chgTime->time();
//qDebug()<<"date: " <<myDate<<" myTime: "<<myTime;
localTime.rtc_hour = myTime.hour();
localTime.rtc_min = myTime.minute();
localTime.rtc_sec = myTime.second();
localTime.rtc_year = uint8_t(myDate.year()%100);
localTime.rtc_month= myDate.month();
localTime.rtc_dayOfMonth= myDate.day();
localTime.rtc_dayOfWeek = myDate.dayOfWeek();
HWaccess->rtc_setTimeDateDirect(&localTime);
//qDebug()<<"send manual date/time to DC ";
//qDebug()<<"date: " << localTime.rtc_year << localTime.rtc_month << localTime.rtc_dayOfMonth << localTime.rtc_dayOfWeek ;
//qDebug()<<"time: " << localTime.rtc_hour << localTime.rtc_min << localTime.rtc_sec;
}
bool T_win03::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win03::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
uint8_t nn; //, yl, yh;
char cbuf34[34];
uint8_t buf[64];
uint16_t uitmp;
QString myStr, tmpStr;
int ii, pp=0;
*nextScreen=0; // 0=no change
*useNavi=0;
HWaccess->rtc_getDateTime(&localTime);
if (tslib_plausiChkTime(localTime.rtc_hour, localTime.rtc_min, localTime.rtc_sec) &&
tslib_plausiChkDate(localTime.rtc_year, localTime.rtc_month, localTime.rtc_dayOfMonth))
{
for (nn=0; nn<20; nn++)
cbuf34[nn]=0;
GetTimeString(localTime.rtc_hour, localTime.rtc_min, localTime.rtc_sec, 0, 1, buf);
//void GetTimeString(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t System12h, uint8_t ShowSec, uint8_t *buf);
for (nn=0; nn<12; nn++)
cbuf34[nn]=buf[nn];
labTime->setText(cbuf34);
for (nn=0; nn<20; nn++)
cbuf34[nn]=0;
GetDateString(localTime.rtc_dayOfMonth, localTime.rtc_month, 0x20, localTime.rtc_year,0, 0, buf);
// void GetDateString(uint8_t day, uint8_t month, uint8_t yearhigh, uint8_t yearlow, uint8_t format, uint8_t sep, uint8_t *buf);
for (nn=0; nn<12; nn++)
cbuf34[nn]=buf[nn];
labDate->setText(cbuf34);
}
for (nn=0; nn<20; nn++)
cbuf34[nn]=0;
GetTimeString(systTime->currentTime().hour(), \
systTime->currentTime().minute(), \
systTime->currentTime().second(), 0, 1, buf);
for (nn=0; nn<12; nn++)
cbuf34[nn]=buf[nn];
labSysTime->setText(cbuf34);
for (nn=0; nn<20; nn++)
cbuf34[nn]=0;
uitmp= systDate->currentDate().year();
tmpStr.clear();
tmpStr.append(QString::number(uitmp));
GetDateString( systDate->currentDate().day(), \
systDate->currentDate().month(), 0, 0, 0, 0, buf);
for (nn=0; nn<12; nn++)
cbuf34[nn]=buf[nn];
cbuf34[6]=tmpStr.at(0).toLatin1();
cbuf34[7]=tmpStr.at(1).toLatin1();
cbuf34[8]=tmpStr.at(2).toLatin1();
cbuf34[9]=tmpStr.at(3).toLatin1();
labSysDate->setText(cbuf34);
// hwVersion1->setText(HWaccess->dc_getHWversion() );
// in 2 Teile zerlegen weil sonst 2.Spalte zu breit
tmpStr.clear();
tmpStr = HWaccess->dc_getHWversion();
for (ii=0; ii<tmpStr.length(); ii++) if (tmpStr.at(ii)==' ') {pp=ii; break; }
// tmpStr.truncate(pp); geht auch, dann muss man tmpStr aber nochmal neu laden
myStr=tmpStr.left(pp);
hwVersion1->setText(myStr);
myStr=tmpStr.right(pp+1);
hwVersion2->setText(myStr);
swVersion->setText(HWaccess->dc_getSWversion() );
labVolt->setText( HWaccess->dc_getVoltagStr());
labCelsius->setText( HWaccess->dc_getTemperaturStr());
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

86
win03_time.h Executable file
View File

@ -0,0 +1,86 @@
#ifndef WIN03_TIME_H
#define WIN03_TIME_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "QDateEdit"
#include "QTimeEdit"
#include "guidefs.h"
class T_win03 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QLabel *labDate;
QLabel *labTime;
QPushButton *butSetSysTime;
QLabel *labSysDate;
QLabel *labSysTime;
QTime *systTime;
QDate *systDate;
QPushButton *butSetDCTime;
QLabel *labVolt;
QLabel *labCelsius;
QDateEdit *chgDate;
QTimeEdit *chgTime;
QPushButton *butSetManual;
QLabel *hwVersion1, *hwVersion2;
QLabel *swVersion;
public:
explicit T_win03(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win03();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void ButtonTime2sysClicked(void);
void ButtonTime2dcClicked(void);
void ButtonSetTimeClicked(void);
};
#endif

446
win04_stat.cpp Executable file
View File

@ -0,0 +1,446 @@
#include "win04_stat.h"
static bool win04_dataAreValid;
T_win04::T_win04(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Machine status"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_refresh = new QPushButton("Refresh");
pb_refresh->setFont(myTabFont);
myLayout->addWidget(pb_refresh,1,1);
connect(pb_refresh, SIGNAL(clicked()), this, SLOT(ButtonRefreshClicked()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab2 =new QLabel(tr("Error or Warning:"));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
win4_showErrors = new QListWidget;
win4_showErrors->setFont(myTabFont);
myLayout->addWidget(win4_showErrors,3,0);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab3 =new QLabel(tr("Used devices"));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,4,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
win4_devParameters = new QListWidget;
win4_devParameters->setFont(myTabFont);
myLayout->addWidget(win4_devParameters,5,0);
// rechte Spalte:
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab4 =new QLabel(tr("state of each device:"));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,2,1);
myTabFont.setPixelSize(PIXELSIZE_DATA);
win4_showDeviceState = new QListWidget;
win4_showDeviceState->setFont(myTabFont);
myLayout->addWidget(win4_showDeviceState,3,1);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab5 =new QLabel(tr("dynamic condition:"));
lab5->setFont(myTabFont);
myLayout->addWidget(lab5,4,1);
myTabFont.setPixelSize(PIXELSIZE_DATA);
win4_showMachineState = new QListWidget;
win4_showMachineState->setFont(myTabFont);
myLayout->addWidget(win4_showMachineState,5,1);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win04::~T_win04()
{
close();
}
void T_win04::Nav_back(void)
{
myNextStep=WCS_WIN04BAK;
}
void T_win04::Nav_home(void)
{
myNextStep=WCS_WIN04MID;
}
void T_win04::Nav_next(void)
{
myNextStep=WCS_WIN04FWD;
}
void T_win04::ButtonRefreshClicked(void)
{
win04_dataAreValid=0;
}
bool T_win04::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
win04_dataAreValid=0;
return false;
}
void T_win04::entryDevState(QString label, uint8_t val)
{
QString myStr;
myStr.clear();
myStr.append(label);
myStr.append(QString::number(val));
win4_showDeviceState->addItem(myStr);
}
void T_win04::entryMachineCond(QString label, uint32_t val)
{
QString myStr;
myStr.clear();
myStr.append(label);
myStr.append(QString::number(val));
win4_showMachineState->addItem(myStr);
}
void T_win04::entryArray(QString label, uint8_t *buff)
{
QString myStr;
char myChar;
int nn;
myStr.clear();
myStr.append(label);
for (nn=0; nn<8; nn++)
{
myChar=char(buff[nn]);
myStr.append(myChar);
}
win4_showMachineState->addItem(myStr);
}
bool T_win04::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
QString myStr;
*nextScreen=0; // 0=no change
*useNavi=0;
struct T_moduleCondition myDevCond;
struct T_dynamicCondition myDynMachCond;
//struct T_devices devPara; // used devices
if (!win04_dataAreValid)
{
win04_dataAreValid=1;
win4_showDeviceState->clear();
HWaccess->sys_getDeviceConditions(&myDevCond);
entryDevState("Internal Ram : ", myDevCond.ram );
entryDevState("Internal Eeprom: ", myDevCond.intEe );
entryDevState("External Eeprom: ", myDevCond.extEe );
entryDevState("Real Time Clock: ", myDevCond.rtc );
entryDevState("Board Hardware : ", myDevCond.boardHw );
entryDevState("Printer : ", myDevCond.printer );
entryDevState("Modem : ", myDevCond.modem );
entryDevState("GSM Signal : ", myDevCond.signal );
entryDevState("GSMregistration: ", myDevCond.regist );
entryDevState("MDB Bus : ", myDevCond.mdbBus );
entryDevState("Coin Checker : ", myDevCond.coinChecker );
entryDevState("Coin Escrow : ", myDevCond.coinEscrow );
entryDevState("Mifare Reader : ", myDevCond.mifareReader );
entryDevState("Credit Terminal: ", myDevCond.creditTerm );
entryDevState("Reject Motor : ", myDevCond.coinReject );
entryDevState("Coin Safe : ", myDevCond.coinSafe );
entryDevState("Bill Safe : ", myDevCond.billSafe );
entryDevState("Battery Voltage: ", myDevCond.voltage );
entryDevState("Temperature : ", myDevCond.temper );
entryDevState("Power-On-Test : ", myDevCond.poweronTest );
entryDevState("Doors State : ", myDevCond.doorState );
entryDevState("Door-Was-Opened: ", myDevCond.doorWasOpened );
entryDevState("Coin Changer : ", myDevCond.changer );
entryDevState("Coin Blocker : ", myDevCond.coinBlocker );
entryDevState("Banknote Reader: ", myDevCond.billReader );
entryDevState("Reset Reason : ", myDevCond.ResetReason );
entryDevState("Check Complete : ", myDevCond.allModulesChecked );
entryDevState("Alarm State : ", myDevCond.alarmState );
//entryDevState(": ", myDevCond. );
//entryDevState(": ", myDevCond. );
win4_showMachineState->clear();
HWaccess->sys_getDynMachineConditions(&myDynMachCond);
entryMachineCond("All Doors deb.: ", myDynMachCond.allDoorsDebounced);
entryMachineCond("open Authorize: ", myDynMachCond.openedAuthorized );
entryMachineCond("CBin debounced: ", myDynMachCond.CBinDebounced );
entryMachineCond("Upper Door : ", myDynMachCond.upperDoor );
entryMachineCond("Middle Door: : ", myDynMachCond.middleDoor );
entryMachineCond("Lower Door : ", myDynMachCond.lowerDoor );
//entryMachineCond("Coin Safe in : ", myDynMachCond.coinBox );
entryMachineCond("Bill Box in : ", myDynMachCond.billBox );
entryMachineCond("Mode Account : ", myDynMachCond.modeAbrech );
entryMachineCond("On Alarm now : ", myDynMachCond.onAlarm );
entryMachineCond("CardTest now : ", myDynMachCond.nowCardTest );
//entryMachineCond("Payment now : ", myDynMachCond.nowPayment );
entryMachineCond("last CardType : ", myDynMachCond.lastMifCardType );
entryMachineCond("last Sdoor st.: ", myDynMachCond.lastSDoorState );
entryMachineCond("last Vdoor st.: ", myDynMachCond.lastVDoorState );
entryMachineCond("last Vault st.: ", myDynMachCond.lastCBstate );
entryMachineCond("PayInProgress : ", myDynMachCond.paymentInProgress );
//entryMachineCond(": ", myDynMachCond.res1 );
entryMachineCond("Voltage now : ", myDynMachCond.U_Batt );
entryMachineCond("Temperature : ", myDynMachCond.Temperatur );
entryMachineCond("Nr Coins now : ", myDynMachCond.nrCoinsInBox );
entryMachineCond("Amount now : ", myDynMachCond.amountInBox );
entryMachineCond("Tot.Trans.Vol.: ", myDynMachCond.totalTransVolume );
entryMachineCond("Tot.Nr.Vends : ", myDynMachCond.totalNrOfVends );
entryMachineCond("jsonConf valid: ", myDynMachCond.jsonValid_config );
entryMachineCond("jsonDev valid : ", myDynMachCond.jsonValid_device );
entryMachineCond("jsonCash valid: ", myDynMachCond.jsonValid_cash );
entryMachineCond("jsonPri valid : ", myDynMachCond.jsonValid_print );
entryMachineCond("jsonSer valid : ", myDynMachCond.jsonValid_serial );
entryMachineCond("jsonTime valid: ", myDynMachCond.jsonValid_time );
entryMachineCond("last File Type: ", myDynMachCond.lastFileType );
entryArray( "Card Holder : ", myDynMachCond.MifCardHolder );
entryMachineCond("Print result : ", myDynMachCond.resultOfLastTemplPrint );
entryMachineCond("last Pri. Stat: ", myDynMachCond.lastPrinterStatus );
entryMachineCond("startup run : ", myDynMachCond.startupTestIsRunning);
//entryMachineCond(": ", myDynMachCond. );
win4_showErrors->clear();
win4_devParameters->clear();
//HWaccess->sys_restoreDeviceParameter(&devPara); // all 0
if (myDevCond.rtc>=200)
win4_showErrors->addItem("Error RTC HW");
else if (myDevCond.rtc>=100)
win4_showErrors->addItem("Warning RTC time may be wrong");
if (myDevCond.printer==200) win4_showErrors->addItem("Error Printer no response");
if (myDevCond.printer==201) win4_showErrors->addItem("Error Printer HW");
if (myDevCond.printer==202) win4_showErrors->addItem("Error Printer no Paper");
if (myDevCond.coinBlocker>=200) win4_showErrors->addItem("Error Coin Blocker");
if (myDevCond.mdbBus>=200) win4_showErrors->addItem("Error Mdb Bus");
if (myDevCond.intEe>=200) win4_showErrors->addItem("Error int eeprom");
if (myDevCond.coinChecker>=200) win4_showErrors->addItem("Error Coin checker");
if (myDevCond.coinEscrow>=200) win4_showErrors->addItem("Error Coin escrow");
if (myDevCond.coinChecker==3)
{
if (myDevCond.changer>=200) win4_showErrors->addItem("Error Coin changer");
}
if (myDevCond.coinChecker>0) // irgendeiner
{
if (myDevCond.coinSafe==200)
win4_showErrors->addItem("Error no cash box ");
if (myDevCond.coinSafe==201)
win4_showErrors->addItem("Error cash box full");
}
if ( myDevCond.billReader>=200 )
{
win4_showErrors->addItem("Error Bill reader");
}
if (myDevCond.voltage==200)
win4_showErrors->addItem("Error voltage off limits");
if (myDevCond.voltage==201)
win4_showErrors->addItem("Error voltage too low");
if (myDevCond.temper==200 )
win4_showErrors->addItem("Error temperature off limits");
if (myDevCond.temper==201 )
win4_showErrors->addItem("Error extrem temperature");
if (myDevCond.printer==100) win4_showErrors->addItem("Warning Printer NearPaperEnd");
if (myDevCond.coinChecker>0)
{
if (myDevCond.coinSafe>=100 && myDevCond.coinSafe<200)
win4_showErrors->addItem("Warning cash box almost full");
}
if (myDevCond.voltage>=100 && myDevCond.voltage<200)
win4_showErrors->addItem("Warning voltage low");
if (myDevCond.temper>=100 && myDevCond.temper<200 )
win4_showErrors->addItem("Warning temperature");
}
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}
/*
uint8_t T_win04::sub_componentAssessment(void)
{
// this function decides if vending mode is possible, independant from door
// return >0 in case of error
// is inncluded in sys_superviseSystem
struct T_moduleCondition *modCond=0;
HWaccess->sys_getDeviceConditions(modCond);
struct T_dynamicCondition *dynMaCond=0;
HWaccess->sys_getDynMachineConditions(dynMaCond);
struct T_devices *devPara=0;
//hwaccess->sys_restoreDeviceParameter(devPara);
if (modCond->rtc>=200)
return 1;
if (modCond->printer==200 || modCond->printer==201) // 200: not connected 201: printer-HW-error 202: no paper
return 2;
if (modCond->printer==202)
return 3;
if (modCond->coinBlocker>=200)
return 4;
if (modCond->mdbBus>=200)
return 5;
if (modCond->intEe>=200)
return 6;
if (devPara->kindOfCoinChecker==1 || devPara->kindOfCoinChecker==2) // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
{
if (modCond->coinChecker>=200 || modCond->coinEscrow>=200)
{
// Fehler Münzver.
return 7;
}
if (modCond->coinSafe>200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
{
return 8;
}
} else
if (devPara->kindOfCoinChecker==3)
{
if (modCond->changer>=200)
{
// Fehler Münzver.
return 7;
}
if (modCond->coinSafe>200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
{
return 8;
}
}
if ( modCond->billReader>=200 && devPara->BillAcceptor>0)
{
// Fehler BNA
return 9;
}
if (dynMaCond->onAlarm>0)
return 10;
if (dynMaCond->modeAbrech>0)
return 11;
if (dynMaCond->nowCardTest>0)
return 12;
//if (dynMaCond->startupTestIsRunning>0)
// return 13;
if (modCond->voltage>=200)
return 14;
if (modCond->temper>=200)
return 15;
return 0;
}
*/
//uint8_t T_win04::sys_getSystemErrors(void)
//{
// 0: everything fine 1..15: errors
/* 1: real time clock error
2: printer error
3: no paper
4: coin blocker
5: mdb error
6: mem error int.ee.
7: error coin validator
8: coin safe missed or full
9: bill acceptor error
10: alarm / intrusion
11: cash box change is ongoing
12: card test running
13: startup-test is running
14: voltage error
15: temperature error
*/
// return this->sub_componentAssessment();
//}

74
win04_stat.h Executable file
View File

@ -0,0 +1,74 @@
#ifndef WIN04_STAT_H
#define WIN04_STAT_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win04 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QLabel *lab4;
QLabel *lab5;
QTimer *myTO;
QPushButton *pb_refresh;
QListWidget *win4_showErrors;
QListWidget *win4_devParameters;
QListWidget *win4_showDeviceState;
QListWidget *win4_showMachineState;
void entryDevState(QString label, uint8_t val);
void entryMachineCond(QString label, uint32_t val);
void entryArray(QString label, uint8_t *buff);
uint8_t sub_componentAssessment(void);
uint8_t sys_getSystemErrors(void);
public:
explicit T_win04(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win04();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void ButtonRefreshClicked(void);
};
#endif

618
win05_doors.cpp Executable file
View File

@ -0,0 +1,618 @@
#include "win05_doors.h"
#define TIME_DISPLAY_SIGNALS_MS 5000
T_win05::T_win05(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Doors"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,0,0);
// -----------------------------------------------------------------------------------------------------
// Spalten anlegen
QLabel *EncLabEmpty = new QLabel(" ");
QLabel *EncLabWide = new QLabel(" ");
//myLayout->addWidget(EncLabEmpty, 0,9);
myLayout->addWidget(EncLabWide, 0,1);
myLayout->addWidget(EncLabEmpty, 0,2);
myLayout->addWidget(EncLabEmpty, 0,3);
myLayout->addWidget(EncLabWide, 0,4);
myLayout->addWidget(EncLabWide, 0,5);
myLayout->addWidget(EncLabEmpty, 0,6);
myLayout->addWidget(EncLabWide, 0,7);
myLayout->addWidget(EncLabWide, 7,0);
// linke Spalte Tür- und Kassenschalter
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab_swPow = new QLabel("Power4switches");
lab_swPow->setFont(myTabFont);
myLayout->addWidget(lab_swPow, 1,0);
LEDpwrOn = new QLabel(tr(" "));
LEDpwrOn->setFrameStyle(QFrame::Panel | QFrame::Raised);
LEDpwrOn->setLineWidth(3); // 1,2,3
LEDpwrOn->setFont(myTabFont);
LEDpwrOn->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
myLayout->addWidget(LEDpwrOn, 1,1);
// obere Tür
QLabel *EncLab2 = new QLabel(tr("Upper Door"));
EncLab2->setFont(myTabFont);
myLayout->addWidget(EncLab2, 2,0);
EncDoorUp = new QLabel(tr("opened"));
EncDoorUp->setFrameStyle(QFrame::Panel | QFrame::Raised);
EncDoorUp->setLineWidth(3); // 1,2,3
EncDoorUp->setFont(myTabFont);
EncDoorUp->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
myLayout->addWidget(EncDoorUp, 2,1);
// mittlere Tür
QLabel *EncLab3 = new QLabel(tr("Vault Door"));
EncLab3->setFont(myTabFont);
myLayout->addWidget(EncLab3, 3,0);
EncDoorMid = new QLabel("opened");
EncDoorMid->setFrameStyle(QFrame::Panel | QFrame::Raised);
EncDoorMid->setLineWidth(3); // 1,2,3
EncDoorMid->setFont(myTabFont);
EncDoorMid->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
myLayout->addWidget(EncDoorMid, 3,1);
// Bill box
QLabel *EncLab5 = new QLabel(tr("Bill Box"));
EncLab5->setFont(myTabFont);
myLayout->addWidget(EncLab5, 4,0);
EncBillBox = new QLabel("missed");
EncBillBox->setFrameStyle(QFrame::Box | QFrame::Raised);
EncBillBox->setLineWidth(3); // 1,2,3
//EncBillBox->setMaximumWidth(60);
EncBillBox->setFont(myTabFont);
EncBillBox->setStyleSheet("background-color: white");
myLayout->addWidget(EncBillBox, 4,1);
// Coin box
QLabel *EncLab6 = new QLabel(tr("Coin Box"));
EncLab6->setFont(myTabFont);
myLayout->addWidget(EncLab6, 5,0);
EncCoinBox = new QLabel("missed");
EncCoinBox->setFrameStyle(QFrame::Box | QFrame::Raised);
EncCoinBox->setLineWidth(3); // 1,2,3
//EncCoinBox->setMaximumWidth(60);
EncCoinBox->setFont(myTabFont);
EncCoinBox->setStyleSheet("background-color: white");
myLayout->addWidget(EncCoinBox, 5,1);
// untere Tür
QLabel *EncLab4 = new QLabel(tr("Lower Door"));
EncLab4->setFont(myTabFont);
myLayout->addWidget(EncLab4, 6,0);
EncDoorDn = new QLabel("opened");
EncDoorDn->setFrameStyle(QFrame::Panel | QFrame::Raised);
EncDoorDn->setLineWidth(3); // 1,2,3
EncDoorDn->setFont(myTabFont);
EncDoorDn->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
myLayout->addWidget(EncDoorDn, 6,1);
// mittlere Spalte: Tasten
// QLabel *EncLab11 = new QLabel(tr("lock/unlock doors"));
// EncLab11->setFont(myTabFont);
// myLayout->addWidget(EncLab11, 0,3);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
PB_uplockOpen = new QPushButton(tr("open\n"));
myLayout->addWidget(PB_uplockOpen, 2,3);
PB_uplockOpen->setFont(myTabFont);
connect(PB_uplockOpen, SIGNAL(clicked()), this, SLOT(ua_osd()));
/* nur PSA2020
PB_uplockClos = new QPushButton(tr("close\n"));
myLayout->addWidget(PB_uplockClos, 2,4);
PB_uplockClos->setFont(myTabFont);
connect(PB_uplockClos, SIGNAL(clicked()), this, SLOT(ua_csd()));
*/
PB_lowlockOpen = new QPushButton(tr("open\n"));
PB_lowlockOpen->setFont(myTabFont);
myLayout->addWidget(PB_lowlockOpen, 3,3);
connect(PB_lowlockOpen, SIGNAL(clicked()), this, SLOT(ua_obd()));
PB_vaultDoor = new QPushButton(tr("open safe\n"));
PB_vaultDoor->setFont(myTabFont);
myLayout->addWidget(PB_vaultDoor, 4,3);
connect(PB_vaultDoor, SIGNAL(clicked()), this, SLOT(ua_vd()));
PB_siren = new QPushButton(tr("alarm\nsiren"));
PB_siren->setCheckable(false); // true = toggle button
PB_siren->setFont(myTabFont);
myLayout->addWidget(PB_siren, 6,3);
connect(PB_siren, SIGNAL(clicked()), this, SLOT(switchSiren()));
/* nur PSA2020
// 3. Spalte nur für PSA2020 - Riegelleisten
QLabel *EncLab10 = new QLabel(tr("PSA2020\nLockbars"));
EncLab10->setFont(myTabFont);
myLayout->addWidget(EncLab10, 0,6);
PB_uplockForw = new QPushButton(tr("upper motor\nforward"));
PB_uplockForw->setFont(myTabFont);
myLayout->addWidget(PB_uplockForw, 1,6);
connect(PB_uplockForw, SIGNAL(clicked()), this, SLOT(ua_ulu()));
PB_uplockStop = new QPushButton(tr("upper motor\n stopp"));
PB_uplockStop->setFont(myTabFont);
myLayout->addWidget(PB_uplockStop, 2,6);
connect(PB_uplockStop, SIGNAL(clicked()), this, SLOT(ua_uls()));
PB_uplockRev = new QPushButton(tr("upper motor\nreverse"));
PB_uplockRev->setFont(myTabFont);
myLayout->addWidget(PB_uplockRev, 3,6);
connect(PB_uplockRev, SIGNAL(clicked()), this, SLOT(ua_uld()));
PB_lowlockForw = new QPushButton(tr("lower motor\nforward"));
PB_lowlockForw->setFont(myTabFont);
myLayout->addWidget(PB_lowlockForw, 5,6);
connect(PB_lowlockForw, SIGNAL(clicked()), this, SLOT(ua_llu()));
PB_lowlockStop = new QPushButton(tr("lower motor\n stopp"));
PB_lowlockStop->setFont(myTabFont);
myLayout->addWidget(PB_lowlockStop, 6,6);
connect(PB_lowlockStop, SIGNAL(clicked()), this, SLOT(ua_lls()));
// display Lock-bar contacts, upper lock up
lockbarContactUU = new QLabel("ulu");
lockbarContactUU->setFrameStyle(QFrame::Panel | QFrame::Raised);
lockbarContactUU->setLineWidth(3); // 1,2,3
lockbarContactUU->setMaximumWidth(40);
lockbarContactUU->setMaximumHeight(25);
lockbarContactUU->setFont(myTabFont);
lockbarContactUU->setStyleSheet("background-color: white");
myLayout->addWidget(lockbarContactUU, 1,7);
// upper lock down
lockbarContactUD = new QLabel("uld");
lockbarContactUD->setFrameStyle(QFrame::Panel | QFrame::Raised);
lockbarContactUD->setLineWidth(3); // 1,2,3
lockbarContactUD->setMaximumWidth(40);
lockbarContactUD->setMaximumHeight(25);
lockbarContactUD->setFont(myTabFont);
lockbarContactUD->setStyleSheet("background-color: yellow");
myLayout->addWidget(lockbarContactUD, 3,7);
lockbarContactDU = new QLabel("lld");
lockbarContactDU->setFrameStyle(QFrame::Panel | QFrame::Raised);
lockbarContactDU->setLineWidth(3); // 1,2,3
lockbarContactDU->setMaximumWidth(40);
lockbarContactDU->setMaximumHeight(25);
lockbarContactDU->setFont(myTabFont);
lockbarContactDU->setStyleSheet("background-color: white");
myLayout->addWidget(lockbarContactDU, 5,7);
*/
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorServiceDoorOpened()), this, SLOT(door_slotUpOpen()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorVaultDoorOpened()), this, SLOT(door_slotLowOpen()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorCoinBoxRemoved()), this, SLOT(door_slotBoxOut()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorCoinBoxInserted()), this, SLOT(door_slotBoxIn()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorCBinAndAllDoorsClosed()), this, SLOT(door_slotCBin_AllClosed()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_doorAllDoorsClosed()), this, SLOT(door_slotAllClosed()));
myTabFont.setPixelSize(PIXELSIZE_DATA);
showSignals = new QLineEdit();
showSignals->setFrame(true);
showSignals->setText(" ");
showSignals->setReadOnly(true);
showSignals->setFont(myTabFont);
showSignals->setStyleSheet("background-color: white");
myLayout->addWidget(showSignals,1,4);
timerClrDisp = new QTimer();
timerClrDisp->setSingleShot(true);
//timerClrDisp->start(1000);
connect(timerClrDisp, SIGNAL(timeout()), this, SLOT(door_slotClrSig()));
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(TIME_DISPLAY_SIGNALS_MS);
}
void T_win05::door_slotUpOpen(void)
{
showSignals->setText("signal service door was opened");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotLowOpen(void)
{
showSignals->setText("signal middlee door was opened");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotBoxOut(void)
{
showSignals->setText("signal coinBox was removed");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotBoxIn(void)
{
showSignals->setText("signal coinBox was inserted");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotCBin_AllClosed(void)
{
showSignals->setText("signal all doors was closed with box in");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotAllClosed(void)
{
showSignals->setText("signal all doors was closed");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win05::door_slotClrSig(void)
{
showSignals->clear();
}
T_win05::~T_win05()
{
close();
}
void T_win05::Nav_back(void)
{
myNextStep=WCS_WIN05BAK;
}
void T_win05::Nav_home(void)
{
myNextStep=WCS_WIN05MID;
}
void T_win05::Nav_next(void)
{
myNextStep=WCS_WIN05FWD;
}
bool T_win05::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win05::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
// Türen: EncDoorUp EncDoorMid EncDoorDn
// LEDpwrOn; EncDoorUp;EncDoorMid;EncBillBox;EncCoinBox;EncDoorDn;
if (HWaccess->door_isContactPowerOn())
LEDpwrOn->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
else
LEDpwrOn->setStyleSheet("background-color: white");
if (HWaccess->door_isUpperDoorOpen())
{
// Tür oben offen
EncDoorUp->setText(" open ");
EncDoorUp->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
} else
{
// Tür oben zu
EncDoorUp->setText("closed");
EncDoorUp->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
}
if (HWaccess->vault_isVaultDoorOpen())
{
// Tür Mitte (Tresor) offen:
EncDoorMid->setText(" open ");
EncDoorMid->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
} else
{
EncDoorMid->setText("closed");
EncDoorMid->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
}
if (HWaccess->door_isLowerDoorOpen())
{
// EncDoorDn->setText(" o\n p\n e\n n");
EncDoorDn->setText(" open ");
EncDoorDn->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
//qDebug() << "batt door is open";
} else
{
// EncDoorDn->setText(" c\n l\n o\n s\n e\n d");
EncDoorDn->setText("closed");
EncDoorDn->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
//qDebug() << "batt door is closed";
}
if (HWaccess->vault_isBillVaultIn())
{
// Bill box drin
// EncBillBox->setText(" B\n I\n L\n L");
EncBillBox->setText(" IN");
EncBillBox->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
} else
{
EncBillBox->setText("OUT");
EncBillBox->setStyleSheet("background-color: white");
}
if (HWaccess->vault_isCoinVaultIn())
{
// Bill box drin
EncCoinBox->setText(" IN");
EncCoinBox->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
} else
{
EncCoinBox->setText("OUT");
EncCoinBox->setStyleSheet("background-color: white");
}
/* nur PSA2020
uint8_t ret=HWaccess->door_getLocks();
// retval bit0: upper lever is up
// bit1: upper lever is down
// bit2: lower lever is up
// bit3: lower lever is down
if (ret & 1)
{
lockbarContactUU->setStyleSheet("background-color: yellow");
} else
{
lockbarContactUU->setStyleSheet("background-color: white");
}
if (ret & 2)
lockbarContactUD->setStyleSheet("background-color: yellow");
else
lockbarContactUD->setStyleSheet("background-color: white");
if (ret & 8) // 4 gibts nicht
lockbarContactDU->setStyleSheet("background-color: yellow");
else
lockbarContactDU->setStyleSheet("background-color: white");
// if (ret & 8)
// lockbarContactDD->setStyleSheet("background-color: yellow");
// else
// lockbarContactDD->setStyleSheet("background-color: white");
if (HWaccess->door_upperDoorIsUnlocked())
LedUdoorIsOpen->setStyleSheet("background-color: yellow");
else
LedUdoorIsOpen->setStyleSheet("background-color: white");
if (HWaccess->door_upperDoorIsLocked())
LedUdoorIsClosed->setStyleSheet("background-color: yellow");
else
LedUdoorIsClosed->setStyleSheet("background-color: white");
// if (HWaccess->door_lowerDoorIsUnlocked()) // dennSchalter gibt's nicht!
if (HWaccess->door_lowerDoorIsLocked())
LedLdoorIsOpen->setStyleSheet("background-color: yellow");
else
LedLdoorIsOpen->setStyleSheet("background-color: white");
// if (HWaccess->door_lowerDoorIsLocked())
// LedLdoorIsClosed->setStyleSheet("background-color: yellow");
// else
// LedLdoorIsClosed->setStyleSheet("background-color: white");
*/
/*
// crash
// safe door cannot be opened if printer fuse is blown, display:
uint8_t fuseState=HWaccess->prn_PrnFuseIsOk();
//retval: 0: fuse blown 1: fuse OK 2:unknown as printer power is off
if (fuseState==0)
dispFuse->setText("cannot open, \nprinter fuse blown!");
else
dispFuse->setText("cannot open, \nprinter fuse OK!");
*/
/*
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
*/
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}
// %%%%%%%%%%%%%%%%%%%% aus TabDoors
/* nur 2020
void T_win05::ua_ulu(void)
{
// user action (=button pressed)
// upper lock up = forward
HWaccess->lock_switchUpperLock(1);
}
void T_win05::ua_uld(void)
{
// upper lock down = reverse
HWaccess->lock_switchUpperLock(2);
}
void T_win05::ua_uls(void)
{
// upper lock stop
HWaccess->lock_switchUpperLock(0);
}
void T_win05::ua_llu(void)
{
// user action (=button pressed)
// upper lock up = forward
HWaccess->lock_switchLowerLock(1);
}
*/
/* void T_win05::ua_lld(void)
{
// upper lock down = reverse
HWaccess->lock_switchLowerLock(2);
}*/
/* nur 2020
void T_win05::ua_lls(void)
{
// upper lock stop
HWaccess->lock_switchLowerLock(0);
}*/
void T_win05::ua_osd(void)
{
// open service door
HWaccess->lock_triggerUpperSolenoid();
}
/* nur 2020
void T_win05::ua_csd(void)
{
// clsoe service door
HWaccess->lock_closeUpperDoor();
}*/
void T_win05::ua_obd(void)
{
// open battery/lower door
HWaccess->lock_triggerLowerSolenoid();
}
/*
void T_win05::ua_cbd(void)
{
HWaccess->lock_closeLowerDoor();
}*/
void T_win05::ua_vd(void)
{
//qDebug() << "GUI: button open vault";
HWaccess->lock_switchVaultDoor();
}
void T_win05::switchPwr(void)
{
if (PB_lockPwr->isChecked() )
HWaccess->lock_switchContactPower(1);
else
HWaccess->lock_switchContactPower(0);
}
void T_win05::switchSiren(void)
{
// if (PB_siren->isChecked() )
HWaccess->alarm_switchSiren(1);
// else
// HWaccess->alarm_switchSiren(0);
}

118
win05_doors.h Executable file
View File

@ -0,0 +1,118 @@
#ifndef WIN05_DOORS_H
#define WIN05_DOORS_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "QLineEdit"
#include "guidefs.h"
class T_win05 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QPushButton *PB_lockPwr;
QPushButton * PB_uplockForw;
QPushButton *PB_uplockStop;
QPushButton *PB_uplockRev;
QPushButton *PB_lowlockForw;
QPushButton *PB_lowlockStop;
QPushButton *PB_uplockOpen;
QPushButton *PB_uplockClos;
QPushButton *PB_lowlockOpen;
QPushButton *PB_vaultDoor;
QPushButton *PB_siren;
QLabel *LEDpwrOn;
QLabel *EncDoorUp;
QLabel *EncDoorMid;
QLabel *EncBillBox;
QLabel *EncCoinBox;
QLabel *EncDoorDn;
QLabel *lockbarContactUU;
QLabel *lockbarContactUD;
QLabel *lockbarContactDU;
QLabel *LedUdoorIsOpen;
QLabel *LedUdoorIsClosed;
QLabel *LedLdoorIsOpen;
QLineEdit *showSignals;
QTimer *timerClrDisp;
public:
explicit T_win05(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win05();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
/* nur 2020:
void ua_ulu(void);
void ua_uld(void);
void ua_uls(void);
void ua_llu(void);
void ua_lls(void);
*/
void ua_osd(void);
// void ua_csd(void);
void ua_obd(void);
void ua_vd(void);
void switchPwr(void);
void switchSiren(void);
void door_slotUpOpen(void);
void door_slotLowOpen(void);
void door_slotBoxOut(void);
void door_slotBoxIn(void);
void door_slotCBin_AllClosed(void);
void door_slotAllClosed(void);
void door_slotClrSig(void);
};
#endif

667
win06_prn.cpp Executable file
View File

@ -0,0 +1,667 @@
#include "win06_prn.h"
T_win06::T_win06(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
int nn;
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Printer"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
butPrnPow = new QPushButton("Power");
myLayout->addWidget(butPrnPow,1,1);
butPrnPow->setFont(myTabFont);
butPrnPow->setStyleSheet("background-color: white");
butPrnPow->setCheckable(true); // true = toggle button
butPrnPow->setAutoDefault(false); // beim start aus
butPrnPow->setMinimumWidth(100);
butPrnPow->setMinimumHeight(40);
butPrnPow->setChecked(true);
connect(butPrnPow, SIGNAL(clicked()), this, SLOT(slot_powerButton()));
myTabFont.setPixelSize(14);
QLabel *lab14 =new QLabel(tr("external low paper sensor:"));
lab14->setFont(myTabFont);
lab14->setAlignment( Qt::AlignRight);
myLayout->addWidget(lab14,1,2);
lab15 =new QLabel(tr(" "));
lab15->setFont(myTabFont);
lab15->setStyleSheet("background-color: white");
lab15->setFrameStyle(3);
myLayout->addWidget(lab15,1,3);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab12 =new QLabel(tr("State:"));
lab12->setFont(myTabFont);
myLayout->addWidget(lab12,3,0);
myTabFont.setPixelSize(22);
showPrnState1 =new QLabel(tr(" "));
showPrnState1->setFont(myTabFont);
showPrnState1->setFrameStyle(1);
myLayout->addWidget(showPrnState1,3,1);
// selection box for Template-number to be printed
myTabFont.setPixelSize(20);
cb_templNr = new QComboBox();
myLayout->addWidget(cb_templNr,3,2);
for (nn=1; nn<=32; nn++)
cb_templNr->addItem(swl_int2str(nn));
cb_templNr->setFont(myTabFont);
cb_templNr->setCurrentIndex(0); // war 28 (=29)
cb_templNr->setMaxVisibleItems(5);
cb_templNr->setStyleSheet("QScrollBar:vertical { width: 30px; }");
cb_kombiNr = new QComboBox();
myLayout->addWidget(cb_kombiNr,5,2);
for (nn=1; nn<=8; nn++)
cb_kombiNr->addItem(swl_int2str(nn));
cb_kombiNr->setFont(myTabFont);
cb_kombiNr->setCurrentIndex(0);
cb_kombiNr->setMaxVisibleItems(5);
// cb_kombiNr->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
// cb_kombiNr->view()->setVerticalScrollBar(QScrollBar::setMinimumWidth(20));
//cb_kombiNr->view()->setVerticalScrollBar()->setMinimumWidth(20);
cb_kombiNr->setStyleSheet("QScrollBar::vertical { width: 30px; }"); // geht :))
// cb_kombiNr->setStyleSheet(QComboBox::downarrow {width: 30px; });
//cb_kombiNr->adjustSize();
//myTabFont.setPixelSize(14);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
QPushButton *butPrint2 = new QPushButton(" print\ntemplate");
myLayout->addWidget(butPrint2,3,3);
connect(butPrint2, SIGNAL(clicked()), this, SLOT(slot_printVaris()));
QPushButton *butPrint6 = new QPushButton(" print\ncombi");
myLayout->addWidget(butPrint6,5,3);
connect(butPrint6, SIGNAL(clicked()), this, SLOT(slot_printCombi()));
// myTabFont.setPixelSize(14);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab13 =new QLabel(tr("Result:"));
lab13->setFont(myTabFont);
myLayout->addWidget(lab13,4,0);
myTabFont.setPixelSize(PIXELSIZE_BIGFONT);
showPrnResult =new QLabel(tr(" "));
showPrnResult->setFont(myTabFont);
showPrnResult->setFrameStyle(1);
myLayout->addWidget(showPrnResult,4,1);
// myTabFont.setPixelSize(14);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab16 =new QLabel(tr("Signals:"));
lab16->setFont(myTabFont);
myLayout->addWidget(lab16,5,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labSignal =new QLabel(tr(" "));
labSignal->setFont(myTabFont);
labSignal->setFrameStyle(1);
myLayout->addWidget(labSignal,5,1);
myTabFont.setPixelSize(PIXELSIZE_SMALLFONT);
QLabel *lab10 =new QLabel(tr("send dummy values: "));
lab10->setFont(myTabFont);
myLayout->addWidget(lab10,13,0);
QPushButton *butSendDyn1 = new QPushButton("V1_abcde V2_ghijk V3_mnopq V4_stuvw\nV5_ABCDE V6_GHIJK V7_MNOPQ V8_STUVW");
myLayout->addWidget(butSendDyn1,13,1);
connect(butSendDyn1, SIGNAL(clicked()), this, SLOT(slot_sendDD1()));
QPushButton *butSendDyn2 = new QPushButton("V1_00011 V2_00022 V3_00033 V4_00044\nV5_00055 V6_00066 V7_00077 V8_00088");
myLayout->addWidget(butSendDyn2,13,2);
connect(butSendDyn2, SIGNAL(clicked()), this, SLOT(slot_sendDD2()));
lab6 =new QLabel(tr("read back: "));
lab6->setFont(myTabFont);
myLayout->addWidget(lab6,16,0);
lab7 =new QLabel(tr(" "));
lab7->setFont(myTabFont);
lab7->setFrameStyle(1);
myLayout->addWidget(lab7,16,1);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
QPushButton *butGetDD = new QPushButton("read\nback");
myLayout->addWidget(butGetDD,16,2);
connect(butGetDD, SIGNAL(clicked()), this, SLOT(slot_rdBackDD()));
QPushButton *butPrint3 = new QPushButton("print \nLogo");
myLayout->addWidget(butPrint3,19,0);
connect(butPrint3, SIGNAL(clicked()), this, SLOT(slot_printLogo()));
QPushButton *butPrint4 = new QPushButton("print \nAcc.Bill");
myLayout->addWidget(butPrint4,19,1);
connect(butPrint4, SIGNAL(clicked()), this, SLOT(slot_printAcc()));
QPushButton *butPrintTicket = new QPushButton("print \nTicket");
myLayout->addWidget(butPrintTicket,19,2);
connect(butPrintTicket, SIGNAL(clicked()), this, SLOT(slot_printTicket()));
QPushButton *butPrint5 = new QPushButton(" CUT \n");
myLayout->addWidget(butPrint5,19,3);
connect(butPrint5, SIGNAL(clicked()), this, SLOT(slot_printCut()));
// -------------------------------------------------------------
// 25.6.23 dazu:
QPushButton *butPrint10 = new QPushButton("Send\nText");
myLayout->addWidget(butPrint10,22,0);
connect(butPrint10, SIGNAL(clicked()), this, SLOT(slot_sendText()));
QPushButton *butPrint11 = new QPushButton("Setup");
myLayout->addWidget(butPrint11,22,1);
connect(butPrint11, SIGNAL(clicked()), this, SLOT(slot_setup()));
QPushButton *butPrint12 = new QPushButton("Move \n Paper");
myLayout->addWidget(butPrint12,22,2);
connect(butPrint12, SIGNAL(clicked()), this, SLOT(slot_movPap()));
QPushButton *butPrint15 = new QPushButton("Paper \n back");
myLayout->addWidget(butPrint15,22,3);
connect(butPrint15, SIGNAL(clicked()), this, SLOT(slot_movBack()));
QPushButton *butPrint13 = new QPushButton(" set \nFonts");
myLayout->addWidget(butPrint13,23,1);
connect(butPrint13, SIGNAL(clicked()), this, SLOT(slot_fonts()));
QPushButton *butPrint14 = new QPushButton(" set \nLetters");
myLayout->addWidget(butPrint14,23,2);
connect(butPrint14, SIGNAL(clicked()), this, SLOT(slot_letters()));
QPushButton *butPrint20 = new QPushButton("Print QR\n");
myLayout->addWidget(butPrint20,23,0);
connect(butPrint20, SIGNAL(clicked()), this, SLOT(slot_printQr()));
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(1000);
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_templatePrintFinished_OK()), this, SLOT(signalPrnDone()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_templatePrintFinished_Err()), this, SLOT(signalPrnErr()));
HWaccess->prn_switchPower(0);
dummyText.clear();
/*
dummyText.append(" Quod equidem non reprehendo; Lorem ipsum dolor sit amet, consectetur adipiscing elit. ");
dummyText.append(" Quibus natura iure responderit non esse verum aliunde finem beate vivendi, ");
dummyText.append(" a se principia rei gerendae peti; Quae enim adhuc protulisti, popularia sunt, ");
dummyText.append(" ego autem a te elegantiora desidero. Duo Reges: constructio interrete. ");
dummyText.append("Tum Lucius: Mihi vero ista valde probata sunt, quod item fratri puto. ");
dummyText.append("Bestiarum vero nullum iudicium puto. Nihil enim iam habes, quod ad corpus referas; ");
dummyText.append("Deinde prima illa, quae in congressu solemus: Quid tu, inquit, huc? Et homini, qui ");
dummyText.append("ceteris animantibus plurimum praestat, praecipue a natura nihil datum esse dicemus? ");
dummyText.append("Iam id ipsum absurdum, maximum malum neglegi. Quod ea non occurrentia fingunt, vincunt Aristonem; ");
dummyText.append("Atqui perspicuum est hominem e corpore animoque constare, cum primae sint animi partes, ");
dummyText.append("secundae corporis. Fieri, inquam, Triari, nullo pacto potest, ut non dicas, quid non probes eius ");
dummyText.append(" a quo dissentias. Equidem e Cn. An dubium est, quin virtus ita maximam partem optineat ");
dummyText.append("in rebus humanis, ut reliquas obruat? ");
dummyText.append("Summus dolor plures dies manere non potest? Dicet pro me ipsa virtus nec dubitabit isti vestro ");
dummyText.append("beato M. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Quod si ita sit, cur ");
dummyText.append("opera philosophiae sit danda nescio. valde probata sunt, quod item fratri puto");
dummyText.truncate(1278);
*/
dummyText.append("abcdefghijklmnopqrstuvwxyz0123ABCDEFGHIJKLMNOPQRSTUVWXYZ4567"); // 60byte
dummyText.append("abcdefghijklmnopqrstuvwxyz0123ABCDEFGHIJKLMNOPQRSTUVWXYZ4567"); // 60byte
dummyText.append("abcdefghijklmnopqrstuvwxyz0123ABCDEFGHIJKLMNOPQRSTUVWXYZ4567"); // 60byte
}
T_win06::~T_win06()
{
close();
}
void T_win06::Nav_back(void)
{
myNextStep=WCS_WIN06BAK;
}
void T_win06::Nav_home(void)
{
myNextStep=WCS_WIN06MID;
}
void T_win06::Nav_next(void)
{
myNextStep=WCS_WIN06FWD;
}
void T_win06::slot_sendDD1(void)
{
uint8_t buf[66];
// schicke V1_abcdef V2_ghijkl V3_mnopqr V4_stuvwx\nV5_ABCDEF V6_GHIJKL V7_MNOPQR V8_STUVWX als dyn.Drucker variablen
swl_text2ui8buf("V1_abcdef", &buf[0],8);
swl_text2ui8buf("V2_ghijkl", &buf[8],8);
swl_text2ui8buf("V3_mnopqr", &buf[16],8);
swl_text2ui8buf("V4_stuvwx", &buf[24],8);
swl_text2ui8buf("V5_ABCDEF", &buf[32],8);
swl_text2ui8buf("V6_GHIJKL", &buf[40],8);
swl_text2ui8buf("V7_MNOPQR", &buf[48],8);
swl_text2ui8buf("V8_STUVWX", &buf[56],8);
HWaccess->prn_sendDynamicPrnValues(buf);
}
void T_win06::slot_rdBackDD(void)
{
HWaccess->prn_requestCurrentDynData();
}
void T_win06::slot_printVaris(void)
{
int val=cb_templNr->currentIndex();
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
val++;
HWaccess->prn_printTemplate(val);
}
void T_win06::slot_printCombi(void)
{
int val=cb_kombiNr->currentIndex();
val++;
HWaccess->prn_printKombiticket(val);
}
void T_win06::slot_printTicket(void)
{
// HWaccess->prn_printTemplate(1);
// HWaccess->prn_printTemplate(2);
// HWaccess->prn_printTemplate(3);
HWaccess->prn_printKombiticket(1);
}
void T_win06::slot_sendDD2(void)
{
uint8_t buf[66];
// send V1_000111 V2_000222 V3_000333 V4_000444\nV5_000555 V6_000666 V7_000777 V8_000888
swl_text2ui8buf("V1_000111", &buf[0],8);
swl_text2ui8buf("V2_000222", &buf[8],8);
swl_text2ui8buf("V3_000333", &buf[16],8);
swl_text2ui8buf("V4_000444", &buf[24],8);
swl_text2ui8buf("V5_000555", &buf[32],8);
swl_text2ui8buf("V6_000666", &buf[40],8);
swl_text2ui8buf("V7_000777", &buf[48],8);
swl_text2ui8buf("V8_000888", &buf[56],8);
HWaccess->prn_sendDynamicPrnValues(buf);
}
void T_win06::signalPrnDone(void)
{
labSignal->setText("signal printing finished");
myTO->start(2000);
}
void T_win06::signalPrnErr(void)
{
labSignal->setText("signal printing ERROR");
myTO->start(2000);
}
void T_win06::slot_powerButton(void)
{
if (butPrnPow->isChecked())
{
HWaccess->prn_switchPower(1);
} else
{
HWaccess->prn_switchPower(0);
}
}
void T_win06::slot_printLogo(void)
{
HWaccess->prn_switchPower(1);
HWaccess->prn_printLogo(1,0);
}
void T_win06::slot_printAcc(void)
{
HWaccess->prn_switchPower(1);
HWaccess->prn_printAccountReceipt();
}
void T_win06::slot_printCut(void)
{
HWaccess->prn_switchPower(1);
HWaccess->prn_cut(1);
}
void T_win06::slot_sendText(void)
{
HWaccess->prn_switchPower(1);
HWaccess->prn_sendText(&dummyText);
// up to 1280 bytes
}
void T_win06::slot_setup(void)
{
uint16_t paperSpeed=240;
uint8_t density=25;
uint8_t alignment='c';
uint8_t orientation=0;
HWaccess->prn_switchPower(1);
HWaccess->prn_sendPrnSetup(paperSpeed, density, alignment, orientation);
// send 5 byte: byte 0,1: speed 5...250 mm/s
// byte2: density 0....(25)....50
// byte3: alignment 'l', 'c', 'r' = left, center, right
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
// not batched! don't use twice within 100ms
}
void T_win06::slot_movPap(void)
{
uint8_t wayInMm=30;
uint8_t direction=1;
HWaccess->prn_switchPower(1);
HWaccess->prn_movePaper(wayInMm, direction);
//direction: 1=forward 2=backward
//void prn_newLine(uint8_t nrOfLines) const override;
}
void T_win06::slot_movBack(void)
{
uint8_t wayInMm=30;
uint8_t direction=2;
HWaccess->prn_switchPower(1);
HWaccess->prn_movePaper(wayInMm, direction);
//direction: 1=forward 2=backward
//void prn_newLine(uint8_t nrOfLines) const override;
}
void T_win06::slot_fonts(void)
{
uint8_t font=10;
uint8_t size=5;
uint8_t width=1;
uint8_t height=2;
HWaccess->prn_switchPower(1);
HWaccess->prn_setFonts(font, size, width, height);
// font = kind of font 5...11 (0..22)
// size = seem to be dots/mm 1..10=nice >15=ugly
// [size = 6...20, 9..9: too tiny 10: small ...12 = normal size ...20=huge] (for some fonts)
// width: 0...4 0=1x 1=2x 2=4x (huge!) 3=8x 4=16x (3,4 make no sense)
// heigth: 0...7 = 1x...8x only 0,1,2,(3) make sense
}
void T_win06::slot_printQr(void)
{
HWaccess->prn_printQRcode();
}
void T_win06::slot_letters(void)
{
uint8_t bold=1;
uint8_t invers=0;
uint8_t underlined=0;
HWaccess->prn_switchPower(1);
HWaccess->prn_setLetters(bold, invers, underlined);
// bold: 0/1
// invers: 0/1
// underlined: 0/1
}
/*
void T_win06::slot_(void)
{
HWaccess->prn_
}
void T_win06::slot_(void)
{
HWaccess->prn_
}
void T_win06::slot_(void)
{
HWaccess->prn_
}
*/
bool T_win06::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win06::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
QString myStr;
uint8_t buf[66];
char ctmp;
uint8_t uctmp;
bool btmp;
// Ruecklesen und anzeigen der dyn. Variablen
myStr.clear();
btmp=HWaccess->prn_getCurrentDynamicPrnValuesFromDC(buf);
if (btmp)
{
for (int nn=0; nn<32; nn++)
{
ctmp=char(buf[nn]);
myStr.append(ctmp);
}
myStr.append('\n');
for (int nn=32; nn<64; nn++)
{
ctmp=char(buf[nn]);
myStr.append(ctmp);
}
lab7->setText(myStr);
if (HWaccess->prn_dynDataAreEqual(buf))
//lab9->setText("equal");
lab7->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
else
//lab9->setText("wrong");
lab7->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
}
// clear signals after 2s:
if (!myTO->isActive())
labSignal->setText(" ");
// HWaccess->sys_getDynMachineConditions(&myDynMachCond);
uctmp=HWaccess->prn_getCurrentPrinterState();
// 0: printer OK
// bit0: near paper end bit1: no paper
// bit2: temperature error bit3: error head open
// bit4: paper jam in cutter
// bit6: no response bit7: serial rec. error
// bit5: printer not ready
myStr.clear();
myStr.append(QString::number(uctmp));
myStr.append(" ");
if (uctmp&0x80) myStr.append("serial rec.error"); else
if (uctmp&0x40) myStr.append("no response"); else
if (uctmp&0x20) myStr.append("Prn not Ready"); else
if (uctmp&0x10) myStr.append("Paper jam"); else
if (uctmp&0x08) myStr.append("head open"); else
if (uctmp&0x04) myStr.append("too hot"); else
if (uctmp&0x02) myStr.append("no paper"); else
if (uctmp&0x01) myStr.append("near paper end");
showPrnState1->setText(myStr);
//btmp=HWaccess->prn_isUpAndReady(); geht nicht richtig
//if (btmp) // up and ready
if (uctmp<2)
showPrnState1->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
else
showPrnState1->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
uctmp=HWaccess->prn_getPrintResult();
// return: 0: unknown
// 1: OK - last template was printed succesful
// 2: error - last template was not printed
myStr.clear();
myStr.append(QString::number(uctmp));
myStr.append(" ");
if (uctmp==1) myStr.append("- OK"); else
if (uctmp==2) myStr.append("- error"); else
if (uctmp==3) myStr.append("- 3"); else
myStr.append("- unknown");
showPrnResult->setText(myStr);
uctmp=HWaccess->cash_getLowPaperSensor();
// 0: Sensor sees paper 1: no paper 99: off
if (uctmp==0)
lab15->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
else if (uctmp==1)
lab15->setStyleSheet("background-color: yellow");
else
lab15->setStyleSheet("background-color: white");
if (HWaccess->prn_isPrinterPowerOn())
{
if (HWaccess->prn_PrnFuseIsOk()==0)
{
// fuse is blown
butPrnPow->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
butPrnPow->setText("FUSE blown");
} else
{
// on
butPrnPow->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
butPrnPow->setText(" O N ");
}
} else
{
butPrnPow->setStyleSheet("background-color: white");
butPrnPow->setText("Power");
}
/*
uctmp=HWaccess->log_getAnswerToLastCmdBatch();
// 0xFF: no command sent by now
// 0: started, in progress
// 1: done and OK
// 2: done and error
myStr.clear();
myStr.append(QString::number(uctmp));
label16->setText(myStr);
uctmp=HWaccess->log_getAnswerToLastSlaveRequest();
// use only for ONE request/command
// return: 0xFF: result unknown by now as sending is ongoing
// 0=OK
// 1= wrong length 2=wrong start sign 5= wrong crc
// 6= slave: master cmd was wrong 7: slave: could not write/read data
// 8=timeout, got no response from slave
myStr.clear();
myStr.append(QString::number(uctmp));
label17->setText(myStr);
*/
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

102
win06_prn.h Executable file
View File

@ -0,0 +1,102 @@
#ifndef WIN06_PRN_H
#define WIN06_PRN_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win06 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QLabel *lab4;
QLabel *lab5;
QLabel *lab6;
QLabel *lab7;
QLabel *lab8;
QLabel *lab9;
QLabel *labSignal;
QLabel *lab15;
QLabel *label16;
QLabel *label17;
QTimer *myTO;
QPushButton *butPrnPow;
QLabel *showPrnState1;
QLabel *showPrnState2;
QLabel *showPrnResult;
QComboBox * cb_templNr;
QComboBox * cb_kombiNr;
QByteArray dummyText;
public:
explicit T_win06(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win06();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_sendDD1(void);
void slot_sendDD2(void);
void slot_rdBackDD(void);
void slot_printVaris(void);
void slot_printCombi(void);
void slot_printTicket(void);
void signalPrnDone(void);
void signalPrnErr(void);
void slot_powerButton(void);
void slot_printLogo(void);
void slot_printAcc(void);
void slot_printCut(void);
void slot_sendText(void);
void slot_setup(void);
void slot_movPap(void);
void slot_movBack(void);
void slot_fonts(void);
void slot_letters(void);
void slot_printQr(void);
};
#endif

511
win07_coin.cpp Executable file
View File

@ -0,0 +1,511 @@
#include "win07_coin.h"
T_win07::T_win07(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
// Überschrift
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *LAB_HEAD = new QLabel("Cash Devices");
LAB_HEAD->setFont(myTabFont);
myLayout->addWidget(LAB_HEAD, 0,0);
QLabel *Led_empty = new QLabel(" ");
myLayout->addWidget(Led_empty, 0,2);
myLayout->addWidget(Led_empty, 0,5);
myLayout->addWidget(Led_empty, 6,0);
myLayout->addWidget(Led_empty, 8,0);
QLabel *ShutLab3 = new QLabel(tr(" MDB Bus"));
ShutLab3->setFont(myTabFont);
myLayout->addWidget(ShutLab3, 1,0);
QLabel *ShutLab4 = new QLabel(tr("Coin Blocker"));
ShutLab4->setFont(myTabFont);
myLayout->addWidget(ShutLab4, 1,3);
QLabel *ShutLab5 = new QLabel(tr("Coin Escrow"));
ShutLab5->setFont(myTabFont);
myLayout->addWidget(ShutLab5, 1,6);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
shut_PB1 = new QPushButton(" MDB\nPower");
shut_PB1->setCheckable(true); // true = toggle button
shut_PB1->setAutoDefault(true); // beim start ein (weil mdb Spannung default EIN ist)
shut_PB1->setFont(myTabFont);
myLayout->addWidget(shut_PB1, 2,0);
connect(shut_PB1, SIGNAL(clicked()), this, SLOT(pbMdbPow()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
labMdbPowDev = new QLabel("dev");
labMdbPowDev->setFrameStyle(QFrame::Box | QFrame::Sunken);
labMdbPowDev->setLineWidth(3); // 1,2,3
labMdbPowDev->setMaximumWidth(60);
labMdbPowDev->setStyleSheet("background-color: white"); // white red green
labMdbPowDev->setFont(myTabFont);
myLayout->addWidget(labMdbPowDev, 2,1);
QLabel *ShutLab30 = new QLabel(tr(" MDB 5V\nalways on"));
ShutLab30->setFont(myTabFont);
myLayout->addWidget(ShutLab30, 3,0);
labMdbPowBus = new QLabel("bus");
labMdbPowBus->setFrameStyle(QFrame::Box | QFrame::Sunken);
labMdbPowBus->setLineWidth(3); // 1,2,3
labMdbPowBus->setMaximumWidth(60);
labMdbPowBus->setStyleSheet("background-color: white"); // white red green
labMdbPowBus->setFont(myTabFont);
myLayout->addWidget(labMdbPowBus, 3,1);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
shut_PB2 = new QPushButton(" MDB wake\n out");
shut_PB2->setCheckable(true); // true = toggle button
shut_PB2->setAutoDefault(true); // beim start ein
shut_PB2->setFont(myTabFont);
myLayout->addWidget(shut_PB2, 4,0);
connect(shut_PB2, SIGNAL(clicked()), this, SLOT(pbMdbWak()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
labMdbWakIn = new QLabel("wake\n In");
labMdbWakIn->setFrameStyle(QFrame::Box | QFrame::Sunken);
labMdbWakIn->setLineWidth(3); // 1,2,3
labMdbWakIn->setMaximumWidth(60);
//labMdbWakIn->setMaximumHeight(60);
labMdbWakIn->setStyleSheet("background-color: white"); // white red green
labMdbWakIn->setFont(myTabFont);
myLayout->addWidget(labMdbWakIn, 4,1);
/* motor dauerlauf nicht nötig
rejMot_PB5 = new QPushButton(" reject motor:");
rejMot_PB5->setCheckable(true); // true = toggle button
rejMot_PB5->setAutoDefault(false); // beim start aus
rejMot_PB5->setStyleSheet("background-color: white");
rejMot_PB5->setFont(myTabFont);
myLayout->addWidget(rejMot_PB5, 5,1);
connect(rejMot_PB5, SIGNAL(clicked()), this, SLOT(PB5clicked()));
*/
QLabel *empty2 = new QLabel(" ");
empty2->setFont(myTabFont);
myLayout->addWidget(empty2, 5,0);
QLabel *rej_label = new QLabel("reject motor");
rej_label->setFont(myTabFont);
myLayout->addWidget(rej_label, 6,0);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
QPushButton *rejMot_PB6 = new QPushButton(" Turn");
rejMot_PB6->setCheckable(false); // true = toggle button
rejMot_PB6->setAutoDefault(false); // beim start aus
rejMot_PB6->setFont(myTabFont);
myLayout->addWidget(rejMot_PB6, 7,0);
connect(rejMot_PB6, SIGNAL(clicked()), this, SLOT(pbRejectTurn()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
labRejSw = new QLabel(" ");
labRejSw->setFrameStyle(QFrame::Box | QFrame::Sunken);
labRejSw->setLineWidth(3); // 1,2,3
labRejSw->setMaximumWidth(60);
labRejSw->setMaximumHeight(40);
labRejSw->setStyleSheet("background-color: white"); // white red green
labRejSw->setFont(myTabFont);
myLayout->addWidget(labRejSw, 7,1);
// 2. Spalte
// read Coin-Attached-Input
labBlockFree = new QLabel(" - ");
labBlockFree->setFrameStyle(QFrame::Box | QFrame::Sunken);
labBlockFree->setLineWidth(3); // 1,2,3
labBlockFree->setMaximumWidth(80);
labBlockFree->setMaximumHeight(40);
labBlockFree->setStyleSheet("background-color: white");
labBlockFree->setFont(myTabFont);
myLayout->addWidget(labBlockFree, 2,3);
// readback Slot is Open (right from uC-output)
labSlotPower = new QLabel("");
labSlotPower->setFrameStyle(QFrame::Box | QFrame::Sunken);
labSlotPower->setLineWidth(3); // 1,2,3
labSlotPower->setMaximumWidth(25);
labSlotPower->setMaximumHeight(25);
labSlotPower->setStyleSheet("background-color: white");
labSlotPower->setFont(myTabFont);
myLayout->addWidget(labSlotPower, 3,4);
// coin blocker
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
Led_PB17 = new QPushButton("Open Slot\n");
Led_PB17->setCheckable(true); // true = toggle button
Led_PB17->setAutoDefault(false); // beim start aus
Led_PB17->setFont(myTabFont);
myLayout->addWidget(Led_PB17, 3,3);
connect(Led_PB17, SIGNAL(clicked()), this, SLOT(pbShutOpen()));
// Coin Blocker: open for 3s
QPushButton *Led_PB27 = new QPushButton("Open for 3s\n");
Led_PB27->setCheckable(false); // true = toggle button
Led_PB27->setAutoDefault(false); // beim start aus
Led_PB27->setFont(myTabFont);
myLayout->addWidget(Led_PB27, 4,3);
connect(Led_PB27, SIGNAL(clicked()), this, SLOT(pbShut3s()));
/* nicht nötig
QPushButton *Led_PB28 = new QPushButton("\nOpen 4 Coin\n");
Led_PB28->setCheckable(true); // true = toggle button
Led_PB28->setAutoDefault(false); // beim start aus
Led_PB28->setFont(myTabFont);
myLayout->addWidget(Led_PB28, 4,3);
connect(Led_PB28, SIGNAL(clicked()), this, SLOT(PB28clicked()));
*/
pb_ledas = new QPushButton("LED issue");
pb_ledas->setCheckable(true); // true = toggle button
pb_ledas->setAutoDefault(false); // beim start aus
pb_ledas->setFont(myTabFont);
myLayout->addWidget(pb_ledas, 7,3);
connect(pb_ledas, SIGNAL(clicked()), this, SLOT(pbLEDclicked()));
// coin Escrow, 3. Spalte
myTabFont.setPixelSize(PIXELSIZE_LABEL);
labEscrowSw = new QLabel(" switch");
labEscrowSw->setFrameStyle(QFrame::Box | QFrame::Sunken);
labEscrowSw->setLineWidth(3); // 1,2,3
labEscrowSw->setStyleSheet("background-color: white");
labEscrowSw->setFont(myTabFont);
myLayout->addWidget(labEscrowSw, 2,6);
/* nicht nötig
Led_PB18 = new QPushButton("\nOpen Take");
Led_PB18->setCheckable(true); // true = toggle button
Led_PB18->setAutoDefault(false); // beim start aus
Led_PB18->setFont(myTabFont);
myLayout->addWidget(Led_PB18, 3,6);
connect(Led_PB18, SIGNAL(clicked()), this, SLOT(PB18clicked()));
Led_PB19 = new QPushButton("\nOpen Give");
Led_PB19->setCheckable(true); // true = toggle button
Led_PB19->setAutoDefault(false); // beim start aus
Led_PB19->setFont(myTabFont);
myLayout->addWidget(Led_PB19, 4,6);
connect(Led_PB19, SIGNAL(clicked()), this, SLOT(PB19clicked()));
*/
// Coin Escrow Level2: open flap for 1s
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
QPushButton *Led_PB30 = new QPushButton("\n Take Coins");
Led_PB30->setCheckable(false); // true = toggle button
Led_PB30->setAutoDefault(false); // beim start aus
Led_PB30->setMinimumHeight(50);
Led_PB30->setFont(myTabFont);
myLayout->addWidget(Led_PB30, 3,6);
connect(Led_PB30, SIGNAL(clicked()), this, SLOT(pbEscrowTake()));
// Coin Escrow Level2: open flap for 1s
QPushButton *Led_PB31 = new QPushButton("\nReturn Coins");
Led_PB31->setCheckable(false); // true = toggle button
Led_PB31->setAutoDefault(false); // beim start aus
Led_PB31->setMinimumHeight(50);
Led_PB31->setFont(myTabFont);
myLayout->addWidget(Led_PB31, 4,6);
connect(Led_PB31, SIGNAL(clicked()), this, SLOT(pbEscrowRet()));
// Barrier
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab_barr = new QLabel("Barrier");
lab_barr->setFont(myTabFont);
myLayout->addWidget(lab_barr, 6,6);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_relay = new QPushButton("Relais\nBarrier");
pb_relay->setCheckable(true); // true = toggle button
pb_relay->setAutoDefault(false); // beim start aus
pb_relay->setFont(myTabFont);
myLayout->addWidget(pb_relay, 7,6);
connect(pb_relay, SIGNAL(clicked()), this, SLOT(pbRELclicked()));
// Barrier INPUTs:
myTabFont.setPixelSize(PIXELSIZE_LABEL);
labBarOk = new QLabel(" OK ");
labBarOk->setFrameStyle(QFrame::Box | QFrame::Sunken);
labBarOk->setLineWidth(3); // 1,2,3
labBarOk->setMaximumWidth(80);
labBarOk->setMaximumHeight(40);
labBarOk->setStyleSheet("background-color: white");
labBarOk->setFont(myTabFont);
myLayout->addWidget(labBarOk, 6,8);
labBarOpen = new QLabel(" open");
labBarOpen->setFrameStyle(QFrame::Box | QFrame::Sunken);
labBarOpen->setLineWidth(3); // 1,2,3
labBarOpen->setMaximumWidth(80);
labBarOpen->setMaximumHeight(40);
labBarOpen->setStyleSheet("background-color: white");
labBarOpen->setFont(myTabFont);
myLayout->addWidget(labBarOpen, 7,8);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
HWaccess->mdb_switchPower(1);
}
T_win07::~T_win07()
{
close();
}
void T_win07::Nav_back(void)
{
myNextStep=WCS_WIN07BAK;
}
void T_win07::Nav_home(void)
{
myNextStep=WCS_WIN07MID;
}
void T_win07::Nav_next(void)
{
myNextStep=WCS_WIN07FWD;
}
bool T_win07::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win07::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
/*
*/
// U_device:
if (HWaccess->mdb_deviceVoltageOK()) // MDB12V
labMdbPowDev->setStyleSheet("background-color: green"); // white red green
else
labMdbPowDev->setStyleSheet("background-color: white"); // white red green
if (HWaccess->mdb_busVoltageOk()) // =MDB-Bus-Pwr (5V), wird im DC auf 1 gehalten
labMdbPowBus->setStyleSheet("background-color: yellow"); // white red green
else
labMdbPowBus->setStyleSheet("background-color: white"); // white red green
if (HWaccess->mdb_WakeINisActive())
labMdbWakIn->setStyleSheet("background-color: yellow"); // white red green
else
labMdbWakIn->setStyleSheet("background-color: white"); // white red green
if (HWaccess->cash_getRejectMotorHomePos())
labRejSw->setStyleSheet("background-color: green");
else
labRejSw->setStyleSheet("background-color: white");
// readback Coin Slot is Open (right from uC-output)
if (HWaccess->coin_shutterIsOpen())
labSlotPower->setStyleSheet("background-color: green");
else
labSlotPower->setStyleSheet("background-color: white");
// read Coin-Attached-Input
if (HWaccess->coid_isAttached())
{
labBlockFree->setText("COIN");
labBlockFree->setStyleSheet("background-color: green");
} else
{
labBlockFree->setText("FREE");
labBlockFree->setStyleSheet("background-color: white");
}
// Coin Escrow Flap is Open
if (HWaccess->coin_escrowIsOpen())
// retval: 1:return flap is open 2:take flap is open 0:closed
labEscrowSw->setStyleSheet("background-color: green");
else
labEscrowSw->setStyleSheet("background-color: white");
// read OptoCouplers:
if (HWaccess->bar_optoIn1isOn())
labBarOk->setStyleSheet("background-color: yellow");
else
labBarOk->setStyleSheet("background-color: white");
if (HWaccess->bar_optoIn2isOn())
labBarOpen->setStyleSheet("background-color: yellow");
else
labBarOpen->setStyleSheet("background-color: white");
/*
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
} */
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}
void T_win07::pbMdbPow(void)
{
if (shut_PB1->isChecked())
HWaccess->mdb_switchPower(1);
else
HWaccess->mdb_switchPower(0);
}
void T_win07::pbMdbWak(void)
{
if (shut_PB2->isChecked())
HWaccess->mdb_switchWake(1);
else
HWaccess->mdb_switchWake(0);
}
void T_win07::pbRejectTurn(void)
{
HWaccess->coin_rejectCoins();
}
void T_win07::pbShutOpen(void)
{
if (Led_PB17->isChecked())
{
//qDebug()<<"main app 1";
HWaccess->shut_move(1);
} else
{
//qDebug()<<"main app 0";
HWaccess->shut_move(0);
}
}
void T_win07::pbShut3s(void)
{
// coin shutter, open for shutter-time
HWaccess->shut_sendOpeningTime(3000);
HWaccess->shut_openOnce();
}
void T_win07::pbLEDclicked(void)
{
if (pb_ledas->isChecked())
HWaccess->led_switchLedPaper(1,0,0);
else
HWaccess->led_switchLedPaper(0,0,0);
}
void T_win07::pbEscrowTake(void)
{
HWaccess->esc_takeMoney();
}
void T_win07::pbEscrowRet(void)
{
HWaccess->esc_returnMoney();
}
void T_win07::pbRELclicked(void)
{
// Relay (Barrier)
if (pb_relay->isChecked())
HWaccess->bar_OpenBarrier(1);
else
HWaccess->bar_OpenBarrier(0);
}

86
win07_coin.h Executable file
View File

@ -0,0 +1,86 @@
#ifndef WIN07_COIN_H
#define WIN07_COIN_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win07 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QLabel *labMdbPowDev;
QLabel *labMdbPowBus;
QLabel *labMdbWakIn;
QLabel *labRejSw;
QLabel *labBlockFree;
QLabel *labSlotPower;
QLabel *labEscrowSw;
QLabel *labBarOpen;
QLabel *labBarOk;
QPushButton *shut_PB1;
QPushButton *shut_PB2;
QPushButton *Led_PB17;
QPushButton *pb_ledas;
QPushButton *pb_relay;
public:
explicit T_win07(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win07();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void pbMdbPow(void);
void pbMdbWak(void);
void pbRejectTurn(void);
void pbShutOpen(void);
void pbShut3s(void);
void pbLEDclicked(void);
void pbEscrowTake(void);
void pbEscrowRet(void);
void pbRELclicked(void);
};
#endif

423
win08_mif.cpp Executable file
View File

@ -0,0 +1,423 @@
#include "win08_mif.h"
T_win08::T_win08(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(18);
/*
lab1 =new QLabel(tr("Mifare Card\n Reader"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,0,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,1);
*/
pbMifPwr = new QPushButton("Power");
pbMifPwr->setCheckable(true); // true = toggle button
pbMifPwr->setAutoDefault(false); // beim start aus
pbMifPwr->setFont(myTabFont);
pbMifPwr->setStyleSheet("background-color: white");
myLayout->addWidget(pbMifPwr, 2, 4);
connect(pbMifPwr, SIGNAL(clicked()), this, SLOT(pbMifPower()));
QLabel *lab3 =new QLabel("Mifare Card\n Reader");
// QLabel *lab3 =new QLabel(tr("Reader State:"));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,2,0);
myTabFont.setPixelSize(18);
labReaderState =new QLabel(); //QListWidget();
labReaderState->setFont(myTabFont);
//labReaderState->setMinimumWidth(300);
//labReaderState->setMinimumHeight(150);
labReaderState->setLineWidth(3); // 1,2,3
labReaderState->setStyleSheet("background-color: white");
labReaderState->setFont(myTabFont);
myLayout->addWidget(labReaderState,2,2);
myTabFont.setPixelSize(18);
QLabel *lab6 =new QLabel(tr("Card tapped?"));
lab6->setFont(myTabFont);
myLayout->addWidget(lab6,4,0);
labCardTap =new QLabel(tr(" "));
labCardTap->setFont(myTabFont);
labCardTap->setMinimumWidth(300);
labCardTap->setLineWidth(3); // 1,2,3
labCardTap->setStyleSheet("background-color: white");
myLayout->addWidget(labCardTap,4,2);
QLabel *lab4 =new QLabel(tr("Card ID: "));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,6,0);
labCardUid =new QLabel(" ");
labCardUid->setFont(myTabFont);
labCardUid->setMinimumWidth(300);
labCardUid->setLineWidth(3); // 1,2,3
labCardUid->setStyleSheet("background-color: white");
myLayout->addWidget(labCardUid,6,2);
QLabel *lab10 =new QLabel(tr(" card size: "));
lab10->setFont(myTabFont);
myLayout->addWidget(lab10,8,0);
labCardSiz =new QLabel(" ");
labCardSiz->setFont(myTabFont);
labCardSiz->setMinimumWidth(300);
labCardSiz->setLineWidth(3); // 1,2,3
labCardSiz->setStyleSheet("background-color: white");
myLayout->addWidget(labCardSiz,8,2);
QLabel *lab11 =new QLabel(tr("ATBcard CuNu: "));
lab11->setFont(myTabFont);
myLayout->addWidget(lab11,10,0);
labCardCunu =new QLabel(" ");
labCardCunu->setFont(myTabFont);
labCardCunu->setMinimumWidth(300);
labCardCunu->setLineWidth(3); // 1,2,3
labCardCunu->setStyleSheet("background-color: white");
myLayout->addWidget(labCardCunu,10,2);
// kind of card and card valid:
QLabel *lab12 =new QLabel(tr("ATB Type\n and validty: "));
lab12->setFont(myTabFont);
myLayout->addWidget(lab12,12,0);
labCardValid =new QLabel(" ");
labCardValid->setFont(myTabFont);
labCardValid->setMinimumWidth(300);
labCardValid->setLineWidth(3); // 1,2,3
labCardValid->setStyleSheet("background-color: white");
myLayout->addWidget(labCardValid,12,2);
QLabel *lab13 =new QLabel(tr("personal code:"));
lab13->setFont(myTabFont);
myLayout->addWidget(lab13,14,0);
labCardPerso =new QLabel(" ");
labCardPerso->setFont(myTabFont);
labCardPerso->setMinimumWidth(300);
labCardPerso->setLineWidth(3); // 1,2,3
labCardPerso->setStyleSheet("background-color: white");
myLayout->addWidget(labCardPerso,14,2);
QLabel *lab14 =new QLabel(tr("expire time:"));
lab14->setFont(myTabFont);
myLayout->addWidget(lab14,16,0);
labCardExpire =new QLabel(" ");
labCardExpire->setFont(myTabFont);
labCardExpire->setMinimumWidth(300);
labCardExpire->setLineWidth(3); // 1,2,3
labCardExpire->setStyleSheet("background-color: white");
myLayout->addWidget(labCardExpire,16,2);
/*
QLabel *lab5 =new QLabel(tr("Seg.0 binary:"));
lab5->setFont(myTabFont);
myLayout->addWidget(lab5,8,0);
myTabFont.setPixelSize(16);
dispCardData =new QListWidget();
dispCardData->setFont(myTabFont);
dispCardData->setMinimumWidth(300);
dispCardData->setLineWidth(3); // 1,2,3
dispCardData->setStyleSheet("background-color: white");
myLayout->addWidget(dispCardData,8,2);
QLabel *lab7 =new QLabel(tr("ATB Card Data:"));
lab7->setFont(myTabFont);
myLayout->addWidget(lab7,9,0);
myTabFont.setPixelSize(16);
dispATBdata =new QListWidget();
dispATBdata->setFont(myTabFont);
dispATBdata->setMinimumWidth(300);
dispATBdata->setLineWidth(3); // 1,2,3
dispATBdata->setStyleSheet("background-color: white");
myLayout->addWidget(dispATBdata,9,2);
*/
/*
pbMiftest = new QPushButton(" TEST");
pbMiftest->setCheckable(false); // true = toggle button
pbMiftest->setAutoDefault(false); // beim start aus
pbMiftest->setFont(myTabFont);
pbMiftest->setStyleSheet("background-color: white");
myLayout->addWidget(pbMiftest, 9, 4);
connect(pbMiftest, SIGNAL(clicked()), this, SLOT(pbMifTest()));
*/
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win08::~T_win08()
{
close();
}
void T_win08::pbMifPower(void)
{
if (pbMifPwr->isChecked())
{
HWaccess->mif_readerOn(1);
} else
HWaccess->mif_readerOn(0);
}
//void T_win08::pbMifTest(void)
//{
// HWaccess->prn_sendPrnSysCmd(0x12, 0x34, 0x56789012);
//}
void T_win08::Nav_back(void)
{
myNextStep=WCS_WIN08BAK;
}
void T_win08::Nav_home(void)
{
myNextStep=WCS_WIN08MID;
}
void T_win08::Nav_next(void)
{
myNextStep=WCS_WIN08FWD;
}
static UCHAR sendingOrder;
bool T_win08::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
sendingOrder=0;
return false;
}
bool T_win08::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
//uint8_t mifData[66];
QString myStr;
//char myChr;
*nextScreen=0; // 0=no change
*useNavi=0;
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
// Power Taste
if (HWaccess->mif_isMifarePowerOn())
{
pbMifPwr->setStyleSheet("background-color: green");
} else
{
pbMifPwr->setStyleSheet("background-color: white");
labReaderState->clear();
labCardTap->clear();
labCardUid->clear();
//dispCardData->clear();
//dispATBdata->clear();
labCardTap->setStyleSheet("background-color: white");
labCardSiz->clear();
labCardCunu->clear();
labCardValid->clear();
labCardPerso->clear();
labCardExpire->clear();
return 0;
}
struct T_moduleCondition myDevCond;
HWaccess->sys_getDeviceConditions(&myDevCond);
uint8_t readerState=myDevCond.mifareReader; // 0: unknown 1=OK 200=no response 201=wrong response 202: Reader reports HW-error
// request Mifare data. As we need all this data just for test it's not requested automatically
sendingOrder++; // inc every 100ms
if (sendingOrder==10)
sendingOrder=1;
else if (sendingOrder==2)
HWaccess->request_MifareID();
else if (sendingOrder==6)
HWaccess->request_MifareAtbType();
switch (readerState)
{
case 0: labReaderState->setText(" state unknown"); break;
case 1: labReaderState->setText(" reader OK"); break;
case 200: labReaderState->setText(" no response from reader"); break;
case 201: labReaderState->setText(" wrong response from reader"); break;
case 202: labReaderState->setText(" reader HW error"); break;
}
if (HWaccess->mif_readerIsOK())
{
labReaderState->setStyleSheet("background-color: green");
} else
{
labReaderState->setStyleSheet("background-color: red");
labCardUid->clear();
labCardTap->clear();
//dispCardData->clear();
//dispATBdata->clear();
labCardSiz->clear();
labCardCunu->clear();
labCardValid->clear();
labCardPerso->clear();
labCardExpire->clear();
}
if (readerState==1)
{
// myStr.clear();
// myStr.append(" reader OK, Type="); // besser nicht anzeigen, gefaerdet Ersatzteil-business
// myStr.append(HWaccess->mif_getReaderType());
// labReaderState->setText(myStr);
// Type anzeigen
} else
{
labCardTap->clear();
labCardTap->setStyleSheet("background-color: white");
labCardUid->clear();
//dispCardData->clear();
//dispATBdata->clear();
labCardSiz->clear();
labCardCunu->clear();
labCardValid->clear();
labCardPerso->clear();
labCardExpire->clear();
return 0;
}
// Card-attached?
if (HWaccess->mif_cardIsAttached())
{
labCardTap->setText(" CARD attached");
if (HWaccess->mif_readResult()>0)
labCardTap->setStyleSheet("background-color: green");
else
labCardTap->setStyleSheet("background-color: yellow");
} else
{
labCardTap->setText("-no card-");
labCardTap->setStyleSheet("background-color: white");
labCardUid->clear();
//dispCardData->clear();
labCardUid->clear();
//dispATBdata->clear();
labCardSiz->clear();
labCardCunu->clear();
labCardValid->clear();
labCardPerso->clear();
labCardExpire->clear();
return false;
}
labCardUid->setText(HWaccess->mif_cardUID());
uint8_t cardSize, idLeng;
HWaccess->mif_getCardSize(&cardSize, &idLeng);
//cardSize=1k or 4kByte idLeng =4Byte or 7 byte
myStr.clear();
myStr.append(" memSize: ");
myStr.append(QString::number(cardSize,10));
myStr.append(" length_of_ID: ");
myStr.append(QString::number(idLeng));
myStr.append(" byte");
labCardSiz->setText(myStr);
labCardCunu->setText(QString::number(HWaccess->mif_getAtbCardCuNu()));
if (HWaccess->mif_isValidAtbCard())
{
labCardValid->setStyleSheet("background-color: green");
} else
{
labCardValid->setStyleSheet("background-color: yellow");
}
uint8_t ret=HWaccess->mif_getAtbCardTyp();
// return 1=upper door card 1=lower door 3=printer-test 4=coin-test
// 0: not a valid atb2020 card
switch (ret)
{
case 1: labCardValid->setText(" upper door "); break;
case 2: labCardValid->setText(" lower door "); break;
case 3: labCardValid->setText(" printer test"); break;
case 4: labCardValid->setText(" coin test "); break;
default: labCardValid->setText(" --- no atb card ---"); break;
}
labCardPerso->setText(HWaccess->mif_getAtbCardPerso());
uint8_t year, month, day, hour, minute;
HWaccess->mif_getAtbCardExpire(&year, &month, &day, &hour, &minute);
//mif_getAtbCardExpire(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute)
myStr.clear();
myStr.append(" expires at (d.m.y h:m): ");
myStr.append(QString::number(day,10));
myStr.append(".");
myStr.append(QString::number(month,10));
myStr.append(".");
myStr.append(QString::number(year,10));
myStr.append(" ");
myStr.append(QString::number(hour,10));
myStr.append(":");
myStr.append(QString::number(minute,10));
labCardExpire->setText(myStr);
return false;
}

69
win08_mif.h Executable file
View File

@ -0,0 +1,69 @@
#ifndef WIN08_MIF_H
#define WIN08_MIF_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include <QLineEdit>
#include "guidefs.h"
class T_win08 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QPushButton *pbMifPwr; //, *pbMiftest;
QLabel *labCardTap;
// QListWidget *labReaderState;
QLabel *labReaderState;
QLabel *labCardUid;
// QListWidget *dispCardData, *dispATBdata;
QLabel *labCardSiz, *labCardCunu, *labCardValid, *labCardPerso, *labCardExpire;
public:
explicit T_win08(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win08();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void pbMifPower(void);
//void pbMifTest(void);
};
#endif

308
win09_gsm.cpp Executable file
View File

@ -0,0 +1,308 @@
#include "win09_gsm.h"
/*
struct T_moduleCondition
{
uint8_t modem;
uint8_t signal; // 1...99
uint8_t regist; // 100:not 1:reg 2:ping OK 3:gotTime
uint8_t creditTerm;
*/
static bool wakeTerminal, wakeModem, resetModem;
T_win09::T_win09(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("Modem"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,1,1);
lab4 =new QLabel(tr(" "));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,1,2);
pbModemPwr = new QPushButton("Modem (credit) Power");
pbModemPwr->setCheckable(true); // true = toggle button
pbModemPwr->setAutoDefault(false); // beim start aus
pbModemPwr->setFont(myTabFont);
pbModemPwr->setStyleSheet("background-color: white");
myLayout->addWidget(pbModemPwr, 3, 1);
connect(pbModemPwr, SIGNAL(clicked()), this, SLOT(slot_ModemPower()));
lab8 =new QLabel(tr(" "));
lab8->setFont(myTabFont);
myLayout->addWidget(lab8,4,1);
pbModemWake = new QPushButton("Modem wake");
pbModemWake->setCheckable(false); // true = toggle button
pbModemWake->setFont(myTabFont);
pbModemWake->setStyleSheet("background-color: white");
myLayout->addWidget(pbModemWake, 5, 1);
connect(pbModemWake, SIGNAL(clicked()), this, SLOT(slot_ModemWake()));
lab9 =new QLabel(tr(" "));
lab9->setFont(myTabFont);
myLayout->addWidget(lab9,6,1);
pbModemRes = new QPushButton("Modem reset");
pbModemRes->setCheckable(false); // true = toggle button
pbModemRes->setFont(myTabFont);
pbModemRes->setStyleSheet("background-color: white");
myLayout->addWidget(pbModemRes, 7, 1);
connect(pbModemRes, SIGNAL(clicked()), this, SLOT(slot_ModemRes()));
lab5 =new QLabel(tr(" modem condition:"));
lab5->setFont(myTabFont);
myLayout->addWidget(lab5,4,2);
showModemCondition = new QLabel();
showModemCondition->setFont(myTabFont);
showModemCondition->setStyleSheet("background-color: white");
myLayout->addWidget(showModemCondition,5,2);
lab10 =new QLabel(tr(" "));
lab10->setFont(myTabFont);
myLayout->addWidget(lab10,8,1);
pbCreditPwr = new QPushButton("Creditcard (PTU) power");
pbCreditPwr->setCheckable(true); // true = toggle button
pbCreditPwr->setAutoDefault(false); // beim start aus
pbCreditPwr->setFont(myTabFont);
pbCreditPwr->setStyleSheet("background-color: white");
myLayout->addWidget(pbCreditPwr, 9, 1);
connect(pbCreditPwr, SIGNAL(clicked()), this, SLOT(slot_CreditPower()));
lab11 =new QLabel(tr(" "));
lab11->setFont(myTabFont);
myLayout->addWidget(lab11,10,1);
pbCreditWake = new QPushButton("Creditcard wake");
pbCreditWake->setCheckable(false); // true = toggle button
pbCreditWake->setFont(myTabFont);
pbCreditWake->setStyleSheet("background-color: white");
myLayout->addWidget(pbCreditWake, 11, 1);
connect(pbCreditWake, SIGNAL(clicked()), this, SLOT(slot_CreditWake()));
lab7 =new QLabel(tr(" "));
lab7->setFont(myTabFont);
myLayout->addWidget(lab7,12,1);
pbCreditWake = new QPushButton("restart System test (20s!)");
pbCreditWake->setCheckable(false); // true = toggle button
pbCreditWake->setFont(myTabFont);
pbCreditWake->setStyleSheet("background-color: white");
myLayout->addWidget(pbCreditWake, 13, 1);
connect(pbCreditWake, SIGNAL(clicked()), this, SLOT(slot_startTest()));
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(100);
wakeTerminal=false;
wakeModem=false;
resetModem=false;
}
T_win09::~T_win09()
{
close();
}
void T_win09::Nav_back(void)
{
myNextStep=WCS_WIN09BAK;
}
void T_win09::Nav_home(void)
{
myNextStep=WCS_WIN09MID;
}
void T_win09::Nav_next(void)
{
myNextStep=WCS_WIN09FWD;
}
void T_win09::slot_ModemPower(void)
{
if (pbModemPwr->isChecked())
{
HWaccess->mod_switchPower(true);
} else
HWaccess->mod_switchPower(false);
}
void T_win09::slot_ModemWake(void)
{
HWaccess->mod_switchWake(true);
myTO->start(200);
wakeModem=true;
}
void T_win09::slot_ModemRes(void)
{
// Modem Reset: aux6=used
//aux_setUsage(0x20);
//aux_setOutputs(0x20); aux_setOutputs(0);
HWaccess->aux_setUsage(0x20);
HWaccess->aux_setOutputs(0x20);
myTO->start(200);
resetModem=true;
}
void T_win09::slot_CreditPower(void)
{
if (pbCreditPwr->isChecked())
{
HWaccess->credit_switchPower(true);
} else
HWaccess->credit_switchPower(false);
}
void T_win09::slot_CreditWake(void)
{
HWaccess->credit_switchWake(true);
myTO->start(200);
wakeTerminal=true;
}
void T_win09::slot_startTest(void)
{
HWaccess->sys_runCompleteTest();
}
bool T_win09::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win09::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
QString myStr;
bool bret;
if (!myTO->isActive())
{
// time out
if (wakeModem)
HWaccess->mod_switchWake(false);
if (wakeTerminal)
HWaccess->credit_switchWake(false);
if (resetModem)
HWaccess->aux_setOutputs(0);
myTO->stop();
wakeTerminal=false;
wakeModem=false;
resetModem=false;
}
bret=HWaccess->mod_isGsmPowerOn();
if (bret)
pbModemPwr->setStyleSheet("background-color: green");
else
pbCreditPwr->setStyleSheet("background-color: white");
bret=HWaccess->cred_isCreditPowerOn();
if (bret)
pbCreditPwr->setStyleSheet("background-color: green");
else
pbCreditPwr->setStyleSheet("background-color: white");
// restart complete system test with cmd 149
/*
struct T_moduleCondition
{
uint8_t modem; // 0:unknown 1:OK 100: sim card problem 200: no resp 201: wrong modem type
uint8_t signal; // 1...99
uint8_t regist; // 100:not 1:reg (not impl.: 2:ping OK 3:gotTime )
uint8_t creditTerm; // always 1
*/
struct T_moduleCondition modulCond;
HWaccess->sys_getDeviceConditions(&modulCond);
if (modulCond.modem==100)
showModemCondition->setText("Simcard problem");
else
if (modulCond.modem==200)
showModemCondition->setText("not connected");
else
if (modulCond.modem==201)
showModemCondition->setText("wrong type");
else
if (modulCond.modem==1)
{
// Modem OK
myStr.append("modem OK, ");
myStr.clear();
if (modulCond.regist==1)
myStr.append("registered, ");
if (modulCond.regist==100)
myStr.append(" not registered, ");
myStr.append("last signal: ");
myStr.append(QString::number(modulCond.signal,10));
showModemCondition->setText(myStr);
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

64
win09_gsm.h Executable file
View File

@ -0,0 +1,64 @@
#ifndef WIN09_GSM_H
#define WIN09_GSM_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win09 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1, *lab2, *lab3, *lab4, *lab5, *lab6, *lab7, *lab8, *lab9, *lab10, *lab11;
QTimer *myTO;
QPushButton *pbModemPwr, *pbModemWake, *pbCreditPwr, *pbCreditWake, *pbModemRes;
QLabel *showModemCondition;
public:
explicit T_win09(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win09();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_ModemPower(void);
void slot_ModemWake(void);
void slot_CreditPower(void);
void slot_CreditWake(void);
void slot_startTest(void);
void slot_ModemRes(void);
};
#endif

609
win10_pay.cpp Executable file
View File

@ -0,0 +1,609 @@
#include "win10_pay.h"
#define TIME_DISPLAY_SIGNALS_MS 2000
static uint8_t win10_paymentStarted;
static uint32_t win10_value;
T_win10::T_win10(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Testing Payment"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
QLabel *labs2 =new QLabel(tr(" "));
labs2->setFont(myTabFont);
myLayout->addWidget(labs2,1,1);
// QLabel *labs3 =new QLabel(tr(" "));
// labs3->setFont(myTabFont);
// myLayout->addWidget(labs3,1,2);
QLabel *labs4 =new QLabel(tr(" "));
labs4->setFont(myTabFont);
myLayout->addWidget(labs4,1,3);
QLabel *labs5 =new QLabel(tr(" "));
labs5->setFont(myTabFont);
myLayout->addWidget(labs5,1,4);
// lab2 =new QLabel(tr(" "));
// lab2->setFont(myTabFont);
// myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr("Amount in cent:"));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
insertedCoin = new QLineEdit();
insertedCoin->setMaxLength(10);
insertedCoin->setFrame(true);
insertedCoin->setText("-");
insertedCoin->setReadOnly(true);
insertedCoin->setFont(myTabFont);
insertedCoin->setMaxLength(100);
insertedCoin->setStyleSheet("background-color: white");
myLayout->addWidget(insertedCoin,3,1);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab4 =new QLabel(tr("inserted total: "));
lab4->setFont(myTabFont);
myLayout->addWidget(lab4,4,0);
myTabFont.setPixelSize(PIXELSIZE_DATA);
insertedTotal = new QLineEdit();
insertedTotal->setMaxLength(10);
insertedTotal->setFrame(true);
insertedTotal->setText("-");
insertedTotal->setReadOnly(true);
insertedTotal->setFont(myTabFont);
insertedTotal->setMaxLength(100);
insertedTotal->setStyleSheet("background-color: white");
myLayout->addWidget(insertedTotal,4,1);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab8 =new QLabel(tr("inserted: "));
lab8->setFont(myTabFont);
myLayout->addWidget(lab8,5,0);
// display ALL inserted coins:
myTabFont.setPixelSize(PIXELSIZE_DATA);
allCoins = new QListWidget;
allCoins->setFont(myTabFont);
allCoins->setMinimumHeight(100);
myLayout->addWidget(allCoins,5,1);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab5 =new QLabel(tr("Amount to pay:"));
lab5->setFont(myTabFont);
myLayout->addWidget(lab5,6,0);
myKeypad = new T_keypad();
myLayout->addWidget(myKeypad,5,1);
connect(myKeypad, SIGNAL(keyEntryFinished()), this, SLOT(valueIsSet()));
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_enterPrice = new QPushButton("click to select");
pb_enterPrice->setFont(myTabFont);
myLayout->addWidget(pb_enterPrice,6,1);
//pb_enterPrice->setText("0");
connect(pb_enterPrice, SIGNAL(clicked()), this, SLOT(Button_enterPriceClicked()));
pb_statPay = new QPushButton("START\n");
pb_statPay->setFont(myTabFont);
myLayout->addWidget(pb_statPay,6,2);
connect(pb_statPay, SIGNAL(clicked()), this, SLOT(ButtonStartClicked()));
pb_stopPay = new QPushButton("STOP\n Pay");
pb_stopPay->setFont(myTabFont);
myLayout->addWidget(pb_stopPay,8,0);
connect(pb_stopPay, SIGNAL(clicked()), this, SLOT(ButtonStopClicked()));
pb_cancelPay = new QPushButton("CANCEL\n Pay");
pb_cancelPay->setFont(myTabFont);
myLayout->addWidget(pb_cancelPay,8,1);
connect(pb_cancelPay, SIGNAL(clicked()), this, SLOT(ButtonCancelClicked()));
pb_vendSucc = new QPushButton(" VEND\nsuccess");
pb_vendSucc->setFont(myTabFont);
myLayout->addWidget(pb_vendSucc,8,2);
connect(pb_vendSucc, SIGNAL(clicked()), this, SLOT(ButtonSuccClicked()));
pb_vendFail = new QPushButton(" VEND\nfailed");
pb_vendFail->setFont(myTabFont);
myLayout->addWidget(pb_vendFail,8,3);
connect(pb_vendFail, SIGNAL(clicked()), this, SLOT(ButtonFailClicked()));
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab7 =new QLabel(tr(" "));
lab7->setFont(myTabFont);
myLayout->addWidget(lab7,9,0);
// rechts oben, zeige Bezahlstatus:
QLabel *lab8 =new QLabel(tr("pay state:"));
lab8->setFont(myTabFont);
myLayout->addWidget(lab8,3,2);
myTabFont.setPixelSize(PIXELSIZE_DATA);
coinPayState = new QLineEdit();
coinPayState->setFrame(true);
coinPayState->setText(" ");
coinPayState->setReadOnly(true);
coinPayState->setFont(myTabFont);
//coinPayState->setMaxLength(100);
myLayout->addWidget(coinPayState,3,3);
coinPayState->setStyleSheet("background-color: white");
// "background-color: white" "background-color: yellow"
// "background-color: rgb(150,230,150)"); // hell grün
// "background-color: rgb(250,150,150)"); // hell rot
// darunter Signale anzeigen:
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab9 =new QLabel(tr("last Signal:"));
lab9->setFont(myTabFont);
myLayout->addWidget(lab9,4,2);
myTabFont.setPixelSize(PIXELSIZE_DATA);
coinPaySignals = new QLineEdit();
coinPaySignals->setFrame(true);
coinPaySignals->setText(" ");
coinPaySignals->setReadOnly(true);
coinPaySignals->setFont(myTabFont);
coinPaySignals->setStyleSheet("background-color: white");
myLayout->addWidget(coinPaySignals,4,3);
empState = new QListWidget;
empState->setFont(myTabFont);
myLayout->addWidget(empState,5,3);
setLayout(myLayout);
myNextStep=0;
myStep=99;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
timerClrDisp = new QTimer();
timerClrDisp->setSingleShot(true);
//timerClrDisp->start(1000);
connect(timerClrDisp, SIGNAL(timeout()), this, SLOT(win10_slotClrSig()));
// Eingangssignal auf QObject casten, weil hwinf kein QObject ist
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_gotNewCoin()), this, SLOT(signalGotNewCoin()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinCollectionJustStarted()), this, SLOT(signalJustStarted()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinCollectionAborted()), this, SLOT(signalCollectAbort()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByMax()), this, SLOT(signalStopByMax()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByPushbutton()), this, SLOT(signalStopByUser()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByEscrow()), this, SLOT(signalStopByEscrow()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByError()), this, SLOT(signalStopByError()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByTimeout()), this, SLOT(signalStopTO()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payCancelled()), this, SLOT(signalCancelled()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinProcessJustStopped()), this, SLOT(signalProcessStop()));
win10_paymentStarted=0;
win10_value=0;
}
void T_win10::addDigit2Val(uint8_t digi)
{
QString myStr;
win10_value*=10;
win10_value+=digi;
myStr.clear();
myStr.append(QString::number(win10_value));
startAmount->setText(myStr);
}
T_win10::~T_win10()
{
close();
}
void T_win10::Nav_back(void)
{
myNextStep=WCS_WIN10BAK;
}
void T_win10::Nav_home(void)
{
myNextStep=WCS_WIN10MID;
}
void T_win10::Nav_next(void)
{
myNextStep=WCS_WIN10FWD;
}
void T_win10::Button_enterPriceClicked(void)
{
myKeypad->show();
}
void T_win10::ButtonStartClicked()
{
QString myStr, tmpStr;
uint32_t val;
myStr.clear();
tmpStr.clear();
insertedCoin->clear();
insertedTotal->clear();
allCoins->clear();
//myStr=startAmount->text();
myStr=pb_enterPrice->text();
val=myStr.toULong();
//tmpStr.append(QString::number(uitmp));
//qDebug()<<"from box: " << myStr << " dec: " << val;
HWaccess->cash_startPayment(val);
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText("starting...");
win10_paymentStarted=1;
}
void T_win10::ButtonStopClicked()
{
HWaccess->cash_stopPayment();
coinPayState->setStyleSheet("background-color: yellow");
coinPayState->setText(" ");
}
void T_win10::ButtonCancelClicked()
{
HWaccess->cash_cancelPayment();
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::ButtonSuccClicked()
{
HWaccess->vend_success();
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::ButtonFailClicked()
{
HWaccess->vend_failed();
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::signalGotNewCoin()
{
uint32_t ultmp;
QString myStr;
uint16_t types[66], values[66];
int nn;
//qDebug()<<"signal got new coin";
myStr.clear();
ultmp=HWaccess->getLastInsertedCoin();
//if (ultmp>0 && ultmp<1000)
{
myStr.append(QString::number(ultmp));
insertedCoin->setText(myStr);
}
//qDebug()<<myStr;
myStr.clear();
ultmp=HWaccess->getInsertedAmount();
//if (ultmp>0 && ultmp<65000)
{
myStr.append(QString::number(ultmp));
insertedTotal->setText(myStr);
}
//qDebug()<<myStr;
HWaccess->getAllInsertedCoins(types, values);
// all inserted coins (max 64) since "cash_startPayment"
allCoins->clear();
nn=0;
do
{
myStr.clear();
if (types[nn]>0 && values[nn]>0)
{
myStr.append("Index: ");
myStr.append(QString::number(nn));
myStr.append(" Type: ");
myStr.append(QString::number(types[nn]));
myStr.append(" Val: ");
myStr.append(QString::number(values[nn]));
allCoins->addItem(myStr);
}
} while (++nn<64);
coinPaySignals->setText("got new coin ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win10::signalJustStarted()
{
coinPaySignals->setText("just started ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: green");
coinPayState->setText("insert coins....");
}
void T_win10::signalCollectAbort()
{
coinPaySignals->setText("collect aborted ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::signalStopByMax()
{
coinPaySignals->setText("stopped by max ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: yellow");
coinPayState->setText(" ");
}
void T_win10::signalStopByUser()
{
coinPaySignals->setText("stopped by user ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: yellow");
coinPayState->setText(" ");
}
void T_win10::signalStopByEscrow()
{
coinPaySignals->setText("STOPPED BY ESCROW ");
timerClrDisp->start(1000); // wieder loeschen
coinPayState->setStyleSheet("background-color: yellow");
coinPayState->setText(" ");
}
void T_win10::signalStopByError()
{
coinPaySignals->setText("stopped by error ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::signalStopTO()
{
coinPaySignals->setText("stopped by TO ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::signalCancelled()
{
coinPaySignals->setText("canncelled ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::signalProcessStop()
{
coinPaySignals->setText("processing stopped ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
coinPayState->setStyleSheet("background-color: white");
coinPayState->setText(" ");
}
void T_win10::win10_slotClrSig()
{
coinPaySignals->setText(" ");
timerClrDisp->start(TIME_DISPLAY_SIGNALS_MS); // wieder loeschen
}
void T_win10::valueIsSet(void)
{
pb_enterPrice->setText( myKeypad->getValueString() );
}
void T_win10::pay_slotClrSig(void)
{
coinPaySignals->clear();
}
bool T_win10::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
#define SENDINGGRID_MS 300
//itmp=globVar_GetCoinChecker();
bool T_win10::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
QString myStr;
struct T_emp empStat;
struct T_dynamicCondition myDynMachCond;
//uint8_t prbuf[66];
myStr.clear();
*nextScreen=0; // 0=no change
*useNavi=0;
//myStr=startAmount->text();
HWaccess->emp_getAllParameters(&empStat);
/*
struct T_emp
{
// Fixdata from EMP:
uint8_t shaft; // = changer level
uint16_t countryCode;
uint8_t scale;
uint8_t decimals;
uint8_t coinValues[16];
uint16_t routing;
// Master specs:
uint8_t gotSetup; // 1: got specifications from master 0: no specs
uint16_t coinAccept; // bit 0 = coin1 bit H=accept
uint8_t tokenChannel;
uint16_t denomination[16];
// dynamic:
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
// 0=Emp & Bus power off, 1=powered, poll off 2=polling on
// 3=device responded, requesting status
// 4=waiting for status 5=have status,
// 6: IDLE, have paramters from master, polling running, ready for payment
// Master can stop/start polling and acceptance
// 7: end of transaction, polling on, accept off, reporting coins, (wait for last coin)
// 8: transaction running, polling on, acceptance on, reporting coins,
uint8_t pollingRunning;
uint8_t paymentRunning;
};
*/
empState->clear();
myStr.clear();
myStr.append("EMP State: ");
myStr.append(QString::number(empStat.state));
empState->addItem(myStr);
myStr.clear();
myStr.append("polling: ");
myStr.append(QString::number(empStat.pollingRunning));
empState->addItem(myStr);
myStr.clear();
myStr.append("pay active: ");
myStr.append(QString::number(empStat.paymentRunning));
empState->addItem(myStr);
HWaccess->sys_getDynMachineConditions(&myDynMachCond);
myStr.clear();
myStr.append("paym. in progress: ");
myStr.append(QString::number(myDynMachCond.paymentInProgress));
empState->addItem(myStr);
uint8_t curStat;
curStat = HWaccess->cash_paymentProcessing();
// return value:
// 0: stopped 1: starting up 2: coin collection
// 3: finished by User (Push button) 4: finished, Max-Value collected
// 5: finished by escrow
// 6: money encashed
// 7: cancelled
// 10,11: error cannot start
// 12: timeout while payment, coins returned
// 13: stopped by unexpected error
myStr.clear();
myStr.append("paym.Processing: ");
myStr.append(QString::number(curStat));
empState->addItem(myStr);
myStr.clear();
myStr.append("paym.Started: ");
myStr.append(QString::number(win10_paymentStarted));
empState->addItem(myStr);
if (win10_paymentStarted==1)
{
/*
if (curStat<2 || curStat==6 || curStat==7)
coinPayState->setStyleSheet("background-color: white");
else
if (curStat==2)
coinPayState->setStyleSheet("background-color: rgb(150,230,150)"); // hell grün
// "background-color: white" "background-color: yellow"
// "background-color: rgb(150,230,150)"); // hell grün
// "background-color: rgb(250,150,150)"); // hell rot
else
if (curStat>=3 && curStat<=5)
coinPayState->setStyleSheet("background-color: yellow");
else
if (curStat>=10)
coinPayState->setStyleSheet("background-color: rgb(250,150,150)"); // hell rot
switch (curStat)
{
case 1: //coinPayState->setText("starting..."); break;
//coinPayState->clear();
break;
case 2: coinPayState->setText("wait for coins"); break;
case 3: coinPayState->setText("finished by user"); break;
case 4: coinPayState->setText("got full amount"); break;
case 5: coinPayState->setText("escrow full"); break;
case 7: coinPayState->setText("cancelled"); break;
case 10: coinPayState->setText("Hardware error"); break;
case 11: coinPayState->setText("cannot start"); break;
case 12: coinPayState->setText("timeout"); break;
case 13: coinPayState->setText("unknown error"); break;
}
*/
if (curStat==0)
win10_paymentStarted++; // nur 1x anzeigen
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

105
win10_pay.h Executable file
View File

@ -0,0 +1,105 @@
#ifndef WIN10_PAY_H
#define WIN10_PAY_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include <QLineEdit>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "keypad.h"
#include "guidefs.h"
class T_win10 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QLabel *lab4;
QLabel *lab5;
QLabel *lab6;
QLabel *lab7;
QLabel *lab8;
QLabel *lab9;
QTimer *myTO;
QTimer *timerClrDisp;
QLineEdit *startAmount;
QLineEdit *insertedTotal;
QLineEdit *insertedCoin;
QLineEdit *coinPayState;
QLineEdit *coinPaySignals;
QListWidget *allCoins;
QPushButton *pb_statPay;
QPushButton *pb_stopPay;
QPushButton *pb_cancelPay;
QPushButton *pb_vendSucc;
QPushButton *pb_vendFail;
QListWidget *empState;
QGroupBox *numPad;
//void drawNumPad(void);
QPushButton *pb_enterPrice;
T_keypad *myKeypad;
public:
explicit T_win10(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win10();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void ButtonStartClicked();
void ButtonStopClicked();
void ButtonCancelClicked();
void ButtonSuccClicked();
void ButtonFailClicked();
void signalGotNewCoin();
void signalJustStarted();
void signalCollectAbort();
void signalStopByMax();
void signalStopByUser();
void signalStopByEscrow();
void signalStopByError();
void signalStopTO() ;
void signalCancelled() ;
void signalProcessStop();
void win10_slotClrSig();
void addDigit2Val(uint8_t digi);
void Button_enterPriceClicked(void);
void valueIsSet(void);
void pay_slotClrSig(void);
};
#endif

663
win11_abr.cpp Executable file
View File

@ -0,0 +1,663 @@
#include "win11_abr.h"
#define BUTTONCOLOR0 "background-color: white"
#define BUTTONCOLORWAIT "background-color: yellow"
#define BUTTONCOLORGOT "background-color: green"
#define BUTTONCOLORBAD "background-color: red"
#define BUTTONCOLORGOOD "background-color: green"
static char updateList, wait4data;
static uint8_t pwreq;
/*
void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const override;
// returns all acc nrs of the backuped vault records
// use: uint16_t backupedAccNumbers[8]
// will be requested automatically
bool log_selectVaultRecord(uint16_t accountNr ) const override;
// return true if sending, false if cmd-stack is full
// and trigger transfer
bool log_chkIfVaultRecordAvailable(void) const override;
// return true if completly received
bool log_getVaultRecord(struct T_vaultRecord *retVR) const override;
// which was selected by: log_selectVaultRecord()
// to be forwarded to Ismas
bool prn_printAccountReceipt(void) const override;
// return true if sending to DC OK, false if cmd-stack is full
*/
T_win11::T_win11(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
//myLayout = new QGridLayout;
mainHLayout = new QHBoxLayout;
leftLayout = new QVBoxLayout;
RightLayout = new QVBoxLayout;
QFont myTabFont;
myTabFont.setPixelSize(20);
// availAccNrList.append("1");
// availAccNrList.append("2");
// availAccNrList.append("3");
// availAccNrList.append("4");
// availAccNrList.append("5");
// availAccNrList.append("6");
// availAccNrList.append("7");
// availAccNrList.append("8");
availAccNrList.clear();
// left side: big ListWindow to show accounting record
but2 = new QPushButton(" Load Data");
leftLayout->addWidget(but2);
connect(but2, SIGNAL(clicked()), this, SLOT(slot_loadData()));
but2->setStyleSheet(BUTTONCOLOR0); // BUTTONCOLORWAIT BUTTONCOLORGOT
but2->setFont(myTabFont);
QLabel *lab1 =new QLabel("accounting data:");
leftLayout->addWidget(lab1);
lab1->setFont(myTabFont);
myTabFont.setPixelSize(16);
win11_showVaultRecord = new QListWidget;
win11_showVaultRecord->setFont(myTabFont);
//win11_showVaultRecord->setMinimumHeight(200);
win11_showVaultRecord->setMinimumWidth(500);
leftLayout->addWidget(win11_showVaultRecord);
//win11_showVaultRecord->addItem("data 123");
win11_showVaultRecord->setLineWidth(3);
// right side:
myTabFont.setPixelSize(20);
but1 = new QPushButton(" Reload Acc. Nrs");
RightLayout->addWidget(but1);
connect(but1, SIGNAL(clicked()), this, SLOT(slot_loadNumbers()));
but1->setFont(myTabFont);
but1->setStyleSheet(BUTTONCOLOR0); // BUTTONCOLORWAIT BUTTONCOLORGOT
//QLabel *lab6 =new QLabel(" ");
//RightLayout->addWidget(lab6);
QLabel *lab4 =new QLabel("select Acc. Nr.:");
RightLayout->addWidget(lab4);
lab4->setFont(myTabFont);
QFont myCBfont;
myCBfont.setPixelSize(16);
//myCBfont.setPointSize(16);
myCBfont.setPointSize(myCBfont.pixelSize() - 5);
cb_selAccNr = new QComboBox();
cb_selAccNr->addItems(availAccNrList);
//cb_selAccNr->setFont(myCBfont); // aendert nur die Liste, Eingabezeile bleibt klein
//cb_selAccNr->setCurrentIndex(7);
cb_selAccNr->setEditable(true);
cb_selAccNr->setMaxVisibleItems(8);
cb_selAccNr->setStyleSheet("QComboBox { font-size: 20px; }"); // gilt fuer Liste und Eingabezeile
//cb_selAccNr->setStyleSheet("QScrollBar:vertical { width: 30px; }");
RightLayout->addWidget(cb_selAccNr);
//myTabFont.setPixelSize(16);
//QLabel *lab5 =new QLabel(" ");
//RightLayout->addWidget(lab5);
//lab5->setFont(myTabFont);
/*
myTabFont.setPixelSize(16);
QLabel *lab2 =new QLabel("available AccNrs.:");
lab2->setFont(myTabFont);
RightLayout->addWidget(lab2);
myTabFont.setPixelSize(16);
win11_showAccNrs = new QListWidget;
win11_showAccNrs->setFont(myTabFont);
//win11_showAccNrs->setMinimumHeight(200);
//win11_showAccNrs->setMinimumWidth(100);
win11_showAccNrs->setLineWidth(3);
win11_showAccNrs->clear();
win11_showAccNrs->addItems(availAccNrList);
RightLayout->addWidget(win11_showAccNrs);
*/
//QLabel *lab3 =new QLabel(" ");
//RightLayout->addWidget(lab3);
but3 = new QPushButton(" print ");
RightLayout->addWidget(but3);
connect(but3, SIGNAL(clicked()), this, SLOT(slot_printSel()));
but3->setStyleSheet(BUTTONCOLOR0);
but3->setFont(myTabFont);
but4 = new QPushButton(" verify ");
RightLayout->addWidget(but4);
connect(but4, SIGNAL(clicked()), this, SLOT(slot_crc()));
but4->setStyleSheet(BUTTONCOLOR0);
but4->setFont(myTabFont);
but5 = new QPushButton("read acc-nr");
RightLayout->addWidget(but5);
connect(but5, SIGNAL(clicked()), this, SLOT(slot_readNr()));
but5->setStyleSheet(BUTTONCOLOR0);
but5->setFont(myTabFont);
//disp_CurrentAccNr=new QLabel();
disp_CurrentAccNr=new QLineEdit(); // mit Eingabemoeglichkeit!
RightLayout->addWidget(disp_CurrentAccNr);
disp_CurrentAccNr->setFont(myTabFont);
//disp_CurrentAccNr->setLineWidth(3);
disp_CurrentAccNr->setStyleSheet(BUTTONCOLOR0);
disp_CurrentAccNr->setEnabled(true);
myTabFont.setPixelSize(16);
//QLabel *lab5 =new QLabel(" ");
//RightLayout->addWidget(lab5);
//lab5->setFont(myTabFont);
myKeypad = new T_keypad();
leftLayout->addWidget(myKeypad);
connect(myKeypad, SIGNAL(keyEntryFinished()), this, SLOT(valueIsSet()));
but6 = new QPushButton("set acc-nr");
RightLayout->addWidget(but6);
connect(but6, SIGNAL(clicked()), this, SLOT(slot_setAccNr()));
but6->setStyleSheet(BUTTONCOLOR0);
but6->setFont(myTabFont);
but7 = new QPushButton("delete all DC-data");
RightLayout->addWidget(but7);
connect(but7, SIGNAL(clicked()), this, SLOT(slot_deleteAccData()));
but7->setStyleSheet(BUTTONCOLOR0);
but7->setFont(myTabFont);
but8 = new QPushButton("delete all Totals");
RightLayout->addWidget(but8);
connect(but8, SIGNAL(clicked()), this, SLOT(slot_deleteTotals()));
but8->setStyleSheet(BUTTONCOLOR0);
but8->setFont(myTabFont);
mainHLayout->addLayout(leftLayout);
mainHLayout->addLayout(RightLayout);
setLayout(mainHLayout);
updateList=1;
wait4data=0;
myNextStep=0;
myStep=0;
pwreq=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->stop();
}
T_win11::~T_win11()
{
close();
}
void T_win11::Nav_back(void)
{
myNextStep=WCS_WIN11BAK;
}
void T_win11::Nav_home(void)
{
myNextStep=WCS_WIN11MID;
}
void T_win11::Nav_next(void)
{
myNextStep=WCS_WIN11FWD;
}
void T_win11::slot_loadData(void)
{
bool ok=0;
int selNr;
QString anStr;
but3->setStyleSheet(BUTTONCOLOR0);
but2->setStyleSheet(BUTTONCOLORWAIT); // BUTTONCOLORGOT
but2->setText("loading...");
//int anInt=cb_selAccNr->currentIndex();
anStr=cb_selAccNr->currentText();
selNr=anStr.toUInt(&ok);
if (ok)
{
if (selNr==0)
{
sub_displayCurrentCashbox();
} else
{
HWaccess->log_selectVaultRecord(uint16_t(selNr));
win11_showVaultRecord->clear();
wait4data=1;
}
}
myStep++;
}
void T_win11::slot_loadNumbers(void)
{
updateList=1;
}
void T_win11::slot_printSel(void)
{
bool ok=0;
QString anStr=cb_selAccNr->currentText();
uint16_t selNr=anStr.toUInt(&ok);
if (ok && selNr>0)
{
HWaccess->prn_printOneAccountReceipt(selNr);
myTO->start(3000);
}
}
void T_win11::slot_crc(void)
{
bool ret=0;
ret=HWaccess->log_verifyVaultRecordByCrc();
if (ret)
but4->setStyleSheet(BUTTONCOLORGOOD);
else
but4->setStyleSheet(BUTTONCOLORBAD);
}
void T_win11::slot_readNr(void)
{
uint16_t nxtAn=0;
nxtAn= HWaccess->log_DC_getNextAccountNumber();
QString myStr;
myStr.clear();
myStr.append(QString::number(nxtAn));
disp_CurrentAccNr->setText(myStr);
}
void T_win11::slot_setAccNr(void)
{
// set new accouning number
// request password before
pwreq=1;
myKeypad->keysVisible(2);
myKeypad->show(); // display pinpad for password entry
}
void T_win11::slot_deleteAccData(void)
{
pwreq=2;
myKeypad->keysVisible(2);
myKeypad->show();
}
void T_win11::slot_deleteTotals(void)
{
pwreq=3;
myKeypad->keysVisible(2);
myKeypad->show();
}
void T_win11::valueIsSet(void)
{
// password was entered
bool ok=0;
QString myPW, myStr;
myPW=myKeypad->getValueString(); // get entered password
if (pwreq==1) // pw-entry requested for acc-nr
{
if (myPW=="92706") // compare password
{
//qDebug()<<"PW correct";
myStr=disp_CurrentAccNr->text(); // new value was set before PW
uint16_t nxtAn=myStr.toUInt(&ok,10);
if (ok)
{
HWaccess->log_DC_setNextAccountNumber(nxtAn);
disp_CurrentAccNr->setText("->new acc.nr set");
}
}
} else
if (pwreq==2) // pw-entry requested for deleteAccData
{
if (myPW=="92637") // compare password
{
HWaccess->log_DC_deleteAllVaultrecordsInDc();
disp_CurrentAccNr->setText("->all acc.data deleted");
}
} else
if (pwreq==3) // pw-entry requested for delete totals
{
if (myPW=="92702") // compare password
{
HWaccess->log_DC_deleteAllTotalCounters();
disp_CurrentAccNr->setText("->all totals deleted");
}
}
pwreq=0;
}
void T_win11::enterAccData(QString label, uint32_t val)
{
QString myStr;
myStr.clear();
myStr.append(label);
myStr.append(QString::number(val));
win11_showVaultRecord->addItem(myStr);
}
void T_win11::enterString(QString label, char *buff, int len)
{
QString myStr;
char myChar;
int nn, LL=len;
myStr.clear();
myStr.append(label);
for (nn=0; nn<LL; nn++)
{
myChar=buff[nn];
myStr.append(myChar);
}
win11_showVaultRecord->addItem(myStr);
}
void T_win11::enterArray(QString label, uint16_t *buff, int len)
{
QString myStr;
int nn, LL=len;
uint16_t val;
myStr.clear();
myStr.append(label);
for (nn=0; nn<LL; nn++)
{
val=buff[nn];
myStr.append(QString::number(val));
myStr.append(", ");
}
win11_showVaultRecord->addItem(myStr);
}
void T_win11::enterArray(QString label, uint32_t *buff, int len)
{
QString myStr;
int nn, LL=len;
uint32_t val;
myStr.clear();
myStr.append(label);
for (nn=0; nn<LL; nn++)
{
val=buff[nn];
myStr.append(QString::number(val));
myStr.append(", ");
}
win11_showVaultRecord->addItem(myStr);
}
bool T_win11::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win11::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
uint8_t nrOfVals, nn;
uint16_t accNr[34], val;
QString myStr;
struct T_vaultRecord retVR;
//uint8_t temp[400];
if (updateList)
{
HWaccess->log_getHoldAccountNumbers(&nrOfVals, &accNr[0] );
//void log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const override;
// returns all acc nrs of the backuped vault records
// use: uint16_t backupedAccNumbers[8]
// will be requested automatically
if (nrOfVals>32) nrOfVals=32;
availAccNrList.clear();
availAccNrList.append("0"); // 0 = immer akt. Kasseninhalt
for (nn=0; nn< nrOfVals; nn++)
{
myStr.clear();
val=accNr[nn];
myStr.append( QString::number(val,10) );
availAccNrList.append(myStr);
}
if (nrOfVals>0)
{
cb_selAccNr->clear();
cb_selAccNr->addItems(availAccNrList);
//win11_showAccNrs->clear();
//win11_showAccNrs->addItems(availAccNrList);
updateList=0;
}
}
//blksRdy=HWaccess->log_getAvailableVaultBlocks();
// return 0x0011 1111 if all 6 blocks arer loaded (one bit per block)
//if (blksRdy==0x3F && wait4data)
if (HWaccess->log_chkIfVaultRecordAvailable() && wait4data)
{
wait4data=0;
win11_showVaultRecord->clear();
but2->setStyleSheet(BUTTONCOLORGOT);
but2->setText("loaded");
// get data from local memory and display to left window
HWaccess->log_getVaultRecord(&retVR);
enterString ("Start : ", retVR.startbuffer, 4);
enterAccData("Acc.Nr. : ", retVR.AccountingNumber );
enterAccData("Cu.Nr. : ", retVR.CUNU );
enterAccData("MachNr. : ", retVR.MANU );
enterAccData("reserve : ", retVR.resint1 );
enterString ("--- : ", retVR.label1buffer, 4 );
enterAccData("Year : ", retVR.year );
enterAccData("Month : ", retVR.month );
enterAccData("Day : ", retVR.dom );
enterAccData("Hour : ", retVR.hour );
enterAccData("Min : ", retVR.min );
enterAccData("Sec : ", retVR.sec );
enterAccData("Weekday : ", retVR.DoW );
enterAccData("reserve : ", retVR.reschar3 );
enterString ("--- : ", retVR.label2buffer, 4 );
enterAccData("Total : ", retVR.AbsIncome1 );
enterAccData("abs.Res : ", retVR.AbsReserve );
enterAccData("abs.Cut : ", retVR.AbsNrOfCuts );
enterString ("--- : ", retVR.label3buffer, 4 );
enterArray ("ins.Coins: ", retVR.VKcoinsInserted, 16 );
enterArray ("ret Coins: ", retVR.VKcoinsReturned, 6 );
enterArray ("fillCoins: ", retVR.ServCoinsInserted, 16 );
enterArray ("takeCoins: ", retVR.ServCoinsReturned, 6 );
enterAccData("reserve : ", retVR.resint3 );
enterAccData("reserve : ", retVR.resint4 );
enterArray ("tubeCont.: ", retVR.currentTubeContent,6 );
enterAccData("reserve : ", retVR.resint5 );
enterAccData("reserve : ", retVR.resint6 );
enterString("--- : ", retVR.label4buffer, 4 );
enterArray ("nr.Coins : ", retVR.coinsInVault, 16 );
enterArray ("nr.Bills : ", retVR.billsInStacker, 8 );
enterString("--- : ", retVR.label5buffer, 4 );
enterArray ("coinDenom: ", retVR.coinDenomination, 16 );
enterArray ("billDenom: ", retVR.billDenom, 8 );
enterArray ("tubeDenom: ", retVR.tubeDenom, 6 );
enterAccData("exchgRate: ", retVR.exchangeRate );
enterAccData("reserve : ", retVR.resint9 );
enterAccData("Cuts CB : ", retVR.cutsSinceCBchange);
enterAccData("Amount CB: ", retVR.CBcontent_cent);
enterAccData("Coins CB : ", retVR.CBnrofCoins);
enterString("End : ", retVR.endofblock, 4 );
// 332 bytes
enterAccData("CRC : ", retVR.CRC16);
enterAccData("res : ", retVR.resint11);
enterString("End : ", retVR.endofRecord, 4 );
}
if (myTO->isActive())
{
uint8_t uctmp=HWaccess->prn_getPrintResult();
// return: 0: unknown
// 1: OK - last template was printed succesful
// 2: error - last template was not printed
if (uctmp==2)
but3->setStyleSheet(BUTTONCOLORBAD);
else if (uctmp==1)
but3->setStyleSheet(BUTTONCOLORGOOD);
else
but3->setStyleSheet(BUTTONCOLOR0);
}
if (myStep==0)
{
//myStep++;
} else
if (myStep==1)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
HWaccess->bna_requestStackerLevel();
//qDebug()<<"win11 requ bills";
}
} else
if (myStep==2)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
}
} else
if (myStep==3)
{
if (!myTO->isActive())
{
myStep=1; // nur 1x auf Tastendruck anfordern
myTO->start(200);
HWaccess->changer_requestTubelevel();
//qDebug()<<"win11 requ tubes";
}
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
*useNavi=0;
return false;
}
void T_win11::sub_displayCurrentCashbox(void)
{
// "Daily" anzeigen, also akt. Kasseninhalt
wait4data=0;
but2->setStyleSheet(BUTTONCOLORGOOD);
but2->setText("loaded");
win11_showVaultRecord->clear();
win11_showVaultRecord->addItem("\nCurrent cashbox content\n");
struct T_dynamicCondition myDynMachCond;
HWaccess->sys_getDynMachineConditions(&myDynMachCond);
enterAccData("nr of coins in Box: ", myDynMachCond.nrCoinsInBox);
enterAccData("Amount in coin Box: ", myDynMachCond.amountInBox);
win11_showVaultRecord->addItem(" ");
uint32_t amountInStacker;
uint16_t countOfBills[16], totalBills;
totalBills=HWaccess->bna_getStackerLevel(&amountInStacker, countOfBills);
// countOfBills[0...7]=Anzahl der jew. Werte countOfBills[8...15]=Wertigkeit
enterAccData("nr of bills in Box: ", totalBills);
enterAccData("Amount of bills : ", (amountInStacker/100) );
enterAccData("Nr of 5€ Bills: ", countOfBills[0]);
enterAccData("Nr of 10€ Bills: ", countOfBills[1]);
enterAccData("Nr of 20€ Bills: ", countOfBills[2]);
enterAccData("Nr of 50€ Bills: ", countOfBills[3]);
enterAccData("Nr of 100€ Bills: ", countOfBills[4]);
win11_showVaultRecord->addItem(" ");
struct T_chg_Tub changer;
HWaccess->changer_getTubelevel(&changer);
// don't use tubeDispens[], it's not yet correct!
QString myStr;
win11_showVaultRecord->addItem("\n Coin changer content: ");
for (int nn=0; nn<6; nn++)
{
myStr.clear();
if (changer.tubeValues[nn]>0)
{
myStr.append(swl_long2str(changer.tubeValues[nn]));
myStr.append(" : ");
myStr.append(swl_long2str(changer.tubeLevel[nn]));
if (changer.tubeFull[nn]>0)
myStr.append(" F");
win11_showVaultRecord->addItem(myStr);
}
}
}

90
win11_abr.h Executable file
View File

@ -0,0 +1,90 @@
#ifndef WIN11_ABR_H
#define WIN11_ABR_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include <QStringList>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include <QLineEdit>
#include "keypad.h"
#include "guidefs.h"
class T_win11 : public QWidget
{
Q_OBJECT
//QGridLayout *myLayout;
QHBoxLayout *mainHLayout;
QVBoxLayout *leftLayout;
QVBoxLayout *RightLayout;
QListWidget *win11_showVaultRecord;
//QListWidget *win11_showAccNrs;
QStringList availAccNrList;
QComboBox *cb_selAccNr;
QPushButton *but1, *but2, *but3, *but4, *but5, *but6, *but7, *but8;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QTimer *myTO;
//QLabel *disp_CurrentAccNr;
QLineEdit *disp_CurrentAccNr;
T_keypad *myKeypad;
void enterAccData(QString label, uint32_t val);
void enterString(QString label, char *buff, int len);
void enterArray(QString label, uint16_t *buff, int len);
void enterArray(QString label, uint32_t *buff, int len);
void sub_displayCurrentCashbox(void);
public:
explicit T_win11(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win11();
private slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_loadNumbers(void);
void slot_loadData(void);
void slot_printSel(void);
void slot_crc(void);
void slot_readNr(void);
void slot_setAccNr(void);
void slot_deleteAccData(void);
void slot_deleteTotals(void);
void valueIsSet(void);
};
#endif

473
win12_BL.cpp Executable file
View File

@ -0,0 +1,473 @@
#include "win12_BL.h"
#define BUTTONCOLOR0 "background-color: white"
#define BUTTONCOLORWAIT "background-color: yellow"
#define BUTTONCOLORGOT "background-color: green"
#define BUTTONCOLORBAD "background-color: red"
#define BUTTONCOLORGOOD "background-color: green"
static bool win12_startProgramming;
static uint16_t win12_nrOfFWblocks, win12_currentBlkNr;
T_win12::T_win12(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myVmainlayer= new QVBoxLayout;
myH0layer = new QHBoxLayout;
myH1layer = new QHBoxLayout;
myVlayer_left = new QVBoxLayout;
myVlayer_midd = new QVBoxLayout;
myVlayer_right = new QVBoxLayout;
myVmainlayer->addLayout(myH0layer);
myVmainlayer->addLayout(myH1layer);
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("program DC-firmware"));
lab1->setFont(myTabFont);
myH0layer->addWidget(lab1);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myH0layer->addWidget(lab2);
myH1layer->addLayout(myVlayer_left);
myH1layer->addLayout(myVlayer_midd);
myH1layer->addLayout(myVlayer_right);
// linke Spalte: controls
QLabel *lab7 = new QLabel(" ");
lab7->setFont(myTabFont);
myVlayer_left->addWidget(lab7);
but9 = new QPushButton("Starting \nBootloader");
myVlayer_left->addWidget(but9);
connect(but9, SIGNAL(clicked()), this, SLOT(slot_b9()));
but9->setStyleSheet(BUTTONCOLOR0);
but9->setFont(myTabFont);
QLabel *lab3 = new QLabel(" ");
lab3->setFont(myTabFont);
myH0layer->addWidget(lab3);
but4 = new QPushButton("load Bin-File");
myVlayer_left->addWidget(but4);
connect(but4, SIGNAL(clicked()), this, SLOT(slot_b4()));
but4->setStyleSheet(BUTTONCOLOR0);
but4->setFont(myTabFont);
QLabel *lab4 = new QLabel(" ");
lab4->setFont(myTabFont);
myH0layer->addWidget(lab4);
but5 = new QPushButton(" send file to DC");
myVlayer_left->addWidget(but5);
connect(but5, SIGNAL(clicked()), this, SLOT(slot_b5()));
but5->setStyleSheet(BUTTONCOLOR0);
but5->setFont(myTabFont);
QLabel *lab5 = new QLabel(" ");
lab5->setFont(myTabFont);
myH0layer->addWidget(lab5);
/*
but6 = new QPushButton(" ");
myVlayer_left->addWidget(but6);
connect(but6, SIGNAL(clicked()), this, SLOT(slot_b6()));
but6->setStyleSheet(BUTTONCOLOR0);
but6->setFont(myTabFont);
but7 = new QPushButton(" ");
myVlayer_left->addWidget(but7);
connect(but7, SIGNAL(clicked()), this, SLOT(slot_b7()));
but7->setStyleSheet(BUTTONCOLOR0);
but7->setFont(myTabFont);
but8 = new QPushButton(" ");
myVlayer_left->addWidget(but8);
connect(but8, SIGNAL(clicked()), this, SLOT(slot_b8()));
but8->setStyleSheet(BUTTONCOLOR0);
but8->setFont(myTabFont);
*/
/*
but9 = new QPushButton("complete start");
myVlayer_left->addWidget(but9);
connect(but9, SIGNAL(clicked()), this, SLOT(slot_b9()));
but9->setStyleSheet(BUTTONCOLOR0);
but9->setFont(myTabFont);
*/
myTabFont.setPixelSize(14);
but1 = new QPushButton("restart DC: ");
myVlayer_left->addWidget(but1);
connect(but1, SIGNAL(clicked()), this, SLOT(slot_b1()));
but1->setStyleSheet(BUTTONCOLOR0);
but1->setFont(myTabFont);
but2 = new QPushButton("Start BL: ");
myVlayer_left->addWidget(but2);
connect(but2, SIGNAL(clicked()), this, SLOT(slot_b2()));
but2->setStyleSheet(BUTTONCOLOR0);
but2->setFont(myTabFont);
but3 = new QPushButton("check BL: ");
myVlayer_left->addWidget(but3);
connect(but3, SIGNAL(clicked()), this, SLOT(slot_b3()));
but3->setStyleSheet(BUTTONCOLOR0);
but3->setFont(myTabFont);
QLabel *lab6 = new QLabel(" ");
lab6->setFont(myTabFont);
myH0layer->addWidget(lab6);
myTabFont.setPixelSize(22);
but10 = new QPushButton("stop BL: ");
myVlayer_left->addWidget(but10);
connect(but10, SIGNAL(clicked()), this, SLOT(slot_b10()));
but10->setStyleSheet(BUTTONCOLOR0);
but10->setFont(myTabFont);
// Mitte: anzeigen
showState =new QLabel("BL is off");
showState->setFont(myTabFont);
myVlayer_midd->addWidget(showState);
myTabFont.setPixelSize(14);
showFile =new QLabel(" --- no file loaded ---");
showFile->setFont(myTabFont);
myVlayer_midd->addWidget(showFile);
showProgress = new QTextEdit();
myVlayer_midd->addWidget(showProgress);
myTabFont.setPixelSize(14);
showProgress->setFont(myTabFont);
showProgress->setStyleSheet("background-color: white");
showProgress->append(" ");
setLayout(myVmainlayer);
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2);
trigger_BLstartup=false;
win12_startProgramming=0;
win12_nrOfFWblocks=0;
win12_currentBlkNr=0;
}
T_win12::~T_win12()
{
close();
}
void T_win12::Nav_back(void)
{
myNextStep=WCS_WIN12BAK;
}
void T_win12::Nav_home(void)
{
myNextStep=WCS_WIN12MID;
}
void T_win12::Nav_next(void)
{
myNextStep=WCS_WIN12FWD;
}
void T_win12::slot_b1(void)
{
showProgress->append(" rebooting");
HWaccess->dc_autoRequest(false);
HWaccess->bl_rebootDC();
}
void T_win12::slot_b2(void)
{
HWaccess->dc_autoRequest(false);
HWaccess->bl_startBL();
}
void T_win12::slot_b3(void)
{
HWaccess->dc_autoRequest(false);
showState->setText(" ");
HWaccess->bl_checkBL();
myTO->stop();
myTO->start(200);
myStep=20;
}
void T_win12::slot_b4(void)
{
QString myStr;
QString fileName;
win12_nrOfFWblocks=0;
fileName.clear();
fileName = QFileDialog::getOpenFileName(this, ("Select DC firmware file:"),
"C:/own/work2023/PSA1256ptu5/PTU SW",
("binary file(*.bin)"));
//qDebug()<<"T_win12: selected file: "<<fileName;
bool ret=HWaccess->bl_storeFirmware(fileName);
win12_nrOfFWblocks = HWaccess->bl_getNrOfFirmwareBlocks();
if (ret)
{
myStr.clear();
myStr=" file ";
myStr.append(fileName);
myStr.append(" \n loaded with ");
myStr.append(swl_ulong2str(win12_nrOfFWblocks));
myStr.append(" blocks");
showFile->setText(myStr);
} else
showFile->setText(" cannot load file :-( ");
}
void T_win12::slot_b5(void)
{
win12_startProgramming=true;
myStep=5;
}
void T_win12::slot_b6(void)
{
}
void T_win12::slot_b7(void)
{
}
void T_win12::slot_b8(void)
{
}
void T_win12::slot_b9(void)
{
showState->setText(" Bootloader is off ");
showFile->setText(" ");
//trigger_BLstartup=true;
//myStep=0;
// neu, 29.9: Start-Schrittkette jetzt in HWapi:
HWaccess->bl_completeStart();
}
void T_win12::slot_b10(void)
{
showState->setText(" Bootloader is off ");
showFile->setText(" ");
HWaccess->bl_stopBL();
HWaccess->dc_autoRequest(true);
}
bool T_win12::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win12::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
int8_t iresult;
if (myStep==0)
{
if (trigger_BLstartup)
{
HWaccess->dc_autoRequest(false);
myStep++;
}
} else
if (myStep==1)
{
//qDebug()<<"win12 chain step 1";
if (trigger_BLstartup)
{
//qDebug()<<"starting up BL step1";
trigger_BLstartup=false;
HWaccess->bl_rebootDC();
myTO->stop();
myTO->start(1000); // restart
retryCtr=0;
myStep++;
//qDebug()<<"win12 chain step 2";
}
} else
if (myStep==2)
{
if (!myTO->isActive())
{
qDebug()<<"starting BL";
HWaccess->bl_startBL();
myTO->stop();
myTO->start(100);
myStep++;
//qDebug()<<"win12 chain step 3";
}
} else
if (myStep==3)
{
if (!myTO->isActive())
{
HWaccess->bl_checkBL();
myTO->stop();
myTO->start(100);
myStep++;
//qDebug()<<"win12 chain step 4";
}
} else
if (myStep==4)
{
if (!myTO->isActive())
{
//qDebug()<<"starting up BL step4";
myTO->stop();
if (HWaccess->bl_isUp())
{
myStep++;
//qDebug()<<"win12 chain step 5";
showState->setText(" --- BL is up and running ---");
//qDebug()<<"BL laeuft!!!";
} else
{
retryCtr++; // start again
if (retryCtr>=15)
{
myStep=99;
//qDebug()<<"win12 chain step 99";
showState->setText(" --- BL error! ---");
//qDebug()<<"BL error!!!";
} else
{
myStep=3;
//qDebug()<<"BL retry...";
//qDebug()<<"win12 chain step 3";
}
}
}
} else
if (myStep==5)
{
if (win12_startProgramming)
{
win12_nrOfFWblocks = HWaccess->bl_getNrOfFirmwareBlocks();
if (win12_nrOfFWblocks>10)
{
// qDebug()<<"win12 chain step 6";
myStep++;
}
win12_currentBlkNr=0;
showProgress->append("transfering file:");
win12_startProgramming=0;
}
} else
if (myStep==6)
{
//qDebug()<<"starting transfer";
HWaccess->bl_blockAutoLoad(win12_currentBlkNr);
showProgress->append(swl_int2str(win12_currentBlkNr));
myStep++;
//qDebug()<<"win12 chain step 6->7";
} else
if (myStep==7)
{
iresult=HWaccess->bl_blockAutoResponse();
// 0: wait 1: OK, blk was sent 2: OK, transfer complete 3: error
if (iresult==1)
{
win12_currentBlkNr++;
if (win12_currentBlkNr <= win12_nrOfFWblocks)
{
myStep=6;
//qDebug()<<"win12 chain step 7->6";
} else
{
showProgress->append("finished");
//qDebug()<<"win12 chain step 99";
myStep=99;
}
} else
if (iresult==2)
{
// fertisch
showProgress->append("finished");
myStep=99;
} else
if (iresult==3)
{
// fehler
showProgress->append("cancel due to error");
myStep=99;
}
} else
if (myStep==8)
{
} else
{
}
if (myStep==20)
{
if (!myTO->isActive())
{
//qDebug()<<"win12 step0";
if (HWaccess->bl_isUp())
showState->setText(" Bootloader is running");
//else
// lab7->setText(" Bootloader is off ");
myTO->stop();
myStep=99;
}
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

82
win12_BL.h Executable file
View File

@ -0,0 +1,82 @@
#ifndef WIN12_BL_H
#define WIN12_BL_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "QPushButton"
#include "QTextEdit"
#include "QFileDialog"
#include "QStringList"
#include "guidefs.h"
class T_win12 : public QWidget
{
Q_OBJECT
//QGridLayout *myLayout;
QHBoxLayout *myH0layer, *myH1layer;
QVBoxLayout *myVmainlayer, *myVlayer_left;
QVBoxLayout *myVlayer_midd;
QVBoxLayout *myVlayer_right;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QLabel *showState, *showFile;
QPushButton *but1, *but2, *but3, *but4, *but5, *but6, *but7, *but8, *but9, *but10;
bool trigger_BLstartup;
int retryCtr;
QTextEdit *showProgress;
public:
explicit T_win12(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win12();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_b1(void);
void slot_b2(void);
void slot_b3(void);
void slot_b4(void);
void slot_b5(void);
void slot_b6(void);
void slot_b7(void);
void slot_b8(void);
void slot_b9(void);
void slot_b10(void);
};
#endif

330
win13_json.cpp Executable file
View File

@ -0,0 +1,330 @@
#include "win13_json.h"
// load Json file from HDD and send it to DC:
//virtual bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const =0;
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
// nrOfTemplate=1...32 if kindOfFile==6
// content = content of the Json file, max 800byte ascii signs
// file is 0-terminated!
// return false if sending is not possible, wait a second
T_win13::T_win13(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
//myLayout = new QGridLayout;
myVmainlayer= new QVBoxLayout;
myH0layer = new QHBoxLayout;
myH1layer = new QHBoxLayout;
myVlayer_left = new QVBoxLayout;
myVlayer_midd = new QVBoxLayout;
myVlayer_right = new QVBoxLayout;
myVmainlayer->addLayout(myH0layer);
myVmainlayer->addLayout(myH1layer);
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("send Jsonfiles from ../smd to DC"));
lab1->setFont(myTabFont);
myH0layer->addWidget(lab1);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myH0layer->addWidget(lab2);
myH1layer->addLayout(myVlayer_left);
myH1layer->addLayout(myVlayer_midd);
myH1layer->addLayout(myVlayer_right);
// linke Spalte: laden
pB1 = new QPushButton("load config");
myVlayer_left->addWidget(pB1);
pB1->setFont(myTabFont);
connect(pB1, SIGNAL(clicked()), this, SLOT(slot_pb1()));
pB2 = new QPushButton("load devices");
myVlayer_left->addWidget(pB2);
pB2->setFont(myTabFont);
connect(pB2, SIGNAL(clicked()), this, SLOT(slot_pb2()));
pB3 = new QPushButton("load cash");
myVlayer_left->addWidget(pB3);
pB3->setFont(myTabFont);
connect(pB3, SIGNAL(clicked()), this, SLOT(slot_pb3()));
pB4 = new QPushButton("load print32");
myVlayer_left->addWidget(pB4);
pB4->setFont(myTabFont);
connect(pB4, SIGNAL(clicked()), this, SLOT(slot_pb4()));
// Mitte: anzeigen
showFile = new QTextEdit();
myVlayer_midd->addWidget(showFile);
myTabFont.setPixelSize(14);
showFile->setFont(myTabFont);
showFile->setStyleSheet("background-color: white");
showFile->append("content of the loaded file:");
showFile->append(" ");
showFile->append(" ");
// rechte Spalte: zum DC senden
myTabFont.setPixelSize(22);
pB5 = new QPushButton("send config");
myVlayer_right->addWidget(pB5);
pB5->setFont(myTabFont);
connect(pB5, SIGNAL(clicked()), this, SLOT(slot_pb5()));
pB6 = new QPushButton("send devices");
myVlayer_right->addWidget(pB6);
pB6->setFont(myTabFont);
connect(pB6, SIGNAL(clicked()), this, SLOT(slot_pb6()));
pB7 = new QPushButton("send cash");
myVlayer_right->addWidget(pB7);
pB7->setFont(myTabFont);
connect(pB7, SIGNAL(clicked()), this, SLOT(slot_pb7()));
pB8 = new QPushButton("send print32");
myVlayer_right->addWidget(pB8);
pB8->setFont(myTabFont);
connect(pB8, SIGNAL(clicked()), this, SLOT(slot_pb8()));
setLayout(myVmainlayer);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win13::~T_win13()
{
close();
}
void T_win13::Nav_back(void)
{
myNextStep=WCS_WIN13BAK;
}
void T_win13::Nav_home(void)
{
myNextStep=WCS_WIN13MID;
}
void T_win13::Nav_next(void)
{
myNextStep=WCS_WIN13FWD;
}
void T_win13::slot_pb1(void)
{
showFile->clear();
if (datei_ifFileExists(FILENAME_CONFIG))
{
loadedFile=datei_readFromFile(FILENAME_CONFIG);
showFile->append(loadedFile);
} else
{
showFile->append("file not found");
}
}
void T_win13::slot_pb2(void)
{
showFile->clear();
if (datei_ifFileExists(FILENAME_DEVICE))
{
loadedFile=datei_readFromFile(FILENAME_DEVICE);
showFile->append(loadedFile);
} else
{
showFile->append("file not found");
}
}
void T_win13::slot_pb3(void)
{
showFile->clear();
if (datei_ifFileExists(FILENAME_CASH))
{
loadedFile=datei_readFromFile(FILENAME_CASH);
showFile->append(loadedFile);
} else
{
showFile->append("file not found");
}
}
void T_win13::slot_pb4(void)
{
showFile->clear();
if (datei_ifFileExists(FILENAME_PRINT))
{
loadedFile=datei_readFromFile(FILENAME_PRINT);
showFile->append(loadedFile);
} else
{
showFile->append("file not found");
}
}
// send selected file:
void T_win13::slot_pb5(void) // send config
{
uint8_t buf800[800];
uint16_t ii, len;
len=loadedFile.size();
memset(buf800,0,800);
for (ii=0; ii<len; ii++)
buf800[ii]=loadedFile.at(ii);
//virtual bool sys_sendJsonFileToDc(uint8_t kindOfFile, uint8_t nrOfTemplate, uint8_t *content ) const =0;
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
// nrOfTemplate=1...32 if kindOfFile==6
// content = content of the Json file, max 800byte ascii signs
// file is 0-terminated!
// return false if sending is not possible, wait a second
HWaccess->sys_sendJsonFileToDc(1, 0, buf800);
}
void T_win13::slot_pb6(void)
{
uint8_t buf800[800];
uint16_t ii, len;
len=loadedFile.size();
memset(buf800,0,800);
for (ii=0; ii<len; ii++)
buf800[ii]=loadedFile.at(ii);
HWaccess->sys_sendJsonFileToDc(2, 0, buf800);
}
void T_win13::slot_pb7(void)
{
uint8_t buf800[800];
uint16_t ii, len;
len=loadedFile.size();
memset(buf800,0,800);
for (ii=0; ii<len; ii++)
buf800[ii]=loadedFile.at(ii);
HWaccess->sys_sendJsonFileToDc(3, 0, buf800);
}
void T_win13::slot_pb8(void)
{
uint8_t buf800[800];
uint16_t ii, len;
len=loadedFile.size();
memset(buf800,0,800);
for (ii=0; ii<len; ii++)
buf800[ii]=loadedFile.at(ii);
HWaccess->sys_sendJsonFileToDc(4, 32, buf800);
}
bool T_win13::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win13::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

76
win13_json.h Executable file
View File

@ -0,0 +1,76 @@
#ifndef WIN13_JSON_H
#define WIN13_JSON_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "QTextEdit"
#include "datei.h"
#include "QDir"
#include "guidefs.h"
class T_win13 : public QWidget
{
Q_OBJECT
//QGridLayout *myLayout;
QHBoxLayout *myH0layer, *myH1layer;
QVBoxLayout *myVmainlayer, *myVlayer_left;
QVBoxLayout *myVlayer_midd;
QVBoxLayout *myVlayer_right;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
QPushButton *pB1, *pB2, *pB3, *pB4, *pB5, *pB6, *pB7, *pB8;
QTextEdit *showFile;
QByteArray loadedFile;
public:
explicit T_win13(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win13();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_pb1(void);
void slot_pb2(void);
void slot_pb3(void);
void slot_pb4(void);
void slot_pb5(void);
void slot_pb6(void);
void slot_pb7(void);
void slot_pb8(void);
};
#endif

689
win14_mw.cpp Executable file
View File

@ -0,0 +1,689 @@
#include "win14_mw.h"
T_win14::T_win14(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myHmainlayer= new QHBoxLayout;
// myV1mainlayer= new QVBoxLayout;
// myV2mainlayer= new QVBoxLayout;
myH0layer = new QHBoxLayout;
myH1layer = new QHBoxLayout;
myH2layer = new QHBoxLayout;
myH3layer = new QHBoxLayout;
myH4layer = new QHBoxLayout;
myH5layer = new QHBoxLayout;
myH6layer = new QHBoxLayout;
myH7layer = new QHBoxLayout;
myVlayer_left = new QVBoxLayout;
//myVlayer_midd = new QVBoxLayout;
myVlayer_right = new QVBoxLayout;
myHmainlayer->addLayout(myVlayer_left);
myHmainlayer->addLayout(myVlayer_right);
myVlayer_left->addLayout(myH0layer);
myVlayer_left->addLayout(myH1layer);
myVlayer_left->addLayout(myH2layer);
myVlayer_left->addLayout(myH3layer);
myVlayer_left->addLayout(myH4layer);
myVlayer_left->addLayout(myH5layer);
myVlayer_left->addLayout(myH6layer);
myVlayer_left->addLayout(myH7layer);
QFont myTabFont;
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Coin Changer"));
lab1->setFont(myTabFont);
myH0layer->addWidget(lab1);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myH0layer->addWidget(lab2);
QLabel *lab40 =new QLabel(tr("Inserted Coin Value: "));
myH1layer->addWidget(lab40);
lab40->setFont(myTabFont);
// Wert:
//myTabFont.setPixelSize(PIXELSIZE_DATA);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
insertedCoin =new QLabel();
insertedCoin->setText(" 0 ");
insertedCoin->setFont(myTabFont);
insertedCoin->setStyleSheet(COLORWHITE);
insertedCoin->setAlignment(Qt::AlignCenter);
insertedCoin->setMinimumHeight(50);
myH1layer->addWidget(insertedCoin);
//QLabel *lab3 =new QLabel(tr(" "));
QLabel *lab3 =new QLabel(tr(" "));
myH1layer->addWidget(lab3);
lab3->setFont(myTabFont);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_powerOn = new QPushButton("Power ON");
myH1layer->addWidget(pb_powerOn);
pb_powerOn->setFont(myTabFont);
pb_powerOn->setCheckable(true); // true = toggle button
pb_powerOn->setAutoDefault(true); // beim start ein
pb_powerOn->setStyleSheet(COLORWHITE);
connect(pb_powerOn, SIGNAL(clicked()), this, SLOT(slot_powerOn()));
QLabel *lab53 =new QLabel(tr(" "));
myH1layer->addWidget(lab53);
lab53->setFont(myTabFont);
// 6 Fenster nebeneinander (Roehren)
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab52 =new QLabel(tr("Tubes: 1 2 3 4 5 6"));
myH3layer->addWidget(lab52);
lab52->setFont(myTabFont);
QLabel *lab50 =new QLabel(tr("Value [cent]: "));
myH4layer->addWidget(lab50);
lab50->setFont(myTabFont);
QLabel *lab51 =new QLabel(tr("Nr.of Coins: "));
myH5layer->addWidget(lab51);
lab51->setFont(myTabFont);
// Wert:
myTabFont.setPixelSize(PIXELSIZE_DATA);
lab20 =new QLabel();
lab20->setText(" - ");
lab20->setFont(myTabFont);
lab20->setStyleSheet(COLORYELLOW);
lab20->setAlignment(Qt::AlignCenter);
myH4layer->addWidget(lab20);
// Inhalt:
lab30 =new QLabel();
myH5layer->addWidget(lab30);
lab30->setText(" 0 ");
lab30->setFont(myTabFont);
lab30->setStyleSheet(COLORWHITE);
lab30->setAlignment(Qt::AlignCenter);
// Wert:
lab21 =new QLabel();
myH4layer->addWidget(lab21);
lab21->setText(" - ");
lab21->setFont(myTabFont);
lab21->setStyleSheet(COLORYELLOW);
lab21->setAlignment(Qt::AlignCenter);
// Inhalt:
lab31 =new QLabel();
myH5layer->addWidget(lab31);
lab31->setText(" 0 ");
lab31->setFont(myTabFont);
lab31->setStyleSheet(COLORWHITE);
lab31->setAlignment(Qt::AlignCenter);
lab22 =new QLabel();
myH4layer->addWidget(lab22);
lab22->setText(" - ");
lab22->setFont(myTabFont);
lab22->setStyleSheet(COLORYELLOW);
lab22->setAlignment(Qt::AlignCenter);
// Inhalt:
lab32 =new QLabel();
myH5layer->addWidget(lab32);
lab32->setText(" 0 ");
lab32->setFont(myTabFont);
lab32->setStyleSheet(COLORWHITE);
lab32->setAlignment(Qt::AlignCenter);
lab23 =new QLabel();
myH4layer->addWidget(lab23);
lab23->setText(" - ");
lab23->setFont(myTabFont);
lab23->setStyleSheet(COLORYELLOW);
lab23->setAlignment(Qt::AlignCenter);
// Inhalt:
lab33 =new QLabel();
myH5layer->addWidget(lab33);
lab33->setText(" 0 ");
lab33->setFont(myTabFont);
lab33->setStyleSheet(COLORWHITE);
lab33->setAlignment(Qt::AlignCenter);
lab24 =new QLabel();
myH4layer->addWidget(lab24);
lab24->setText(" - ");
lab24->setFont(myTabFont);
lab24->setStyleSheet(COLORYELLOW);
lab24->setAlignment(Qt::AlignCenter);
// Inhalt:
lab34 =new QLabel();
myH5layer->addWidget(lab34);
lab34->setText(" 0 ");
lab34->setFont(myTabFont);
lab34->setStyleSheet(COLORWHITE);
lab34->setAlignment(Qt::AlignCenter);
lab25 =new QLabel();
myH4layer->addWidget(lab25);
lab25->setText(" - ");
lab25->setStyleSheet(COLORYELLOW);
lab25->setFont(myTabFont);
lab25->setAlignment(Qt::AlignCenter);
// Inhalt:
lab35 =new QLabel();
myH5layer->addWidget(lab35);
lab35->setText(" 0 ");
lab35->setFont(myTabFont);
lab35->setStyleSheet(COLORWHITE);
lab35->setAlignment(Qt::AlignCenter);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
QLabel *lab5 =new QLabel(tr("Total content: "));
myH6layer->addWidget(lab5);
lab5->setFont(myTabFont);
myTabFont.setPixelSize(PIXELSIZE_DATA);
labTotalContent =new QLabel();
myH6layer->addWidget(labTotalContent);
labTotalContent->setFont(myTabFont);
showDynamics = new QTextEdit("dynamic values:");
myH7layer->addWidget(showDynamics);
showDynamics->setFont(myTabFont);
showDynamics->setStyleSheet("background-color: white");
showDynamics->append(" ");
/*
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_powerOn = new QPushButton(" Power ON ");
myVlayer_right->addWidget(pb_powerOn);
pb_powerOn->setFont(myTabFont);
pb_powerOn->setCheckable(true); // true = toggle button
pb_powerOn->setAutoDefault(false); // beim start aus
pb_powerOn->setStyleSheet(COLORWHITE);
connect(pb_powerOn, SIGNAL(clicked()), this, SLOT(slot_powerOn()));
*/
pb_startPay = new QPushButton("Start filling");
myVlayer_right->addWidget(pb_startPay);
pb_startPay->setFont(myTabFont);
pb_startPay->setCheckable(false); // true = toggle button
pb_startPay->setAutoDefault(false); // beim start aus
pb_startPay->setStyleSheet(COLORWHITE);
connect(pb_startPay, SIGNAL(clicked()), this, SLOT(ButtonStartClicked()));
pb_stopPay = new QPushButton("Stop filling");
pb_stopPay->setFont(myTabFont);
myVlayer_right->addWidget(pb_stopPay);
connect(pb_stopPay, SIGNAL(clicked()), this, SLOT(ButtonStopClicked()));
pb_vendSucc = new QPushButton("Finish, or:");
pb_vendSucc->setFont(myTabFont);
myVlayer_right->addWidget(pb_vendSucc);
connect(pb_vendSucc, SIGNAL(clicked()), this, SLOT(ButtonSuccClicked()));
pb_giveChange = new QPushButton("Payout 185cent");
myVlayer_right->addWidget(pb_giveChange);
pb_giveChange->setFont(myTabFont);
pb_giveChange->setCheckable(false); // true = toggle button
pb_giveChange->setStyleSheet(COLORWHITE);
connect(pb_giveChange, SIGNAL(clicked()), this, SLOT(slot_giveChange()));
pb_giveAll = new QPushButton("Empty completely");
myVlayer_right->addWidget(pb_giveAll);
pb_giveAll->setFont(myTabFont);
pb_giveAll->setCheckable(false); // true = toggle button
pb_giveAll->setStyleSheet(COLORWHITE);
connect(pb_giveAll, SIGNAL(clicked()), this, SLOT(slot_giveAll()));
showChangeRes =new QLabel(" ");
myVlayer_right->addWidget(showChangeRes);
//showChangeRes->setText(" ");
showChangeRes->setFont(myTabFont);
showChangeRes->setStyleSheet(COLORWHITE);
showChangeRes->setAlignment(Qt::AlignCenter);
showChangeRes->setMaximumHeight(80);
// Eingangssignal auf QObject casten, weil hwinf kein QObject ist
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_gotNewCoin()), this, SLOT(signalGotNewCoin()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinCollectionJustStarted()), this, SLOT(signalJustStarted()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinCollectionAborted()), this, SLOT(signalCollectAbort()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByMax()), this, SLOT(signalStopByMax()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByPushbutton()), this, SLOT(signalStopByUser()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByEscrow()), this, SLOT(signalStopByEscrow()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByError()), this, SLOT(signalStopByError()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payStopByTimeout()), this, SLOT(signalStopTO()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_payCancelled()), this, SLOT(signalCancelled()));
connect( dynamic_cast<QObject*>(HWaccess), SIGNAL(hwapi_coinProcessJustStopped()), this, SLOT(signalProcessStop()));
setLayout(myHmainlayer);
myNextStep=0;
myStep=0;
fl_payStarted=false;
fl_storeStartVal=true;
fl_displayLevel=false;
for (int ii=0; ii<8; ii++)
{
diffLevel[ii]=0;
mw_BeginLevel[ii]=0;
}
diffAmount=0; totalContent=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(200);
}
T_win14::~T_win14()
{
close();
}
void T_win14::Nav_back(void)
{
myNextStep=WCS_WIN14BAK;
}
void T_win14::Nav_home(void)
{
myNextStep=WCS_WIN14MID;
}
void T_win14::Nav_next(void)
{
myNextStep=WCS_WIN14FWD;
}
void T_win14::slot_powerOn(void)
{
if (pb_powerOn->isChecked())
{
HWaccess->mdb_switchPower(true);
} else
{
HWaccess->mdb_switchPower(false);
}
}
void T_win14::ButtonStartClicked(void)
{
HWaccess->cash_startPayment(0);
insertedCoin->clear();
fl_payStarted=true;
fl_storeStartVal=true;
for (int ii=0; ii<8; ii++)
{
diffLevel[ii]=0;
}
diffAmount=0;
showDynamics->clear();
}
void T_win14::ButtonStopClicked(void)
{
HWaccess->cash_stopPayment();
pb_startPay->setStyleSheet(COLORYELLOW);
}
void T_win14::ButtonSuccClicked(void)
{
HWaccess->vend_success();
pb_startPay->setStyleSheet(COLORWHITE);
}
void T_win14::slot_giveChange(void)
{
HWaccess->changer_returnCoins(185);
pb_startPay->setStyleSheet(COLORWHITE);
showChangeRes->setText(" busy... ");
}
void T_win14::slot_giveAll(void)
{
HWaccess->changer_returnCoins(totalContent);
pb_startPay->setStyleSheet(COLORWHITE);
showChangeRes->setText(" busy... ");
}
void T_win14::signalGotNewCoin()
{
uint32_t ultmp;
QString myStr;
//uint16_t types[66], values[66];
//int nn;
myStr.clear();
ultmp=HWaccess->getLastInsertedCoin();
{
myStr.append(QString::number(ultmp));
insertedCoin->setText(myStr);
}
}
void T_win14::signalJustStarted()
{
pb_startPay->setStyleSheet("background-color: green");
}
void T_win14::signalCollectAbort()
{
pb_startPay->setStyleSheet("background-color: white");
}
void T_win14::signalStopByMax()
{
pb_startPay->setStyleSheet("background-color: yellow");
}
void T_win14::signalStopByUser()
{
pb_startPay->setStyleSheet("background-color: yellow");
}
void T_win14::signalStopByEscrow()
{
pb_startPay->setStyleSheet("background-color: yellow");
}
void T_win14::signalStopByError()
{
pb_startPay->setStyleSheet("background-color: white");
}
void T_win14::signalStopTO()
{
pb_startPay->setStyleSheet("background-color: white");
}
void T_win14::signalCancelled()
{
pb_startPay->setStyleSheet("background-color: white");
}
void T_win14::signalProcessStop()
{
pb_startPay->setStyleSheet("background-color: white");
}
bool T_win14::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
this->ButtonSuccClicked();
return false;
}
bool T_win14::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
uint8_t buf8t[8], res;
char ctmp;
int pp, ii;
uint32_t oneSum;
QString myStr;
bool found;
myStr.clear();
*nextScreen=0; // 0=no change
*useNavi=0;
struct T_chg_Tub tubLevel;
struct T_changer mw;
uint32_t returnedAmount;
if (HWaccess->mdb_isMdbPowerOn())
pb_powerOn->setStyleSheet(COLORGREEN);
else
pb_powerOn->setStyleSheet(COLORWHITE);
HWaccess->changer_getAllParameters(&mw);
if (mw.paymentRunning && fl_payStarted)
{
pb_startPay->setStyleSheet(COLORGREEN);
fl_payStarted=false;
}
HWaccess->changer_getTubelevel(&tubLevel);
if (fl_storeStartVal)
{
// call only at program start
found=false;
// wait until levels are known (at least one >0)
for (ii=0; ii<6; ii++)
{
if (tubLevel.tubeLevel[ii]>0)
found=true;
}
if (found)
{
// store current levels
for (ii=0; ii<8; ii++)
mw_BeginLevel[ii] = tubLevel.tubeLevel[ii];
fl_storeStartVal=false;
fl_displayLevel=true;
}
}
showDynamics->clear();
showDynamics->append(swl_labelAndValToStr("Country Code (6520=EURO): ", mw.countryCode));
showDynamics->append(swl_labelAndValToStr("Scale multiplier: ", mw.scale));
showDynamics->append(swl_labelAndValToStr("Currency decimals: ", mw.decimals));
for (ii=0; ii<8; ii++)
{
res=mw.coinSetup[ii];
if (res !=3)
res *= mw.scale; // Tokenwert 3 nicht veraendern
buf8t[ii]=res;
}
showDynamics->append(swl_8valInaRowToStr("accepted coin 1-8 : ", buf8t));
/*
//showDynamics->append(swl_8valInaRowToStr("accepted coin9-16: ", &mw.coinSetup[8])); // nur 0er
int pp=1;
for (ii=0; ii<6; ii++)
{
if (mw.availableTubes & pp)
buf8t[ii]=mw.coinSetup[ii] * mw.scale;
else
buf8t[ii]=0;
pp<<=1;
}
showDynamics->append(swl_8valInaRowToStr("available tubes : ", buf8t));
*/
showDynamics->append(swl_8valInaRowToStr("level of tubes : ", tubLevel.tubeLevel));
lab30->setText(swl_ulong2str(tubLevel.tubeLevel[0]));
lab31->setText(swl_ulong2str(tubLevel.tubeLevel[1]));
lab32->setText(swl_ulong2str(tubLevel.tubeLevel[2]));
lab33->setText(swl_ulong2str(tubLevel.tubeLevel[3]));
lab34->setText(swl_ulong2str(tubLevel.tubeLevel[4]));
lab35->setText(swl_ulong2str(tubLevel.tubeLevel[5]));
/*
pp=1;
for (ii=0; ii<6; ii++)
{
if (mw.availableTubes & pp)
buf8t[ii]=mw.coinSetup[ii] * mw.scale;
else
buf8t[ii]=0;
pp<<=1;
}
buf8t[6]=0; buf8t[7]=0;
showDynamics->append(swl_8valInaRowToStr("value of tubes : ", buf8t));
*/
// Feld rot wenn Roehre voll:
if (tubLevel.tubeFull[0] && tubLevel.tubeValues[0]>0) lab30->setStyleSheet(COLOR_LIGHTRED); else lab30->setStyleSheet(COLORWHITE);
if (tubLevel.tubeFull[1] && tubLevel.tubeValues[1]>0) lab31->setStyleSheet(COLOR_LIGHTRED); else lab31->setStyleSheet(COLORWHITE);
if (tubLevel.tubeFull[2] && tubLevel.tubeValues[2]>0) lab32->setStyleSheet(COLOR_LIGHTRED); else lab32->setStyleSheet(COLORWHITE);
if (tubLevel.tubeFull[3] && tubLevel.tubeValues[3]>0) lab33->setStyleSheet(COLOR_LIGHTRED); else lab33->setStyleSheet(COLORWHITE);
if (tubLevel.tubeFull[4] && tubLevel.tubeValues[4]>0) lab34->setStyleSheet(COLOR_LIGHTRED); else lab34->setStyleSheet(COLORWHITE);
if (tubLevel.tubeFull[5] && tubLevel.tubeValues[5]>0) lab35->setStyleSheet(COLOR_LIGHTRED); else lab35->setStyleSheet(COLORWHITE);
for (int ii=0; ii<8; ii++)
{
ctmp=char(tubLevel.tubeFull[ii]);
buf8t[ii]=ctmp;
}
showDynamics->append(swl_8valInaRowToStr("full tubes : ", buf8t));
showDynamics->append(swl_8valInaRowToStr("tube values : ", tubLevel.tubeValues));
// Roehren-Wertigkeiten oben in gelben Feldern anzeigen:
lab20->setText(swl_ulong2str(tubLevel.tubeValues[0]));
lab21->setText(swl_ulong2str(tubLevel.tubeValues[1]));
lab22->setText(swl_ulong2str(tubLevel.tubeValues[2]));
lab23->setText(swl_ulong2str(tubLevel.tubeValues[3]));
lab24->setText(swl_ulong2str(tubLevel.tubeValues[4]));
lab25->setText(swl_ulong2str(tubLevel.tubeValues[5]));
//showDynamics->append(swl_8valInaRowToStr("filled tubes : ", tubLevel.tubeFilled));
//showDynamics->append(swl_8valInaRowToStr("dispensed tubes : ", tubLevel.tubeDispens)); // stimmt nicht ist aber auch nicht nötig
// Anzeige Wechsler Gesamtinhalt:
totalContent=0;
for (ii=0; ii<6; ii++)
{
oneSum = tubLevel.tubeLevel[ii] * tubLevel.tubeValues[ii];
totalContent += oneSum;
}
labTotalContent->setText(swl_centToEuroString(totalContent));
if (fl_displayLevel)
{
// display filled/dispensed coins and their value, start first when tubelevel is known
// int diffLevel[6];
// long diffAmount;
diffLevel[6]=0; diffLevel[7]=0;
for (ii=0; ii<6; ii++)
{
diffLevel[ii]= tubLevel.tubeLevel[ii] - mw_BeginLevel[ii];
}
// Testwerte:
//diffLevel[1]=-6; diffLevel[2]=2; diffLevel[3]=-10; diffLevel[4]=3;
//showDynamics->append(swl_8valInaRowToStr("start level : ", mw_BeginLevel));
diffAmount=0;
for (ii=0; ii<6; ii++)
{
pp = diffLevel[ii] * tubLevel.tubeValues[ii];
diffAmount += pp;
}
showDynamics->append( swl_8intsInaRowToStr(" tubes changes: ", diffLevel));
myStr="Inserted in total: ";
if (diffAmount>=0)
{
myStr.append(swl_centToEuroString(diffAmount));
} else
{
myStr.append(swl_long2str(diffAmount));
myStr.append(" cents");
}
showDynamics->append(myStr);
}
res=HWaccess->changer_getChangeResult(&returnedAmount);
// get result of coin dispensing
// receivedData[0]: 0: not yet started 1:amount returned
// 2:only partial return 3: no return possible
// receivedData[2,3,4,5]: returned amount
myStr.clear();
//if (res==0)
// showChangeRes->setText(" --- \n");
//else
if (res==1)
{
myStr.append("amount \nreturned");
//myStr.append(swl_ulong2str(returnedAmount)); // ist hier immer 0
//myStr.append(" cent remain");
showChangeRes->setText(myStr);
} else
if (res==2)
{
myStr.append("partial returned\n");
myStr.append(swl_ulong2str(returnedAmount));
myStr.append("cent \nremain");
showChangeRes->setText(myStr);
} else
if (res==3)
showChangeRes->setText("not possible");
if (myStep<=1)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
uint16_t acc=0x07; // accept 5c,10c,20c
uint16_t coinVal[16];
memset(coinVal,0,32);
coinVal[0]=2;
coinVal[3]=49;
coinVal[10]=230;
HWaccess->emp_sendSettings(acc, 12, coinVal); // getestet 19.10.23TS
}
} else
if (myStep==2)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
HWaccess->changer_requestChangeResult();
}
} else
if (myStep==3)
{
if (!myTO->isActive())
{
myStep=2;
myTO->start(200);
HWaccess->changer_requestTubelevel();
}
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

111
win14_mw.h Executable file
View File

@ -0,0 +1,111 @@
#ifndef WIN14_MW_H
#define WIN14_MW_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win14 : public QWidget
{
Q_OBJECT
//QGridLayout *myLayout;
QHBoxLayout *myH0layer, *myH1layer, *myH2layer, *myH3layer, *myH4layer;
QHBoxLayout *myH5layer, *myH6layer, *myH7layer;
QVBoxLayout *myVmainlayer, *myVlayer_left;
QVBoxLayout *myVlayer_midd;
QVBoxLayout *myVlayer_right;
QHBoxLayout *myHmainlayer;
QVBoxLayout *myV1mainlayer, *myV2mainlayer;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QTimer *myTO;
//QPushButton *pB1, *pB2, *pB3, *pB4, *pB5, *pB6, *pB7, *pB8;
QLabel *lab20, *lab21, *lab22, *lab23, *lab24, *lab25;
QLabel *lab30, *lab31, *lab32, *lab33, *lab34, *lab35;
QLabel *lab41, *lab43, *insertedCoin, *showChangeRes;
QLabel *labTotalContent;
//QTextEdit *showStatics;
QTextEdit *showDynamics;
QPushButton *pb_stopPay, *pb_vendSucc;
QPushButton *pb_startPay;
QPushButton *pb_powerOn, *pb_giveChange, *pb_giveAll;
bool fl_payStarted;
bool fl_storeStartVal;
bool fl_displayLevel;
uint8_t mw_BeginLevel[8];
int diffLevel[8];
long diffAmount;
uint32_t totalContent;
public:
explicit T_win14(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win14();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_powerOn(void);
void ButtonStartClicked();
void ButtonStopClicked(void);
void ButtonSuccClicked(void);
void slot_giveChange(void);
void slot_giveAll(void);
void signalGotNewCoin();
void signalJustStarted();
void signalCollectAbort();
void signalStopByMax();
void signalStopByUser();
void signalStopByEscrow();
void signalStopByError();
void signalStopTO() ;
void signalCancelled() ;
void signalProcessStop();
/*
void slot_pb3(void);
void slot_pb4(void);
void slot_pb5(void);
void slot_pb6(void);
void slot_pb8(void);
*/
};
#endif

484
win15_bna.cpp Executable file
View File

@ -0,0 +1,484 @@
#include "win15_bna.h"
T_win15::T_win15(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
myH0layer = new QHBoxLayout;
myVlayer_left = new QVBoxLayout;
myVlayer_midd = new QVBoxLayout;
myVlayer_right = new QVBoxLayout;
myH0layer->addLayout(myVlayer_left);
myH0layer->addLayout(myVlayer_midd);
myH0layer->addLayout(myVlayer_right);
QFont myTabFont;
myTabFont.setPixelSize(22);
myTabFont.setPixelSize(PIXELSIZE_LABEL);
lab1 =new QLabel(tr("Bank note reader"));
lab1->setFont(myTabFont);
//myLayout->addWidget(lab1,1,1);
myVlayer_left->addWidget(lab1);
myTabFont.setPixelSize(PIXELSIZE_DATA);
showDynamics = new QTextEdit("dynamic values:");
showDynamics->setFont(myTabFont);
showDynamics->setStyleSheet("background-color: white");
showDynamics->append(" ");
//myLayout->addWidget(showDynamics,3,1);
myVlayer_left->addWidget(showDynamics);
lab4 =new QLabel(tr("Stacker / Billbox:"));
lab4->setFont(myTabFont);
//myLayout->addWidget(lab4,4,1);
myVlayer_left->addWidget(lab4);
showStacker = new QTextEdit("stacker content:");
showStacker->setFont(myTabFont);
showStacker->setStyleSheet("background-color: white");
showStacker->append(" ");
showStacker->setMinimumHeight(250);
//myLayout->addWidget(showStacker,5,1);
myVlayer_left->addWidget(showStacker);
lab5 =new QLabel(tr("Reader Data:"));
lab5->setFont(myTabFont);
//myLayout->addWidget(lab5,6,1);
myVlayer_midd->addWidget(lab5);
showStatics = new QTextEdit("static values:");
showStatics->setFont(myTabFont);
showStatics->setStyleSheet("background-color: white");
showStatics->append(" ");
//myLayout->addWidget(showStatics,7,1);
myVlayer_midd->addWidget(showStatics);
myTabFont.setPixelSize(PIXELSIZE_BUTTONS);
pb_powerOn = new QPushButton(" Power ON");
pb_powerOn->setFont(myTabFont);
pb_powerOn->setCheckable(true); // true = toggle button
pb_powerOn->setAutoDefault(true); // beim start ein
pb_powerOn->setStyleSheet(COLORWHITE);
connect(pb_powerOn, SIGNAL(clicked()), this, SLOT(slot_powerOn()));
//myLayout->addWidget(pb_powerOn,2,2);
myVlayer_right->addWidget(pb_powerOn);
pb_sendDefault = new QPushButton("All Bills on");
pb_sendDefault->setFont(myTabFont);
pb_sendDefault->setStyleSheet(COLORWHITE);
connect(pb_sendDefault, SIGNAL(clicked()), this, SLOT(slot_sendDef()));
//myLayout->addWidget(pb_sendDefault,3,2);
myVlayer_right->addWidget(pb_sendDefault);
pb_startPay = new QPushButton("Start Payment");
pb_startPay->setFont(myTabFont);
pb_startPay->setCheckable(false); // true = toggle button
pb_startPay->setAutoDefault(false); // beim start aus
pb_startPay->setStyleSheet(COLORWHITE);
connect(pb_startPay, SIGNAL(clicked()), this, SLOT(slot_start()));
//myLayout->addWidget(pb_startPay, 4,2);
myVlayer_right->addWidget(pb_startPay);
pb_only10_5 = new QPushButton(" only 10€ & 5€");
pb_only10_5->setFont(myTabFont);
pb_only10_5->setStyleSheet(COLORWHITE);
connect(pb_only10_5, SIGNAL(clicked()), this, SLOT(slot_send10_5()));
//myLayout->addWidget(pb_only10_5,5,2);
myVlayer_right->addWidget(pb_only10_5);
pb_only5 = new QPushButton(" only 5€");
pb_only5->setFont(myTabFont);
pb_only5->setStyleSheet(COLORWHITE);
connect(pb_only5, SIGNAL(clicked()), this, SLOT(slot_send5()));
//myLayout->addWidget(pb_only5,6,2);
myVlayer_right->addWidget(pb_only5);
pb_stopPay = new QPushButton("Stop Payment");
pb_stopPay->setFont(myTabFont);
pb_stopPay->setStyleSheet(COLORWHITE);
connect(pb_stopPay, SIGNAL(clicked()), this, SLOT(slot_stop()));
//myLayout->addWidget(pb_stopPay, 7,2);
myVlayer_right->addWidget(pb_stopPay);
//setLayout(myLayout);
setLayout(myH0layer);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
paymentStarted=false;
}
T_win15::~T_win15()
{
close();
}
void T_win15::Nav_back(void)
{
myNextStep=WCS_WIN15BAK;
}
void T_win15::Nav_home(void)
{
myNextStep=WCS_WIN15MID;
}
void T_win15::Nav_next(void)
{
myNextStep=WCS_WIN15FWD;
}
void T_win15::slot_powerOn(void)
{
if (pb_powerOn->isChecked())
{
HWaccess->mdb_switchPower(true);
} else
{
HWaccess->mdb_switchPower(false);
}
}
void T_win15::slot_sendDef(void)
{
uint16_t bilVals[16];
memset(bilVals,0,32);
bilVals[0]=500;
bilVals[1]=1000;
bilVals[2]=2000;
bilVals[3]=5000;
HWaccess->bna_sendSettings(0b0000000000001111, 0, bilVals, 35000);
}
void T_win15::slot_start(void)
{
HWaccess->cash_startPayment(0);
showDynamics->clear();
showDynamics->setStyleSheet("background-color: white");
pb_startPay->setStyleSheet(COLORWHITE);
paymentStarted=true;
}
void T_win15::slot_send10_5(void)
{
HWaccess->bna_setCurrentAcceptance(0b0000000000000011);
}
void T_win15::slot_send5(void)
{
HWaccess->bna_setCurrentAcceptance(0b0000000000000001);
}
void T_win15::slot_stop(void)
{
//HWaccess->cash_stopPayment();
HWaccess->vend_success();
pb_startPay->setStyleSheet(COLORWHITE);
showDynamics->clear();
showDynamics->setStyleSheet("background-color: white");
paymentStarted=false;
}
bool T_win15::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win15::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
struct T_dynamicCondition myDynMachCond;
*nextScreen=0; // 0=no change
*useNavi=0;
if (HWaccess->mdb_isMdbPowerOn())
pb_powerOn->setStyleSheet(COLORGREEN);
else
pb_powerOn->setStyleSheet(COLORWHITE);
HWaccess->sys_getDynMachineConditions(&myDynMachCond);
if (myDynMachCond.paymentInProgress==2)
{
pb_startPay->setStyleSheet(COLORGREEN);
displayDynamics();
}
displayStacker();
displayStatics();
if (myStep==0)
{
myStep++;
} else
if (myStep==1)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
HWaccess->bna_requestParameters();
//qDebug()<<"win15 requesting bna parameters";
}
} else
if (myStep==2)
{
if (!myTO->isActive())
{
myStep++;
myTO->start(200);
HWaccess->bna_requestCurrentNotes();
//qDebug()<<"win15 requesting bna new bills";
}
} else
if (myStep==3)
{
if (!myTO->isActive())
{
myStep=1;
myTO->start(200);
HWaccess->bna_requestStackerLevel();
}
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}
void T_win15::displayDynamics(void)
{
uint8_t ret;
uint16_t currentNotes[8];
uint32_t amount;
static uint8_t lastNoteCount;
ret= HWaccess->bna_getCurrentNotes(0, currentNotes);
// returns number of collected bank notes since start-command (current transaction)
// latestBill: not used
// currentNotes[0] = last bill value
// currentNotes[1] = 0/1 1 if bill in escrow 0 if bill in cash box (stacker)
// currentNotes[2,3] = total sum of collected bills within this transaction
if (paymentStarted==false)
{
} else
if (ret==99 )
{
showDynamics->clear();
showDynamics->append("BNA ERROR");
//qDebug() << "BNA ERROR "<< currentNotes[0] <<" "<< currentNotes[1] <<" "
// << currentNotes[2] <<" "<< currentNotes[3];
if (currentNotes[0]>0)
showDynamics->append(swl_int2str(currentNotes[0]));
if (currentNotes[1]>0)
showDynamics->append(swl_int2str(currentNotes[1]));
if (currentNotes[2]>0)
showDynamics->append(swl_int2str(currentNotes[2]));
if (currentNotes[3]>0)
showDynamics->append(swl_int2str(currentNotes[3]));
showDynamics->setStyleSheet("background-color: red");
} else
if (ret != lastNoteCount)
{
lastNoteCount=ret;
showDynamics->setStyleSheet("background-color: white");
showDynamics->clear();
showDynamics->append(swl_labelAndValToStr("count : ", ret));
showDynamics->append(swl_labelAndValToStr("Last bill: ", currentNotes[0]));
//showDynamics->append(swl_labelAndValToStr("stacked : ", currentNotes[1]));
if (currentNotes[1]==1)
showDynamics->append("in escrow");
else
showDynamics->append("stacked");
amount=currentNotes[3];
amount<<=16;
amount |=currentNotes[2];
showDynamics->append(swl_labelAndValToStr("total : ", amount));
}
}
void T_win15::displayStacker(void)
{
uint16_t ret;
uint32_t amountInStacker;
uint16_t countOfBills[16];
static uint16_t stacker_lastCount;
ret= HWaccess->bna_getStackerLevel(&amountInStacker, countOfBills);
// return val: nr of bills in stacker
// countOfBills[0..7] = count of bills of bill-type 0..7 (e.g. countOfBills[0]=nr of 5€-bills in stacker)
// countOfBills[8..15] = value of bill-type 0...7
if (ret>0 && ret != stacker_lastCount)
{
qDebug()<<"win15 displ stacker "<< ret << " " << stacker_lastCount;
stacker_lastCount=ret;
showStacker->clear();
showStacker->append(swl_labelAndValToStr("count of bills : ", ret));
showStacker->append(swl_labelAndValToStr("total amount : ", amountInStacker));
showStacker->append(swl_labelAndValToStr("count of bill 0: ", countOfBills[0]));
showStacker->append(swl_labelAndValToStr("count of bill 1: ", countOfBills[1]));
showStacker->append(swl_labelAndValToStr("count of bill 2: ", countOfBills[2]));
showStacker->append(swl_labelAndValToStr("count of bill 3: ", countOfBills[3]));
showStacker->append(swl_labelAndValToStr("count of bill 4: ", countOfBills[4]));
showStacker->append(swl_labelAndValToStr("count of bill 5: ", countOfBills[5]));
showStacker->append(swl_labelAndValToStr("count of bill 6: ", countOfBills[6]));
showStacker->append(swl_labelAndValToStr("count of bill 7: ", countOfBills[7]));
showStacker->append(swl_labelAndValToStr("value of bill 0: ", countOfBills[8]));
showStacker->append(swl_labelAndValToStr("value of bill 1: ", countOfBills[9]));
showStacker->append(swl_labelAndValToStr("value of bill 2: ", countOfBills[10]));
showStacker->append(swl_labelAndValToStr("value of bill 3: ", countOfBills[11]));
showStacker->append(swl_labelAndValToStr("value of bill 4: ", countOfBills[12]));
showStacker->append(swl_labelAndValToStr("value of bill 5: ", countOfBills[13]));
showStacker->append(swl_labelAndValToStr("value of bill 6: ", countOfBills[14]));
showStacker->append(swl_labelAndValToStr("value of bill 7: ", countOfBills[15]));
showStacker->moveCursor(QTextCursor::Start);
}
}
void T_win15::displayStatics(void)
{
struct T_bna bna;
static uint16_t lastCountryCode, lastStackLev;
HWaccess->bna_getAllParameters(&bna);
/* struct T_bna
uint8_t setup; // 0: not 1: got valid parameters from device
uint8_t FeatureLevel;
uint16_t countryCode; // programmed in EMP
uint16_t scalingFactor; // z.B. 5
uint8_t decimalPlace;
uint8_t pad1;
uint16_t stackerCap;
uint16_t billSecureLevel;
uint8_t hasEscrow;
uint8_t accBillTypes[16]; // programmed in EMP z.B. (bit 0..7): 1 2 4 10 20 40 0 0
uint16_t currentStackerLevel; // requested number of notes in billbox
// settings from Master
uint16_t intendedAccept; // bit 0 =5€
uint16_t pad2;
uint16_t billDenomination[16];
}; */
//if (bna.countryCode>0)
// qDebug()<<"win15 got CountryCode" << bna.countryCode;
if (bna.countryCode>0 && (lastCountryCode!=bna.intendedAccept || lastStackLev != bna.currentStackerLevel))
{
lastCountryCode = bna.intendedAccept;
lastStackLev = bna.currentStackerLevel;
showStatics->clear();
showStatics->append(swl_labelAndValToStr("Parameter valid:", bna.setup));
showStatics->append(swl_labelAndValToStr("countryCode: ", bna.countryCode ));
showStatics->append(swl_labelAndValToStr("scalingFactor: ", bna.scalingFactor));
showStatics->append(swl_labelAndValToStr("decimals: ", bna.decimalPlace ));
showStatics->append(swl_labelAndValToStr("stackerCap: ", bna.stackerCap ));
showStatics->append(swl_labelAndValToStr("curr. st.Level: ", bna.currentStackerLevel ));
showStatics->append(swl_labelAndValToStr("intend accept : ", bna.intendedAccept ));
showStatics->append(" ");
showStatics->append(swl_labelAndValToStr("accBillTypes 1: ", bna.accBillTypes[0] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 2: ", bna.accBillTypes[1] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 3: ", bna.accBillTypes[2] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 4: ", bna.accBillTypes[3] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 5: ", bna.accBillTypes[4] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 6: ", bna.accBillTypes[5] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 7: ", bna.accBillTypes[6] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 8: ", bna.accBillTypes[7] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes 9: ", bna.accBillTypes[8] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes10: ", bna.accBillTypes[9] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes11: ", bna.accBillTypes[10] *bna.scalingFactor ));
showStatics->append(swl_labelAndValToStr("accBillTypes12: ", bna.accBillTypes[11] *bna.scalingFactor ));
//showStatics->append(swl_labelAndValToStr("curr. st.Level: ", bna.currentStackerLevel ));
//showStatics->append(swl_labelAndValToStr("intend accept : ", bna.intendedAccept ));
showStatics->append(swl_labelAndValToStr("intend denom 1: ", bna.billDenomination[0] ));
showStatics->append(swl_labelAndValToStr("intend denom 2: ", bna.billDenomination[1] ));
showStatics->append(swl_labelAndValToStr("intend denom 3: ", bna.billDenomination[2] ));
showStatics->append(swl_labelAndValToStr("intend denom 4: ", bna.billDenomination[3] ));
showStatics->append(swl_labelAndValToStr("intend denom 5: ", bna.billDenomination[4] ));
showStatics->append(swl_labelAndValToStr("intend denom 16 ", bna.billDenomination[5] ));
showStatics->append(swl_labelAndValToStr("intend denom 7: ", bna.billDenomination[6] ));
showStatics->append(swl_labelAndValToStr("intend denom 8: ", bna.billDenomination[7] ));
showStatics->append(swl_labelAndValToStr("intend denom 9: ", bna.billDenomination[8] ));
showStatics->append(swl_labelAndValToStr("intend denom10: ", bna.billDenomination[9] ));
showStatics->append(swl_labelAndValToStr("intend denom11: ", bna.billDenomination[10] ));
showStatics->append(swl_labelAndValToStr("intend denom12: ", bna.billDenomination[11] ));
showStatics->moveCursor(QTextCursor::Start);
}
}

78
win15_bna.h Executable file
View File

@ -0,0 +1,78 @@
#ifndef WIN15_BNA_H
#define WIN15_BNA_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win15 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
QHBoxLayout *myH0layer;
QVBoxLayout *myVlayer_left;
QVBoxLayout *myVlayer_midd;
QVBoxLayout *myVlayer_right;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1, *lab2, *lab3, *lab4, *lab5;
QTimer *myTO;
QPushButton *pb_powerOn, *pb_sendDefault, *pb_only10_5, *pb_only5;
QTextEdit *showDynamics, *showStatics, *showStacker;
QPushButton *pb_startPay, *pb_stopPay;
void displayDynamics(void);
void displayStacker(void);
void displayStatics(void);
bool paymentStarted;
public:
explicit T_win15(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win15();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
void slot_powerOn(void);
void slot_sendDef(void);
void slot_send10_5(void);
void slot_send5(void);
void slot_start(void);
void slot_stop(void);
};
#endif

137
win16.cpp Executable file
View File

@ -0,0 +1,137 @@
#include "win16.h"
T_win16::T_win16(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("win16"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win16::~T_win16()
{
close();
}
void T_win16::Nav_back(void)
{
myNextStep=WCS_WIN16BAK;
}
void T_win16::Nav_home(void)
{
myNextStep=WCS_WIN16MID;
}
void T_win16::Nav_next(void)
{
myNextStep=WCS_WIN16FWD;
}
bool T_win16::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win16::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win16.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN16_H
#define WIN16_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win16 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win16(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win16();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif

136
win17.cpp Executable file
View File

@ -0,0 +1,136 @@
#include "win17.h"
T_win17::T_win17(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("win17"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win17::~T_win17()
{
close();
}
void T_win17::Nav_back(void)
{
myNextStep=WCS_WIN17BAK;
}
void T_win17::Nav_home(void)
{
myNextStep=WCS_WIN17MID;
}
void T_win17::Nav_next(void)
{
myNextStep=WCS_WIN17FWD;
}
bool T_win17::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win17::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win17.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN17_H
#define WIN17_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win17 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win17(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win17();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif

137
win18.cpp Executable file
View File

@ -0,0 +1,137 @@
#include "win18.h"
T_win18::T_win18(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("win18"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win18::~T_win18()
{
close();
}
void T_win18::Nav_back(void)
{
myNextStep=WCS_WIN18BAK;
}
void T_win18::Nav_home(void)
{
myNextStep=WCS_WIN18MID;
}
void T_win18::Nav_next(void)
{
myNextStep=WCS_WIN18FWD;
}
bool T_win18::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win18::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win18.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN18_H
#define WIN18_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win18 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win18(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win18();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif

137
win19.cpp Executable file
View File

@ -0,0 +1,137 @@
#include "win19.h"
T_win19::T_win19(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("win19"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win19::~T_win19()
{
close();
}
void T_win19::Nav_back(void)
{
myNextStep=WCS_WIN19BAK;
}
void T_win19::Nav_home(void)
{
myNextStep=WCS_WIN19MID;
}
void T_win19::Nav_next(void)
{
myNextStep=WCS_WIN19FWD;
}
bool T_win19::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win19::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win19.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN19_H
#define WIN19_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win19 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win19(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win19();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif

136
win20.cpp Executable file
View File

@ -0,0 +1,136 @@
#include "win20.h"
T_win20::T_win20(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("win20"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win20::~T_win20()
{
close();
}
void T_win20::Nav_back(void)
{
myNextStep=WCS_WIN20BAK;
}
void T_win20::Nav_home(void)
{
myNextStep=WCS_WIN20MID;
}
void T_win20::Nav_next(void)
{
myNextStep=WCS_WIN20FWD;
}
bool T_win20::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_ON | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win20::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win20.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN20_H
#define WIN20_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win20 : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win20(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win20();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif

139
win_template.cpp Executable file
View File

@ -0,0 +1,139 @@
#include "win_template.h"
T_win_template::T_win_template(hwinf *HWaccess, QWidget *parent) : QWidget(parent)
{
this->HWaccess = HWaccess;
myLayout = new QGridLayout;
QFont myTabFont;
myTabFont.setPixelSize(22);
lab1 =new QLabel(tr("template screen"));
lab1->setFont(myTabFont);
myLayout->addWidget(lab1,1,0);
lab2 =new QLabel(tr(" "));
lab2->setFont(myTabFont);
myLayout->addWidget(lab2,2,0);
lab3 =new QLabel(tr(" "));
lab3->setFont(myTabFont);
myLayout->addWidget(lab3,3,0);
setLayout(myLayout);
myNextStep=0;
myStep=0;
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(2000);
}
T_win_template::~T_win_template()
{
close();
}
void T_win_template::Nav_back(void)
{
myNextStep=WCS_WIN99BAK;
}
void T_win_template::Nav_home(void)
{
myNextStep=WCS_WIN99MID;
}
void T_win_template::Nav_next(void)
{
myNextStep=WCS_WIN99FWD;
}
bool T_win_template::work_ini(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called ONE time after selecting this state (initialization)
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // needed 0=no change
*useNavi=SWITCH_BACK_OFF | SWITCH_HOME_ON | SWITCH_NEXT_ON;
myNextStep=0;
return false;
}
bool T_win_template::working(uint16_t *nextScreen, uint8_t *useNavi)
{
// one state of the vending/operating FSM
// called cyclic until this state changes intentionally to another state
// display informations for human operator, react on operators inputs or wait for payment media
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
*nextScreen=0; // 0=no change
*useNavi=0;
if (myStep==0)
{
myTO->start(); // restart
} else
if (myStep==1)
{
if (!myTO->isActive())
{
// time out
}
} else
if (myStep==2)
{
} else
if (myStep==3)
{
} else
if (myStep==4)
{
} else
if (myStep==5)
{
} else
if (myStep==6)
{
} else
if (myStep==7)
{
} else
{
}
if (myNextStep)
{
//qDebug()<<"fenster1 working: "<< myNextStep;
*nextScreen=myNextStep;
myNextStep=0;
}
return false;
}

56
win_template.h Executable file
View File

@ -0,0 +1,56 @@
#ifndef WIN_TEMPLATE_H
#define WIN_TEMPLATE_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QObject>
#include <QTimer>
#include <QDebug>
#include <QScrollBar>
#include <QPlainTextEdit>
#include <QComboBox>
#include <QLabel>
#include <QScrollArea>
#include <QSerialPortInfo>
#include <QWidget>
#include <QListWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include "tslib.h"
#include "stepList.h"
#include "plugin.h"
#include "guidefs.h"
class T_win_template : public QWidget
{
Q_OBJECT
QGridLayout *myLayout;
hwinf *HWaccess;
uint16_t myNextStep;
uint8_t myStep;
QLabel *lab1;
QLabel *lab2;
QLabel *lab3;
QTimer *myTO;
public:
explicit T_win_template(hwinf *HWaccess = nullptr, QWidget *parent = nullptr);
bool work_ini(uint16_t *nextScreen, uint8_t *useNavi);
// useNavi=0: no change
// bit0,1: enable/disable button "next"
// bit2,3: enable/disable button "home"
// bit4,5: enable/disable button "back"
bool working (uint16_t *nextScreen, uint8_t *useNavi);
~T_win_template();
public slots:
void Nav_back(void);
void Nav_home(void);
void Nav_next(void);
};
#endif