tdaq-develop-2025-02-12
SlowControlsVInterface.h
1 #ifndef _ots_SlowControlsVInterface_h_
2 #define _ots_SlowControlsVInterface_h_
3 
4 #include "otsdaq/Configurable/Configurable.h"
5 #include "otsdaq/FiniteStateMachine/VStateMachine.h"
6 
7 #include <array>
8 #include <string>
9 
10 // clang-format off
11 namespace ots
12 {
14 {
15  public:
16  SlowControlsVInterface(const std::string& interfaceType,
17  const std::string& interfaceUID,
18  const ConfigurationTree& theXDAQContextConfigTree,
19  const std::string& configurationPath)
20  : Configurable(theXDAQContextConfigTree, configurationPath)
21  , VStateMachine(Configurable::theConfigurationRecordName_)
22  , interfaceUID_(interfaceUID)
23  , interfaceType_(interfaceType)
24  , mfSubject_("controls-" + interfaceType_ + "-" + interfaceUID_)
25  , newAlarmCallback_(nullptr)
26  {
27  // inheriting children classes should use __GEN_COUT_*
28  // for decorations using mfSubject.
29  __GEN_COUT__ << __E__;
30  __GEN_COUTV__(interfaceUID_);
31  __GEN_COUTV__(mfSubject_);
32  }
33 
34  virtual ~SlowControlsVInterface(void) {}
35 
36  virtual void initialize() = 0;
37 
38 
39  virtual void subscribe(const std::string& Name) = 0;
40  virtual void subscribeJSON(const std::string& JSONNameString) = 0;
41  virtual void unsubscribe(const std::string& Name)= 0;
42  virtual std::vector<std::string /*Name*/> getChannelList(void) = 0;
43  virtual std::string getList(const std::string& format) = 0;
44  virtual std::array<std::string, 4> getCurrentValue(const std::string& Name) = 0;
45  virtual std::vector<std::vector<std::string>> getChannelHistory(const std::string& Name, int startTime, int endTime) = 0;
46  virtual std::vector<std::vector<std::string>> getLastAlarms(const std::string& pvName) = 0;
47  virtual std::vector<std::vector<std::string>> getAlarmsLog(const std::string& pvName) = 0;
48  virtual std::vector<std::vector<std::string>> checkAlarmNotifications (void) = 0;
49 
50  virtual std::array<std::string, 9> getSettings(const std::string& Name) = 0;
51 
52 
53 
54  virtual void configure(void) override {;}
55  virtual void halt(void) override {;}
56  virtual void pause(void) override {;}
57  virtual void resume(void) override {;}
58  virtual void start(std::string /*runNumber*/) override {;}
59  virtual void stop(void) override {;}
60 
62  virtual bool running(void) override { return false; }
63 
64  void setNewAlarmCallback(std::function<void()> callback) { newAlarmCallback_ = callback; }
65 
66  protected:
67  const std::string interfaceUID_;
68  const std::string interfaceType_;
69  const std::string mfSubject_;
70  std::function<void()> newAlarmCallback_;
71 };
72 // clang-format on
73 } // namespace ots
74 #endif
virtual void stop(void) override
by default do nothing on FSM transitions
virtual void pause(void) override
by default do nothing on FSM transitions
virtual bool running(void) override
States.
virtual void resume(void) override
by default do nothing on FSM transitions
virtual void configure(void) override
by default do nothing on FSM transitions
virtual void start(std::string) override
by default do nothing on FSM transitions
virtual void halt(void) override
by default do nothing on FSM transitions