LCOV - code coverage report
Current view: top level - tdemodules/plugins - TDEAMCModule.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 29 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 7 0

            Line data    Source code
       1              : /**
       2              :  * @file TDEAMCModule.cpp
       3              :  *
       4              :  * Implementations of TDEAMCModule's functions
       5              :  *
       6              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       7              :  * Licensing/copyright details are in the COPYING file that you should have
       8              :  * received with this code.
       9              :  */
      10              : 
      11              : #include "appmodel/TDEAMCModule.hpp"
      12              : #include "appmodel/TdeAmcDetDataSender.hpp"
      13              : #include "appmodel/NWDetDataSender.hpp"
      14              : #include "confmodel/NetworkInterface.hpp"
      15              : #include "TDEAMCModule.hpp"
      16              : #include "tdemodules/AMCController.hpp"
      17              : 
      18              : #include "tdemodules/opmon/tdeamcmodule_info.pb.h"
      19              : 
      20              : #include <string>
      21              : 
      22              : namespace dunedaq::tdemodules {
      23              : 
      24            0 : TDEAMCModule::TDEAMCModule(const std::string& name)
      25            0 :   : dunedaq::appfwk::DAQModule(name)
      26              : {
      27            0 :   register_command("conf", &TDEAMCModule::do_conf);
      28            0 :   register_command("start", &TDEAMCModule::do_start);
      29            0 :   register_command("stop", &TDEAMCModule::do_stop);
      30            0 : }
      31              : 
      32              : void
      33            0 : TDEAMCModule::init(std::shared_ptr<appfwk::ConfigurationManager> mcfg)
      34              : {
      35            0 :     m_dal = mcfg->get_dal<appmodel::TDEAMCModule>(get_name());
      36            0 : }
      37              : 
      38              : void
      39            0 : TDEAMCModule::generate_opmon_data()
      40              : {
      41            0 :   opmon::TDEAMCModuleInfo info;
      42            0 :   info.set_total_amount(m_total_amount.load());
      43            0 :   info.set_amount_since_last_call(m_amount_since_last_call.exchange(0));
      44            0 :   publish(std::move(info));
      45            0 : }
      46              : 
      47              : void
      48            0 : TDEAMCModule::do_conf(const CommandData_t& /* do not pass an argument*/)
      49              : {
      50              :     //! placehodler for now, source id, ip and port should come from the configuration manager
      51              :     //! for now, have one AMCModule per AMC.
      52              : 
      53            0 :     uint32_t data_port = m_dal->get_amc()->get_port();
      54            0 :     std::string ip = m_dal->get_amc()->get_control_endpoint()[0].get_ip_address()[0];
      55              : 
      56              :     // int amc_id = 2;
      57              :     // std::string ip = "10.73.32." + std::to_string(amc_id);
      58              :     // int data_port = 54321 + amc_id;
      59              : 
      60              :     // Create the AMC controller
      61            0 :     m_ctrl = std::make_unique<AMCController>(ip, data_port);
      62            0 :     std::cout << "Created conroller for AMC " << ip << std::endl;
      63            0 :     m_ctrl->card_status();
      64              : 
      65              :     // probably want some checks here, e.g. (AMC is pingable?)
      66            0 : }
      67              : 
      68              : void
      69            0 : TDEAMCModule::do_start(const CommandData_t& /* do not pass an argument*/)
      70              : {
      71            0 :     m_ctrl->card_start();
      72            0 : }
      73              : 
      74              : void
      75            0 : TDEAMCModule::do_stop(const CommandData_t& /* do not pass an argument*/)
      76              : {
      77            0 :     m_ctrl->card_stop();
      78            0 : }
      79              : 
      80              : } // namespace dunedaq::tdemodules
      81              : 
      82            0 : DEFINE_DUNE_DAQ_MODULE(dunedaq::tdemodules::TDEAMCModule)
        

Generated by: LCOV version 2.0-1