Implemented printer status retrieval
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include "libusb.h"
|
||||
#include "libusbwrap/LibUsbTypes.hpp"
|
||||
#include "libusbwrap/interface/IUsbDevice.hpp"
|
||||
|
||||
namespace libusbwrap {
|
||||
@@ -16,9 +17,16 @@ class UsbDevice : public IUsbDevice {
|
||||
UsbDevice(const UsbDevice&) = delete;
|
||||
UsbDevice& operator=(UsbDevice&) = delete;
|
||||
|
||||
Error open() override;
|
||||
bool open() override;
|
||||
void close() override;
|
||||
|
||||
// libusb wrappers
|
||||
bool detachKernelDriver(int interfaceNo) override;
|
||||
bool claimInterface(int interfaceNo) override;
|
||||
bool releaseInterface(int interfaceNo) override;
|
||||
bool bulkTransfer(uint8_t endpoint, std::vector<uint8_t>& data, int* tx,
|
||||
unsigned int timeout) override;
|
||||
|
||||
// getters
|
||||
const uint16_t getVid() override;
|
||||
const uint16_t getPid() override;
|
||||
@@ -26,11 +34,16 @@ class UsbDevice : public IUsbDevice {
|
||||
const uint8_t getBusNumber() override;
|
||||
const uint8_t getPortNumber() override;
|
||||
|
||||
// errors
|
||||
const Error getLastError() override;
|
||||
const std::string getLastErrorString() override;
|
||||
|
||||
private:
|
||||
libusb_context* mLibusbCtx{nullptr};
|
||||
libusb_device* mLibusbDev{nullptr};
|
||||
libusb_device_handle* mLibusbDevHandle{nullptr};
|
||||
libusb_device_descriptor mLibusbDevDesc;
|
||||
std::atomic<bool> mIsOpen = false;
|
||||
Error mLastError = Error::SUCCESS;
|
||||
};
|
||||
} // namespace libusbwrap
|
Reference in New Issue
Block a user