Fawkes API  Fawkes Development Version
openprs_agent_plugin.cpp
1 
2 /***************************************************************************
3  * openprs_agent_plugin.cpp - OpenPRS agent plugin
4  *
5  * Created: Fri Aug 22 13:55:28 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 #include "openprs_agent_thread.h"
23 #include <core/plugin.h>
24 #include <config/config.h>
25 
26 using namespace fawkes;
27 
28 /** Agent executive using OpenPRS.
29  * @author Tim Niemueller
30  */
32 {
33  public:
34  /** Constructor.
35  * @param config Fawkes configuration
36  */
38  {
40  bool gdb_delay = false;
41  try {
42  std::string mode_s = config->get_string("/openprs-agent/oprs-mode");
43  if (mode_s == "XOPRS") mode = OpenPRSAspect::XOPRS;
44  } catch (Exception &e) {} // ignored, use default
45  try {
46  gdb_delay = config->get_bool("/openprs-agent/gdb-delay");
47  } catch (Exception &e) {} // ignored, use default
48  thread_list.push_back(new OpenPRSAgentThread(mode, gdb_delay));
49  }
50 };
51 
52 
53 PLUGIN_DESCRIPTION("OpenPRS agent executive")
54 EXPORT_PLUGIN(OpenPRSAgentPlugin)
Mode
OPRS kernel operation mode.
Definition: openprs.h:45
Plugin interface class.
Definition: plugin.h:33
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
graphical mode
Definition: openprs.h:47
Base class for exceptions in Fawkes.
Definition: exception.h:36
command line mode
Definition: openprs.h:46
OpenPRS agent thread.
OpenPRSAgentPlugin(Configuration *config)
Constructor.
Agent executive using OpenPRS.
Interface for configuration handling.
Definition: config.h:67
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.