parent
830fe1af59
commit
f743f32e63
|
|
@ -35,6 +35,7 @@ pybind11_add_module(icsneopy
|
|||
icsneopy/communication/message/scriptstatusmessage.cpp
|
||||
icsneopy/communication/message/callback/messagecallback.cpp
|
||||
icsneopy/communication/message/filter/messagefilter.cpp
|
||||
icsneopy/communication/message/flexray/flexraymessage.cpp
|
||||
icsneopy/disk/diskdriver.cpp
|
||||
icsneopy/device/device.cpp
|
||||
icsneopy/icsneocpp.cpp
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/functional.h>
|
||||
|
||||
#include "icsneo/communication/message/flexray/flexraymessage.h"
|
||||
#include "icsneo/device/extensions/flexray/symbol.h"
|
||||
#include "icsneo/device/extensions/flexray/channel.h"
|
||||
#include "icsneo/device/extensions/flexray/crcstatus.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
struct FlexRayNamespace {
|
||||
using Symbol = icsneo::FlexRay::Symbol;
|
||||
using CRCStatus = icsneo::FlexRay::CRCStatus;
|
||||
using Channel = icsneo::FlexRay::Channel;
|
||||
};
|
||||
|
||||
void init_flexraymessage(pybind11::module_& m) {
|
||||
// dummy class to hold the enums
|
||||
pybind11::class_<FlexRayNamespace> flexray(m, "FlexRay");
|
||||
// enumerations
|
||||
pybind11::enum_<FlexRayNamespace::Symbol>(flexray, "Symbol")
|
||||
.value("None", FlexRayNamespace::Symbol::None)
|
||||
.value("Unknown", FlexRayNamespace::Symbol::Unknown)
|
||||
.value("Wakeup", FlexRayNamespace::Symbol::Wakeup)
|
||||
.value("CAS", FlexRayNamespace::Symbol::CAS);
|
||||
pybind11::enum_<FlexRayNamespace::CRCStatus>(flexray, "CRCStatus")
|
||||
.value("OK", FlexRayNamespace::CRCStatus::OK)
|
||||
.value("Error", FlexRayNamespace::CRCStatus::Error)
|
||||
.value("NoCRC", FlexRayNamespace::CRCStatus::NoCRC);
|
||||
pybind11::enum_<FlexRayNamespace::Channel>(flexray, "Channel")
|
||||
.value("None", FlexRayNamespace::Channel::None)
|
||||
.value("A", FlexRayNamespace::Channel::A)
|
||||
.value("B", FlexRayNamespace::Channel::B)
|
||||
.value("AB", FlexRayNamespace::Channel::AB);
|
||||
// read-only until transmit is supported
|
||||
pybind11::class_<FlexRayMessage, std::shared_ptr<FlexRayMessage>, Frame>(m, "FlexRayMessage")
|
||||
.def(pybind11::init())
|
||||
.def_readonly("slotid", &FlexRayMessage::slotid)
|
||||
.def_readonly("tsslen", &FlexRayMessage::tsslen)
|
||||
.def_readonly("framelen", &FlexRayMessage::framelen)
|
||||
.def_readonly("symbol", &FlexRayMessage::symbol)
|
||||
.def_readonly("header_crc_status", &FlexRayMessage::headerCRCStatus)
|
||||
.def_readonly("header_crc", &FlexRayMessage::headerCRC)
|
||||
.def_readonly("frame_crc_status", &FlexRayMessage::crcStatus)
|
||||
.def_readonly("frame_crc", &FlexRayMessage::frameCRC)
|
||||
.def_readonly("channel", &FlexRayMessage::channel)
|
||||
.def_readonly("null_frame", &FlexRayMessage::nullFrame)
|
||||
.def_readonly("payload_preamble", &FlexRayMessage::payloadPreamble)
|
||||
.def_readonly("sync_frame", &FlexRayMessage::sync)
|
||||
.def_readonly("startup_frame", &FlexRayMessage::startup)
|
||||
.def_readonly("dynamic_frame", &FlexRayMessage::dynamic)
|
||||
.def_readonly("cycle", &FlexRayMessage::cycle);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
|
|
@ -28,6 +28,7 @@ void init_device(pybind11::module_&);
|
|||
void init_messagefilter(pybind11::module_&);
|
||||
void init_messagecallback(pybind11::module_&);
|
||||
void init_version(pybind11::module_&);
|
||||
void init_flexraymessage(pybind11::module_& m);
|
||||
|
||||
PYBIND11_MODULE(icsneopy, m) {
|
||||
pybind11::options options;
|
||||
|
|
@ -56,6 +57,7 @@ PYBIND11_MODULE(icsneopy, m) {
|
|||
init_messagecallback(m);
|
||||
init_diskdriver(m);
|
||||
init_device(m);
|
||||
init_flexraymessage(m);
|
||||
|
||||
m.def("find_all_devices", &FindAllDevices);
|
||||
m.def("get_supported_devices", &GetSupportedDevices);
|
||||
|
|
|
|||
Loading…
Reference in New Issue