#include #include #include #include #include "icsneo/device/device.h" #include namespace icsneo { void init_device(pybind11::module_& m) { pybind11::class_>(m, "Device") .def("__repr__", &Device::describe) .def("add_message_callback", &Device::addMessageCallback, pybind11::call_guard()) .def("clear_script", &Device::clearScript, pybind11::call_guard()) .def("close", &Device::close, pybind11::call_guard()) .def("describe", &Device::describe) .def("disable_message_polling", &Device::disableMessagePolling, pybind11::call_guard()) .def("enable_message_polling", &Device::enableMessagePolling, pybind11::arg("filter") = std::nullopt, pybind11::call_guard()) .def("get_current_message_count", &Device::getCurrentMessageCount) .def("get_digital_io", &Device::getDigitalIO, pybind11::arg("type"), pybind11::arg("number"), pybind11::call_guard()) .def("get_gptp_status", &Device::getGPTPStatus, pybind11::arg("timeout") = std::chrono::milliseconds(100), pybind11::call_guard()) .def("get_messages", [](Device& device) { return device.getMessages(); }, pybind11::call_guard()) .def("get_polling_message_limit", &Device::getPollingMessageLimit) .def("get_product_name", &Device::getProductName) .def("get_rtc", &Device::getRTC, pybind11::call_guard()) .def("get_script_status", &Device::getScriptStatus, pybind11::call_guard()) .def("get_serial_number", &Device::getSerialNumber) .def("get_serial", &Device::getSerial) .def("get_supported_rx_networks", &Device::getSupportedRXNetworks, pybind11::return_value_policy::reference) .def("get_supported_tx_networks", &Device::getSupportedTXNetworks, pybind11::return_value_policy::reference) .def("get_tc10_status", &Device::getTC10Status, pybind11::call_guard()) .def("get_type", &Device::getType) .def("go_offline", &Device::goOffline, pybind11::call_guard()) .def("go_online", &Device::goOnline, pybind11::call_guard()) .def("is_message_polling_enabled", &Device::isMessagePollingEnabled) .def("is_online_supported", &Device::isOnlineSupported) .def("is_online", &Device::isOnline) .def("is_open", &Device::isOpen) .def("open", [](Device& device) { return device.open(); }, pybind11::call_guard()) .def("prepare_script_load", &Device::prepareScriptLoad, pybind11::call_guard()) .def("remove_message_callback", &Device::removeMessageCallback, pybind11::call_guard()) .def("request_tc10_sleep", &Device::requestTC10Sleep, pybind11::call_guard()) .def("request_tc10_wake", &Device::requestTC10Wake, pybind11::call_guard()) .def("set_digital_io", pybind11::overload_cast(&Device::setDigitalIO), pybind11::arg("type"), pybind11::arg("number"), pybind11::arg("value"), pybind11::call_guard()) .def("set_polling_message_limit", &Device::setPollingMessageLimit) .def("set_rtc", &Device::setRTC, pybind11::call_guard()) .def("start_script", &Device::startScript, pybind11::call_guard()) .def("stop_script", &Device::stopScript, pybind11::call_guard()) .def("supports_tc10", &Device::supportsTC10) .def("transmit", pybind11::overload_cast>(&Device::transmit), pybind11::call_guard()) .def("upload_coremini", [](Device& device, std::string& path, Disk::MemoryType memType) { std::ifstream ifs(path, std::ios::binary); return device.uploadCoremini(ifs, memType); }, pybind11::call_guard()) .def("write_macsec_config", &Device::writeMACsecConfig, pybind11::call_guard()) .def_readonly("settings", &Device::settings); } } // namespace icsneo