Drivers: Decouple from devices

This allows us to better implement alternative drivers
for devices, such as for device sharing servers or
talking to CoreMini processors within the same device.
This commit is contained in:
Paul Hollinsky
2022-03-27 14:30:31 -04:00
parent 0ff12300f3
commit 781fc2c034
66 changed files with 780 additions and 1566 deletions
+5 -3
View File
@@ -16,7 +16,7 @@ namespace icsneo {
class FTDI : public Driver {
public:
static std::vector<neodevice_t> FindByProduct(int product);
static void Find(std::vector<FoundDevice>& found);
FTDI(const device_eventhandler_t& err, neodevice_t& forDevice);
~FTDI() { if(isOpen()) close(); }
@@ -34,7 +34,9 @@ private:
context = nullptr;
}
std::pair<int, std::vector<std::string>> findDevices(int pid);
// A PID of 0 disables filtering by PID
std::pair<int, std::vector< std::pair<std::string, uint16_t> > > findDevices(int pid = 0);
int openDevice(int pid, const char* serial);
bool closeDevice();
bool isOpen() const { return deviceOpen; }
@@ -52,7 +54,7 @@ private:
};
FTDIContext ftdi;
static std::vector<std::tuple<int, std::string>> handles;
static std::vector<std::string> handles;
static bool ErrorIsDisconnection(int errorCode);
void readTask();