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