APservice/win20.cpp

137 lines
2.5 KiB
C++
Raw Permalink Normal View History

2023-11-14 09:32:56 +01:00
#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;
}