Class GatewayPlugin
Defined in File gateway_plugin.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Derived Types
public ParameterBeaconPluginpublic TopicBeaconPluginpublic ros2_medkit_gateway::GraphProviderPluginpublic ros2_medkit_gateway::OpcuaPluginpublic ros2_medkit_gateway::SovdServiceInterface
Class Documentation
-
class GatewayPlugin
Base class for all gateway plugins.
Plugins are loaded as shared libraries (.so) via dlopen/dlsym. Each .so must export two extern “C” functions: int plugin_api_version(); // must return PLUGIN_API_VERSION GatewayPlugin* create_plugin(); // factory
Plugins implement this base class plus one or more provider interfaces (UpdateProvider, IntrospectionProvider) via multiple inheritance.
See also
PluginManager for loading and lifecycle orchestration
See also
UpdateProvider, IntrospectionProvider for typed interfaces
Subclassed by ParameterBeaconPlugin, TopicBeaconPlugin, ros2_medkit_gateway::GraphProviderPlugin, ros2_medkit_gateway::OpcuaPlugin, ros2_medkit_gateway::SovdServiceInterface
Public Functions
-
virtual ~GatewayPlugin() = default
-
virtual std::string name() const = 0
Unique name for this plugin.
- Returns:
Plugin name (e.g., “systemd”, “procfs”, “mender_ota”)
-
virtual void configure(const nlohmann::json &config) = 0
Configure the plugin.
Called once after loading with per-plugin config from YAML.
- Parameters:
config – JSON configuration object
-
inline virtual void set_context(PluginContext&)
Receive gateway context.
Called after configure(). Provides access to the ROS 2 node, entity cache, fault data, and HTTP handler utilities. Store the reference if needed during runtime.
- Parameters:
context – Gateway plugin context (outlives this plugin)
-
inline virtual std::vector<PluginRoute> get_routes()
Return custom REST routes for this plugin.
Called once during REST server setup. The gateway registers the returned routes on the HTTP server, wrapping PluginRequest/PluginResponse around the underlying library types.
- Returns:
Routes to register (method, pattern, handler)
-
inline virtual void shutdown()
Shutdown hook for cleanup.
Called before the plugin is destroyed. Use for releasing resources, closing connections, etc.
Protected Functions
-
inline void log_info(const std::string &msg) const
Log an informational message (routed to gateway’s ROS 2 logger)
-
inline void log_warn(const std::string &msg) const
Log a warning message.
-
inline void log_error(const std::string &msg) const
Log an error message.
-
struct PluginRoute
Describes a single REST route registered by a plugin.
Public Members
-
std::string method
HTTP method (“GET”, “POST”, “PUT”, “DELETE”)
-
std::string pattern
Regex pattern relative to api_prefix.
-
std::function<void(const PluginRequest&, PluginResponse&)> handler
-
std::string method
-
virtual ~GatewayPlugin() = default