Plugins

digraph inheritance { rankdir=LR; GObject -> WpObject; WpObject -> WpPlugin; }

struct WpPlugin

WpPlugin is a base class for objects that provide functionality to the WirePlumber daemon.

Typically, a plugin is created within a module and then registered to make it available for use by the daemon. The daemon is responsible for calling wp_object_activate() on it after all modules have been loaded, the core is connected and the initial discovery of global objects is done.

Being a WpObject subclass, the plugin inherits WpObject’s activation system. For most implementations, there is only need for activating one feature, WP_PLUGIN_FEATURE_ENABLED, and this can be done by implementing only WpPluginClass::enable() and WpPluginClass::disable(). For more advanced plugins that need to have more features, you may implement directly the functions of WpObjectClass and ignore the ones of WpPluginClass.

GObject Properties

name

The name of this plugin

gchar *

G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY

struct _WpPluginClass

Public Members

WpObjectClass parent_class
void (*enable)(WpPlugin *self, WpTransition *transition)

Enables the plugin. The plugin is required to start any operations only when this method is called and not before.

When enabling the plugin is done, you must call wp_object_update_features() with WP_PLUGIN_FEATURE_ENABLED marked as activated, or return an error on transition.

Param self

the plugin

Param transition

the activation transition

void (*disable)(WpPlugin *self)

Disables the plugin. The plugin is required to stop all operations and release all resources associated with it.

Param self

the plugin

enum WpPluginFeatures

Flags to be used as WpObjectFeatures on WpPlugin subclasses.

Values:

enumerator WP_PLUGIN_FEATURE_ENABLED = (1 << 0)

enables the plugin

void wp_plugin_register(WpPlugin *plugin)

Registers the plugin to its associated core, making it available for use.

Parameters
  • plugin – (transfer full): the plugin

WpPlugin *wp_plugin_find(WpCore *core, const gchar *plugin_name)

Looks up a plugin.

Parameters
  • core – the core

  • plugin_name – the lookup name

Returns

(transfer full) (nullable): the plugin matching the lookup name

const gchar *wp_plugin_get_name(WpPlugin *self)

Retreives the name of a plugin.

Parameters
  • self – the plugin

Returns

the name of this plugin

WP_TYPE_PLUGIN (wp_plugin_get_type ())

The WpPlugin GType.