Fix PCAP MAC PID issues by checking against the serial returned instead

This commit is contained in:
Paul Hollinsky
2018-10-04 17:37:17 -04:00
parent efe04128fb
commit 6ad4e564b9
4 changed files with 17 additions and 8 deletions
@@ -31,6 +31,9 @@ public:
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
if(!device->open()) // We will get the serial number on open
continue; // If the open failed, we won't display the device as an option to connect to
const char* serial = device->getNeoDevice().serial;
if(serial[0] != 'C' || serial[1] != 'Y')
continue; // The device is not a FIRE 2
strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial));
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
}
+9 -5
View File
@@ -15,12 +15,13 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGalaxy;
static constexpr const uint16_t PRODUCT_ID = 0x0003;
RADGalaxy(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<PCAP>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new PCAP(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
packetizer->disableChecksum = true;
packetizer->align16bit = false;
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}
@@ -29,12 +30,15 @@ public:
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) {
{
{ // Scope created so that we don't have two of the same device at once
strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial));
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
auto device = std::make_shared<RADGalaxy>(neodevice);
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
if(!device->open()) // We will get the serial number on open
continue; // If the open failed, we won't display the device as an option to connect to
const char* serial = device->getNeoDevice().serial;
if(serial[0] != 'R' || serial[1] != 'G')
continue; // The device is not a RADGalaxy
strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial));
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
}