690 lines
21 KiB
C++
690 lines
21 KiB
C++
|
#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;
|
||
|
}
|
||
|
|