LCOV - code coverage report
Current view: top level - fddetdataformats/pybindsrc - wibeth.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 75 0
Test Date: 2026-05-24 15:29:04 Functions: 0.0 % 36 0

            Line data    Source code
       1              : /**
       2              :  * @file wibeth.cpp Python bindings for the WIBEthFrame format
       3              :  *
       4              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "fddetdataformats/WIBEthFrame.hpp"
      10              : 
      11              : #include <pybind11/pybind11.h>
      12              : #include <pybind11/stl.h>
      13              : 
      14              : namespace py = pybind11;
      15              : 
      16              : namespace dunedaq::fddetdataformats::python {
      17              : 
      18              : void
      19            0 : register_wibeth(py::module& m)
      20              : {
      21              : 
      22              :   // NOLINTBEGIN(build/unsigned)
      23              : 
      24            0 :   py::class_<WIBEthFrame::WIBEthHeader>(m, "WIBEthHeader")
      25            0 :     .def_property(
      26              :       "channel",
      27            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.channel; },
      28            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t channel) { self.channel = channel; })
      29            0 :     .def_property(
      30              :       "version",
      31            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.version; },
      32            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t version) { self.version = version; })
      33              :     // .def_property("reserved",
      34              :     // [](WIBEthFrame::WIBEthHeader& self) -> uint32_t {return self.reserved;},
      35              :     // [](WIBEthFrame::WIBEthHeader& self, uint32_t reserved) {self.reserved = reserved;}
      36              :     // )
      37            0 :     .def_property(
      38              :       "cd",
      39            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.cd; },
      40            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t cd) { self.version = cd; })
      41            0 :     .def_property(
      42              :       "context",
      43            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.context; },
      44            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t context) { self.version = context; })
      45            0 :     .def_property(
      46              :       "ready",
      47            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.ready; },
      48            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t ready) { self.ready = ready; })
      49            0 :     .def_property(
      50              :       "calibration",
      51            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.calibration; },
      52            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t calibration) { self.calibration = calibration; })
      53            0 :     .def_property(
      54              :       "pulser",
      55            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.pulser; },
      56            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t pulser) { self.pulser = pulser; })
      57            0 :     .def_property(
      58              :       "femb_sync",
      59            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.femb_sync; },
      60            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t femb_sync) { self.femb_sync = femb_sync; })
      61            0 :     .def_property(
      62              :       "wib_sync",
      63            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.wib_sync; },
      64            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t wib_sync) { self.wib_sync = wib_sync; })
      65            0 :     .def_property(
      66              :       "lol",
      67            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.lol; },
      68            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t lol) { self.lol = lol; })
      69            0 :     .def_property(
      70              :       "link_valid",
      71            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.link_valid; },
      72            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t link_valid) { self.link_valid = link_valid; })
      73            0 :     .def_property(
      74              :       "crc_err",
      75            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.crc_err; },
      76            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t crc_err) { self.crc_err = crc_err; })
      77            0 :     .def_property(
      78              :       "colddata_timestamp_1",
      79            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.colddata_timestamp_1; },
      80            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t colddata_timestamp_1) { self.lol = colddata_timestamp_1; })
      81            0 :     .def_property(
      82              :       "colddata_timestamp_0",
      83            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint32_t { return self.colddata_timestamp_0; },
      84            0 :       [](WIBEthFrame::WIBEthHeader& self, uint32_t colddata_timestamp_0) {
      85            0 :         self.colddata_timestamp_0 = colddata_timestamp_0;
      86            0 :       })
      87            0 :     .def_property(
      88              :       "extra_data",
      89            0 :       [](WIBEthFrame::WIBEthHeader& self) -> uint64_t { return self.extra_data; },
      90            0 :       [](WIBEthFrame::WIBEthHeader& self, uint64_t extra_data) { self.extra_data = extra_data; });
      91              : 
      92            0 :   py::class_<WIBEthFrame>(m, "WIBEthFrame", py::buffer_protocol())
      93            0 :     .def(py::init())
      94            0 :     .def(py::init([](py::capsule capsule) {
      95            0 :       auto wfp = *static_cast<WIBEthFrame*>(capsule.get_pointer());
      96            0 :       return wfp;
      97              :     }))
      98            0 :     .def(py::init([](py::bytes bytes) {
      99            0 :       py::buffer_info info(py::buffer(bytes).request());
     100            0 :       auto wfp = *static_cast<WIBEthFrame*>(info.ptr);
     101            0 :       return wfp;
     102            0 :     }))
     103            0 :     .def(
     104              :       "get_daqheader",
     105            0 :       [](WIBEthFrame& self) -> const detdataformats::DAQEthHeader& { return self.daq_header; },
     106            0 :       py::return_value_policy::reference_internal)
     107            0 :     .def(
     108              :       "get_wibheader",
     109            0 :       [](WIBEthFrame& self) -> const WIBEthFrame::WIBEthHeader& { return self.header; },
     110            0 :       py::return_value_policy::reference_internal)
     111            0 :     .def("get_adc", &WIBEthFrame::get_adc)
     112            0 :     .def("set_adc", &WIBEthFrame::set_adc)
     113            0 :     .def("get_timestamp", &WIBEthFrame::get_timestamp)
     114            0 :     .def("set_timestamp", &WIBEthFrame::set_timestamp)
     115            0 :     .def("get_channel", &WIBEthFrame::get_channel)
     116            0 :     .def("set_channel", &WIBEthFrame::set_channel)
     117            0 :     .def_static("sizeof", []() { return sizeof(WIBEthFrame); })
     118            0 :     .def("get_bytes", [](WIBEthFrame* fr) -> py::bytes {
     119            0 :       return py::bytes(reinterpret_cast<char*>(fr), sizeof(WIBEthFrame)); // NOLINT reinterpret_cast
     120              :     });
     121            0 : } // NOLINT function length
     122              : 
     123              : // NOLINTEND(build/unsigned)
     124              : 
     125              : } // namespace dunedaq::fddetdataformats::python
        

Generated by: LCOV version 2.0-1