Device: Conditionally retrieve component versions

pull/64/head
Kyle Schwarz 2024-04-17 14:23:11 -04:00
parent 53ba297a44
commit bc6f5eca9c
17 changed files with 40 additions and 5 deletions

View File

@ -220,10 +220,13 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
// Get component versions *after* the extension "onDeviceOpen" hooks (e.g. device reflashes)
if (auto compVersions = com->getComponentVersionsSync())
if(supportsComponentVersions()) {
if(auto compVersions = com->getComponentVersionsSync())
componentVersions = std::move(*compVersions);
else
// It's possible the device is on older firmware so don't return false here
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::EventWarning);
}
if(!settings->disabled) {
// Since we will not fail the open if a settings read fails,

View File

@ -715,6 +715,8 @@ public:
virtual bool isOnlineSupported() const { return true; }
virtual bool supportsComponentVersions() const { return false; }
protected:
bool online = false;
int messagePollingCallbackID = 0;

View File

@ -26,6 +26,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
EtherBADGE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<EtherBADGESettings>(makeDriver);

View File

@ -87,6 +87,8 @@ public:
};
}
bool supportsComponentVersions() const override { return true; }
protected:
NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIFIRE2Settings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
@ -99,7 +101,7 @@ protected:
}
}
bool currentDriverSupportsDFU() const override { return com->driver->isEthernet(); }
bool currentDriverSupportsDFU() const override { return !com->driver->isEthernet(); }
void setupPacketizer(Packetizer& packetizer) override {
Device::setupPacketizer(packetizer);

View File

@ -50,6 +50,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);

View File

@ -52,6 +52,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);

View File

@ -35,6 +35,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);

View File

@ -15,6 +15,8 @@ public:
// USB PID is 0x0901, standard driver is FTDI
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIION, DeviceType::ION, 0x0901);
bool supportsComponentVersions() const override { return true; }
private:
NeoVIION(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);

View File

@ -24,6 +24,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize(makeDriver);

View File

@ -29,6 +29,8 @@ public:
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsComponentVersions() const override { return true; }
protected:
RADJupiter(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADJupiterSettings>(makeDriver);

View File

@ -16,6 +16,8 @@ public:
uint8_t getPhyAddrOrPort() const override { return 1; }
bool supportsComponentVersions() const override { return true; }
protected:
RADMoon2ZL(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
initialize<RADMoon2Settings>(makeDriver);

View File

@ -27,6 +27,8 @@ public:
bool isOnlineSupported() const override { return false; }
bool supportsComponentVersions() const override { return true; }
protected:
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADMoon3Settings>(makeDriver);

View File

@ -25,6 +25,8 @@ public:
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsComponentVersions() const override { return true; }
protected:
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADMoonDuoSettings>(makeDriver);

View File

@ -34,6 +34,8 @@ public:
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsComponentVersions() const override { return true; }
protected:
RADPluto(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADPlutoSettings>(makeDriver);

View File

@ -22,6 +22,8 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
private:
ValueCAN3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<ValueCAN3Settings>(makeDriver);

View File

@ -12,6 +12,8 @@ class ValueCAN4 : public Device {
public:
// All ValueCAN 4 devices share a USB PID of 0x1101
bool supportsComponentVersions() const override { return true; }
protected:
using Device::Device;

View File

@ -29,6 +29,8 @@ public:
bool isOnlineSupported() const override { return false; }
bool supportsComponentVersions() const override { return true; }
protected:
VividCAN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<VividCANSettings>(makeDriver);