ValueCAN 4-2EL: Fix device agnostic CAN settings
parent
8843ace87e
commit
211f844f77
|
|
@ -11,7 +11,32 @@ namespace icsneo {
|
||||||
class ValueCAN4_4_2ELSettings : public IDeviceSettings {
|
class ValueCAN4_4_2ELSettings : public IDeviceSettings {
|
||||||
public:
|
public:
|
||||||
ValueCAN4_4_2ELSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_4_2el_settings_t)) {}
|
ValueCAN4_4_2ELSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_4_2el_settings_t)) {}
|
||||||
// We do not override getCANSettingsFor, getCANFDSettingsFor, or getEthernetSettingsFor here because they will be device specific
|
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<valuecan4_1_2_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::HSCAN:
|
||||||
|
return &(cfg->can1);
|
||||||
|
case Network::NetID::HSCAN2:
|
||||||
|
return &(cfg->can2);
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<valuecan4_1_2_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::HSCAN:
|
||||||
|
return &(cfg->canfd1);
|
||||||
|
case Network::NetID::HSCAN2:
|
||||||
|
return &(cfg->canfd2);
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue