Re-structured project

This commit is contained in:
2023-08-26 11:53:44 +02:00
parent c3915336dd
commit 61e2352a3c
25 changed files with 257 additions and 257 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "libusbwrap/interface/IUsbDeviceFactory.hpp"
namespace libusbwrap {
class UsbDeviceFactory : public IUsbDeviceFactory {
public:
UsbDeviceFactory();
~UsbDeviceFactory();
// delete copy ctor and assignment
UsbDeviceFactory(const UsbDeviceFactory&) = delete;
UsbDeviceFactory& operator=(UsbDeviceFactory&) = delete;
bool init();
/**
* @brief Gets all devices that are detected by libusb. Will allocate a shared_ptr for each Device
*
* @return std::vector<std::shared_ptr<IUsbDevice>> Vector of all detected USB devices
*/
std::vector<std::shared_ptr<IUsbDevice>> findAllDevices() override;
/**
* @brief Gets all devices with certain vid/pid combination.
* If only one device of certain type is connected, vector is usually only one element
*
* @param vid VendorId of the devices to find
* @param pid ProductId of the devices to find
* @return std::vector<std::shared_ptr<IUsbDevice>> Vector of detected USB devices based on vid/pid
*/
std::vector<std::shared_ptr<IUsbDevice>> findDevices(uint16_t vid, uint16_t pid) override;
private:
// methods
int refreshDeviceList();
// members
libusb_context* mLibusbCtx{nullptr};
libusb_device** mLibusbDeviceList;
};
} // namespace libusbwrap