2019-10-31 18:00:42 +00:00
|
|
|
#pragma once
|
|
|
|
#include <cstdio>
|
2019-11-13 11:16:13 +00:00
|
|
|
#include "Result.h"
|
2019-10-31 18:00:42 +00:00
|
|
|
#include "IUSBInterface.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class IUSBDevice
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
std::vector<std::unique_ptr<IUSBInterface>> m_interfaces{};
|
|
|
|
|
2019-11-08 08:59:11 +00:00
|
|
|
uint16_t m_vendorID;
|
|
|
|
uint16_t m_productID;
|
|
|
|
|
2019-10-31 18:00:42 +00:00
|
|
|
public:
|
|
|
|
virtual ~IUSBDevice() = default;
|
|
|
|
|
|
|
|
//Open and close the device.
|
2019-11-13 11:16:13 +00:00
|
|
|
virtual Result Open() = 0;
|
2019-10-31 18:00:42 +00:00
|
|
|
virtual void Close() = 0;
|
|
|
|
|
|
|
|
//Reset the device.
|
|
|
|
virtual void Reset() = 0;
|
|
|
|
|
|
|
|
//Get the raw reference to interfaces vector.
|
|
|
|
virtual std::vector<std::unique_ptr<IUSBInterface>> &GetInterfaces() { return m_interfaces; }
|
2019-11-08 08:59:11 +00:00
|
|
|
|
|
|
|
virtual uint16_t GetVendor() { return m_vendorID; }
|
|
|
|
virtual uint16_t GetProduct() { return m_productID; }
|
2019-10-31 18:00:42 +00:00
|
|
|
};
|