Add T1S PLCA and related settings support for Fire3T1S, RadComet3, RadGigaStar2, and RadMoonT1S devices
parent
5ee450353b
commit
530a99d264
|
|
@ -41,20 +41,20 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.def("apply", &IDeviceSettings::apply, pybind11::arg("temporary") = 0, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("apply_defaults", &IDeviceSettings::applyDefaults, pybind11::arg("temporary") = 0, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("refresh", &IDeviceSettings::refresh, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
|
||||
// Baudrate methods
|
||||
.def("get_baudrate", &IDeviceSettings::getBaudrateFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_baudrate", &IDeviceSettings::setBaudrateFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_fd_baudrate", &IDeviceSettings::getFDBaudrateFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_fd_baudrate", &IDeviceSettings::setFDBaudrateFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
|
||||
// Termination methods
|
||||
.def("is_termination_supported", &IDeviceSettings::isTerminationSupportedFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("can_termination_be_enabled", &IDeviceSettings::canTerminationBeEnabledFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("is_termination_enabled", &IDeviceSettings::isTerminationEnabledFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_termination", &IDeviceSettings::setTerminationFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_termination_groups", &IDeviceSettings::getTerminationGroups, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
|
||||
// LIN methods
|
||||
.def("is_commander_resistor_enabled", &IDeviceSettings::isCommanderResistorEnabledFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_commander_resistor", &IDeviceSettings::setCommanderResistorFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
|
@ -62,7 +62,7 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.def("set_lin_mode", &IDeviceSettings::setLINModeFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_lin_commander_response_time", &IDeviceSettings::getLINCommanderResponseTimeFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_lin_commander_response_time", &IDeviceSettings::setLINCommanderResponseTimeFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
|
||||
// Ethernet PHY methods
|
||||
.def("get_phy_enable", &IDeviceSettings::getPhyEnable, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_phy_mode", &IDeviceSettings::getPhyMode, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
|
@ -70,6 +70,20 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.def("set_phy_enable", &IDeviceSettings::setPhyEnable, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_phy_mode", &IDeviceSettings::setPhyMode, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_phy_speed", &IDeviceSettings::setPhySpeed, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
// 10BASE-T1S methods
|
||||
.def("is_t1s_plca_enabled", &IDeviceSettings::isT1SPLCAEnabledFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_plca", &IDeviceSettings::setT1SPLCAFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_t1s_local_id", &IDeviceSettings::getT1SLocalIDFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_local_id", &IDeviceSettings::setT1SLocalIDFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_t1s_max_nodes", &IDeviceSettings::getT1SMaxNodesFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_max_nodes", &IDeviceSettings::setT1SMaxNodesFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_t1s_tx_opp_timer", &IDeviceSettings::getT1STxOppTimerFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_tx_opp_timer", &IDeviceSettings::setT1STxOppTimerFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_t1s_max_burst", &IDeviceSettings::getT1SMaxBurstFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_max_burst", &IDeviceSettings::setT1SMaxBurstFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_t1s_burst_timer", &IDeviceSettings::getT1SBurstTimerFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_t1s_burst_timer", &IDeviceSettings::setT1SBurstTimerFor, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
|
||||
// Status properties
|
||||
.def_readonly("disabled", &IDeviceSettings::disabled)
|
||||
|
|
|
|||
|
|
@ -940,6 +940,74 @@ public:
|
|||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual std::optional<bool> isT1SPLCAEnabledFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1SPLCAFor(Network net, bool enable) {
|
||||
(void)net; (void)enable;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<uint8_t> getT1SLocalIDFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1SLocalIDFor(Network net, uint8_t id) {
|
||||
(void)net; (void)id;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<uint8_t> getT1SMaxNodesFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1SMaxNodesFor(Network net, uint8_t nodes) {
|
||||
(void)net; (void)nodes;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<uint8_t> getT1STxOppTimerFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1STxOppTimerFor(Network net, uint8_t timer) {
|
||||
(void)net; (void)timer;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<uint8_t> getT1SMaxBurstFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1SMaxBurstFor(Network net, uint8_t burst) {
|
||||
(void)net; (void)burst;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::optional<uint8_t> getT1SBurstTimerFor(Network net) const {
|
||||
(void)net;
|
||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual bool setT1SBurstTimerFor(Network net, uint8_t timer) {
|
||||
(void)net; (void)timer;
|
||||
return false;
|
||||
}
|
||||
|
||||
const void* getRawStructurePointer() const { return settingsInDeviceRAM.data(); }
|
||||
void* getMutableRawStructurePointer() { return settings.data(); }
|
||||
template<typename T> const T* getStructurePointer() const { return reinterpret_cast<const T*>(getRawStructurePointer()); }
|
||||
|
|
|
|||
|
|
@ -257,6 +257,153 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
||||
}
|
||||
|
||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
if(enable)
|
||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
else
|
||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->local_id);
|
||||
}
|
||||
|
||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->local_id = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_num_nodes);
|
||||
}
|
||||
|
||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_num_nodes = nodes;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->to_timer);
|
||||
}
|
||||
|
||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->to_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_burst_count);
|
||||
}
|
||||
|
||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_burst_count = burst;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->burst_timer);
|
||||
}
|
||||
|
||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->burst_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_02: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_03: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s6);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s7);
|
||||
case Network::NetID::AE_08: return &(cfg->t1s8);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
||||
auto cfg = getMutableStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_02: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_03: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s6);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s7);
|
||||
case Network::NetID::AE_08: return &(cfg->t1s8);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
|
|
|
|||
|
|
@ -113,6 +113,149 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
||||
}
|
||||
|
||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
if(enable)
|
||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
else
|
||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->local_id);
|
||||
}
|
||||
|
||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->local_id = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_num_nodes);
|
||||
}
|
||||
|
||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_num_nodes = nodes;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->to_timer);
|
||||
}
|
||||
|
||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->to_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_burst_count);
|
||||
}
|
||||
|
||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_burst_count = burst;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->burst_timer);
|
||||
}
|
||||
|
||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->burst_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
||||
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s6);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
||||
auto cfg = getMutableStructurePointer<radcomet3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s6);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,6 +249,153 @@ namespace icsneo
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
||||
}
|
||||
|
||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
if(enable)
|
||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
else
|
||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->local_id);
|
||||
}
|
||||
|
||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->local_id = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_num_nodes);
|
||||
}
|
||||
|
||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_num_nodes = nodes;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->to_timer);
|
||||
}
|
||||
|
||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->to_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_burst_count);
|
||||
}
|
||||
|
||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_burst_count = burst;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->burst_timer);
|
||||
}
|
||||
|
||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->burst_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
||||
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_03: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_08: return &(cfg->t1s6);
|
||||
case Network::NetID::AE_09: return &(cfg->t1s7);
|
||||
case Network::NetID::AE_10: return &(cfg->t1s8);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
||||
auto cfg = getMutableStructurePointer<radgigastar2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_03: return &(cfg->t1s1);
|
||||
case Network::NetID::AE_04: return &(cfg->t1s2);
|
||||
case Network::NetID::AE_05: return &(cfg->t1s3);
|
||||
case Network::NetID::AE_06: return &(cfg->t1s4);
|
||||
case Network::NetID::AE_07: return &(cfg->t1s5);
|
||||
case Network::NetID::AE_08: return &(cfg->t1s6);
|
||||
case Network::NetID::AE_09: return &(cfg->t1s7);
|
||||
case Network::NetID::AE_10: return &(cfg->t1s8);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
ICSNEO_UNALIGNED(const uint64_t *)
|
||||
getTerminationEnables() const override
|
||||
|
|
|
|||
|
|
@ -47,6 +47,169 @@ static_assert(sizeof(radmoont1s_settings_t) == 160, "RADMoonT1S settings size mi
|
|||
class RADMoonT1SSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoonT1SSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoont1s_settings_t)) {}
|
||||
|
||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
||||
}
|
||||
|
||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
if(enable)
|
||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
else
|
||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->local_id);
|
||||
}
|
||||
|
||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->local_id = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_num_nodes);
|
||||
}
|
||||
|
||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_num_nodes = nodes;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->to_timer);
|
||||
}
|
||||
|
||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->to_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->max_burst_count);
|
||||
}
|
||||
|
||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->max_burst_count = burst;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_optional(t1s->burst_timer);
|
||||
}
|
||||
|
||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
||||
if(t1s == nullptr)
|
||||
return false;
|
||||
|
||||
t1s->burst_timer = timer;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01:
|
||||
return &(cfg->t1s);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01:
|
||||
return &(cfg->t1s);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const {
|
||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01:
|
||||
return &(cfg->t1sExt);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::AE_01:
|
||||
return &(cfg->t1sExt);
|
||||
default:
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue