Fawkes API
Fawkes Development Version
|
22 #include "openprs_agent_thread.h"
24 #include <logging/logger.h>
25 #include <plugins/openprs/utils/openprs_comm.h>
26 #include <utils/time/time.h>
43 :
Thread(
"OpenPRSAgentThread",
Thread::OPMODE_WAITFORWAKEUP),
62 openprs->signal_msg_rcvd().connect(
63 boost::bind(&OpenPRSAgentThread::handle_message,
this, _1, _2));
65 "add (! (= @@AGENT_NAME \"%s\"))",
85 "(fawkes-time %lill %lill %lill %lill)",
96 OpenPRSAgentThread::handle_message(std::string sender, std::string message)
99 message.erase(std::remove(message.begin(), message.end(),
'\n'), message.end());
101 logger->
log_debug(
name(),
"Received message from %s: %s", sender.c_str(), message.c_str());
111 agent_alive_ =
false;
void get_time(struct timeval *tv) const
Returns the time of the selected time source.
void set_openprs_gdb_delay(const bool enable_gdb_delay)
Enable/disable GDB delay.
const char * name() const
LockPtr< OpenPRSComm > openprs
const std::string openprs_kernel_name
virtual ~OpenPRSAgentThread()
Destructor.
virtual void log_error(const char *component, const char *format,...)=0
virtual void init()
Initialize the thread.
void get_systime(struct timeval *tv) const
Returns the system time.
void add_openprs_data_path(const std::string &path)
Add an OpenPRS data path.
Mode
OPRS kernel operation mode.
OpenPRSAgentThread(OpenPRSAspect::Mode oprs_mode, bool gdb_delay)
Constructor.
virtual std::string get_string(const char *path)=0
virtual void finalize()
Finalize the thread.
virtual void log_debug(const char *component, const char *format,...)=0
virtual void loop()
Code to execute in the thread.