Line data Source code
1 : /**
2 : * @file TimingMasterControllerBase.hpp
3 : *
4 : * TimingMasterControllerBase is a DAQModule implementation that
5 : * provides a control interface for timing master hardware.
6 : *
7 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
8 : * Licensing/copyright details are in the COPYING file that you should have
9 : * received with this code.
10 : */
11 :
12 : #ifndef TIMINGLIBS_PLUGINS_TIMINGMASTERCONTROLLERBASE_HPP_
13 : #define TIMINGLIBS_PLUGINS_TIMINGMASTERCONTROLLERBASE_HPP_
14 :
15 : #include "timinglibs/TimingController.hpp"
16 : #include "timinglibs/dal/TimingMasterControllerConf.hpp"
17 :
18 : #include "timinglibs/timingcmd/Nljs.hpp"
19 : #include "timinglibs/timingcmd/Structs.hpp"
20 :
21 : #include "appfwk/DAQModule.hpp"
22 : #include "ers/Issue.hpp"
23 : #include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
24 : #include "utilities/WorkerThread.hpp"
25 :
26 : #include <memory>
27 : #include <string>
28 : #include <vector>
29 :
30 : namespace dunedaq {
31 1 : ERS_DECLARE_ISSUE(timinglibs, ///< Namespace
32 : TimingMasterNotReady, ///< Issue class name
33 : master << " timing master did not become ready in time.", ///< Message
34 : ((std::string)master) ) ///< Message parameters
35 : namespace timinglibs {
36 :
37 : /**
38 : * @brief TimingMasterControllerBase is a DAQModule implementation that
39 : * provides a control interface for timing master hardware.
40 : */
41 : class TimingMasterControllerBase : public dunedaq::timinglibs::TimingController
42 : {
43 : public:
44 : /**
45 : * @brief TimingMasterControllerBase Constructor
46 : * @param name Instance name for this TimingMasterControllerBase instance
47 : */
48 : explicit TimingMasterControllerBase(const std::string& name);
49 :
50 : TimingMasterControllerBase(const TimingMasterControllerBase&) = delete; ///< TimingMasterControllerBase is not copy-constructible
51 : TimingMasterControllerBase& operator=(const TimingMasterControllerBase&) =
52 : delete; ///< TimingMasterControllerBase is not copy-assignable
53 : TimingMasterControllerBase(TimingMasterControllerBase&&) = delete; ///< TimingMasterControllerBase is not move-constructible
54 : TimingMasterControllerBase& operator=(TimingMasterControllerBase&&) =
55 : delete; ///< TimingMasterControllerBase is not move-assignable
56 0 : virtual ~TimingMasterControllerBase()
57 0 : {
58 0 : if (endpoint_scan_thread.thread_running())
59 0 : endpoint_scan_thread.stop_working_thread();
60 0 : }
61 :
62 : protected:
63 : // Commands
64 : void do_configure(const CommandData_t&) override;
65 : void do_start(const CommandData_t& data) override;
66 : void do_stop(const CommandData_t& data) override;
67 : void send_configure_hardware_commands(const CommandData_t& data) override;
68 :
69 : // timing master commands
70 : void do_master_set_timestamp(const CommandData_t&);
71 : void do_master_set_endpoint_delay(const CommandData_t& data);
72 : void do_master_send_fl_command(const CommandData_t& data);
73 : void do_master_measure_endpoint_rtt(const CommandData_t& data);
74 : void do_master_endpoint_scan(const CommandData_t& data);
75 :
76 : // pass op mon info
77 : // void get_info(opmonlib::InfoCollector& ci, int level) override;
78 :
79 : timingcmd::TimingEndpointLocations m_monitored_endpoint_locations;
80 : uint m_endpoint_scan_period; // NOLINT(build/unsigned)
81 : dunedaq::utilities::WorkerThread endpoint_scan_thread;
82 : virtual void endpoint_scan(std::atomic<bool>&);
83 : };
84 : } // namespace timinglibs
85 : } // namespace dunedaq
86 :
87 : #endif // TIMINGLIBS_PLUGINS_TIMINGMASTERCONTROLLERBASE_HPP_
88 :
89 : // Local Variables:
90 : // c-basic-offset: 2
91 : // End:
|