otsdaq  v2_05_02_indev
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  {
26  // inheriting children classes should use __GEN_COUT_*
27  // for decorations using mfSubject.
28  __GEN_COUT__ << __E__;
29  __GEN_COUTV__(interfaceUID_);
30  __GEN_COUTV__(mfSubject_);
31  }
32 
33  virtual ~SlowControlsVInterface(void) {}
34 
35  virtual void initialize() = 0;
36 
37 
38  virtual void subscribe(const std::string& Name) = 0;
39  virtual void subscribeJSON(const std::string& JSONNameString) = 0;
40  virtual void unsubscribe(const std::string& Name)= 0;
41  virtual std::vector<std::string /*Name*/> getChannelList(void) = 0;
42  virtual std::string getList(const std::string& format) = 0;
43  virtual std::array<std::string, 4> getCurrentValue(const std::string& Name) = 0;
44  virtual std::vector<std::vector<std::string>> getChannelHistory(const std::string& Name) = 0;
45  virtual std::vector<std::vector<std::string>> getLastAlarms(const std::string& pvName) = 0;
46  virtual std::vector<std::vector<std::string>> getAlarmsLog(const std::string& pvName) = 0;
47  virtual std::vector<std::vector<std::string>> checkAlarmNotifications (void) = 0;
48 
49  virtual std::array<std::string, 9> getSettings(const std::string& Name) = 0;
50 
51 
52 
53  virtual void configure(void) override {;} //by default do nothing on FSM transitions
54  virtual void halt(void) override {;} //by default do nothing on FSM transitions
55  virtual void pause(void) override {;} //by default do nothing on FSM transitions
56  virtual void resume(void) override {;} //by default do nothing on FSM transitions
57  virtual void start(std::string /*runNumber*/) override {;} //by default do nothing on FSM transitions
58  virtual void stop(void) override {;} //by default do nothing on FSM transitions
59 
60  // States
61  virtual bool running(void) override { return false; } //This is a workloop/thread, by default do nothing and end thread during running (Note: return true would repeat call)
62 
63  protected:
64  const std::string interfaceUID_;
65  const std::string interfaceType_;
66  const std::string mfSubject_;
67 };
68 // clang-format on
69 } // namespace ots
70 #endif