138 lines
2.5 KiB
C++
Executable File
138 lines
2.5 KiB
C++
Executable File
#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;
|
|
}
|
|
|
|
|