Go to the documentation of this file.
12 #include <boost/asio.hpp>
13 #include <boost/scoped_ptr.hpp>
14 #include <boost/program_options.hpp>
19 namespace po = boost::program_options;
20 #include "configure.hpp"
27 boost::scoped_ptr<JControlHost>
m_ch;
29 mutable boost::asio::ip::udp::socket
m_input;
36 std::string
const&
name
37 , std::string
const&
server
57 virtual void actionInit(
int length,
const char* buffer) {}
63 std::string(buffer, length)
66 m_input.open(boost::asio::ip::udp::v4());
69 boost::asio::ip::udp::endpoint(
70 boost::asio::ip::udp::v4()
77 conf.get<std::string>(
"out_server_address")
78 , conf.get<
unsigned>(
"out_server_port")
127 static size_t const max_size = 10000;
128 static char buffer[max_size];
130 std::size_t
const size =
m_input.receive(
131 boost::asio::buffer(buffer, max_size)
144 int main(
int argc,
char* argv[])
146 std::string server(
"localhost");
147 std::string logger(
"localhost");
148 std::string client_name(
"MonRouter");
152 po::options_description desc(
"Options");
154 (
"help,h",
"Print this help and exit.")
155 (
"version,v",
"Print the version and exit.")
158 , po::value<std::string>(&server)->default_value(server)
159 ,
"Set the address of the SM server."
163 , po::value<std::string>(&logger)->default_value(logger)
164 ,
"Set the address of the logger server."
168 , po::value<std::string>(&client_name)->default_value(client_name)
169 ,
"Set the address of the client name."
173 , po::value<int>(&port)->required()
174 ,
"Set the UDP port to read data from"
178 , po::value<int>(&
debug)->default_value(
debug)
179 ,
"Set the debug level."
183 po::variables_map vm;
185 po::command_line_parser(argc, argv).options(desc).run(),
189 if (vm.count(
"help")) {
190 std::cout << desc << std::endl;
194 if (vm.count(
"version")) {
200 }
catch (
const po::error& e) {
201 std::cerr <<
"MonRouter: Error: " << e.what() <<
'\n'
202 << desc << std::endl;
204 }
catch (
const std::runtime_error& e) {
205 std::cerr <<
"MonRouter: Error: " << e.what() <<
'\n'
206 << desc << std::endl;
Interface for logging messages.
virtual void actionRunning()
This method is repeatedly called when this client machine is in state Running and the clock interval ...
virtual void actionEnter()
Interface methods for actions corresponding to state transitions.
int getRunNumber() const
Get run number.
virtual void actionExit()
static const JNET::JTag RC_MONITORING_ROUTER
void run()
Run as run control client following command messages via JNET::JControlHost.
bool has(const int file_descriptor) const
Has file descriptor.
virtual void actionPause(int length, const char *buffer)
int main(int argc, char *argv[])
JSharedPointer< JControlHost > server
message server
boost::asio::io_service m_service
boost::scoped_ptr< JControlHost > m_ch
virtual void actionContinue(int length, const char *buffer)
boost::asio::ip::udp::socket m_input
virtual void actionConfigure(int length, const char *buffer)
void replaceEvent(const JTag &oldTag, const JTag &newTag, JDAQEvent_t &event)
Replace tag of given event in event table.
boost::property_tree::ptree parse(std::string str)
virtual void setSelect(JFileDescriptorMask &mask) const
Set the file descriptor mask for the select call.
Auxiliary class for method select.
virtual void actionQuit(int length, const char *buffer)
void set(const int file_descriptor)
Set file descriptor.
Control unit client base class.
Message logging based on ControlHost.
MonitorRouter(std::string const &name, std::string const &server, JLogger *logger, const int level, int port)
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
int getDetectorID() const
Get detector identifier.
JMessageLogger logger
message logger
virtual void actionStop(int length, const char *buffer)
virtual void actionSelect(const JFileDescriptorMask &mask)
Action method following last select call.
JDAQStateMachine::ev_configure_event ev_configure
KM3NeT DAQ data structures and auxiliaries.
static const JNET::JTag RC_CMD
virtual void actionReset(int length, const char *buffer)
static const JNET::JTag IO_MONITORING_DATA
virtual void actionStart(int length, const char *buffer)
virtual void actionInit(int length, const char *buffer)
virtual bool enter(const JArgs &args)
Enter the state machine.