Bindings: Python: Add DoIP Ethernet Activation

This commit is contained in:
Kyle Schwarz
2025-03-10 10:50:25 -04:00
parent f97fd75b8d
commit 89047447a6
5 changed files with 57 additions and 0 deletions
@@ -0,0 +1,19 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/functional.h>
#include "icsneo/communication/io.h"
namespace icsneo {
void init_io(pybind11::module_& m) {
pybind11::enum_<IO>(m, "IO")
.value("EthernetActivation", IO::EthernetActivation)
.value("USBHostPower", IO::USBHostPower)
.value("BackupPowerEnabled", IO::BackupPowerEnabled)
.value("BackupPowerGood", IO::BackupPowerGood)
.value("Misc", IO::Misc)
.value("EMisc", IO::EMisc);
}
} // namespace icsneo
@@ -19,6 +19,7 @@ void init_device(pybind11::module_& m) {
.def("disable_message_polling", &Device::disableMessagePolling, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("enable_message_polling", &Device::enableMessagePolling, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("get_current_message_count", &Device::getCurrentMessageCount)
.def("get_digital_io", &Device::getDigitalIO, pybind11::arg("type"), pybind11::arg("number"), pybind11::call_guard<pybind11::gil_scoped_release>())
.def("get_gptp_status", &Device::getGPTPStatus, pybind11::arg("timeout") = std::chrono::milliseconds(100), pybind11::call_guard<pybind11::gil_scoped_release>())
.def("get_messages", [](Device& device) { return device.getMessages(); }, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("get_polling_message_limit", &Device::getPollingMessageLimit)
@@ -42,6 +43,7 @@ void init_device(pybind11::module_& m) {
.def("remove_message_callback", &Device::removeMessageCallback, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("request_tc10_sleep", &Device::requestTC10Sleep, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("request_tc10_wake", &Device::requestTC10Wake, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("set_digital_io", pybind11::overload_cast<IO, size_t, bool>(&Device::setDigitalIO), pybind11::arg("type"), pybind11::arg("number"), pybind11::arg("value"), pybind11::call_guard<pybind11::gil_scoped_release>())
.def("set_polling_message_limit", &Device::setPollingMessageLimit)
.def("set_rtc", &Device::setRTC, pybind11::call_guard<pybind11::gil_scoped_release>())
.def("start_script", &Device::startScript, pybind11::call_guard<pybind11::gil_scoped_release>())
+2
View File
@@ -10,6 +10,7 @@ void init_event(pybind11::module_&);
void init_eventcallback(pybind11::module_&);
void init_eventmanager(pybind11::module_&);
void init_network(pybind11::module_&);
void init_io(pybind11::module_&);
void init_devicetype(pybind11::module_&);
void init_message(pybind11::module_&);
void init_canmessage(pybind11::module_&);
@@ -39,6 +40,7 @@ PYBIND11_MODULE(icsneopy, m) {
init_version(m);
init_devicetype(m);
init_network(m);
init_io(m);
init_message(m);
init_canmessage(m);
init_canerrormessage(m);