APservice/win19.cpp

138 lines
2.5 KiB
C++
Executable File

#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;
}