-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cpp
61 lines (42 loc) · 1.21 KB
/
main.cpp
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
53
54
55
56
57
58
59
60
61
#include <QtCore/QCoreApplication>
#include <iostream>
#include "printer.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Printer *p = new Printer();
std::cout << "Trying to open port" << std::endl;
bool res = p->open("/dev/ttyAMA0");
std::cout << "Status: " << res << std::endl;
if (!res) {
std::cerr << "Error opening port, aborting" << std::endl;
return (0);
}
p->init();
p->write("Printer Test\n");
p->setReverse(true);
p->write("Reverse ON\n");
p->setReverse(false);
p->setBold(true);
p->write("Bold ON\n");
p->setBold(false);
p->setUpDown(true);
p->write("UpDown ON\n");
p->setUpDown(false);
p->setUnderline(true);
p->write("Underline ON\n");
p->setUnderline(false);
p->setDoubleWidth(true);
p->write("Double Width ON\n");
p->setDoubleWidth(false);
p->setAlign(Printer::MIDDLE);
p->write("middle align\n");
p->setAlign(Printer::RIGHT);
p->write("right align\n");
p->setAlign(Printer::LEFT);
p->printBarcode("12345678", Printer::EAN8);
std::cout << "Closing Device" << std::endl;
p->close();
return 1;
return a.exec();
}