Formatting...

This commit is contained in:
2022-11-12 18:37:24 +01:00
parent d7dfdc4739
commit f09e4ab5c8
6 changed files with 37 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
#include "UsbTypes.hpp"
#include <vector>
#include <optional>
#include <vector>
#pragma once

View File

@@ -11,7 +11,8 @@ namespace ptprnt::driver {
class P700Driver : public IDriver {
public:
P700Driver(std::shared_ptr<Usb> usbDriver, uint16_t usbDevVendor = 0x04f9, uint16_t usbDevId = 0x2061);
P700Driver(std::shared_ptr<Usb> usbDriver, uint16_t usbDevVendor = 0x04f9,
uint16_t usbDevId = 0x2061);
~P700Driver() override;
driver::info getInfo() override;

View File

@@ -7,16 +7,16 @@
namespace ptprnt::driver {
P700Driver::P700Driver(std::shared_ptr<Usb> usbDriver, uint16_t usbDevVendor, uint16_t usbProductId)
: mUsbDriver{std::move(usbDriver)}
, mUsbDev{.vendorId = usbDevVendor, .productId = usbProductId}
P700Driver::P700Driver(std::shared_ptr<Usb> usbDriver, uint16_t usbDevVendor,
uint16_t usbProductId)
: mUsbDriver{std::move(usbDriver)},
mUsbDev{.vendorId = usbDevVendor, .productId = usbProductId}
{
spdlog::debug("P700Driver constructing");
if (!init()) {
spdlog::error("Could not find any P700 Printers.");
}
else {
} else {
spdlog::info("Found P700 Printer :-).");
}
}
@@ -49,12 +49,15 @@ bool P700Driver::init() {
return false;
}
auto devIt = std::find_if(devs.value().begin(), devs.value().end(),
[=] (auto dev) { return mUsbDev.vendorId == dev.vendorId && mUsbDev.productId == dev.productId;}
);
auto devIt =
std::find_if(devs.value().begin(), devs.value().end(), [=](auto dev) {
return mUsbDev.vendorId == dev.vendorId &&
mUsbDev.productId == dev.productId;
});
if (devIt == devs.value().end()) {
spdlog::error("No device with {0:04X}:{1:04X}", mUsbDev.vendorId, mUsbDev.productId);
spdlog::error("No device with {0:04X}:{1:04X}", mUsbDev.vendorId,
mUsbDev.productId);
return false;
}

View File

@@ -1,9 +1,9 @@
#include "Usb.hpp"
#include <iostream>
#include <iomanip>
#include <optional>
#include <spdlog/spdlog.h>
#include <iomanip>
#include <iostream>
#include <optional>
namespace ptprnt::driver {
@@ -11,6 +11,7 @@ Usb::Usb() {
spdlog::debug("Usb constructing");
libusb_init(NULL);
}
Usb::~Usb() {
spdlog::debug("Usb destructing");
}

View File

@@ -13,7 +13,6 @@ using namespace ptprnt;
void setupLogger() {
spdlog::set_level(spdlog::level::debug);
spdlog::info("Starting ptprnt {}", PROJ_VERSION);
}
int main(int argc, char** argv) {
@@ -32,6 +31,3 @@ int main(int argc, char** argv) {
return 0;
}