#ifndef POS_PRINTER_H #define POS_PRINTER_H #include #include #include #include struct SupportedPrinters { std::array, 2> models{ // {Vendor ID, Model ID} std::make_pair(0x0456, 0x0808), std::make_pair(0x0416, 0x5011), }; }; struct PrinterDevice { int idVendor{}; int idProduct{}; }; class PosPrinter { public: PosPrinter(); PosPrinter(const PrinterDevice& printerDevice); ~PosPrinter(); void write(const std::string& text); void printHeader(); void printTest(); void printSaleReceipt(Sale* sale); void printSellerReceipt(Seller* seller, int percent, int maxFeeInCent); bool isValid(); struct Command { static const std::string RESET; static const std::string ENCODING; static const std::string CENTERING; static const std::string LEFT_ALIGN; static const std::string RIGHT_ALIGN; static const std::string FONT_SIZE_BIG; static const std::string FONT_SIZE_NORMAL; static const std::string FEED; }; private: libusb_context* contextPtr_{}; libusb_device_handle* devicePtr_{}; SupportedPrinters supportedPrinters_; PrinterDevice printerDevice_{}; }; #endif