47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#include <sys/types.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "interface/IPrinterDriver.hpp"
|
|
#include "interface/IPrinterTypes.hpp"
|
|
#include "libusbwrap/interface/IUsbDevice.hpp"
|
|
|
|
#pragma once
|
|
|
|
namespace ptprnt::printer {
|
|
|
|
class P700Printer : public ::ptprnt::IPrinterDriver {
|
|
public:
|
|
P700Printer();
|
|
~P700Printer();
|
|
|
|
// delete copy ctor and assignment
|
|
P700Printer(const P700Printer&) = delete;
|
|
P700Printer& operator=(P700Printer&) = delete;
|
|
|
|
// IPrinterDriver
|
|
const std::string_view getDriverName() override;
|
|
const std::string_view getName() override;
|
|
const uint16_t getPid() override;
|
|
const uint16_t getVid() override;
|
|
const std::string_view getVersion() override;
|
|
const PrinterInfo getPrinterInfo() override;
|
|
const PrinterStatus getPrinterStatus() override;
|
|
bool attachUsbDevice(std::shared_ptr<libusbwrap::IUsbDevice> usbHndl) override;
|
|
bool detachUsbDevice() override;
|
|
bool printBitmap(const Bitmap& bitmap) override;
|
|
bool printText(const std::string& text, uint16_t fontSize) override;
|
|
|
|
private:
|
|
bool send(std::vector<uint8_t>& data);
|
|
|
|
std::shared_ptr<libusbwrap::IUsbDevice> mUsbHndl{nullptr};
|
|
|
|
PrinterInfo mInfo{.driverName = "P700",
|
|
.name = "Brother P-touch P700",
|
|
.version = "v1.0",
|
|
.vid = 0x04f9,
|
|
.pid = 0x2061};
|
|
};
|
|
|
|
} // namespace ptprnt::printer
|