From 2a2d55f20dbaa56dffb7ecac47b690ae57016702 Mon Sep 17 00:00:00 2001 From: Thomas Stoddard Date: Wed, 7 Jan 2026 15:51:25 +0000 Subject: [PATCH] Bindings: Python : Add baudrate and LIN mode methods --- .../icsneopy/device/idevicesettings.cpp | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/bindings/python/icsneopy/device/idevicesettings.cpp b/bindings/python/icsneopy/device/idevicesettings.cpp index 326ca7a..19273fe 100644 --- a/bindings/python/icsneopy/device/idevicesettings.cpp +++ b/bindings/python/icsneopy/device/idevicesettings.cpp @@ -31,16 +31,49 @@ void init_idevicesettings(pybind11::module_& m) { .value("Speed5G", DeviceSettingsNamespace::LinkSpeed::ETH_SPEED_5000) .value("Speed10G", DeviceSettingsNamespace::LinkSpeed::ETH_SPEED_10000); + pybind11::enum_(settings, "LINMode") + .value("Sleep", LINMode::SLEEP_MODE) + .value("Slow", LINMode::SLOW_MODE) + .value("Normal", LINMode::NORMAL_MODE) + .value("Fast", LINMode::FAST_MODE); + pybind11::classh(m, "IDeviceSettings") .def("apply", &IDeviceSettings::apply, pybind11::arg("temporary") = 0, pybind11::call_guard()) .def("apply_defaults", &IDeviceSettings::applyDefaults, pybind11::arg("temporary") = 0, pybind11::call_guard()) + .def("refresh", &IDeviceSettings::refresh, pybind11::call_guard()) + + // Baudrate methods + .def("get_baudrate", &IDeviceSettings::getBaudrateFor, pybind11::call_guard()) + .def("set_baudrate", &IDeviceSettings::setBaudrateFor, pybind11::call_guard()) + .def("get_fd_baudrate", &IDeviceSettings::getFDBaudrateFor, pybind11::call_guard()) + .def("set_fd_baudrate", &IDeviceSettings::setFDBaudrateFor, pybind11::call_guard()) + + // Termination methods + .def("is_termination_supported", &IDeviceSettings::isTerminationSupportedFor, pybind11::call_guard()) + .def("can_termination_be_enabled", &IDeviceSettings::canTerminationBeEnabledFor, pybind11::call_guard()) + .def("is_termination_enabled", &IDeviceSettings::isTerminationEnabledFor, pybind11::call_guard()) + .def("set_termination", &IDeviceSettings::setTerminationFor, pybind11::call_guard()) + .def("get_termination_groups", &IDeviceSettings::getTerminationGroups, pybind11::call_guard()) + + // LIN methods + .def("is_commander_resistor_enabled", &IDeviceSettings::isCommanderResistorEnabledFor, pybind11::call_guard()) + .def("set_commander_resistor", &IDeviceSettings::setCommanderResistorFor, pybind11::call_guard()) + .def("get_lin_mode", &IDeviceSettings::getLINModeFor, pybind11::call_guard()) + .def("set_lin_mode", &IDeviceSettings::setLINModeFor, pybind11::call_guard()) + .def("get_lin_commander_response_time", &IDeviceSettings::getLINCommanderResponseTimeFor, pybind11::call_guard()) + .def("set_lin_commander_response_time", &IDeviceSettings::setLINCommanderResponseTimeFor, pybind11::call_guard()) + + // Ethernet PHY methods .def("get_phy_enable", &IDeviceSettings::getPhyEnable, pybind11::call_guard()) .def("get_phy_mode", &IDeviceSettings::getPhyMode, pybind11::call_guard()) .def("get_phy_speed", &IDeviceSettings::getPhySpeed, pybind11::call_guard()) .def("set_phy_enable", &IDeviceSettings::setPhyEnable, pybind11::call_guard()) .def("set_phy_mode", &IDeviceSettings::setPhyMode, pybind11::call_guard()) .def("set_phy_speed", &IDeviceSettings::setPhySpeed, pybind11::call_guard()) - .def("refresh", &IDeviceSettings::refresh, pybind11::call_guard()); + + // Status properties + .def_readonly("disabled", &IDeviceSettings::disabled) + .def_readonly("readonly", &IDeviceSettings::readonly); } } // namespace icsneo