File indexing completed on 2025-01-18 10:01:38
0001
0002
0003
0004
0005 #ifndef _JControlZMQ_h_
0006 #define _JControlZMQ_h_
0007
0008 #include <thread>
0009 #include <JANA/JApplication.h>
0010 #include <zmq.h>
0011 #include <unistd.h>
0012
0013 #include "JControlEventProcessor.h"
0014
0015 class JControlZMQ {
0016 public:
0017
0018 JControlZMQ(JApplication *app, int port);
0019 ~JControlZMQ();
0020
0021 void ServerLoop();
0022 std::string GetStatusJSON();
0023 void JANAStatusPROC(std::map<std::string,float> &vals);
0024 static void HostStatusPROC(std::map<std::string,float> &vals);
0025 static void HostStatusPROCLinux(std::map<std::string,float> &vals);
0026 static void HostStatusPROCMacOSX(std::map<std::string,float> &vals);
0027 static void GetDiskSpace(const std::string &dirname, std::map<std::string,float> &vals);
0028 std::string GetJANAFactoryListJSON();
0029 std::string GetJANAObjectListJSON();
0030 std::string GetJANAObjectsJSON(const std::string &object_name, const std::string &factory_name, const std::string &factory_tag);
0031 std::string FetchJANAObjectsJSON(std::vector<std::string> &vals);
0032
0033 private:
0034
0035 bool _done = false;
0036 JApplication *_japp = nullptr;
0037 int _port = 0;
0038 void *_zmq_context = nullptr;
0039 std::thread *_thr = nullptr;
0040 char _host[256] = {};
0041 pid_t _pid = 0;
0042 JControlEventProcessor *_jproc = nullptr;
0043 };
0044
0045
0046 #endif
0047