otsdaq_utilities  v2_05_02_indev
SlowControlsDashboardSupervisor.h
1 #ifndef _ots_SlowControlsDashboardSupervisor_h_
2 #define _ots_SlowControlsDashboardSupervisor_h_
3 
4 #include "otsdaq/CoreSupervisors/CoreSupervisorBase.h"
5 
6 //#include "otsdaq-utilities/SlowControlsInterfacePlugins/EpicsInterface.h"
7 //#include "EpicsInterface.h.bkup"
8 
9 namespace ots
10 {
11 class SlowControlsVInterface;
12 class ConfigurationManager;
13 
14 // SlowControlsDashboardSupervisor
15 // This class handles the management of slow controls interface plugins, as well as the
16 // user web interface
17 class SlowControlsDashboardSupervisor : public CoreSupervisorBase
18 {
19  public:
20  XDAQ_INSTANTIATOR();
21 
22  SlowControlsDashboardSupervisor (xdaq::ApplicationStub* s);
23  virtual ~SlowControlsDashboardSupervisor (void);
24 
25  void init (void);
26  void destroy (void);
27  void checkSubscriptions (SlowControlsDashboardSupervisor* cs);
28  void checkSlowControlsAlarms (SlowControlsDashboardSupervisor* cs);
29 
30  virtual void request (const std::string& requestType,
31  cgicc::Cgicc& cgiIn,
32  HttpXmlDocument& xmlOut,
33  const WebUsers::RequestUserInfo& userInfo) override;
34  virtual void handleRequest (const std::string Command,
35  HttpXmlDocument& xmlOut,
36  cgicc::Cgicc& cgiIn,
37  const WebUsers::RequestUserInfo& userInfo);
38 
39  virtual void setSupervisorPropertyDefaults (void) override;
40  virtual void forceSupervisorPropertyValues (void) override; // override to force
41  // supervisor property
42  // values (and ignore user
43  // settings)
44 
45  void Poll (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::string UID);
46  void GetChannelSettings (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
47  void GetChannelArchiverData (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
48  void GetLastAlarmsData (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
49  void GetAlarmsLogData (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
50  void GetUserPermissions (cgicc::Cgicc& cgiIn,
51  HttpXmlDocument& xmlOut,
52  const WebUsers::RequestUserInfo& userInfo);
53  void GenerateUID (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::string pvlist);
54  void GetList (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
55  void GetPages (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
56  void loadPage (cgicc::Cgicc& cgiIn,
57  HttpXmlDocument& xmlOut,
58  std::string page,
59  const WebUsers::RequestUserInfo& userInfo);
60  void loadPhoebusPage (cgicc::Cgicc& cgiIn,
61  HttpXmlDocument& xmlOut,
62  std::string page,
63  const WebUsers::RequestUserInfo& userInfo);
64  void SaveControlsPage (cgicc::Cgicc& cgiIn,
65  HttpXmlDocument& xmlOut,
66  const WebUsers::RequestUserInfo& userInfo);
67  void SavePhoebusControlsPage (cgicc::Cgicc& cgiIn,
68  HttpXmlDocument& xmlOut,
69  const WebUsers::RequestUserInfo& userInfo);
70  void Subscribe (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
71  void Unsubscribe (cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut);
72 
73  // Utilities, eventually to be moved
74  bool isDir (std::string dir);
75  void listFiles (std::string baseDir, bool recursive, std::vector<std::string>* pages);
76 
77  private:
78  std::map<int, std::set<std::string>> channelDependencyLookupMap_;
79  std::map<int, long int> uidPollTimeMap_;
80  int UID_;
81  int alarmNotifyRefreshRate_;
82  std::mutex alarmCheckThreadErrorMutex_;
83  std::string alarmCheckThreadError_;
84  public:
85  SlowControlsVInterface* interface_;
86  std::mutex pluginBusyMutex_;
87 };
88 }
89 
90 #endif