tx-gxx-linux/device/gxx-linux/usb/usbservice.h

36 lines
983 B
C
Raw Permalink Normal View History

2023-04-08 00:56:20 +00:00
#pragma once
#include <string>
#include <memory>
#include <thread>
#include <functional>
class IRegsAccess;
class UsbDevice;
class INotify;
class ITransmit;
class IReceive;
class UsbService
{
public:
UsbService(std::shared_ptr<IRegsAccess> fgparegs, std::shared_ptr<IRegsAccess> motorregs, std::shared_ptr<IRegsAccess> scannerregs = nullptr);
virtual ~UsbService();
std::shared_ptr<ITransmit> transmiter();
std::shared_ptr<INotify> notify();
std::shared_ptr<IReceive> receiver();
void set_onconnect_call(std::function<void(bool)> usbhotplugcall);
void set_scannerregs(std::shared_ptr<IRegsAccess> scannerregs);
private:
std::shared_ptr<UsbDevice> usb;
std::shared_ptr<IRegsAccess> fgparegs;
std::shared_ptr<IRegsAccess> motorregs;
std::shared_ptr<IRegsAccess> devregs;
std::shared_ptr<ITransmit> transmit;
std::shared_ptr<INotify> noti;
std::shared_ptr<IReceive> receiv;
std::function<void(bool)> m_usbconnect;
};