Device: Refactor ComponentVersions

Also:
- Add setGenericData()
- Add ExtendedResponseFilter
This commit is contained in:
Yasser Yassine
2025-04-30 18:49:35 +00:00
committed by Kyle Schwarz
parent b1e875980c
commit 7eeb1b6c38
22 changed files with 90 additions and 56 deletions
+12 -7
View File
@@ -570,6 +570,7 @@ public:
NODISCARD("If the Lifetime is not held, disconnects will be immediately unsuppressed")
Lifetime suppressDisconnects();
bool refreshComponentVersions();
/**
* For use by extensions only. A more stable API will be provided in the future.
*/
@@ -727,7 +728,9 @@ public:
virtual bool isOnlineSupported() const { return true; }
virtual bool supportsComponentVersions() const { return false; }
virtual bool supportsComponentVersions() const {
return !getComponentVersions().empty();
}
virtual bool supportsTC10() const { return false; }
@@ -743,6 +746,8 @@ public:
/* MACsec support */
virtual bool writeMACsecConfig(const MACsecMessage& message, uint16_t binaryIndex);
std::shared_ptr<DeviceExtension> getExtension(const std::string& name) const;
protected:
bool online = false;
int messagePollingCallbackID = 0;
@@ -824,12 +829,6 @@ protected:
virtual void setupExtensions() {}
// Hook for devices such as FIRE which need to inject traffic before RequestSerialNumber
// Return false to bail
virtual bool afterCommunicationOpen() { return true; }
virtual bool requiresVehiclePower() const { return true; }
template<typename Extension>
std::shared_ptr<Extension> getExtension() const {
std::shared_ptr<Extension> ret;
@@ -841,6 +840,12 @@ protected:
return ret;
}
// END Initialization Functions
// Hook for devices such as FIRE which need to inject traffic before RequestSerialNumber
// Return false to bail
virtual bool afterCommunicationOpen() { return true; }
virtual bool requiresVehiclePower() const { return true; }
void handleInternalMessage(std::shared_ptr<Message> message);
@@ -28,6 +28,7 @@ public:
virtual void onGoOffline() {}
virtual void onDeviceClose() {}
virtual void setGenericData(void*) {}
virtual bool providesFirmware() const { return false; }
virtual void handleMessage(const std::shared_ptr<Message>&) {}
@@ -26,8 +26,6 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
EtherBADGE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<EtherBADGESettings>(makeDriver);
@@ -69,7 +69,6 @@ protected:
return 0;
}
bool supportsComponentVersions() const override { return true; }
bool supportsGPTP() const override { return true; }
};
@@ -87,8 +87,6 @@ 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);
@@ -49,9 +49,6 @@ 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,8 +52,6 @@ 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,7 +35,6 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
@@ -15,8 +15,6 @@ 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);
@@ -25,8 +25,6 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
@@ -29,8 +29,6 @@ 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,8 +16,6 @@ public:
uint8_t getPhyAddrOrPort() const override { return 1; }
bool supportsComponentVersions() const override { return true; }
bool supportsTC10() const override { return true; }
protected:
@@ -28,8 +28,6 @@ public:
bool isOnlineSupported() const override { return false; }
bool supportsComponentVersions() const override { return true; }
bool supportsTC10() const override { return true; }
protected:
@@ -25,8 +25,6 @@ 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,8 +34,6 @@ 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,8 +22,6 @@ public:
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
private:
ValueCAN3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<ValueCAN3Settings>(makeDriver);
@@ -11,9 +11,6 @@ namespace icsneo {
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;
@@ -28,9 +28,6 @@ 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);