Fawkes API  Fawkes Development Version
openprs_agent_thread.h
1 
2 /***************************************************************************
3  * openprs_agent_thread.h - OpenPRS agent thread
4  *
5  * Created: Fri Aug 22 13:56:36 2014
6  * Copyright 2014 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_OPENPRS_AGENT_OPENPRS_AGENT_THREAD_H_
23 #define __PLUGINS_OPENPRS_AGENT_OPENPRS_AGENT_THREAD_H_
24 
25 #include <core/threading/thread.h>
26 #include <aspect/logging.h>
27 #include <aspect/clock.h>
28 #include <aspect/blocked_timing.h>
29 #include <aspect/configurable.h>
30 #include <plugins/openprs/aspect/openprs.h>
31 
32 #include <string>
33 
35 : public fawkes::Thread,
36  public fawkes::LoggingAspect,
37  public fawkes::ClockAspect,
41 {
42  public:
43  OpenPRSAgentThread(OpenPRSAspect::Mode oprs_mode, bool gdb_delay);
44  virtual ~OpenPRSAgentThread();
45 
46  virtual void init();
47  virtual void loop();
48  virtual void finalize();
49 
50  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
51  protected: virtual void run() { Thread::run(); }
52 
53  private: // methods
54  void handle_message(std::string sender, std::string message);
55 
56  private: // members
57  std::string cfg_agent_;
58  bool agent_alive_;
59 };
60 
61 #endif
virtual ~OpenPRSAgentThread()
Destructor.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Thread class encapsulation of pthreads.
Definition: thread.h:42
OpenPRS kernel creation and communication aspect.
Definition: openprs.h:39
Thread aspect to use blocked timing.
virtual void finalize()
Finalize the thread.
virtual void loop()
Code to execute in the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to log output.
Definition: logging.h:35
OpenPRSAgentThread(OpenPRSAspect::Mode oprs_mode, bool gdb_delay)
Constructor.
Thread aspect to access configuration data.
Definition: configurable.h:35
OpenPRS agent thread.
virtual void init()
Initialize the thread.