DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
hsi.cpp
Go to the documentation of this file.
1
9
10#include <pybind11/pybind11.h>
11#include <pybind11/stl.h>
12
13namespace py = pybind11;
14
16
17// Quiet the linter about use of unsigned ints in the file
18// NOLINTBEGIN(build/unsigned)
19
20void
21register_hsi(py::module& m)
22{
23
24 py::class_<HSIFrame>(m, "HSIFrame", py::buffer_protocol())
25 .def(py::init())
26 .def(py::init([](py::capsule capsule) {
27 auto hsfp = *static_cast<HSIFrame*>(capsule.get_pointer());
28 return hsfp;
29 }))
30 .def(py::init([](py::bytes bytes) {
31 py::buffer_info info(py::buffer(bytes).request());
32 auto wfp = *static_cast<HSIFrame*>(info.ptr);
33 return wfp;
34 }))
35 .def("get_timestamp", &HSIFrame::get_timestamp)
36 .def_property_readonly("version", [](const HSIFrame& self) -> uint64_t { return self.version; })
37 .def_property_readonly("detector_id", [](const HSIFrame& self) -> uint64_t { return self.detector_id; })
38 .def_property_readonly("crate", [](const HSIFrame& self) -> uint64_t { return self.crate; })
39 .def_property_readonly("slot", [](const HSIFrame& self) -> uint64_t { return self.slot; })
40 .def_property_readonly("link", [](const HSIFrame& self) -> uint64_t { return self.link; })
41 .def_property_readonly("input_low", [](const HSIFrame& self) -> uint64_t { return self.input_low; })
42 .def_property_readonly("input_high", [](const HSIFrame& self) -> uint64_t { return self.input_high; })
43 .def_property_readonly("trigger", [](const HSIFrame& self) -> uint64_t { return self.trigger; })
44 .def_property_readonly("sequence", [](const HSIFrame& self) -> uint64_t { return self.sequence; })
45 .def_static("sizeof", []() { return sizeof(HSIFrame); });
46}
47
48} // namespace dunedaq::detdataformats::python
49
50// NOLINTEND(build/unsigned)
void register_hsi(py::module &m)
Definition hsi.cpp:21