Fawkes API
Fawkes Development Version
|
Program to communicate with plugin manager via Fawkes network. More...
#include <tools/plugin/plugin_tool.h>
Public Member Functions | |
PluginTool (fawkes::ArgumentParser *argp, fawkes::FawkesNetworkClient *c) | |
Constructor. More... | |
PluginTool (fawkes::FawkesNetworkClient *c) | |
Constructor. More... | |
~PluginTool () | |
Destructor. More... | |
void | handle_signal (int signum) |
Handle signals. More... | |
void | set_load_plugin (const char *plugin_name) |
Load plugin on next run. More... | |
void | set_unload_plugin (const char *plugin_name) |
Unload plugin on next run. More... | |
void | set_watch_mode () |
Set watch mode. More... | |
void | set_list_mode () |
Set list mode. More... | |
void | run () |
Run opmode as requested determined by the arguments. More... | |
![]() | |
virtual | ~SignalHandler () |
Virtual destructor. More... | |
![]() | |
virtual | ~FawkesNetworkClientHandler () |
Empty virtual destructor. More... | |
Static Public Member Functions | |
static void | print_usage (const char *program_name) |
Print usage. More... | |
Program to communicate with plugin manager via Fawkes network.
Definition at line 35 of file plugin_tool.h.
PluginTool::PluginTool | ( | fawkes::ArgumentParser * | argp, |
fawkes::FawkesNetworkClient * | c | ||
) |
Constructor.
argp | argument parser, three arguments are handled:
|
c | FawkesNetworkClient with established connection |
Definition at line 47 of file plugin_tool.cpp.
References fawkes::ArgumentParser::arg(), fawkes::ArgumentParser::has_arg(), and fawkes::ArgumentParser::program_name().
PluginTool::PluginTool | ( | fawkes::FawkesNetworkClient * | c | ) |
Constructor.
This constructor just set the Fawkes network client. A run() call will fail if not one of set_load_plugin(), set_unload_plugin(), set_watch_mode() or set_list_mode() has been called before.
c | Fawkes network client with established connection |
Definition at line 82 of file plugin_tool.cpp.
PluginTool::~PluginTool | ( | ) |
Destructor.
Definition at line 92 of file plugin_tool.cpp.
|
virtual |
Handle signals.
signum | signal number of received signal |
Implements fawkes::SignalHandler.
Definition at line 165 of file plugin_tool.cpp.
References fawkes::FawkesNetworkMessage::cid(), fawkes::PluginListMessage::has_next(), fawkes::MSG_PLUGIN_AVAIL_LIST, fawkes::MSG_PLUGIN_AVAIL_LIST_FAILED, fawkes::MSG_PLUGIN_LIST_AVAIL, fawkes::MSG_PLUGIN_LIST_LOADED, fawkes::MSG_PLUGIN_LOAD, fawkes::MSG_PLUGIN_LOAD_FAILED, fawkes::MSG_PLUGIN_LOADED, fawkes::MSG_PLUGIN_LOADED_LIST, fawkes::MSG_PLUGIN_LOADED_LIST_FAILED, fawkes::MSG_PLUGIN_SUBSCRIBE_WATCH, fawkes::MSG_PLUGIN_UNLOAD, fawkes::MSG_PLUGIN_UNLOAD_FAILED, fawkes::MSG_PLUGIN_UNLOADED, fawkes::MSG_PLUGIN_UNSUBSCRIBE_WATCH, fawkes::FawkesNetworkMessage::msgc(), fawkes::FawkesNetworkMessage::msgid(), fawkes::plugin_load_msg_t::name, fawkes::plugin_unload_msg_t::name, fawkes::plugin_loaded_msg_t::name, fawkes::plugin_load_failed_msg_t::name, fawkes::plugin_unload_failed_msg_t::name, fawkes::plugin_unloaded_msg_t::name, fawkes::PluginListMessage::next(), fawkes::FawkesNetworkMessage::payload(), and fawkes::FawkesNetworkMessage::payload_size().
|
static |
void PluginTool::run | ( | ) |
Run opmode as requested determined by the arguments.
Definition at line 393 of file plugin_tool.cpp.
void PluginTool::set_list_mode | ( | ) |
Set list mode.
On next run() call the client will list all loaded plugins once.
Definition at line 155 of file plugin_tool.cpp.
void PluginTool::set_load_plugin | ( | const char * | plugin_name | ) |
Load plugin on next run.
The next time run is called a LOAD_PLUGIN message is sent for the given plugin name.
plugin_name | name of the plugin to load |
Definition at line 121 of file plugin_tool.cpp.
void PluginTool::set_unload_plugin | ( | const char * | plugin_name | ) |
Unload plugin on next run.
The next time run is called a UNLOAD_PLUGIN message is sent for the given plugin name.
plugin_name | name of the plugin to unload |
Definition at line 134 of file plugin_tool.cpp.
void PluginTool::set_watch_mode | ( | ) |
Set watch mode.
On next run() call the client will watch for new events.
Definition at line 145 of file plugin_tool.cpp.