use new pos printer settings
This commit is contained in:
parent
dc74c59287
commit
f0078647d4
9 changed files with 144 additions and 47 deletions
|
@ -46,8 +46,9 @@ PosPrinter::PosPrinter(const PrinterDevice& printerDevice) : printerDevice_(prin
|
|||
|
||||
if (printerDevice_.idVendor == 0) {
|
||||
for (const auto& supported : supportedPrinters_.models) {
|
||||
if (desc.idVendor == supported.first && desc.idProduct == supported.second) {
|
||||
if (desc.idVendor == std::get<0>(supported) && desc.idProduct == std::get<1>(supported)) {
|
||||
numDevice = i;
|
||||
printerEndpoint_ = std::get<2>(supported);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +56,7 @@ PosPrinter::PosPrinter(const PrinterDevice& printerDevice) : printerDevice_(prin
|
|||
if (desc.idVendor == printerDevice_.idVendor &&
|
||||
desc.idProduct == printerDevice_.idProduct) {
|
||||
numDevice = i;
|
||||
printerEndpoint_ = printerDevice.endpoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +124,7 @@ void PosPrinter::write(const std::string& text)
|
|||
int length = text_escaped.length();
|
||||
int actual{0};
|
||||
int retValue =
|
||||
libusb_bulk_transfer(devicePtr_, (0x03 | LIBUSB_ENDPOINT_OUT),
|
||||
libusb_bulk_transfer(devicePtr_, (printerEndpoint_ | LIBUSB_ENDPOINT_OUT),
|
||||
(unsigned char*)text_escaped.c_str(), length, &actual, 10000);
|
||||
if (retValue != 0 || actual != length)
|
||||
std::cerr << "Write Error" << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue