mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Bindings: Python: Migrate to smart_holder
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
namespace icsneo {
|
||||
|
||||
void init_ethernetmessage(pybind11::module_& m) {
|
||||
pybind11::class_<MACAddress>(m, "MACAddress")
|
||||
pybind11::classh<MACAddress>(m, "MACAddress")
|
||||
.def("to_string", &MACAddress::toString)
|
||||
.def("__repr__", &MACAddress::toString);
|
||||
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
namespace icsneo {
|
||||
|
||||
void init_ethphymessage(pybind11::module_& m) {
|
||||
pybind11::classh<Clause22Message>(m, "Clause22Message")
|
||||
.def_readwrite("phyAddr", &Clause22Message::phyAddr)
|
||||
.def_readwrite("page", &Clause22Message::page)
|
||||
.def_readwrite("regAddr", &Clause22Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause22Message::regVal);
|
||||
pybind11::classh<Clause45Message>(m, "Clause45Message")
|
||||
.def_readwrite("port", &Clause45Message::port)
|
||||
.def_readwrite("device", &Clause45Message::device)
|
||||
.def_readwrite("regAddr", &Clause45Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause45Message::regVal);
|
||||
pybind11::classh<PhyMessage>(m, "PhyMessage")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("Enabled", &PhyMessage::Enabled)
|
||||
@@ -16,18 +26,6 @@ void init_ethphymessage(pybind11::module_& m) {
|
||||
.def_readwrite("BusIndex", &PhyMessage::BusIndex)
|
||||
.def_readwrite("Clause22", &PhyMessage::Clause22)
|
||||
.def_readwrite("Clause45", &PhyMessage::Clause45);
|
||||
pybind11::class_<Clause22Message>(m, "Clause22Message")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("phyAddr", &Clause22Message::phyAddr)
|
||||
.def_readwrite("page", &Clause22Message::page)
|
||||
.def_readwrite("regAddr", &Clause22Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause22Message::regVal);
|
||||
pybind11::class_<Clause45Message>(m, "Clause45Message")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("port", &Clause45Message::port)
|
||||
.def_readwrite("device", &Clause45Message::device)
|
||||
.def_readwrite("regAddr", &Clause45Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause45Message::regVal);
|
||||
pybind11::classh<EthPhyMessage, Message>(m, "EthPhyMessage")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("messages", &EthPhyMessage::messages);
|
||||
|
||||
@@ -9,38 +9,38 @@ namespace icsneo {
|
||||
void init_gptpstatusmessage(pybind11::module_& m) {
|
||||
pybind11::classh<GPTPStatus, Message> gptpStatus(m, "GPTPStatus");
|
||||
|
||||
pybind11::class_<GPTPStatus::Timestamp>(gptpStatus, "Timestamp")
|
||||
pybind11::classh<GPTPStatus::Timestamp>(gptpStatus, "Timestamp")
|
||||
.def_readonly("seconds", &GPTPStatus::Timestamp::seconds)
|
||||
.def_readonly("nanoseconds", &GPTPStatus::Timestamp::nanoseconds)
|
||||
.def("to_seconds", &GPTPStatus::Timestamp::toSeconds, pybind11::call_guard<pybind11::gil_scoped_release>());
|
||||
|
||||
pybind11::class_<GPTPStatus::ScaledNanoSeconds>(gptpStatus, "ScaledNanoSeconds")
|
||||
pybind11::classh<GPTPStatus::ScaledNanoSeconds>(gptpStatus, "ScaledNanoSeconds")
|
||||
.def_readonly("nanoseconds_msb", &GPTPStatus::ScaledNanoSeconds::nanosecondsMSB)
|
||||
.def_readonly("nanoseconds_lsb", &GPTPStatus::ScaledNanoSeconds::nanosecondsLSB)
|
||||
.def_readonly("fractional_nanoseconds", &GPTPStatus::ScaledNanoSeconds::fractionalNanoseconds);
|
||||
|
||||
pybind11::class_<GPTPStatus::PortID>(gptpStatus, "PortID")
|
||||
pybind11::classh<GPTPStatus::PortID>(gptpStatus, "PortID")
|
||||
.def_readonly("clock_identity", &GPTPStatus::PortID::clockIdentity)
|
||||
.def_readonly("port_number", &GPTPStatus::PortID::portNumber);
|
||||
|
||||
pybind11::class_<GPTPStatus::ClockQuality>(gptpStatus, "ClockQuality")
|
||||
pybind11::classh<GPTPStatus::ClockQuality>(gptpStatus, "ClockQuality")
|
||||
.def_readonly("clock_class", &GPTPStatus::ClockQuality::clockClass)
|
||||
.def_readonly("clock_accuracy", &GPTPStatus::ClockQuality::clockAccuracy)
|
||||
.def_readonly("offset_scaled_log_variance", &GPTPStatus::ClockQuality::offsetScaledLogVariance);
|
||||
|
||||
pybind11::class_<GPTPStatus::SystemID>(gptpStatus, "SystemID")
|
||||
pybind11::classh<GPTPStatus::SystemID>(gptpStatus, "SystemID")
|
||||
.def_readonly("priority1", &GPTPStatus::SystemID::priority1)
|
||||
.def_readonly("clock_quality", &GPTPStatus::SystemID::clockQuality)
|
||||
.def_readonly("priority2", &GPTPStatus::SystemID::priority2)
|
||||
.def_readonly("clock_id", &GPTPStatus::SystemID::clockID);
|
||||
|
||||
pybind11::class_<GPTPStatus::PriorityVector>(gptpStatus, "PriorityVector")
|
||||
pybind11::classh<GPTPStatus::PriorityVector>(gptpStatus, "PriorityVector")
|
||||
.def_readonly("sys_id", &GPTPStatus::PriorityVector::sysID)
|
||||
.def_readonly("steps_removed", &GPTPStatus::PriorityVector::stepsRemoved)
|
||||
.def_readonly("port_id", &GPTPStatus::PriorityVector::portID)
|
||||
.def_readonly("port_number", &GPTPStatus::PriorityVector::portNumber);
|
||||
|
||||
pybind11::class_<GPTPStatus::ParentDS>(gptpStatus, "ParentDS")
|
||||
pybind11::classh<GPTPStatus::ParentDS>(gptpStatus, "ParentDS")
|
||||
.def_readonly("parent_port_identity", &GPTPStatus::ParentDS::parentPortIdentity)
|
||||
.def_readonly("cumulative_rate_ratio", &GPTPStatus::ParentDS::cumulativeRateRatio)
|
||||
.def_readonly("grandmaster_identity", &GPTPStatus::ParentDS::grandmasterIdentity)
|
||||
@@ -50,7 +50,7 @@ void init_gptpstatusmessage(pybind11::module_& m) {
|
||||
.def_readonly("gm_priority1", &GPTPStatus::ParentDS::gmPriority1)
|
||||
.def_readonly("gm_priority2", &GPTPStatus::ParentDS::gmPriority2);
|
||||
|
||||
pybind11::class_<GPTPStatus::CurrentDS>(gptpStatus, "CurrentDS")
|
||||
pybind11::classh<GPTPStatus::CurrentDS>(gptpStatus, "CurrentDS")
|
||||
.def_readonly("steps_removed", &GPTPStatus::CurrentDS::stepsRemoved)
|
||||
.def_readonly("offset_from_master", &GPTPStatus::CurrentDS::offsetFromMaster)
|
||||
.def_readonly("lastgm_phase_change", &GPTPStatus::CurrentDS::lastgmPhaseChange)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace icsneo {
|
||||
|
||||
void init_linmessage(pybind11::module_& m) {
|
||||
pybind11::class_<LINErrorFlags>(m, "LINErrorFlags")
|
||||
pybind11::classh<LINErrorFlags>(m, "LINErrorFlags")
|
||||
.def_readwrite("ErrRxBreakOnly", &LINErrorFlags::ErrRxBreakOnly)
|
||||
.def_readwrite("ErrRxBreakSyncOnly", &LINErrorFlags::ErrRxBreakSyncOnly)
|
||||
.def_readwrite("ErrTxRxMismatch", &LINErrorFlags::ErrTxRxMismatch)
|
||||
@@ -20,7 +20,7 @@ void init_linmessage(pybind11::module_& m) {
|
||||
.def_readwrite("ErrFrameResponderData", &LINErrorFlags::ErrFrameResponderData)
|
||||
.def_readwrite("ErrChecksumMatch", &LINErrorFlags::ErrChecksumMatch);
|
||||
|
||||
pybind11::class_<LINStatusFlags>(m, "LINStatusFlags")
|
||||
pybind11::classh<LINStatusFlags>(m, "LINStatusFlags")
|
||||
.def_readwrite("TxChecksumEnhanced", &LINStatusFlags::TxChecksumEnhanced)
|
||||
.def_readwrite("TxCommander", &LINStatusFlags::TxCommander)
|
||||
.def_readwrite("TxResponder", &LINStatusFlags::TxResponder)
|
||||
|
||||
Reference in New Issue
Block a user