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
24
#include <config/config.h>
25
#include <core/plugin.h>
26
27
using namespace
fawkes
;
28
29
/** Agent executive using OpenPRS.
30
* @author Tim Niemueller
31
*/
32
class
OpenPRSAgentPlugin
:
public
fawkes::Plugin
33
{
34
public
:
35
/** Constructor.
36
* @param config Fawkes configuration
37
*/
38
explicit
OpenPRSAgentPlugin
(
Configuration
*config) :
Plugin
(config)
39
{
40
OpenPRSAspect::Mode
mode =
OpenPRSAspect::OPRS
;
41
bool
gdb_delay =
false
;
42
try
{
43
std::string mode_s = config->
get_string
(
"/openprs-agent/oprs-mode"
);
44
if
(mode_s ==
"XOPRS"
)
45
mode =
OpenPRSAspect::XOPRS
;
46
}
catch
(
Exception
&e) {
47
}
// ignored, use default
48
try
{
49
gdb_delay = config->
get_bool
(
"/openprs-agent/gdb-delay"
);
50
}
catch
(
Exception
&e) {
51
}
// ignored, use default
52
thread_list.push_back(
new
OpenPRSAgentThread
(mode, gdb_delay));
53
}
54
};
55
56
PLUGIN_DESCRIPTION(
"OpenPRS agent executive"
)
57
EXPORT_PLUGIN(
OpenPRSAgentPlugin
)
OpenPRSAgentPlugin
Agent executive using OpenPRS.
Definition:
openprs_agent_plugin.cpp:32
fawkes::Configuration::get_bool
virtual bool get_bool(const char *path)=0
fawkes::OpenPRSAspect::OPRS
command line mode
Definition:
openprs.h:49
fawkes::Configuration
Definition:
config.h:68
OpenPRSAgentThread
Definition:
openprs_agent_thread.h:33
fawkes
fawkes::OpenPRSAspect::XOPRS
graphical mode
Definition:
openprs.h:50
fawkes::OpenPRSAspect::Mode
Mode
OPRS kernel operation mode.
Definition:
openprs.h:48
fawkes::Configuration::get_string
virtual std::string get_string(const char *path)=0
fawkes::Plugin
Definition:
plugin.h:37
OpenPRSAgentPlugin::OpenPRSAgentPlugin
OpenPRSAgentPlugin(Configuration *config)
Constructor.
Definition:
openprs_agent_plugin.cpp:38
fawkes::Exception
Definition:
exception.h:39
src
plugins
openprs-agent
openprs_agent_plugin.cpp
Generated by
1.8.16