2018-08-05 21:51:30 +02:00
|
|
|
#ifndef POS_PRINTER_H
|
|
|
|
#define POS_PRINTER_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <libusb-1.0/libusb.h>
|
|
|
|
|
2018-08-06 09:59:06 +02:00
|
|
|
struct SupportedPrinters {
|
|
|
|
std::array<std::pair<int, int>, 2> models{
|
|
|
|
// {Vendor ID, Model ID}
|
|
|
|
std::make_pair(0x0456, 0x0808),
|
|
|
|
std::make_pair(0x0416, 0x5011),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-08-05 21:51:30 +02:00
|
|
|
class PosPrinter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PosPrinter();
|
|
|
|
~PosPrinter();
|
2018-08-06 12:52:45 +02:00
|
|
|
void write(const std::string& text);
|
|
|
|
void printHeader();
|
|
|
|
void printTest();
|
|
|
|
|
|
|
|
struct Command {
|
|
|
|
static const std::string RESET;
|
|
|
|
static const std::string ENCODING;
|
|
|
|
static const std::string CENTERING;
|
|
|
|
static const std::string FONT_SIZE_BIG;
|
|
|
|
static const std::string FONT_SIZE_NORMAL;
|
|
|
|
static const std::string LEFT_ALIGN;
|
|
|
|
static const std::string FEED;
|
|
|
|
};
|
2018-08-06 09:59:06 +02:00
|
|
|
|
|
|
|
private:
|
2018-08-05 21:51:30 +02:00
|
|
|
libusb_context* contextPtr_{};
|
|
|
|
libusb_device_handle* devicePtr_{};
|
2018-08-06 09:59:06 +02:00
|
|
|
SupportedPrinters supportedPrinters_;
|
2018-08-05 21:51:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|