mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
reuse discovered pcap interfaces in DeviceFinder::FindAll()
This commit is contained in:
@@ -11,10 +11,10 @@ namespace icsneo {
|
||||
class RADStar2ETH : public RADStar2 {
|
||||
public:
|
||||
// Serial numbers start with RS
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
static std::vector<std::shared_ptr<Device>> Find(const std::vector<PCAP::PCAPFoundDevice>& pcapDevices) {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto& foundDev : PCAP::FindAll()) {
|
||||
for(auto& foundDev : pcapDevices) {
|
||||
auto fakedev = std::shared_ptr<RADStar2ETH>(new RADStar2ETH({}));
|
||||
for(auto& payload : foundDev.discoveryPackets)
|
||||
fakedev->com->packetizer->input(payload);
|
||||
@@ -34,7 +34,8 @@ public:
|
||||
if(sn->deviceSerial.substr(0, 2) != SERIAL_START)
|
||||
continue; // Not a RADStar2
|
||||
|
||||
foundDev.device.serial[sn->deviceSerial.copy(foundDev.device.serial, sizeof(foundDev.device.serial))] = '\0';
|
||||
auto device = foundDev.device;
|
||||
device.serial[sn->deviceSerial.copy(device.serial, sizeof(device.serial))] = '\0';
|
||||
found.push_back(std::make_shared<RADStar2ETH>(foundDev.device));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user