Device: Conditionally retrieve component versions
parent
53ba297a44
commit
bc6f5eca9c
|
|
@ -220,10 +220,13 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
|||
|
||||
// Get component versions *after* the extension "onDeviceOpen" hooks (e.g. device reflashes)
|
||||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -715,6 +715,8 @@ public:
|
|||
|
||||
virtual bool isOnlineSupported() const { return true; }
|
||||
|
||||
virtual bool supportsComponentVersions() const { return false; }
|
||||
|
||||
protected:
|
||||
bool online = false;
|
||||
int messagePollingCallbackID = 0;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue