This Commit adds a rudimentary printer factory to greatly simplify the creation of printers
All checks were successful
Build ptprnt / build (push) Successful in 1m36s

This commit is contained in:
Moritz Martinius
2024-03-23 14:35:43 +01:00
parent e0e158ca90
commit 0462ba4d34
13 changed files with 86 additions and 53 deletions

View File

@@ -25,6 +25,7 @@
#include "interface/IPrinterDriver.hpp"
#include "interface/IPrinterTypes.hpp"
#include "libusbwrap/LibUsbTypes.hpp"
#include "libusbwrap/interface/IUsbDevice.hpp"
#pragma once
@@ -44,11 +45,13 @@ class P700Printer : public ::ptprnt::IPrinterDriver {
P700Printer(P700Printer&&) = default;
P700Printer& operator=(P700Printer&&) = default;
// Printer info has to be static to be accessed without instantiation
static const PrinterInfo mInfo;
// IPrinterDriver
const std::string_view getDriverName() override;
const std::string_view getName() override;
const uint16_t getPid() override;
const uint16_t getVid() override;
const libusbwrap::usbId getUsbId() override;
const std::string_view getVersion() override;
const PrinterInfo getPrinterInfo() override;
const PrinterStatus getPrinterStatus() override;
@@ -62,12 +65,6 @@ class P700Printer : public ::ptprnt::IPrinterDriver {
bool init();
std::shared_ptr<libusbwrap::IUsbDevice> mUsbHndl{nullptr};
static constexpr PrinterInfo mInfo{.driverName = "P700",
.name = "Brother P-touch P700",
.version = "v1.0",
.vid = 0x04f9,
.pid = 0x2061};
std::map<std::string, std::vector<uint8_t>> commands{
{"rasterstart",
{0x1b, 0x69, 0x61,