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
+7 -11
View File
@@ -6,6 +6,7 @@
#include "icsneo/platform/windows/internal/pcapdll.h"
#include "icsneo/device/neodevice.h"
#include "icsneo/communication/driver.h"
#include "icsneo/device/founddevice.h"
#include "icsneo/api/eventmanager.h"
#include "icsneo/communication/ethernetpacketizer.h"
#include <string>
@@ -14,20 +15,15 @@ namespace icsneo {
class PCAP : public Driver {
public:
class PCAPFoundDevice {
public:
neodevice_t device;
std::vector<std::vector<uint8_t>> discoveryPackets;
};
static std::vector<PCAPFoundDevice> FindAll();
static void Find(std::vector<FoundDevice>& foundDevices);
static std::string GetEthDevSerialFromMacAddress(uint8_t product, uint16_t macSerial);
static bool IsHandleValid(neodevice_handle_t handle);
PCAP(const device_eventhandler_t& err, neodevice_t& forDevice);
bool open();
bool isOpen();
bool close();
bool open() override;
bool isOpen() override;
bool close() override;
bool isEthernet() const override { return true; }
private:
const PCAPDLL& pcap;
char errbuf[PCAP_ERRBUF_SIZE] = { 0 };
@@ -48,7 +44,7 @@ private:
class NetworkInterface {
public:
uint8_t uuid;
uint8_t macAddress[8];
uint8_t macAddress[6];
std::string nameFromWinPCAP;
std::string nameFromWin32API;
std::string descriptionFromWinPCAP;