tdaq-develop-2025-02-12
SlowControlsDashboardSupervisor.h
1 #ifndef _ots_SlowControlsDashboardSupervisor_h_
2 #define _ots_SlowControlsDashboardSupervisor_h_
3 
4 #include <chrono>
5 #include "otsdaq/CoreSupervisors/CoreSupervisorBase.h"
6 
7 // #include "otsdaq-utilities/SlowControlsInterfacePlugins/EpicsInterface.h"
8 // #include "EpicsInterface.h.bkup"
9 
10 namespace ots
11 {
12 class SlowControlsVInterface;
13 class ConfigurationManager;
14 
18 class SlowControlsDashboardSupervisor : public CoreSupervisorBase
19 {
20  public:
21  XDAQ_INSTANTIATOR();
22 
23  SlowControlsDashboardSupervisor(xdaq::ApplicationStub* s);
24  virtual ~SlowControlsDashboardSupervisor(void);
25 
26  void init(void);
27  void destroy(void);
30  void handleNewAlarms();
31 
32  virtual void request(const std::string& requestType,
33  cgicc::Cgicc& cgiIn,
34  HttpXmlDocument& xmlOut,
35  const WebUsers::RequestUserInfo& userInfo) override;
36  virtual void handleRequest(const std::string Command,
37  HttpXmlDocument& xmlOut,
38  cgicc::Cgicc& cgiIn,
39  const WebUsers::RequestUserInfo& userInfo);
40 
41  virtual void setSupervisorPropertyDefaults(void) override;
42  virtual void forceSupervisorPropertyValues(void) override;
46 
47  void Poll(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::string UID);
48  void Poll(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
49  void GetChannelSettings(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
50  void GetChannelArchiverData(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
51  void GetLastAlarmsData(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
52  void GetAlarmsLogData(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
53  void GetAlarmsCheck(HttpXmlDocument& xmlOut);
54  void GetUserPermissions(cgicc::Cgicc& cgiIn,
55  HttpXmlDocument& xmlOut,
56  const WebUsers::RequestUserInfo& userInfo);
57  void GenerateUID(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::string pvlist);
58  void GetList(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
59  void GetPages(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
60  void loadPage(cgicc::Cgicc& cgiIn,
61  HttpXmlDocument& xmlOut,
62  std::string page,
63  const WebUsers::RequestUserInfo& userInfo);
64  void loadPhoebusPage(cgicc::Cgicc& cgiIn,
65  HttpXmlDocument& xmlOut,
66  std::string page,
67  const WebUsers::RequestUserInfo& userInfo);
68  void SaveControlsPage(cgicc::Cgicc& cgiIn,
69  HttpXmlDocument& xmlOut,
70  const WebUsers::RequestUserInfo& userInfo);
71  void SavePhoebusControlsPage(cgicc::Cgicc& cgiIn,
72  HttpXmlDocument& xmlOut,
73  const WebUsers::RequestUserInfo& userInfo);
74  void saveImageFile(cgicc::Cgicc& cgiIn,
75  HttpXmlDocument& xmlOut,
76  const WebUsers::RequestUserInfo& userInfo);
77  void Subscribe(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
78  void Unsubscribe(cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
79 
81  bool isDir(std::string dir);
82  void listFiles(std::string baseDir, bool recursive, std::vector<std::string>* pages);
83 
84  private:
85  std::string PollChannels_(std::set<std::string>& channels, bool resubscibe = true);
86  std::map<int, std::set<std::string>> channelDependencyLookupMap_;
87  std::map<int, long int> uidPollTimeMap_;
88  int UID_;
89  int alarmNotifyRefreshRate_;
90  std::mutex alarmCheckThreadErrorMutex_;
91  std::string alarmCheckThreadError_;
92  int readOnly_;
93 
95  std::vector<std::vector<std::string>> alarms_;
96  std::chrono::time_point<std::chrono::system_clock> alarms_timestamp_;
97 
98  public:
99  SlowControlsVInterface* interface_;
100  std::mutex pluginBusyMutex_;
101 };
102 } // namespace ots
103 
104 #endif
bool isDir(std::string dir)
Utilities, eventually to be moved.
void checkSubscriptions(SlowControlsDashboardSupervisor *cs)
Manage channel subscriptions to Interface.
void checkSlowControlsAlarms(SlowControlsDashboardSupervisor *cs)
Manage channel subscriptions to Interface.