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) // Get component versions *after* the extension "onDeviceOpen" hooks (e.g. device reflashes)
if (auto compVersions = com->getComponentVersionsSync()) if(supportsComponentVersions()) {
componentVersions = std::move(*compVersions); if(auto compVersions = com->getComponentVersionsSync())
else componentVersions = std::move(*compVersions);
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::EventWarning); 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) { if(!settings->disabled) {
// Since we will not fail the open if a settings read fails, // 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 isOnlineSupported() const { return true; }
virtual bool supportsComponentVersions() const { return false; }
protected: protected:
bool online = false; bool online = false;
int messagePollingCallbackID = 0; int messagePollingCallbackID = 0;

View File

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

View File

@ -87,6 +87,8 @@ public:
}; };
} }
bool supportsComponentVersions() const override { return true; }
protected: protected:
NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIFIRE2Settings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver); 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 { void setupPacketizer(Packetizer& packetizer) override {
Device::setupPacketizer(packetizer); Device::setupPacketizer(packetizer);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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