-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (48 loc) · 1019 Bytes
/
Copy pathmain.cpp
File metadata and controls
52 lines (48 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "usbdriver.h"
#include <QDebug>
#include <iostream>
using namespace std;
int getOption()
{
qDebug() << "COMMANDOS\n"
<< "\t[1] Open\n"
<< "\t[2] Close\n"
<< "\t[3] Print\n"
<< "\t[4] Get command set\n"
<< "\t[5] Get Product Info\n"
<< "\t[0] Exit\n"
<< "DIGITE:";
int opt = 0;
cin >> opt;
return opt;
}
void executeOption(BematechDrv &drv, int opt)
{
switch(opt)
{
case 1:
drv.open();
break;
case 2:
drv.close();
break;
case 3:
drv.sendCommand("\x1B\x74\x2 Renato\x0A\x1B\x50");
break;
case 4:
qDebug() << "Command set: " << drv.getCommandSet();
break;
case 5:
qDebug() << "Product Info:" << drv.productInfo();
}
}
int main(int argc, char **argv)
{
BematechDrv drv(3);
int opt = -1;
while(opt != 0) {
opt = getOption();
executeOption(drv, opt);
}
return 0;
}